Ejemplo n.º 1
0
        public void BaseButtonSave_Click(object sender, EventArgs e)
        {
            //try
            //{

            if (curAdminUser != null)
            {
                //   468 管理员:在删除后加设置密码 20180525 原密码不需要了
                //if (curAdminUser.Password != SecurityHelper.MD5String2(this.skinTextBox_ID.SkinTxt.Text.Trim()))
                //{
                //    this.skinTextBox_ID.Focus();
                //    this.skinTextBox_ID.ResetText();
                //    GlobalMessageBox.Show("原密码错误!");
                //    this.skinTextBox_Name.ResetText();
                //    this.skinTextBox_Password.ResetText();
                //    return;
                //}
                if (String.IsNullOrEmpty(this.skinTextBox_Name.SkinTxt.Text.Trim()))
                {
                    this.skinTextBox_Name.Focus();
                    this.skinTextBox_Name.ResetText();
                    return;
                }
                else
                if (GlobalCache.CurrentUserID == SystemDefault.DefaultAdmin && this.skinTextBox_Name.SkinTxt.Text.Trim() == SystemDefault.DefaultAdminPassword)
                {
                    GlobalMessageBox.Show("密码不能是初始密码:" + SystemDefault.DefaultAdminPassword);
                    this.skinTextBox_Name.Focus();
                    this.skinTextBox_Name.ResetText();
                    return;
                }
                else if (String.IsNullOrEmpty(this.skinTextBox_Password.SkinTxt.Text.Trim()))
                {
                    this.skinTextBox_Password.Focus();
                    this.skinTextBox_Password.ResetText();

                    return;
                }
                else if (this.skinTextBox_Password.SkinTxt.Text.Trim() != this.skinTextBox_Name.SkinTxt.Text.Trim())
                {
                    GlobalMessageBox.Show("两次新密码输入不相同,请重新确认!");
                    this.skinTextBox_Name.Focus();
                    return;
                }
                //if (GlobalUtil.EngineUnconnectioned(this))
                //{
                //    return;
                //}
                this.curAdminUser.Password = SecurityHelper.MD5String2(this.skinTextBox_Password.SkinTxt.Text.Trim());
                InteractResult result = GlobalCache.AdminUser_OnUpdate(curAdminUser);
                switch (result.ExeResult)
                {
                case ExeResult.Error:
                    GlobalMessageBox.Show(result.Msg);
                    break;

                default:
                    GlobalMessageBox.Show("保存成功!");
                    //if (DoClose)
                    //{
                    this.TabPage_Close?.Invoke(this.CurrentTabPage, SourceCtrlType);
                    //  }
                    break;
                }
            }
            //}

            //catch (Exception ex)
            //{
            //    GlobalUtil.ShowError(ex );
            //}

            //finally
            //{
            //    GlobalUtil.UnLockPage(this);
            //}
        }
Ejemplo n.º 2
0
        private void SaveAdminUser()
        {
            if (curAdminUser != null)
            {
                //   468 管理员:在删除后加设置密码 20180525 原密码不需要了
                //if (curAdminUser.Password != SecurityHelper.MD5String2(this.skinTextBox_ID.SkinTxt.Text.Trim()))
                //{
                //    this.skinTextBox_ID.Focus();
                //    this.skinTextBox_ID.ResetText();
                //    GlobalMessageBox.Show("原密码错误!");
                //    this.skinTextBox_Name.ResetText();
                //    this.skinTextBox_Password.ResetText();
                //    return;
                //}
                if (String.IsNullOrEmpty(this.skinTextBox_Name.SkinTxt.Text.Trim()))
                {
                    this.skinTextBox_Name.Focus();
                    this.skinTextBox_Name.ResetText();
                    return;
                }
                else
                if (GlobalCache.CurrentUserID == SystemDefault.DefaultAdmin && this.skinTextBox_Name.SkinTxt.Text.Trim() == SystemDefault.DefaultAdminPassword)
                {
                    GlobalMessageBox.Show("密码不能是初始密码:" + SystemDefault.DefaultAdminPassword);
                    this.skinTextBox_Name.Focus();
                    this.skinTextBox_Name.ResetText();
                    return;
                }
                else if (String.IsNullOrEmpty(this.skinTextBox_Password.SkinTxt.Text.Trim()))
                {
                    this.skinTextBox_Password.Focus();
                    this.skinTextBox_Password.ResetText();

                    return;
                }
                else if (this.skinTextBox_Password.SkinTxt.Text.Trim() != this.skinTextBox_Name.SkinTxt.Text.Trim())
                {
                    GlobalMessageBox.Show("两次新密码输入不相同,请重新确认!");
                    this.skinTextBox_Name.Focus();
                    return;
                }
                //if (GlobalUtil.EngineUnconnectioned(this))
                //{
                //    return;
                //}
                this.curAdminUser.Password = SecurityHelper.MD5String2(this.skinTextBox_Password.SkinTxt.Text.Trim());


                InteractResult result = GlobalCache.AdminUser_OnUpdate(curAdminUser);
                switch (result.ExeResult)
                {
                case ExeResult.Error:
                    GlobalMessageBox.Show(result.Msg);
                    break;

                default:
                    if (DoClose)
                    {
                        this.TabPage_Close?.Invoke(this.CurrentTabPage, this);
                    }
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        private void Btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(this.skinTextBox_ID.SkinTxt.Text.Trim()))
                {
                    this.skinTextBox_ID.Focus();
                    return;
                }
                else
                if (String.IsNullOrEmpty(this.skinTextBox_Name.SkinTxt.Text.Trim()))
                {
                    this.skinTextBox_Name.Focus();
                    return;
                }
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                if (curAdminUser == null)
                {
                    AdminUser adminUser = new AdminUser()
                    {
                        RoleIDs    = GetRoles(),
                        ID         = this.skinTextBox_ID.SkinTxt.Text.ToLower().Trim(),
                        Remarks    = skinTextBox_Remarks.SkinTxt.Text.Trim(),
                        Name       = this.skinTextBox_Name.SkinTxt.Text.Trim(),
                        Password   = SecurityHelper.MD5String2("888888"),
                        State      = (byte)(this.skinCheckBox_State.Checked ? 0 : 1),
                        CreateTime = DateTime.Now,
                    };

                    if (String.IsNullOrEmpty(adminUser.ID))
                    {
                        this.skinTextBox_ID.Focus();
                        return;
                    }
                    else if (String.IsNullOrEmpty(adminUser.Name))
                    {
                        this.skinTextBox_Name.Focus();
                        return;
                    }
                    //  curAdminUser = AdminUser;

                    InteractResult result = GlobalCache.AdminUser_OnInsert(adminUser);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        GlobalMessageBox.Show("添加成功!");
                        base.TabPage_Close?.Invoke(this.CurrentTabPage, this.SourceCtrlType);
                        break;
                    }
                }
                else
                {
                    AdminUser adminUser = new AdminUser()
                    {
                    };
                    ReflectionHelper.CopyProperty(curAdminUser, adminUser);
                    adminUser.Name    = this.skinTextBox_Name.SkinTxt.Text.ToLower().Trim();
                    adminUser.State   = (byte)(this.skinCheckBox_State.Checked ? 0 : 1);
                    adminUser.Remarks = skinTextBox_Remarks.SkinTxt.Text.Trim();
                    adminUser.RoleIDs = GetRoles();
                    InteractResult result = GlobalCache.AdminUser_OnUpdate(adminUser);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        GlobalMessageBox.Show("保存成功!");
                        base.TabPage_Close?.Invoke(this.CurrentTabPage, this.SourceCtrlType);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }