Ejemplo n.º 1
0
 private void GetManageInfo()
 {
     try
     {
         DataTable dt = Dal_ManageInfo.GetManageAndRights();
         dt.Columns.Remove("ID1");
         dt.Columns.Remove("UserID");
         dgv_ManageList.DataSource = dt;
         dgv_ManageList.Focus();
     }
     catch (Exception ex)
     {
         CustomExceptionHandler.GetExceptionMessage(ex);
         MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 2
0
        private void Btn_Enter_Click(object sender, EventArgs e)
        {
            string account  = tb_Accounts.Text.Trim();
            string password = tb_Password.Text.Trim();

            if (account.Length == 0)
            {
                l_AccountsTitle.Text      = "帐号不能为空";
                l_AccountsTitle.ForeColor = Color.Red;
                tb_Accounts.Focus();
                return;
            }
            //if (password.Length == 0)
            //{
            //    l_PasswordTitle.Text = "密码不能为空";
            //    l_PasswordTitle.ForeColor = Color.Red;
            //    tb_Password.Focus();
            //    return;
            //}
            try
            {
                CbManageInfo Manage = Dal_ManageInfo.GetManage(account, password);
                if (Manage == null)
                {
                    MessageBox.Show("帐号或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (account != Dal_SysSettings.SystemSettings.ManageAccount || cb_RecordPassword.Checked != Dal_SysSettings.SystemSettings.IsSavePassword || password != Dal_SysSettings.SystemSettings.ManagePassword)
                {
                    Dal_SysSettings.SystemSettings.ManageAccount  = account;
                    Dal_SysSettings.SystemSettings.IsSavePassword = cb_RecordPassword.Checked;
                    Dal_SysSettings.SystemSettings.ManagePassword = password;
                    XmlHelper.Update <CbSysSettings>(Dal_SysSettings.SystemSettings);
                }
                Dal_ManageInfo.ManageInfo     = Manage;
                Dal_ManageRights.ManageRights = Dbhelper.Db.FirstDefault <CbManageRights>(" and UserId=" + Manage.ID);
                this.DialogResult             = DialogResult.OK;
            }
            catch (Exception ex)
            {
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }