public static void saveProfile(UserProfileBO profile) { //setup a connection to the database SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DB_CST465"].ConnectionString); //setup a way to talk to the database SqlCommand command = new SqlCommand(); command.Connection = connection; //open connection and set command parameters and type command.Connection.Open(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "UserProfile_InsertUpdate"; //set all of the data to be sent to database command.Parameters.Add(new SqlParameter("@UserID", profile.UserID)); command.Parameters.Add(new SqlParameter("@FirstName", profile.fname)); command.Parameters.Add(new SqlParameter("@LastName", profile.lname)); command.Parameters.Add(new SqlParameter("@Age", profile.age)); command.Parameters.Add(new SqlParameter("@PhoneNumber", profile.phone)); command.Parameters.Add(new SqlParameter("@EmailAddress", profile.email)); command.Parameters.Add(new SqlParameter("@StreetAddress", profile.street)); command.Parameters.Add(new SqlParameter("@City", profile.city)); command.Parameters.Add(new SqlParameter("@State", profile.state)); command.Parameters.Add(new SqlParameter("@ZipCode", profile.zip)); command.Parameters.Add(new SqlParameter("@ProfileImage", profile.profpic)); command.ExecuteNonQuery(); command.Connection.Close(); }
public UserProfileBO GetUserByLoginName(string userName) { UserProfileBO user = new UserProfileBO(); ObjectMapper.Map(UserRepository.GetUserByLoginName(userName), user); return(user); }
/// <summary> /// Displays the user profile. /// </summary> /// <param name="userId">The userId.</param> /// <returns></returns> public UserProfileBO DisplayUserProfile(int userId) { UserProfileBO userProfile = new UserProfileBO(); UserMaster user = UserRepository.DisplayUserProfile(userId); List <UserWeddingSubscriptionBO> userWeddingSubscriptions = new List <UserWeddingSubscriptionBO>(); AddressMasterBO address = new AddressMasterBO(); ObjectMapper.Map(SystemRepository.GetAddressDetailsByType((int)AspectEnums.AddressOwnerType.User, userId), address); ObjectMapper.Map(user, userProfile); // userProfile.UserWeddingSubscriptions = userWeddingSubscriptions; userProfile.Address = address; RoleMaster role = user.UserRoles.Where(k => !k.isDeleted).ToList().Count > 0 ? user.UserRoles.Where(k => !k.isDeleted).ToList()[0].RoleMaster : null; userProfile.RoleID = role != null ? role.RoleID : 0; userProfile.userRoleID = user.UserRoles.Where(k => !k.isDeleted).FirstOrDefault().UserRoleID; if (!String.IsNullOrEmpty(userProfile.ImagePath)) { userProfile.ImagePath = userProfile.ImagePath; // AppUtil.GetServerMobileImages(userProfile.ImagePath, AspectEnums.ImageFileTypes.User); } else { userProfile.ImagePath = "~/content/images/users/avatar.png"; } userProfile.IsAdmin = UserRepository.IsAdminRole(Convert.ToInt32(userProfile.RoleID)); userProfile.Mobile = EncryptionEngine.DecryptString(userProfile.Mobile); userProfile.Phone = EncryptionEngine.DecryptString(userProfile.Phone); userProfile.Email = EncryptionEngine.DecryptString(userProfile.Email); userProfile.LoginName = EncryptionEngine.DecryptString(userProfile.LoginName); return(userProfile); }
public JsonResponse <UserProfileDTO> DisplayRaceUserProfile(long userID) { JsonResponse <UserProfileDTO> response = new JsonResponse <UserProfileDTO>(); try { ExceptionEngine.AppExceptionManager.Process(() => { UserProfileDTO objUserProfileDTO = new UserProfileDTO(); UserProfileBO objUserProfileBO = UserBusinessInstance.DisplayUserProfile(userID); EntityMapper.Map(objUserProfileBO, objUserProfileDTO); if (objUserProfileDTO.UserID > 0) { response.IsSuccess = true; response.SingleResult = objUserProfileDTO; } else { response.IsSuccess = false; response.Message = Messages.InvalidUserID; } }, AspectEnums.ExceptionPolicyName.ServiceExceptionPolicy.ToString()); } catch (Exception ex) { response.Message = ex.Message; } return(response); }
// GET: Books/Create public ActionResult Create() { List <UserProfile> userProfiles = new UserProfileBO().GetUsers(); ViewBag.FKAddedBy = new SelectList(userProfiles, "PKUserId", "FirstName"); return(View()); }
public ActionResult Edit([Bind(Include = "PKBookId,BookName,BookDescription,BookImageURL,AuthorName,Price,OfferedPrice,Rating,FKAddedBy,IsActive")] Book book, HttpPostedFileBase BookImage) { if (ModelState.IsValid) { if (BookImage == null) { booksBO.UpdateBook(book); return(RedirectToAction("Index")); } string extension = Path.GetExtension(BookImage.FileName); if (extension == ".jpeg" || extension == ".png" || extension == ".jpg") { book.BookImageURL = Guid.NewGuid() + extension; BookImage.SaveAs(Server.MapPath("~/BookImages/" + book.BookImageURL)); booksBO.UpdateBook(book); return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Invalid File Format"); return(View()); } } List <UserProfile> userProfiles = new UserProfileBO().GetUsers(); ViewBag.FKAddedBy = new SelectList(userProfiles, "PKUserId", "FirstName", book.FKAddedBy); return(View(book)); }
//Create public UserProfileBO Create(UserProfileBO userProfile) { using (var uow = facade.UnitOfWork) { var newProfile = uow.UserProfileRepository.Create(conv.Convert(userProfile)); uow.Complete(); return(conv.Convert(newProfile)); } }
/// <summary> /// Method to return user for an employee code /// </summary> /// <param name="loginName">cemployee Code</param> /// <returns>returns user</returns> public UserProfileBO GetUserByName(string loginName) { UserProfileBO userDetail = new UserProfileBO(); ObjectMapper.Map(UserRepository.GetUserByName(loginName), userDetail); userDetail.Email = EncryptionEngine.DecryptString(userDetail.Email); userDetail.Mobile = EncryptionEngine.DecryptString(userDetail.Mobile); return(userDetail); }
/// <summary> /// Creates a new instance of myCoalUser and tracks the values using a cookie /// </summary> /// <param name="UserIdentity"></param> /// <param name="Profile"></param> private myCoalUser(UserProfileBO Profile) { Roles = Profile.Roles.Trim().Length > 0 ? Profile.Roles.Split(' ') : new string[] { }; FirstName = Profile.Registration.FirstName; LastName = Profile.Registration.LastName; RegistrationId = Profile.Registration.RegistrationID; Email = Profile.Registration.Email; IsRegistered = true; Status = (myCoalUserStatus)Enum.Parse(typeof(myCoalUserStatus), Profile.Registration.RegistrationStatusID); }
private void GetDatabaseUserRolesPermissions() { //Get user roles and permissions from database tables... profile = HttpContext.Current.Session[PageConstants.SESSION_PROFILE_KEY] as UserProfileBO; if (profile != null) { IsAdmin = profile.IsAdmin; LoginName = profile.LoginName; UserId = profile.UserID; } }
/// <summary> /// Creates a new instance of myCoalUser and tracks the values using a cookie /// </summary> /// <param name="UserIdentity"></param> /// <param name="Profile"></param> private myCoalUser(UserProfileBO Profile) { Roles = Profile.Roles.Split(' '); FirstName = Profile.Registration.FirstName; LastName = Profile.Registration.LastName; RegistrationId = Profile.Registration.RegistrationID; Email = Profile.Registration.Email; IsRegistered = true; Status = (myCoalUserStatus)Enum.Parse(typeof(myCoalUserStatus), Profile.Registration.RegistrationStatusID); AddProfileCookie(); }
public async Task UpdateUserProfileAsync(UserProfileBO profile) { Validate.NotNull(profile, "User profile"); var p = await FindProfileAsync(x => x.Id == profile.ProfileId); p.FirstName = profile.FirstName; p.LastName = profile.LastName; p.Email = profile.Email; //p.ProfileImage = profile.ProfileImage; // TODO: implement this uow.UserProfileRepository.Update(p); }
public virtual void Add(UserProfileBO userProfile) { if (userProfile == null) { throw new ArgumentNullException("userProfile", "User Profile is null"); } else { db.userProfileRepository.Add(userProfile); unitofWork.Commit(); } }
public virtual void Delete(UserProfileBO userProfile, bool purge = false) { if (purge) { db.userProfileRepository.Delete(userProfile); unitofWork.Commit(); } else { userProfile.Audit.RecordState = Entity.Enums.RecordStateType.InActive; Update(userProfile); } }
public async Task CreateUserProfileAsync(UserProfileBO profile) { Validate.NotNull(profile, "User profile"); var p = new Entities.UserProfile { FirstName = profile.FirstName, LastName = profile.LastName, Email = profile.Email }; await uow.UserProfileRepository.CreateAsync(p); }
internal UserProfile Convert(UserProfileBO userProfile) { if (userProfile == null) { return(null); } return(new UserProfile() { Id = userProfile.Id, FirstName = userProfile.FirstName, LastName = userProfile.LastName, JoinDate = userProfile.JoinDate, }); }
public static UserProfileBO getProfile(Guid id) { //create a user object to return at the end UserProfileBO usr = new UserProfileBO(); //setup a connection to the database SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DB_CST465"].ConnectionString); //setup a way to talk to the database SqlCommand command = new SqlCommand(); command.Connection = connection; //open connection and set command parameters and type command.Connection.Open(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "UserProfile_Get"; command.Parameters.Add(new SqlParameter("@UserID", id)); //setup a data reader to get user info from database SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { //set the user object attributes to the information read in usr.UserID = (Guid)reader[0]; usr.fname = (String)reader[1]; usr.lname = (String)reader[2]; usr.age = (int)reader[3]; usr.phone = (String)reader[4]; usr.email = (String)reader[5]; usr.street = (String)reader[6]; usr.city = (String)reader[7]; usr.state = (String)reader[8]; usr.zip = (String)reader[9]; if (reader[10] == System.DBNull.Value) { usr.profpic = null; } else { usr.profpic = (byte[])reader[10]; } } command.Connection.Close(); //return user object return(usr); }
public static UserProfileBO getProfile(Guid id) { //create a user object to return at the end UserProfileBO usr = new UserProfileBO(); //setup a connection to the database SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DB_CST465"].ConnectionString); //setup a way to talk to the database SqlCommand command = new SqlCommand(); command.Connection = connection; //open connection and set command parameters and type command.Connection.Open(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "UserProfile_Get"; command.Parameters.Add(new SqlParameter("@UserID", id)); //setup a data reader to get user info from database SqlDataReader reader = command.ExecuteReader(); if(reader.Read()) { //set the user object attributes to the information read in usr.UserID = (Guid)reader[0]; usr.fname = (String)reader[1]; usr.lname = (String)reader[2]; usr.age = (int)reader[3]; usr.phone = (String)reader[4]; usr.email = (String)reader[5]; usr.street = (String)reader[6]; usr.city = (String)reader[7]; usr.state = (String)reader[8]; usr.zip = (String)reader[9]; if(reader[10] == System.DBNull.Value) { usr.profpic = null; } else { usr.profpic = (byte[])reader[10]; } } command.Connection.Close(); //return user object return usr; }
public ActionResult Put(int id, [FromBody] UserProfileBO userProfile) { if (id != userProfile.Id) { return(StatusCode(405, "Path id not matching with json id")); } try { var editedProfile = facade.UserProfileService.Update(userProfile); return(Ok(editedProfile)); } catch (InvalidOperationException e) { return(StatusCode(404, e.Message)); } }
//Update public UserProfileBO Update(UserProfileBO userProfile) { using (var uow = facade.UnitOfWork) { var userProfileFromDb = uow.UserProfileRepository.Get(userProfile.Id); if (userProfileFromDb == null) { throw new InvalidOperationException("User Profile not found"); } userProfileFromDb.FirstName = userProfile.FirstName; userProfileFromDb.LastName = userProfile.LastName; userProfileFromDb.JoinDate = userProfile.JoinDate; uow.Complete(); return(conv.Convert(userProfileFromDb)); } }
// GET: Books/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Book book = booksBO.GetBook((int)id); if (book == null) { return(HttpNotFound()); } List <UserProfile> userProfiles = new UserProfileBO().GetUsers(); ViewBag.FKAddedBy = new SelectList(userProfiles, "PKUserId", "FirstName", book.FKAddedBy); return(View(book)); }
///// <summary> ///// The product groups ///// </summary> //List<ProductGroupBO> productGroups = new List<ProductGroupBO>(); ///// <summary> ///// Get list of User Master ///// </summary> ///// <returns></returns> //public IEnumerable<UserProfileBO> GetUsersMaster() //{ // List<UserProfileBO> GetUsersMaster = new List<UserProfileBO>(); // ObjectMapper.Map(UserRepository.GetUsersMaster(), GetUsersMaster); // return GetUsersMaster; //} /// <summary> /// Updates the user profile. /// </summary> /// <param name="userId">The user identifier.</param> /// <param name="userName">Name of the user.</param> /// <param name="mobile">The mobile.</param> /// <param name="address">The address.</param> /// <param name="emailId">The email identifier.</param> /// <returns></returns> public bool UpdateUserProfile(UserProfileBO userProfile) { bool isSuccess = false; //UserProfileBO user = new UserProfileBO(); UserMaster userMaster = new UserMaster(); userProfile.Mobile = EncryptionEngine.EncryptString(userProfile.Mobile); userProfile.Phone = EncryptionEngine.EncryptString(userProfile.Phone); userProfile.Email = EncryptionEngine.EncryptString(userProfile.Email); // userProfile.LoginName = EncryptionEngine.EncryptString(userProfile.LoginName); // userProfile.Password = EncryptionEngine.EncryptString(userProfile.Password); ObjectMapper.Map(userProfile, userMaster); if (userMaster != null && userMaster.UserID > 0) { isSuccess = UserRepository.UpdateUserProfile(userMaster); } return(isSuccess); }
private void WelcomeUserAccuITAdmin(int userID) { USERPROFILE = UserBusinessInstance.DisplayUserProfile(userID); USERWEDDINGPROFILE = WeddingBusinessInstance.GetUserWeddingSubscriptions(userID); CreateFreshSession(); int roleID = (int)USERPROFILE.RoleID; HttpContext.Session[PageConstants.SESSION_USER_ID] = userID; HttpContext.Session[PageConstants.SESSION_PROFILE_KEY] = USERPROFILE; HttpContext.Session[PageConstants.SESSION_WEDDING_PROFILE] = USERWEDDINGPROFILE; HttpContext.Session[PageConstants.SESSION_ROLE_ID] = roleID; HttpContext.Session[PageConstants.SESSION_ADMIN] = USERPROFILE.IsAdmin ? "1" : "0"; var myWeddings = WeddingBusinessInstance.GetUserWeddingDetail(userID); SetUserModules(userID); ActivityLog.SetLog("Welcome to Accuit| Sessions created.", LogLoc.INFO); }
public SecurityVM(UserProfileBO profile) { Registration = new RegistrationVM() { Registration = profile.Registration }; myPermitRegistrations = profile.PermitRegistration; myCoalUser user = myCoalUser.GetInstance(); // owners and permit coordinators can see a user's permit registrations if (user.IsInRole(CoalRoles.Owner) || user.IsInRole(CoalRoles.PermitCoordinator)) { AllPermits = PermitBLL.GetPermits(); } // owners can see user's system roles if (user.IsInRole(CoalRoles.Owner)) { IsOwner = profile.Roles.Contains(CoalRoles.Owner); IsManagement = profile.Roles.Contains(CoalRoles.Management); IsReviewStaff = profile.Roles.Contains(CoalRoles.ReviewStaff); IsPermitCoordinator = profile.Roles.Contains(CoalRoles.PermitCoordinator); IsReadOnly = profile.Roles.Contains(CoalRoles.Reader); } }
public ActionResult Index() { UserProfileBO profile = new UserProfileBO(); //UserWeddingSubscriptionBO weddingProfile = new UserWeddingSubscriptionBO(); WeddingViewModel WVM = new WeddingViewModel(); var weddingProfile = Session[PageConstants.SESSION_WEDDING_PROFILE] as List <UserWeddingSubscriptionBO>; WVM.listTemplates = weddingProfile.Select(x => x.TemplateMaster).ToList(); WVM.userSubscriptions = weddingProfile; foreach (var temp in WVM.listTemplates) { temp.Weddings = WeddingBusinessInstance.GetUserWeddingDetail(UserID).Where(x => x.TemplateID == temp.TemplateID && x.IsDeleted == false).ToList(); } if (Session[PageConstants.SESSION_PROFILE_KEY] == null) { WVM.userProfile = EmpBusinessInstance.DisplayUserProfile(UserID); } else { WVM.userProfile = Session[PageConstants.SESSION_PROFILE_KEY] as UserProfileBO; } return(View(WVM)); }
/// <summary> /// Create a new instance of Permit Access object /// </summary> /// <param name="PermitKey"></param> /// <param name="Profile"></param> public PermitAccessVM(int PermitKey, string UserToken) { _permitKey = PermitKey; _profile = RegistrationBLL.GetUserProfile(UserToken); }
public SystemRoles(UserProfileBO Profile) { _profile = Profile; }
public PermitRoles(int PermitKey, UserProfileBO Profile) { _profile = Profile; _permitKey = PermitKey; }
public ActionResult Post([FromBody] UserProfileBO userProfile) { return(Ok(facade.UserProfileService.Create(userProfile))); }
public ActionResult Register(UserMasterBO model, string sessionID) { List <string> ErrorMessage = new List <string>(); string newPassword = model.Password; var userinfo = new UserProfileBO(); if (model.Password != model.ConfirmPassword) { ViewBag.Message = "New Password & Confirm Password did not match. Try again."; ViewBag.IsSuccess = false; return(View(model)); } newPassword.IsComplexPassword(ref ErrorMessage); if (ErrorMessage.Count > 0) { ViewBag.Message = ErrorMessage.Select(k => k).Aggregate((a, b) => a + "\n" + b); ViewBag.IsSuccess = false; return(View(model)); } try { userinfo = UserBusinessInstance.GetUserByLoginName(model.LoginName); bool IfUserExists = userinfo.UserID > 0 ? true : false; #region Old registration code //else //{ // // if (!IfUserExists) // { // model.CreatedBy = 0; // model.JoiningDate = DateTime.Now; // model.Email = model.LoginName; // model.isDeleted = false; // model.isActive = true; // model.IsEmployee = false; // model.AccountStatus = (int)AspectEnums.UserLoginStatus.Active; // sessionID = HttpContext.Session.SessionID.ToString(); // int registerEmp = UserBusinessInstance.SubmitNewEmployee(model, sessionID); // ViewBag.IsSuccess = true; // ViewBag.ShowPopup = true; // ViewBag.Message = "Congratulations for being a part of Dream Wedds family."; // return View(); // } #endregion if (IfUserExists && userinfo.AccountStatus == (int)AspectEnums.UserAccountStatus.Pending) { userinfo.AccountStatus = (int)AspectEnums.UserLoginStatus.Active; sessionID = HttpContext.Session.SessionID.ToString(); userinfo.Password = model.Password; bool isUpdated = UserBusinessInstance.UpdateUserProfile(userinfo); if (isUpdated) { ViewBag.IsSuccess = true; ViewBag.ShowPopup = true; ViewBag.Message = "You have created your password. Login now."; return(View("Login")); } else { ViewBag.IsSuccess = true; ViewBag.ShowPopup = true; ViewBag.Message = "Something went wrong. Try again later."; } return(View(model)); } else { ViewBag.Message = "User with this email address already exists. Please with your email address."; ViewBag.IsSuccess = false; return(View(model)); } } catch (DbEntityValidationException ex) { ViewBag.IsSuccess = false; var newException = new FormattedDbEntityValidationException(ex); ViewBag.Message = "Error: " + ex; } catch (Exception e) { ViewBag.IsSuccess = false; ViewBag.Message = "Error: " + e; } return(View(model)); }
public void DeleteAccount(Account acc) { //Temp fix : Need to improve. UserProfileBO userProfileBO = new UserProfileBO(); List<UserProfile> userProfileList = userProfileBO.GetAll().Where(user => user.AccountId == acc.Id).ToList(); if (userProfileList.Count > 1) { userProfileBO.DeleteAll(userProfileList); userProfileBO.SaveChanges(); } SavedFilterBO savedFilterBO = new SavedFilterBO(); List<SavedFilter> savedFilterList = savedFilterBO.GetAll(); foreach (SavedFilter sf in savedFilterList) { AccountFilterMappingBO accFilterBO = new AccountFilterMappingBO(); AccountFilterMapping accFilter = accFilterBO.Get(af => af.FilterId == sf.Id); accFilterBO.Delete(accFilter); accFilterBO.SaveChanges(); } foreach (SavedFilter sf in savedFilterList) { savedFilterBO.Delete(sf); savedFilterBO.SaveChanges(); } SavedSearchBO savedSearchBO = new SavedSearchBO(); List<SavedSearch> savedSearchList = savedSearchBO.GetAll(); if (savedSearchList.Count > 1) { savedSearchBO.DeleteAll(savedSearchList); savedSearchBO.SaveChanges(); } _accountBO.Delete(acc); _accountBO.SaveChanges(); _cachedAccountList = _accountBO.GetAll(); //Stop Temporary Stop(); //Get TOBBaseOBject TOBBaseObject baseObj = GetTOBObject(acc); if (baseObj != null) { _tobObjects.Remove(baseObj); baseObj = null; } //Again Start the update operation Start(); }
public async Task UpdateProfileAsync(UserProfileBO profile) { Validate(profile); await ups.UpdateUserProfileAsync(profile); }