public AccountMembershipService(string Login) { if (!String.IsNullOrEmpty(Login)) { _CurrUsrLogin = Login; System.Web.HttpContext.Current.Session["Login"] = Login; } if (_currUser == null) { _CurrUsrLogin = (System.Web.HttpContext.Current.Session["Login"] != null ? System.Web.HttpContext.Current.Session["Login"].ToString() : _CurrUsrLogin); _currUser = _db.GetUserByLogin(_CurrUsrLogin); } }
public void SaveUser(Users obj) { Users old = GetUser(obj.ID); old.RoleID = obj.RoleID; old.SortType = obj.SortType; _DB.SaveChanges(); }
public Users GetCurrUser(string username, string filterAttribute) { Users usr = null; if (username == "sysadmin") { if (filterAttribute == Configuration.SysPassword) { usr = new Users(); usr.ID = Guid.NewGuid(); usr.Login = username; usr.FIO = username; usr.AccessRights = 31;//все права } //_DB.Users.AddObject(usr); //_DB.SaveChanges(); return usr; } IList<Users> userlst = _DB.Users.Where(p => p.Login.Equals(username, StringComparison.CurrentCultureIgnoreCase)).ToList(); if (userlst.Count == 0 || userlst[0].FIO != filterAttribute) { usr = new Users(); usr.ID = Guid.NewGuid(); usr.Login = username; usr.FIO = filterAttribute; _DB.Users.AddObject(usr); _DB.SaveChanges(); } else usr = userlst[0]; return usr; }
public bool ValidateUser(string userName, string password) { if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", "userName"); if (String.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", "password"); _currUser = IsAuthenticated("LDAP://maytea.com", "maytea", userName, password); // if (_currUser == null) _currUser = new Users(); _currUser.Login = "******"; return (_currUser != null); }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(Users users) { base.AddObject("Users", users); }
/// <summary> /// Create a new Users object. /// </summary> /// <param name="id">Initial value of the ID property.</param> public static Users CreateUsers(global::System.Guid id) { Users users = new Users(); users.ID = id; return users; }
public ActionResult EditUser(Users obj, String Roles) { obj.RoleID = _db.GetRoleID(Roles); _db.SaveUser(obj); return RedirectToAction("UsersList", "Admin"); }