예제 #1
0
파일: BaseForm.cs 프로젝트: honstat/mvctest
 protected override void OnLoad(EventArgs e)
 {
     if (currentUser == null)
     {
         currentUser = new LYH_JXC.Entity.Employee();
         myPermissionList = new List<string>();
     }
 }
예제 #2
0
파일: BaseForm.cs 프로젝트: honstat/mvctest
 protected override void OnLoad(EventArgs e)
 {
     if (currentUser == null)
     {
         currentUser      = new LYH_JXC.Entity.Employee();
         myPermissionList = new List <string>();
     }
 }
예제 #3
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static int add(Employee model)
 {
     var sql = string.Format(@"INSERT INTO [a_Emp]([EmpName],[Sex],[BirthDay],[DepId] ,[Phone],[Email],[Address],[Remark],[Pwd],[Role],[CreateTime],[UpdateTime],[RealName]) VALUES('{0}','{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}',{9},'{10}','{11}','{12}')", model.EmpName, model.Sex, model.BirthDay, model.DepId, model.Phone, model.Email, model.Address, model.Remark, model.Pwd, model.Role, model.CreateTime, model.UpdateTime, model.RealName);
     using (BaseContext db = new BaseContext())
     {
         var result = db.Database.ExecuteSqlCommand(sql);
         return result;
     }
 }
예제 #4
0
파일: FrmLogin.cs 프로젝트: honstat/mvctest
        private LYH_JXC.Entity.Employee Login(string name, string pwd, out string msg)
        {
            LYH_JXC.Entity.Employee model = null;
            var ret = EmployeeDAL.Login(name, pwd);

            if (ret.success)
            {
                model = ret.data;
                msg   = ret.message;
            }
            else
            {
                msg = ret.message;
            }
            return(model);
        }
예제 #5
0
파일: FrmLogin.cs 프로젝트: honstat/mvctest
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string LoginName = txtLoginName.Text.Trim();
            string LoginPwd  = txtLoginPwd.Text.Trim();

            if (string.IsNullOrEmpty(LoginName))
            {
                MessageBox.Show("请输入用户名");
            }
            else if (string.IsNullOrEmpty(LoginPwd))
            {
                MessageBox.Show("请输入密码");
            }
            else
            {
                string msg = string.Empty;
                LYH_JXC.Entity.Employee user = Login(LoginName, LoginPwd, out msg);
                if (user != null)
                {
                    //保存权限和用户信息
                    currentUser      = user;
                    myPermissionList = new List <string>()
                    {
                        currentUser.Role.ToString()
                    };

                    //登录成功,跳转
                    FrmMain main = new FrmMain();

                    this.Hide();
                    main.Show();
                }
                else
                {
                    //登录失败,弹出信息
                    MessageBox.Show(msg);
                }
            }
        }
예제 #6
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="model"></param>
 public static void edit(Employee model)
 {
     EditEntry<Employee>(model, "EmpId");
 }