Ejemplo n.º 1
0
 public static User get(User obj)
 {
     using (var model = ModelConnector.Connector())
     {
         var objUser = from u in model.Users where u.UserName == obj.UserName select u;
         return objUser.FirstOrDefault();
     }
 }
Ejemplo n.º 2
0
 public static void update(User obj)
 {
     using (var model = ModelConnector.Connector())
     {
         var _user = model.Users.Where(a => a.UserName == obj.UserName).FirstOrDefault();
         _user.Password = obj.Password;
         _user.Status = obj.Status;
         _user.Active = obj.Active;
         _user.GroupRole = obj.GroupRole;
         model.Entry(_user).State = System.Data.Entity.EntityState.Modified;
         model.SaveChanges();
     }
 }
Ejemplo n.º 3
0
        bool login()
        {
            User obj = new User();
            obj.UserName = txtUser.Text;
            obj = AUsers.get(obj);
            if (obj == null)
            {
                commons.ShowAlert("Sai tên đăng nhập", 3);
                return false;
            }

            if (obj.Password != ComputeHash.Hash(txtPass.Text))
            {
                commons.ShowAlert("Sai mật khẩu", 3);
                return false; }
            Local_Params.UserName = obj.UserName;
            Local_Params.PassWord = obj.Password;
            return true;
        }