コード例 #1
0
ファイル: ModifyPwd.cs プロジェクト: tuhongwu/Graduation
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!IsAllowOpt())
            {
                return;
            }
            string    userID = this.txtUserID.Text;
            Hashtable ht     = new Hashtable();

            ht["UserPassword"] = this.txtNewUserPassword.Text;

            BLL.BllDbOpt bll    = new BLL.BllDbOpt();
            bool         result = bll.UpdateUserInfo(ht, userID);

            MessageBox.Show(string.Format("修改{0}!", result ? "成功" : "失败"));
        }
コード例 #2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;               //缓冲转动圆圈
         BLL.BllDbOpt bll          = new BLL.BllDbOpt(); //
         string       UserID       = txtUserID.Text.Trim();
         string       UserPassword = txtUserPassword.Text.Trim();
         int          typeIndex    = this.cmbUserType.SelectedIndex;
         if (UserID != "" && UserPassword != "")
         {
             //string strWhere = string.Format("UserID='{0}' and UserPassword='******' and UserType='{2}'", UserID, UserPassword, typeIndex);
             //Model.ModelUserInfo model = new Model.ModelUserInfo();
             DataTable dt = new DataTable();
             dt = bll.GetUserInfo(UserID, UserPassword, typeIndex);
             if (dt.Rows.Count == 1)
             {
                 this.Hide();
                 BLL.UserInfo.UserID       = UserID;
                 BLL.UserInfo.UserPassword = UserPassword;
                 if (this.cmbUserType.SelectedIndex.Equals(0))
                 {
                     FormAdmin dlg = new FormAdmin();
                     dlg.ShowDialog();
                 }
                 else
                 {
                     FormEmployee dlg = new FormEmployee();
                     dlg.ShowDialog();
                 }
                 this.Close();
             }
             else
             {
                 MessageBox.Show("用户名或者密码错误!");
             }
         }
         else
         {
             MessageBox.Show("用户名或者密码未输入!");
         }
     }
     finally { this.Cursor = Cursors.Default; }
 }
コード例 #3
0
ファイル: FromUserAdd.cs プロジェクト: tuhongwu/Graduation
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (!IsAllowOpt())
            {
                return;
            }
            BLL.BllDbOpt bll = new BLL.BllDbOpt();
            DataTable    dt  = bll.GetUserInfo(this.txtUserID.Text);

            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("账号已存在!");
                return;
            }

            Hashtable ht     = this.SetUserInfo();
            bool      result = bll.AddUserInfo(ht);

            MessageBox.Show(string.Format("数据添加{0}", result ? "成功" : "失败"));
        }