public UserController(IUsersView view, IList users) { _view = view; _users = users; view.SetController(this); }
public UserController(IStoreReader storeReader, IUserView userView, IUsersView usersView) { _userView = userView; _usersView = usersView; _storeReader = storeReader; this.Initialize(); }
/// <summary> /// /// </summary> /// <param name="userRegistrationInfo"></param> /// <param name="userId"></param> /// <returns></returns> public IEmailDetail CreateUserRegistrationRequestEmail(IUsersView userRegistrationInfo, int userId) { if (userRegistrationInfo == null) { throw new ArgumentNullException(nameof(userRegistrationInfo)); } var token = string.Format("xyz"); var theSubject = "Confirm your AA.HRMS Registration Request"; var recipient = userRegistrationInfo.Email; var theBody = "You are now registered for AA HRMS services."; theBody = string.Format("{0} {1}", theBody, "<br><br> Your username is your email."); theBody = string.Format("{0} {1}{2}", theBody, "<br><br> Your confirmation token is ", token); theBody = string.Format("{0} {1}", theBody, "<br><br> <a href='www.automataassociates.com'>AA.HRMS</a>"); theBody = string.Format("{0} {1}", theBody, "<br><br> Thank you"); var mailDetail = new EmailDetail { Body = theBody, Recipients = recipient, Subject = theSubject }; return(mailDetail); }
public Controller(IUsersView view) { this.view = view; this.view.SetController(this); function = new Function(this); PolynomialFunctionMakeGraph(); }
public UsersPresenter(IUsersView view) { if (view == null) { throw new ArgumentNullException("Parameter 'view' is null"); } this._view = view; }
public UsersController(IUsersView userView) { _userView = userView; _userView.UserInfo = new User("", 0, "", User.SexOfPerson.Male, User.UserStatus.Active); userView.SetController(this); _service = new UPSAssignment.Service.Service(); _service.SetConfiguration(ConfigurationManager.AppSettings["ServiceApiURL"].ToString(), ConfigurationManager.AppSettings["ApiToken"].ToString()); }
/// <summary> /// Gets the updated user view. /// </summary> /// <param name="users">The users.</param> /// <param name="processingMessage">The processing message.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">users</exception> public IUsersView GetUpdatedUserView(IUsersView users, string processingMessage) { if (users == null) { throw new ArgumentNullException(nameof(users)); } var viewModel = this.usersViewsModelFactory.CreateUpdatedUserView(users, processingMessage); return(viewModel); }
/// <summary> /// Creates the updated user view. /// </summary> /// <param name="userRegistrationInfo">The user registration information.</param> /// <param name="processingMessage">The processing message.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">userRegistrationInfo</exception> public IUsersView CreateUpdatedUserView(IUsersView userRegistrationInfo, string processingMessage) { if (userRegistrationInfo == null) { throw new ArgumentNullException(nameof(userRegistrationInfo)); } userRegistrationInfo.ProcessingMessage = processingMessage; return(userRegistrationInfo); }
/// <summary> /// Generates the employee details from registration view. /// </summary> /// <param name="userRegistrationView">The user registration view.</param> /// <returns> /// IEmployeeView. /// </returns> /// <exception cref="ArgumentNullException">userRegistrationView</exception> public IEmployeeView GenerateEmployeeDetailsFromRegistrationView(IUsersView userRegistrationView) { if (userRegistrationView == null) { throw new ArgumentNullException(nameof(userRegistrationView)); } var employeeView = new EmployeeView { FirstName = userRegistrationView.FirstName, LastName = userRegistrationView.LastName, StaffNumber = userRegistrationView.StaffNumber, CompanyId = userRegistrationView.CompanyId, }; return(employeeView); }
/// <summary> /// Saves the user registration information. /// </summary> /// <param name="userRegistrationInfo">The user registration information.</param> /// <param name="userId">The user identifier.</param> /// <returns> /// System.String. /// </returns> /// <exception cref="ArgumentNullException">userRegistrationInfo</exception> public string SaveUserRegistrationInfo(IUsersView userRegistrationInfo, out int userId) { if (userRegistrationInfo == null) { throw new ArgumentNullException(nameof(userRegistrationInfo)); } var result = string.Empty; //Create New user Account var newRecord = new User { Email = userRegistrationInfo.Email, CompanyId = userRegistrationInfo.CompanyId, IsUserVerified = userRegistrationInfo.IsUserVerified, DateCreated = DateTime.Now, Password = "******", //TODO: Password Hashing }; //Add New User to Employee Table try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { dbContext.Users.Add(newRecord); dbContext.SaveChanges(); } } catch (Exception e) { result = string.Format("SaveRegistrationInfo - {0} , {1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""); } userId = newRecord.UserId; return(result); }
/// <summary> /// Initializes a new instance of the <see cref="UsersController"/> class by using the specified view context and data source. /// </summary> /// <param name="view">The view context.</param> /// <param name="mails">The data source.</param> public UsersController(IUsersView view, IEnumerable <User> users) { this.view = view; this.users = users; view.SetController(this); }
public UsersPresenter(IUsersView view) { if (view == null) throw new ArgumentNullException("Parameter 'view' is null"); this._view = view; }
/// <summary> /// Processes the user registration view. /// </summary> /// <param name="userRegistrationInfo">The user registration information.</param> /// <returns> /// IUsersView. /// </returns> /// <exception cref="ArgumentNullException">userRegistrationInfo</exception> public IUsersView ProcessUserRegistrationInfo(IUsersView userRegistrationInfo) { if (userRegistrationInfo == null) { throw new ArgumentNullException(nameof(userRegistrationInfo)); } var processingMessage = string.Empty; var isDataOkay = true; //validate User Entry //1. Validate Email var userData = this.usersRepository.GetUserByEmail(userRegistrationInfo.Email); var isRecordExist = (userData == null) ? false : true; // Returns false if no record is found and true if a record is found if (isRecordExist) { processingMessage = Messages.EmailAlreadyUsedText; processingMessage = !userData.IsUserVerified ? Messages.ConfirmRegistrationText : ""; // email used and account not confirmed by user isDataOkay = false; } //Get Updated ViewModel var returnViewModel = this.usersViewsModelFactory.CreateUpdatedUserView(userRegistrationInfo, processingMessage); //If user Data is not Valid if (!isDataOkay) { return(returnViewModel); } var userId = 0; //save to database //Assign Applicant Role to the Newly Registered User //: Set User Role Here userRegistrationInfo.Role = 1; //Store User Information to database var registrationData = this.usersRepository.SaveUserRegistrationInfo(userRegistrationInfo, out userId); //Store User Information to Employee Table //NOTE : Company Administrator is registered here and Company Administrator is also and Employee in the Company var employeeInfo = employeeViewModelFactory.GenerateEmployeeDetailsFromRegistrationView(userRegistrationInfo); //send Mail to User //1. generate Email Details var registrationRequestEmail = this.emailFactory.CreateUserRegistrationRequestEmail(userRegistrationInfo, userId); //2. Send Email to User var sendMail = this.usersRepository.SendEmail(registrationRequestEmail); //Goto Company Registration After a Successfully Registration returnViewModel = this.usersViewsModelFactory.CreateUpdatedUserView(userRegistrationInfo, processingMessage); return(returnViewModel); }
public UsersController(IUsersView view, IList users) { _view = view; _users = users; view.setController(this); }