Exemple #1
0
 /// <summary>
 /// 确定
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void OKButton_Click(object sender, EventArgs e)
 {
     using (iiUser userProvider = new iiUser())
     {
         if (this.CurrentID.Length == 0)
         {
             //新增
             if (userProvider.GetItem(UID.Text) == null) //不存在
             {
                 try
                 {
                     userProvider.Create(UID.Text, Name.Text, Password.Text, Remark.Text,
                                         string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,
                                         RoleSelector1.RIDList
                                         );
                 }
                 catch (Exception error)
                 {
                     this.ShowErrorMessage(this.GetGlobalResourceString("CreateErrorMessage") + error.Message);
                     return;
                 }
             }
             else
             {
                 this.ShowWarningMessage(this.GetGlobalResourceString("ExistedErrorMessage"));
                 return;
             }
         }
         else
         {
             //编辑
             try
             {
                 if (Password.Text.Length != 0) //要修改密码
                 {
                     userProvider.Update(UID.Text, Password.Text);
                 }
                 userProvider.Update(UID.Text, Name.Text, Remark.Text,
                                     string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,
                                     RoleSelector1.RIDList
                                     );
             }
             catch (Exception error)
             {
                 this.ShowErrorMessage(this.GetGlobalResourceString("UpdateErrorMessage") + error.Message);
                 return;
             }
         }
     }
     //回调
     this.DialogCallback("'CloseRefresh'", "window");
 }
Exemple #2
0
        /// <summary>
        /// 绑定项目
        /// </summary>
        private void BindItem()
        {
            DataRow user;

            using (iiUser userProvider = new iiUser())
            {
                user = userProvider.GetItem(this.CurrentID);
            }

            UID.Text    = user["ID"].ToString().Trim();
            UID.Enabled = false;
            Name.Text   = user["Name"].ToString();
            Remark.Text = user["Remark"].ToString();
            //角色
            RoleSelector1.RIDList = user["RIDList"].ToString();
            RoleSelector1.Enabled = (user["Status"].ToString().Trim() != "S");
        }