private void UpdateAssociateToItris(AssociateModel associate, Guid userId) { if (associate.ITRISAppId == null) { this.InsertAssociateToItris(associate, userId); } else { string empId = this.GetItrisEmployeeIdFromMembershipId(userId); if (empId == null) { throw new RecordNotFoundException( string.Format("Cannot update to ITRIS as could not find correct EMP_ID to use for user {0}", userId)); } this.associateRepo.UpdateAssociateToItris(this.dataMapper.MapAssociateM2E(associate), empId); } }
public void UpdateReferenceAdminEventHistoryForAssociate(AssociateModel associate) { foreach (ReferenceBaseModel reference in associate.References) { reference.AdministrativeEventsForReference = this.associateRefRepo.GetAdministrativeEventsForReference(reference.Id); var referenceWithAccountants = reference as IReferenceWithAccountants; if (referenceWithAccountants != null) { foreach (ReferenceAccountantModel accountant in referenceWithAccountants.Accountants) { accountant.AdministrativeEventsForReference = this.associateRefRepo.GetAdministrativeEventsForReference(accountant.Id); } } } associate.UpdateJson(); }
private void InsertAssociateToItris(AssociateModel associate, Guid userId) { // This is the 'Portal' user. Admin site password is 'Portal1' // ITRIS ID is 'HQ00000203' // For now all records inserted into ITRIS from Admin site will be make under // the employee name of 'Portal'. This is to avoid having to synched 2 different systems // users may exist in the admin site but not in ITRIS. string empId = this.GetItrisEmployeeIdFromMembershipId(new Guid("08B418E8-EDD9-452B-843D-ECC985048DD2")); // string empId = this.GetItrisEmployeeIdFromMembershipId(userId); if (empId == null) { throw new RecordNotFoundException( string.Format("Cannot insert to ITRIS as could not find correct EMP_ID to use for user {0}", userId)); } this.associateRepo.InsertAssociateToItris(this.dataMapper.MapAssociateM2E(associate), empId); }
public int CreateAssociate(AssociateModel associate, Guid membershipUserId) { Associate associateEntity = this.dataMapper.MapAssociateM2E(associate); associateEntity.AssociateApprovalStatusId = (byte)AssociateApprovalStatus.Accepted; associateEntity.CreatedDate = DateTime.Now; associateEntity.AdminOwnerId = this.associateRepo.AssignAssociateOwner(associate.LastName); return this.associateRepo.CreateAssociate( associateEntity, membershipUserId); }
public void UpdateAssociateToITRIS(AssociateModel associate, Guid currentUserId) { if (Settings.Default.UseTransactionScopeForItris) { using (var scope = new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted })) { this.UpdateAssociateToItris(associate, currentUserId); scope.Complete(); } } else { this.UpdateAssociateToItris(associate, currentUserId); } }
public void ApproveAssociate(AssociateModel associate) { this.associateRepo.UpdateAssociateStatus(associate.Id, AssociateApprovalStatus.Approved); }
public void AcceptAssociate(AssociateModel associate) { this.associateRepo.UpdateAssociateStatus(associate.Id, AssociateApprovalStatus.Accepted); // send associate approval notication EmailModel associateSubmission = this.emailService.GetAssociateEmail(associate.Id, EmailTemplate.AssociateAcceptedNotification); associateSubmission.ToAddress = associate.Email; this.emailService.SendEmail(associateSubmission); }
private void SetOptionsForDetailsView( AssociateModel associate, bool isPostBack, bool isCompare, AssociateHistorySaveOperation versionB) { bool associateChangeAfterAdmin; int associateId = associate.Id; var saveOperations = this.associateService.GetAssociateCollapsedEditHistory(associateId, out associateChangeAfterAdmin); this.ViewBag.AssociateHistorySaveOperations = saveOperations; this.ViewBag.EditedByAssociateAfterAdmin = associateChangeAfterAdmin; var mostCurrentVersion = !saveOperations.Any() ? true : (versionB.LastSaveTimeStamp == saveOperations.Last().LastSaveTimeStamp); var currentUserId = this.MembershipService.GetCurrentUserId(); var lockedByCurrentUser = associate.LockingUser.HasValue && currentUserId == associate.LockingUser; this.ViewBag.CompareToolMessage = GetCompareToolMessage( lockedByCurrentUser, isPostBack, isCompare, mostCurrentVersion, associateChangeAfterAdmin); this.ViewBag.Readonly = !lockedByCurrentUser || (isCompare && !mostCurrentVersion); this.ViewBag.IsCompare = isCompare; if (associate.LockingUser.HasValue && currentUserId != associate.LockingUser) { this.ViewBag.LockMessage = "This record is currently locked by " + this.MembershipService.GetUserNameById(associate.LockingUser.Value); } this.ViewBag.AdminUserFoundInItris = !string.IsNullOrEmpty(this.associateService.GetItrisEmployeeIdFromMembershipId(currentUserId)); if (associate.ApprovalStatus != AssociateApprovalStatus.PendingApproval) { this.ViewBag.warnings = this.associateService.ValidateBusinessRules(associate); } this.ViewBag.MomentaEmployeeList = this.employeeService.GetMomentaEmployeeList(); this.ViewBag.AssociateOwnerList = this.employeeService.GetMomentaEmployeeListForRole(RoleName.AssociateOwner); this.ViewBag.VettingContactList = this.employeeService.GetMomentaEmployeeListForRole(RoleName.Vetting); this.ViewBag.BusinessUnits = ListItem.GetSelectListItems( this.associateService.GetBusinessUnitOptions(), arg => associate.BusinessUnitId.HasValue && (byte)associate.BusinessUnitId == arg.Value, true); this.ViewBag.ReferralSources = this.associateService.GetReferralSourceOptions(); this.ViewBag.DocumentationWarning = this.SetContractingDocumentationStatus(associate); this.ViewBag.IsApprover = this.associateService.AssociateIsApprover(associateId); if (associate.AssociateRegistrationTypeId == (byte)AssociateRegistrationType.Agency) { // agency var agency = ListItem.GetSelectListItems( this.associateService.GetAgencyOptions(), arg => associate.AgencyId.HasValue && associate.AgencyId == arg.Value); this.ViewBag.Agency = agency; } this.ViewBag.Roles = this.roleService.GetRoleTypeList(); this.SetOptionsForDetailsView(associate); }
private void SendNewOptOutSelfBillingSignatureRequiredEmail(AssociateModel associate, AssociateModel originalassociate) { var id = associate.Id; var msg = this.emailService.GetAssociateEmail(id, EmailTemplate.NewOptOutSelfBillingSignatureRequired, originalassociate); msg.ToAddress = associate.Email; this.emailService.SendEmail(msg); }
private MembershipCreateStatus RegisterNewAssociate(AssociateModel associate) { var password = "******"; // Attempt to register the user MembershipCreateStatus createStatus; var user = this.AssociateMembership.CreateUser( associate.Email, password, associate.Email, null, null, false, null, out createStatus); if (createStatus == MembershipCreateStatus.Success) { // put the associate into the associate role Debug.Assert(user.ProviderUserKey != null, "user.ProviderUserKey != null"); associate.Id = this.associateService.CreateAssociate(associate, (Guid)user.ProviderUserKey); } return createStatus; }