80 lines
2.9 KiB
C#
80 lines
2.9 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Configuration;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
|
||
namespace VRS.Management.VSAT
|
||
{
|
||
public partial class SystemSettings : BasePage
|
||
{
|
||
DataService.BLL.admin_config bllConfig = new DataService.BLL.admin_config();
|
||
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
|
||
|
||
protected override void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
BindDeviceType("10", examine_kind, "");
|
||
Dataload();
|
||
|
||
}
|
||
}
|
||
|
||
protected void btnSelect_Click(object sender, EventArgs e)
|
||
{
|
||
int count_down = 0;
|
||
if (!int.TryParse(examine_count_down.Text,out count_down))
|
||
{
|
||
RadAjaxManager1.ResponseScripts.Add("alert('倒计时请输入合法数值!');");
|
||
return;
|
||
}
|
||
decimal xl_rate_value = 0;
|
||
if (!decimal.TryParse(xl_rate.Text,out xl_rate_value))
|
||
{
|
||
RadAjaxManager1.ResponseScripts.Add("alert('训练占考试比重,数值不合法!');");
|
||
return;
|
||
}
|
||
|
||
if (xl_rate_value<0 || xl_rate_value>1)
|
||
{
|
||
RadAjaxManager1.ResponseScripts.Add("alert('训练占考试比重,取值在0到1之间!');");
|
||
return;
|
||
}
|
||
var configModel = GetSystemConfig(ConfigurationManager.AppSettings["SystemName"].ToString());
|
||
if (configModel != null)
|
||
{
|
||
//configModel.examine_term = examine_term.SelectedValue;
|
||
//configModel.examine_kind = examine_kind.SelectedValue;
|
||
configModel.examine_count_down = count_down;
|
||
configModel.xl_rate = xl_rate_value;
|
||
if (bllConfig.Update(configModel))
|
||
{
|
||
log.write_log("修改系统配置成功。" + "考试学期:" + configModel.examine_term + ",考试类型:" + configModel.examine_kind + ",倒计时(分钟):" + configModel.examine_count_down + ",id:" + configModel.config_id);
|
||
//RadAjaxManager1.ResponseScripts.Add("alert('修改系统配置成功!');");
|
||
RadAjaxManager1.Alert("修改系统配置成功!");
|
||
}
|
||
}
|
||
Dataload();
|
||
}
|
||
|
||
protected void Dataload()
|
||
{
|
||
var configModel = GetSystemConfig(ConfigurationManager.AppSettings["SystemName"].ToString());
|
||
if (configModel != null)
|
||
{
|
||
|
||
examine_term.SelectedValue = configModel.examine_term;
|
||
examine_kind.SelectedValue = configModel.examine_kind;
|
||
examine_count_down.Text = configModel.examine_count_down.ToString();
|
||
xl_rate.Text = configModel.xl_rate.ToString();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |