Exemple #1
0
        private void FrmSelectedUser_Load(object sender, EventArgs e)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_USER_INFO userBll = new Maticsoft.BLL.SMT_USER_INFO();
                    var models = userBll.GetModelList("IS_DELETE!=1");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in models)
                        {
                            Node node = new Node(item.USER_NAME + "[" + item.REAL_NAME + "]");
                            node.Tag  = item;
                            advTree.Nodes[0].Nodes.Add(node);
                            if (_selectUserIds.Contains(item.ID))
                            {
                                node.Checked = true;
                            }
                        }
                        advTree.Nodes[0].ExpandAll();
                    }));
                }
                catch (System.Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载用户异常!" + ex.Message);
                }
            });

            waiting.Show(this);
        }
Exemple #2
0
        private void DoSave()
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                decimal?old = _userInfo.ROLE_ID;
                try
                {
                    _userInfo.ROLE_ID = SELECT_ROLE.ID;
                    Maticsoft.BLL.SMT_USER_INFO userBll = new Maticsoft.BLL.SMT_USER_INFO();
                    userBll.Update(_userInfo);
                    SmtLog.InfoFormat("用户", "修改用户:{0},角色:{1}成功.", _userInfo.USER_NAME, _userInfo.ROLE_ID + ":" + SELECT_ROLE.ROLE_NAME);
                    this.Invoke(new Action(() =>
                    {
                        _userInfo.ROLE_NAME = SELECT_ROLE.ROLE_NAME + "(点击修改)";
                        this.DialogResult   = DialogResult.OK;
                        this.Close();
                    }));
                }
                catch (Exception ex)
                {
                    _userInfo.ROLE_ID = old;
                    WinInfoHelper.ShowInfoWindow(this, "保存失败:" + ex.Message);
                    log.Error("保存授权角色失败:", ex);
                }
            });

            waiting.Show(this);
        }
Exemple #3
0
 private void dgvRoleInfos_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
     {
         if (dgvRoleInfos.Columns[e.ColumnIndex].Name != "ColDelete")
         {
             Maticsoft.Model.SMT_ROLE_INFO role = (Maticsoft.Model.SMT_ROLE_INFO)dgvRoleInfos.Rows[e.RowIndex].Tag;
             CtrlWaiting waiting = new CtrlWaiting(() =>
             {
                 try
                 {
                     Maticsoft.BLL.SMT_USER_INFO userBll = new Maticsoft.BLL.SMT_USER_INFO();
                     var list = userBll.GetModelListByPageEx("ROLE_ID=" + role.ID + " and IS_DELETE=0 and IS_ENABLE=1", "USER_NAME", 0, 100);
                     this.Invoke(new Action(() =>
                     {
                         DoShowUsersToGrid2(list);
                     }));
                 }
                 catch (Exception ex)
                 {
                     WinInfoHelper.ShowInfoWindow(this, "加载权限操作人错误:" + ex.Message);
                     log.Error("加载权限操作人错误:", ex);
                 }
             });
             waiting.Show(dgvRoleInfos);
         }
     }
 }
