Пример #1
0
        /// <summary>
        /// 绑定项目
        /// </summary>
        private void BindItem()
        {
            DataRow config;

            using (iiConfig configProvider = new iiConfig())
            {
                config = configProvider.GetItem(this.CurrentID, this.CurrentKey);
            }

            Key.Text    = config["Key"].ToString().Trim();
            Key.Enabled = false;
            Name.Text   = config["Name"].ToString();
            Remark.Text = config["Remark"].ToString();
        }
Пример #2
0
 /// <summary>
 /// 确定
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void OKButton_Click(object sender, EventArgs e)
 {
     using (iiConfig configProvider = new iiConfig())
     {
         if (this.CurrentKey.Length == 0)
         {
             //新增
             if (configProvider.GetItem(this.CurrentID, Key.Text) == null) //不存在
             {
                 try
                 {
                     configProvider.Create(this.CurrentID, Key.Text, Name.Text, Remark.Text);
                 }
                 catch (Exception error)
                 {
                     this.ShowErrorMessage(this.GetGlobalResourceString("CreateErrorMessage") + error.Message);
                     return;
                 }
             }
             else
             {
                 this.ShowWarningMessage(this.GetGlobalResourceString("ExistedErrorMessage"));
                 return;
             }
         }
         else
         {
             //编辑
             try
             {
                 configProvider.Update(this.CurrentID, Key.Text, Name.Text, Remark.Text);
             }
             catch (Exception error)
             {
                 this.ShowErrorMessage(this.GetGlobalResourceString("UpdateErrorMessage") + error.Message);
                 return;
             }
         }
     }
     //回调
     this.DialogCallback("'CloseRefresh'", "window");
 }