Ejemplo n.º 1
0
        protected void btnSaveSystemConfig_Click(object sender, DirectEventArgs e)
        {
            try
            {
                if (SystemConfigWrapper.CheckIfExistedConfigByKey(this.txtConfigKey.Text.Trim()))
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "Error Message : config '" + this.txtConfigKey.Text.Trim() + "' is existed  ,Please change key name.";
                    return;
                }


                SystemConfigWrapper obj = new SystemConfigWrapper();
                if (this.cmbGroup.SelectedItem != null)
                {
                    obj.ConfigGroupID = SystemConfigGroupWrapper.FindById(int.Parse(this.cmbGroup.SelectedItem.Value));
                }
                else
                {
                    obj.ConfigGroupID = null;
                }
                obj.ConfigKey         = this.txtConfigKey.Text.Trim();
                obj.ConfigValue       = this.txtConfigValue.Text.Trim();
                obj.ConfigDescription = this.txtConfigDescription.Text.Trim();
                obj.SortIndex         = 1;
                obj.ConfigDataType    = this.cmbDataType.SelectedItem.Value;



                SystemConfigWrapper.Save(obj);

                winSystemConfigAdd.Hide();
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message :" + ex.Message;
            }
        }
Ejemplo n.º 2
0
        protected void btnSaveSystemConfigGroup_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemConfigGroupWrapper obj = SystemConfigGroupWrapper.FindById(int.Parse(hidId.Text.Trim()));
                obj.Name        = this.txtName.Text.Trim();
                obj.Code        = this.txtCode.Text.Trim();
                obj.Description = this.txtDescription.Text.Trim();
                obj.IsEnable    = this.chkIsEnable.Checked;
                obj.IsSystem    = this.chkIsSystem.Checked;


                SystemConfigGroupWrapper.Update(obj);

                winSystemConfigGroupEdit.Hide();
                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
                return;
            }
        }
        protected void btnSaveSystemConfig_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemConfigWrapper obj = SystemConfigWrapper.FindById(int.Parse(hidSystemConfigID.Text.Trim()));

                if (this.cmbGroup.SelectedItem != null)
                {
                    obj.ConfigGroupID = SystemConfigGroupWrapper.FindById(int.Parse(this.cmbGroup.SelectedItem.Value));
                }
                else
                {
                    obj.ConfigGroupID = null;
                }

                string configValue = this.txtConfigValue.Text.Trim();

                if (this.cmbDataType.SelectedItem.Value.ToString() == DictionaryConst.Dictionary_System_DataType_int_Key)
                {
                    try
                    {
                        int.Parse(configValue);
                    }
                    catch (Exception ex)
                    {
                        ResourceManager.AjaxSuccess      = false;
                        ResourceManager.AjaxErrorMessage = "请输入整数:" + ex.Message;
                        return;
                    }
                }
                else if (this.cmbDataType.SelectedItem.Value.ToString() == DictionaryConst.Dictionary_System_DataType_datetime_Key)
                {
                    try
                    {
                        DateTime.Parse(configValue);
                    }
                    catch (Exception ex)
                    {
                        ResourceManager.AjaxSuccess      = false;
                        ResourceManager.AjaxErrorMessage = "请输入日期时间:" + ex.Message;
                        return;
                    }
                }
                else if (this.cmbDataType.SelectedItem.Value.ToString() == DictionaryConst.Dictionary_System_DataType_bool_Key)
                {
                    try
                    {
                        bool.Parse(configValue);
                    }
                    catch (Exception ex)
                    {
                        ResourceManager.AjaxSuccess      = false;
                        ResourceManager.AjaxErrorMessage = "请输入布尔值:" + ex.Message;
                        return;
                    }
                }
                else if (this.cmbDataType.SelectedItem.Value.ToString() == DictionaryConst.Dictionary_System_DataType_decimal_Key)
                {
                    try
                    {
                        decimal.Parse(configValue);
                    }
                    catch (Exception ex)
                    {
                        ResourceManager.AjaxSuccess      = false;
                        ResourceManager.AjaxErrorMessage = "请输入小数:" + ex.Message;
                        return;
                    }
                }

                obj.ConfigDataType = this.cmbDataType.SelectedItem.Value;

                obj.ConfigValue       = this.txtConfigValue.Text.Trim();
                obj.ConfigDescription = this.txtConfigDescription.Text.Trim();
                obj.SortIndex         = 1;



                SystemConfigWrapper.Update(obj);

                winSystemConfigEdit.Hide();
                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = string.Format(GetGlobalResourceObject("GlobalResource", "msgShowError").ToString(), ex.Message);
                return;
            }
        }