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();
                obj.ConfigKey         = this.txtConfigKey.Text.Trim();
                obj.ConfigValue       = this.txtConfigValue.Text.Trim();
                obj.ConfigDescription = this.txtConfigDescription.Text.Trim();
                obj.SortIndex         = Convert.ToInt32(this.numSortIndex.Text.Trim());



                SystemConfigWrapper.Save(obj);

                winSystemConfigAdd.Hide();
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message :" + ex.Message;
            }
        }
        protected void storeSystemConfig_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            int    recordCount   = 0;
            string sortFieldName = "";

            if (e.Sort != null)
            {
                sortFieldName = e.Sort;
            }

            int startIndex = 0;

            if (e.Start > -1)
            {
                startIndex = e.Start;
            }

            int limit = this.PagingToolBar1.PageSize;

            int pageIndex = 1;

            if ((startIndex % limit) == 0)
            {
                pageIndex = startIndex / limit + 1;
            }
            else
            {
                pageIndex = startIndex / limit;
            }

            storeSystemConfig.DataSource = SystemConfigWrapper.FindAllByOrderBy(sortFieldName, (e.Dir == Ext.Net.SortDirection.DESC), pageIndex, limit, out recordCount);
            e.Total = recordCount;

            storeSystemConfig.DataBind();
        }
        public void Show(int id)
        {
            try
            {
                SystemConfigWrapper obj = SystemConfigWrapper.FindById(id);

                if (obj != null)
                {
                    this.txtConfigKey.Text         = obj.ConfigKey.ToString();
                    this.txtConfigValue.Text       = obj.ConfigValue.ToString();
                    this.txtConfigDescription.Text = obj.ConfigDescription.ToString();
                    this.numSortIndex.Text         = obj.SortIndex.ToString();



                    hidSystemConfigID.Text = id.ToString();


                    winSystemConfigEdit.Show();
                }
                else
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "Error Message:Data does not exist";
                    return;
                }
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
                return;
            }
        }
        protected void storeSystemConfig_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            PageQueryParams pageQueryParams = WebUIHelper.GetPageQueryParamFromStoreRefreshDataEventArgs(e, this.PagingToolBar1);

            RecordSortor recordSortor = WebUIHelper.GetRecordSortorFromStoreRefreshDataEventArgs(e);

            storeSystemConfig.DataSource = SystemConfigWrapper.FindAllByOrderBy(recordSortor.OrderByColumnName, recordSortor.IsDesc, pageQueryParams);
            e.Total = pageQueryParams.RecordCount;

            storeSystemConfig.DataBind();
        }
        public void Show(int id)
        {
            try
            {
                SystemConfigWrapper obj = SystemConfigWrapper.FindById(id);

                if (obj != null)
                {
                    if (obj.ConfigGroupID != null)
                    {
                        this.cmbGroup.SetValue(obj.ConfigGroupID.Id);
                    }
                    else
                    {
                        this.cmbGroup.ClearValue();
                    }
                    this.txtConfigKey.Text         = obj.ConfigKey.ToString();
                    this.txtConfigValue.Text       = obj.ConfigValue.ToString();
                    this.txtConfigDescription.Text = obj.ConfigDescription.ToString();


                    if (!string.IsNullOrEmpty(obj.ConfigDataType))
                    {
                        this.cmbDataType.SetValue(obj.ConfigDataType);
                    }
                    else
                    {
                        this.cmbDataType.ClearValue();
                    }


                    hidSystemConfigID.Text = id.ToString();


                    winSystemConfigEdit.Show();
                }
                else
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = GetGlobalResourceObject("GlobalResource", "msgDataNotExisted").ToString();
                    return;
                }
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = string.Format(GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message);
                return;
            }
        }
        public void DeleteRecord(int id)
        {
            try
            {
                SystemConfigWrapper.DeleteByID(id);

                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = string.Format(ex.Message);
                return;
            }
        }
Example #7
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;
            }
        }
        protected void btnSaveSystemConfig_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemConfigWrapper obj = new SystemConfigWrapper();
                obj.ConfigKey         = this.txtConfigKey.Text.Trim();
                obj.ConfigValue       = this.txtConfigValue.Text.Trim();
                obj.ConfigDescription = this.txtConfigDescription.Text.Trim();
                obj.SortIndex         = Convert.ToInt32(this.txtSortIndex.Text.Trim());



                SystemConfigWrapper.Save(obj);

                winSystemConfigAdd.Hide();
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
            }
        }
        protected void btnSaveSystemConfig_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemConfigWrapper obj = SystemConfigWrapper.FindById(int.Parse(hidSystemConfigID.Text.Trim()));
                obj.ConfigValue       = this.txtConfigValue.Text.Trim();
                obj.ConfigDescription = this.txtConfigDescription.Text.Trim();
                obj.SortIndex         = Convert.ToInt32(this.numSortIndex.Text.Trim());


                SystemConfigWrapper.Update(obj);

                winSystemConfigEdit.Hide();
                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "ErrorMessage:" + ex.Message;
                return;
            }
        }
Example #10
0
        public void DeleteRecord(int id)
        {
            if (!this.CurrentLoginUserIsDevelopeAdmin())
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = " only developer admin can delete config.";
                return;
            }


            try
            {
                SystemConfigWrapper.DeleteByID(id);

                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = string.Format(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;
            }
        }