//Function to get User for editing /// <summary> /// Edits the user. /// </summary> /// <param name="UserID">The user identifier.</param> /// <returns></returns> public ActionResult EditUser(int UserID) { var objUserBal = new UsersBal(); var user = objUserBal.GetUserById(UserID); var currentUser = new UsersCustomModel { CurrentUser = user, //RoleId = user.UserRole //UserID = user.UserID, //CountryID = user.CountryID, //StateID = user.StateID, //CityID = user.CityID, //UserGroup = user.UserGroup, //UserName = user.UserName, //FirstName = user.FirstName, //LastName = user.LastName, //Answer = user.Answer, //Password = user.Password, //Address = user.Address, //Email = user.Email, //Phone = user.Phone, //HomePhone = user.HomePhone, //AdminUser = user.AdminUser, //IsActive = user.IsActive, //FailedLoginAttempts = user.FailedLoginAttempts, //IsDeleted = user.IsDeleted, RoleName = GetRoleName(user.UserID), RoleId = GetRoleId(user.UserID) }; return(Json(currentUser, JsonRequestBehavior.AllowGet)); //return PartialView(PartialViews.AddUpdateUser, currentUser); }
/// <summary> /// Gets the logged in user details. /// </summary> /// <returns></returns> public ActionResult GetLoggedInUserDetails() { var objUserBal = new UsersBal(); var userid = Helpers.GetLoggedInUserId(); var user = objUserBal.GetUserById(userid); var viewpath = string.Format("../PatientSearch/{0}", PartialViews.ChangePassword); return(PartialView(viewpath, user)); }
//public ActionResult AddRoleWithUser(int userID, int roleID) //{ // var objUserRoleBal = new UserRoleBal(); // var isExist = objUserRoleBal.CheckIfExists(userID, roleID); // if (!isExist) // { // var lstUserRoles = new List<UserRole> // { // new UserRole // { // UserID = userID, // RoleID = roleID, // IsActive = true, // IsDeleted = false, // CreatedBy = Helpers.GetLoggedInUserId(), // CreatedDate = Helpers.GetInvariantCultureDateTime() // } // }; // return Json(objUserRoleBal.AddUpdateUserRole(lstUserRoles)); // } // return Json(0); //} /// <summary> /// Adds the role with user. /// </summary> /// <returns></returns> /// <summary> /// Deletes the user. /// </summary> /// <param name="userId">The user identifier.</param> /// <param name="cId"></param> /// <param name="fId"></param> /// <returns></returns> public ActionResult DeleteUser(int userId, int cId, int fId) { var objUserBal = new UsersBal(); var objUser = objUserBal.GetUserById(userId); objUser.IsDeleted = true; objUser.DeletedBy = Helpers.GetLoggedInUserId(); objUser.DeletedDate = Helpers.GetInvariantCultureDateTime(); //To Do change it to server datetime objUser.TokenExpiryDate = null; objUser.UserToken = null; objUserBal.AddUpdateUser(objUser, 0); cId = cId == 0 ? Helpers.GetSysAdminCorporateID() : cId; if (fId == 0 && !Helpers.GetLoggedInUserIsAdmin()) { fId = Helpers.GetDefaultFacilityId(); } var list = objUserBal.GetUsersByCorporateIdFacilityId(cId, fId); return(PartialView("UserControls/_UsersList", list)); }