//
// DotNetNuke - http://www.dotnetnuke.com
// Copyright (c) 2002-2005
// by Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System.IO;
using System.Runtime.Serialization.Formatters;
using DotNetNuke;
using System;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Common.Utilities;
namespace DotNetNuke.Modules.Survey
{
public partial class Settings : DotNetNuke.Entities.Modules.ModuleSettingsBase
{
// '' -----------------------------------------------------------------------------
// ''
// '' LoadSettings loads the settings from the Database and displays them
// ''
// ''
// ''
// ''
// '' [cnurse] 10/22/2004 created
// '' [mwashington] 10/14/2006 converted to C#
// ''
// '' -----------------------------------------------------------------------------
public override void LoadSettings()
{
try
{
// this needs to execute always to the client script code is registred in InvokePopupCal
cmdCalendar.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtClosingDate);
if ((Page.IsPostBack == false))
{
if ((ModuleSettings["surveyclosingdate"]) == null)
{
ModuleSettings["surveyclosingdate"] = DateTime.Now.AddYears(1).ToShortDateString();
}
if ((ModuleSettings["surveytracking"]) == null)
{
ModuleSettings["surveytracking"] = 0;
}
if ((ModuleSettings["surveyresultstype"]) == null)
{
ModuleSettings["surveyresultstype"] = 0;
}
txtClosingDate.Text = Convert.ToDateTime(ModuleSettings["surveyclosingdate"]).ToShortDateString();
txtGraphWidth.Text = ((string)(TabModuleSettings["surveygraphwidth"]));
rblstPersonal.SelectedIndex = (Convert.ToInt32((ModuleSettings["surveytracking"])));
rblstSurveyResults.SelectedIndex = (Convert.ToInt32((ModuleSettings["surveyresultstype"])));
}
}
catch (Exception exc)
{
// Module failed to load
Exceptions.ProcessModuleLoadException(this, exc);
}
}
// '' -----------------------------------------------------------------------------
// ''
// '' UpdateSettings saves the modified settings to the Database
// ''
// ''
// ''
// ''
// '' [cnurse] 10/22/2004 created
// '' [mwashington] 10/14/2006 converted to C#
// ''
// '' -----------------------------------------------------------------------------
public override void UpdateSettings()
{
try
{
DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
DateTime datClosingDate = Null.NullDate;
if ((txtClosingDate.ToString().Trim().Length > 0))
{
datClosingDate = Convert.ToDateTime(txtClosingDate.Text.Trim());
}
// Update Module Settings
objModules.UpdateModuleSetting(ModuleId, "surveyclosingdate", DotNetNuke.Common.Globals.DateToString(datClosingDate));
objModules.UpdateModuleSetting(ModuleId, "surveytracking", rblstPersonal.SelectedIndex.ToString());
objModules.UpdateModuleSetting(ModuleId, "surveyresultstype", rblstSurveyResults.SelectedIndex.ToString());
// Update Tab Module Settings
objModules.UpdateTabModuleSetting(TabModuleId, "surveygraphwidth", txtGraphWidth.Text);
}
catch (Exception exc)
{
// Module failed to load
Exceptions.ProcessModuleLoadException(this, exc);
}
}
}
}