Exemple #4
0
        //执行登陆
        private void DoLogin()
        {
            Maticsoft.DBUtility.DbHelperSQL.connectionString = SysConfig.GetSqlServerConnectString();
            if (tbUserName.Text.Trim() == "")
            {
                MessageBox.Show("用户名不能为空!");
                tbUserName.Focus();
                return;
            }
            if (tbPwd.Text == "")
            {
                MessageBox.Show("密码不能为空!");
                tbPwd.Focus();
                return;
            }
            SunCreate.Common.ConfigHelper.SetConfigValue("RememberUser", cbRememberUser.Checked.ToString());
            string user = tbUserName.Text.Trim();

            if (cbRememberUser.Checked)
            {
                SunCreate.Common.ConfigHelper.SetConfigValue("LastLoginUser", user);
            }
            else
            {
                SunCreate.Common.ConfigHelper.SetConfigValue("LastLoginUser", "");
            }
            SunCreate.Common.ConfigHelper.SetConfigValue("RememberPwd", cbRememberPwd.Checked.ToString());
            if (cbRememberPwd.Checked)
            {
                string p = EncryptUtils.DESEncrypt(tbPwd.Text, "yjdd@@!!", "djifd##c");
                SunCreate.Common.ConfigHelper.SetConfigValue("LastLoginPwd", p);
            }
            else
            {
                SunCreate.Common.ConfigHelper.SetConfigValue("LastLoginPwd", "");
            }

            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_USER_INFO userbll = new Maticsoft.BLL.SMT_USER_INFO();
                    var users = userbll.GetModelList("USER_NAME='" + tbUserName.Text.Trim() + "' and IS_ENABLE=1 and IS_DELETE=0 and PASS_WORD= substring(sys.fn_sqlvarbasetostr(HashBytes('MD5','" + tbPwd.Text + "')),3,32)");
                    if (users.Count > 0)
                    {
                        UserInfoHelper.UserInfo = users[0];
                        UserInfoHelper.OldPwd   = tbPwd.Text;
                        PrivateMgr.LoadPrivates();
                    }
                    this.Invoke(new Action(() =>
                    {
                        if (users.Count > 0)
                        {
                            DoEnter();
                        }
                        else
                        {
                            MessageBox.Show("输入用户信息错误!");
                        }
                    }));
                }
                catch (System.Exception ex)
                {
                    this.Invoke(new Action(() =>
                    {
                        MessageBox.Show("登陆失败:" + ex.Message);
                    }));
                }
            });

            waiting.Show(this);
        }
Exemple #5
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (tbUserName.Text.Trim() == "")
            {
                MessageBox.Show("用户名不能为空!");
                return;
            }
            if (_userInfo == null)
            {
                _userInfo    = new Maticsoft.Model.SMT_USER_INFO();
                _userInfo.ID = -1;
            }
            string oldUser = _userInfo.USER_NAME;

            _userInfo.USER_NAME = tbUserName.Text.Trim();
            _userInfo.PASS_WORD = tbPwd.Text;
            if (_userInfo.PASS_WORD == "123456")
            {
                _userInfo.PASS_WORD = "e10adc3949ba59abbe56e057f20f883e";
            }
            _userInfo.REAL_NAME = tbRealName.Text.Trim();
            _userInfo.IS_ENABLE = cbEnable.Checked;
            _userInfo.TELEPHONE = tbTel.Text.Trim();
            _userInfo.ADDRESS   = tbAddress.Text.Trim();
            _userInfo.EMAIL     = tbEmail.Text.Trim();
            _userInfo.QQ        = tbQQ.Text.Trim();
            _userInfo.KEY_VAL   = "";
            _userInfo.IS_DELETE = false;
            if (cboRole.SelectedItem != null)
            {
                ComboItem cboItem = (ComboItem)cboRole.SelectedItem;
                Maticsoft.Model.SMT_ROLE_INFO roleInfo = (Maticsoft.Model.SMT_ROLE_INFO)cboItem.Tag;
                _userInfo.ROLE_ID   = roleInfo.ID;
                _userInfo.ROLE_NAME = roleInfo.ROLE_NAME;
            }
            else
            {
                _userInfo.ROLE_ID = -1;
            }
            if (cbtDept.SelectedNode != null)
            {
                Maticsoft.Model.SMT_ORG_INFO orgInfo = (Maticsoft.Model.SMT_ORG_INFO)cbtDept.SelectedNode.Tag;
                _userInfo.ORG_ID    = orgInfo.ID;
                _userInfo.DEPT_NAME = orgInfo.ORG_NAME;
            }
            else
            {
                _userInfo.ORG_ID = -1;
            }
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_USER_INFO userBll = new Maticsoft.BLL.SMT_USER_INFO();
                    if (_userInfo.ID == -1)
                    {
                        userBll.Add(_userInfo);
                        SmtLog.InfoFormat("用户", "添加用户:用户名={0},状态={1}", _userInfo.USER_NAME, _userInfo.IS_ENABLE);
                    }
                    else
                    {
                        userBll.Update(_userInfo);
                        SmtLog.InfoFormat("用户", "更新用户:用户名={0},状态={1},原始用户名={2}", _userInfo.USER_NAME, _userInfo.IS_ENABLE, oldUser);
                    }
                    this.BeginInvoke(new Action(() =>
                    {
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "保存用户异常:" + ex.Message);
                    log.Error("保存用户异常:", ex);
                }
            });

            waiting.Show(this);
        }