示例#1
0
 /// <summary>
 /// 该方法更新用户帐户信息
 /// </summary>
 /// <param name="model">用户表实体层</param>
 /// <returns></returns>
 public int userOperationUpdate(HY_Model.User model, int h_ID)
 {
     try
     {
         string sql = "update HY_User set h_UserName='******',h_yUserPwd='" + model.PassWord + "',h_Status='" + model.UserStatus + "' where h_ID='" + h_ID + "'";
         int    res = hy_help.insertEx(sql);
         return(res);
     }
     catch (Exception EX)
     {
         throw EX;
     }
 }
示例#2
0
 /// <summary>
 /// 更新权限
 /// </summary>
 /// <param name="model">用户权限实体类</param>
 /// <param name="user">用户</param>
 /// <returns></returns>
 public int userSecurityUpdate(HY_Model.User model, string user)
 {
     try
     {
         string sql = "update HY_User set h_Security='" + model.Security + "' where h_UserName='******'";
         int    res = hy_help.insertEx(sql);
         return(res);
     }
     catch (Exception EX)
     {
         throw EX;
     }
 }
示例#3
0
 /// <summary>
 /// 用户执行增加操作
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int userOperation(HY_Model.User model)
 {
     try
     {
         string sql = "insert into HY_user(h_UserName,h_yUserPwd,h_Status) values('" + model.UserName + "','" + model.PassWord + "','" + model.UserStatus + "')";
         int    res = hy_help.insertEx(sql);
         return(res);
     }
     catch (Exception EX)
     {
         throw EX;
     }
 }
示例#4
0
 /// <summary>
 /// 验证登陆用户信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public DataTable userAuthentication(HY_Model.User model)
 {
     try
     {
         DataTable dt  = new DataTable();
         string    sql = "select h_UserName,h_yUserPwd,h_yUserPwd,h_Status from HY_User where h_UserName='******' and h_yUserPwd='" + model.PassWord + "'";
         dt = hy_help.ExecuteQuery(sql);
         return(dt);
     }
     catch (Exception EX)
     {
         throw EX;
     }
 }
示例#5
0
        /// <summary>
        /// 自定义登陆
        /// </summary>
        private void LoGIin()
        {
            //TODO
            bool isEmpty = UserInputCheck();
            if (isEmpty == true)
            {
                HY_Model.User u = new User();
                u.UserName = this.userName.Text.Trim();
                u.PassWord = this.passWord.Text.Trim();

                HY_BLL.HY_setbll hyset = new HY_setbll();
                DataTable dt = hyset.userAuthentication(u);
                if (dt.Rows.Count > 0)
                {
                    if (int.Parse(dt.Rows[0]["h_Status"].ToString()) > 0)
                    {
                        string user = this.userName.Text.Trim();
                        if (!this.userName.AutoCompleteCustomSource.Contains(user))
                        {
                            this.userName.AutoCompleteCustomSource.Add(user);
                        }
                        MianForm mf = new MianForm();
                        mf.UserName = this.userName.Text.Trim();
                        mf.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBoxEx.Show("此账户已被锁定暂无法登录!", "登陆提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.userName.Text = "";
                        this.passWord.Text = "";
                        this.userName.Focus();
                    }
                }
                else
                {
                    MessageBoxEx.Show("登陆失败:用户名或密码错误,请重新输入!", "登陆提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.userName.Text = "";
                    this.passWord.Text = "";
                    this.userName.Focus();

                }
            }
        }
示例#6
0
        /// <summary>
        /// 保存(包括新增用户、修改用户保存)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripSave_Click(object sender, EventArgs e)
        {
            //TODO:添加
            if (this.h_UserName.Text.Trim() == string.Empty || this.h_UserPwd.Text.Trim() == string.Empty)
            {
                MessageBox.Show("用户名或密码不能为空!");
                this.h_UserName.Focus();
                return;
            }
            else if (this.h_UserPwd.Text.Length<6)
            {
                MessageBox.Show("账户密码不能小于6位数字!");
                this.h_UserPwd.Focus();
                return;
            }
            HY_Model.User u = new User();  //给USER表实体类赋值
            u.UserName = this.h_UserName.Text.Trim();
            u.PassWord = this.h_UserPwd.Text.Trim();

            if (this.h_Status.Checked)
            {
                u.UserStatus = 1;
            }
            if (this.toolStripEdit.Enabled == false)//添加帐户数据判断
            {
                HY_BLL.HY_setbll hyset = new HY_setbll();
                int res = hyset.userOperation(u);
                if (res > 0)
                {
                    MessageBox.Show("系统用户添加成功!");
                    dgv_User();
                }
            }
            else if (this.toolStripAdd.Enabled == false)//修改帐户数据判断
            {
                int rowIndex = int.Parse(this.dataGridView_user.SelectedRows[0].Cells[0].Value.ToString());
                HY_BLL.HY_setbll hyset = new HY_setbll();
                int res = hyset.userOperationUpdate(u, rowIndex);
                if (res > 0)
                {
                    MessageBox.Show("用户帐号修改成功!");
                    dgv_User();
                }
            }
        }
示例#7
0
 /// <summary>
 /// 查询后返回DataTable
 /// </summary>
 /// <param name="model">登陆用户实体类</param>
 /// <returns></returns>
 public DataTable userAuthentication(HY_Model.User model)
 {
     return(hyset.userAuthentication(model));
 }
示例#8
0
 /// <summary>
 /// 返回修改更新用户操作
 /// </summary>
 /// <param name="model">用户表实体</param>
 /// <param name="h_ID">需要修改用户编号(唯一)</param>
 /// <returns></returns>
 public int userOperationUpdate(HY_Model.User model, int h_ID)
 {
     return(hyset.userOperationUpdate(model, h_ID));
 }
示例#9
0
 /// <summary>
 /// 更新权限
 /// </summary>
 /// <param name="model">用户权限实体类</param>
 /// <param name="user">用户</param>
 /// <returns></returns>
 public int userSecurityUpdate(HY_Model.User model, string user)
 {
     return(hyset.userSecurityUpdate(model, user));
 }
示例#10
0
 /// <summary>
 /// 返回添加用户操作
 /// </summary>
 /// <param name="model">Moldel实体对象</param>
 /// <returns></returns>
 public int userOperation(HY_Model.User model)
 {
     return(hyset.userOperation(model));
 }