Esempio n. 1
0
 /// <summary>
 /// 添加新用户
 /// </summary>
 /// <param name="company"></param>
 /// <returns></returns>
 public int addUsers(ABiAdminUsers users)
 {
     VPDAL.ABi_Admin_Users obj = new VPDAL.ABi_Admin_Users();
     obj.Username = users.Username;
     users.Password = this.getMd5Hash(users.Password);
     obj.Password = users.Password;
     obj.PwdLastChanged = users.PwdLastChanged;
     obj.Name = users.Name;
     obj.DateCreated = users.DateCreated;
     obj.DateModified = users.DateModified;
     obj.Phone = users.Phone;
     obj.Status = users.Status;
     obj.Mobile = users.Mobile;
     obj.Email = users.Email;
     obj.LoginStatus = users.LoginStatus;
     obj.LastLogin = Convert.ToDateTime(users.LastLogin);
     obj.NeedResetPwd = true;
     dbContext.ABi_Admin_Users.AddObject(obj);
     return dbContext.SaveChanges();
 }
Esempio n. 2
0
 /// <summary>
 /// 更新用户密码
 /// </summary>
 /// <param name="company"></param>
 /// <returns></returns>
 public int updateUsersPassWord(ABiAdminUsers user, bool needResetPwd)
 {
     var obj = dbContext.ABi_Admin_Users.FirstOrDefault(o => o.ABi_Admin_Users_ID == user.ABi_Admin_Users_ID);
     if (obj != null)
     {
         user.Password = this.getMd5Hash(user.Password);
         obj.Password = user.Password;
         obj.PwdLastChanged = user.PwdLastChanged;
         obj.NeedResetPwd = needResetPwd;
         return dbContext.SaveChanges();
     }
     return 0;
 }
Esempio n. 3
0
 /// <summary>
 /// 更新公司最后登陆时间
 /// </summary>
 /// <param name="company"></param>
 /// <returns></returns>
 public int updateUsersLastLogin(ABiAdminUsers user)
 {
     var obj = dbContext.ABi_Admin_Users.FirstOrDefault(o => o.ABi_Admin_Users_ID == user.ABi_Admin_Users_ID);
     if (obj != null)
     {
         obj.LastLogin = String.IsNullOrEmpty(user.LastLogin.ToString()) ? obj.LastLogin : user.LastLogin;
         obj.LoginStatus = user.LoginStatus;
         obj.IPAddress = user.IPAddress;
         return dbContext.SaveChanges();
     }
     return 0;
 }
Esempio n. 4
0
 /// <summary>
 ///更新用户
 /// </summary>
 /// <param name="company"></param>
 /// <returns></returns>
 public int updateUsers(ABiAdminUsers users)
 {
     int id = Convert.ToInt32(users.ABi_Admin_Users_ID);
     var obj = dbContext.ABi_Admin_Users.FirstOrDefault(o => o.ABi_Admin_Users_ID == id);
     if (obj != null)
     {
         if (string.IsNullOrEmpty(users.Password) == false)
             users.Password = this.getMd5Hash(users.Password);
         obj.ABi_Admin_Users_ID = obj.ABi_Admin_Users_ID;
         obj.Username = users.Username;
         obj.Password = string.IsNullOrEmpty(users.Password)?obj.Password:users.Password;
         obj.PwdLastChanged = string.IsNullOrEmpty(users.Password)?obj.PwdLastChanged:DateTime.Now;
         obj.Name = users.Name;
         obj.DateCreated = obj.DateCreated;
         obj.DateModified = users.DateModified;
         obj.Phone = users.Phone;
         obj.Status = users.Status;
         obj.Mobile = users.Mobile;
         obj.Email = users.Email;
         obj.LoginStatus = users.LoginStatus;
         obj.LastLogin = obj.LastLogin;
     }
     return dbContext.SaveChanges();
 }
Esempio n. 5
0
 public static ABiAdminUsers FromABiVendor(VPBLL.Vendor.ABiVendor vendor)
 {
     ABiAdminUsers obj = new ABiAdminUsers();
     obj.Username = vendor.VendorCode;
     obj.Password = vendor.TaxNumber;
     obj.PwdLastChanged = DateTime.Now;
     obj.Name = vendor.VendorName;
     obj.DateCreated = DateTime.Now;
     obj.DateModified = DateTime.Now;
     obj.Phone = "";
     obj.Status =true;
     obj.Mobile = "";
     obj.Email ="";
     obj.LoginStatus = "0";
     obj.LastLogin = DateTime.Now;
     return obj;
 }
Esempio n. 6
0
 public static ABiAdminUsers FromABi_Admin_Users(VPDAL.ABi_Admin_Users use)
 {
     ABiAdminUsers obj = new ABiAdminUsers();
     obj.ABi_Admin_Users_ID = use.ABi_Admin_Users_ID;
     obj.Username = use.Username;
     obj.Password = use.Password;
     obj.PwdLastChanged = use.PwdLastChanged;
     obj.Name = use.Name;
     obj.DateCreated = use.DateCreated;
     obj.DateModified = use.DateModified;
     obj.Phone = use.Phone;
     obj.Status = use.Status;
     obj.Mobile = use.Mobile;
     obj.Email = use.Email;
     obj.LoginStatus = use.LoginStatus;
     obj.LastLogin = Convert.ToDateTime(use.LastLogin);
     obj.IPAddress = use.IPAddress;
     obj.NeedResetPwd = use.NeedResetPwd ?? false;
     return obj;
 }