public void Edit(QuoteTemplateItem item) { item.GetValidationErrors().ThrowIfHasErrors(); var dbItem = new QuoteTemplate(); if (item.Id != 0) { dbItem = Db.QuoteTemplates.Single(x => x.Id == item.Id); } else { dbItem.DateCreate = DateTime.Now; Db.QuoteTemplates.Add(dbItem); } dbItem.Name = item.Name; dbItem.Description = item.Description; dbItem.CustomDesign = item.CustomDesign; dbItem.DateModify = DateTime.Now; Db.SaveChanges(); item.Id = dbItem.Id; item.DateModify = dbItem.DateModify; item.DateCreate = dbItem.DateCreate; }
public ActionResult DeleteQuoteTemplate(QuoteTemplate quoteSheetTemplate) { var result = AdminModuleManager.DeleteQuoteTemplate(quoteSheetTemplate); return(new JsonNetResult { Data = result }); }
public QuoteTemplateItem New() { var newTemplate = new QuoteTemplate { DateCreate = DateTime.Now, DateModify = DateTime.Now, CustomDesign = false, Name = "Новый шаблон" }; Db.QuoteTemplates.Add(newTemplate); Db.SaveChanges(); return(Get(newTemplate.Id)); }
public ActionResult EditQuoteTemplate(QuoteTemplate quoteTemplate) { if (!ModelState.IsValid) { throw new HttpException(406, "Not Acceptable - Invalid Data"); } var updatedQuoteTemplate = AdminModuleManager.EditQuoteTemplate(quoteTemplate); return(new JsonNetResult { Data = updatedQuoteTemplate }); }
public bool Delete(QuoteTemplate quoteTemplate) { throw new NotImplementedException(); }
public QuoteTemplate Create(QuoteTemplate quoteTemplate) { throw new NotImplementedException(); }
// ReSharper restore InconsistentNaming public override void SetupTeam() { this.SetUpCob(); this.SetUpTermsNCondition(); this.SetUpLinks(); this.SetUpUser(); QuoteTemplate01 = _consoleRepository.Query <QuoteTemplate>(qtmpl => qtmpl.Name == "Political Risk").SingleOrDefault(); QuoteTemplate01 = QuoteTemplate01 ?? new QuoteTemplate { Name = "Political Risk", RdlPath = "/Underwriting/Console/QuoteSheet_WK" }; SubmissionType01 = _consoleRepository.Query <SubmissionType>(styp => styp.Id == "CM").SingleOrDefault(); SubmissionType01 = SubmissionType01 ?? new SubmissionType { Id = "CM", Title = "Crisis Management_Submission" }; Team01 = _consoleRepository.Query <Team>(team => team.Title == "Crisis Management").SingleOrDefault(); if (Team01 == null) { Team01 = new Team { Title = "Crisis Management", QuoteExpiryDaysDefault = 14, RelatedCOBs = new List <COB> { COB_AK }, Links = new List <Link> { Link_01, Link_02, Link_03, Link_04, Link_05, Link_06, Link_07, Link_08, Link_09, Link_10, Link_11, Link_12, Link_13, Link_14, Link_15, Link_16, Link_17, Link_18 }, RelatedQuoteTemplates = new List <QuoteTemplate> { QuoteTemplate01 }, Memberships = new Collection <TeamMembership> { new TeamMembership { StartDate = DateTime.Now, User = User01 }, new TeamMembership { StartDate = DateTime.Now, User = User04 }, }, RelatedOffices = new List <Office> { _consoleRepository.Query <Office>(off => off.Id == "LON").Single(), _consoleRepository.Query <Office>(off => off.Id == "MIA").Single(), _consoleRepository.Query <Office>(off => off.Id == "LAB").Single(), _consoleRepository.Query <Office>(off => off.Id == "NYC").Single(), _consoleRepository.Query <Office>(off => off.Id == "SNG").Single(), _consoleRepository.Query <Office>(off => off.Id == "DUB").Single(), }, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now, SubmissionTypeId = SubmissionType01.Id, DefaultPolicyType = "MARINE" }; //filters foreach (var teamMembership in Team01.Memberships) { var membershipLocal = teamMembership; _consoleRepository.Query <User>(u => u.Id == membershipLocal.User.Id, u => u.FilterMembers, u => u.FilterCOBs, u => u.FilterOffices).FirstOrDefault(); if (teamMembership.User.FilterMembers == null) { teamMembership.User.FilterMembers = new Collection <User>(); } foreach (var membership in Team01.Memberships) { if (teamMembership.User.FilterMembers.All(fm => fm.DomainLogon != membership.User.DomainLogon)) { teamMembership.User.FilterMembers.Add(membership.User); } } if (teamMembership.User.FilterCOBs == null) { teamMembership.User.FilterCOBs = new Collection <COB>(); } foreach (var relatedCoB in Team01.RelatedCOBs) { if (teamMembership.User.FilterCOBs.All(fc => fc.Id != relatedCoB.Id)) { teamMembership.User.FilterCOBs.Add(relatedCoB); } } if (teamMembership.User.FilterOffices == null) { teamMembership.User.FilterOffices = new Collection <Office>(); } foreach (var relatedOffice in Team01.RelatedOffices) { if (teamMembership.User.FilterOffices.All(fo => fo.Id != relatedOffice.Id)) { teamMembership.User.FilterOffices.Add(relatedOffice); } } } _consoleRepository.Add(Team01); } _consoleRepository.SaveChanges(); }
public IActionResult ProcessTemplate(QuoteTemplate quoteTemplate) { if (HttpContext.Session.Keys.All(x => x != Statics.EmailTempData)) { return(RedirectToAction("Index", "Registration")); } QuoteRequest quoteRequest = null; if (!Request.Query.ContainsKey("quoteIdIdentity")) { string email = (HttpContext.Session.Keys.Contains(Statics.EmailTempData) ? HttpContext.Session.GetString(Statics.EmailTempData) : String.Empty); User user = _wrapper.CreateUser(email); Journey journey = _wrapper.GetJourney(email); var templateId = 0; if (Request.Method == "POST") { int attendance = int.Parse(Request.Form["Attendees"]); templateId = int.Parse(Request.Form["TemplateId"]); quoteRequest = _wrapper.CreateRequestFromTemplate(templateId, user.Id, attendance, journey.EventDate); return(View(quoteRequest)); } if (!journey.QuoteIdIdentity.HasValue) { if (journey.Completed.HasValue) { if (!HttpContext.Session.Keys.Contains(Statics.EmailTempData)) { HttpContext.Session.SetString(Statics.EmailTempData, journey.Email); } return(RedirectToAction("Step3", "Registration")); } } else { templateId = journey.QuoteIdIdentity.Value; if (Request.Method == "GET") { quoteRequest = _wrapper.LoadQuoteRequest(templateId); } } } else { int id = int.Parse(Request.Query["quoteIdIdentity"]); quoteRequest = _wrapper.LoadQuoteRequest(id); } if (Request.Query.ContainsKey(Statics.ProcessingStatus)) { quoteRequest.ProcessingResult = Enum.Parse <ProcessingResult>(Request.Query[Statics.ProcessingStatus]); quoteRequest.ProcessingMessage = Request.Query[Statics.ProcessingMessage]; } return(View(quoteRequest)); }
public QuoteTemplate AddUpdateQuoteTemplate(QuoteTemplate quoteTemplate) { _wrapper = new Wrapper(_connectionString); return(_wrapper.AddUpdateQuoteTemplate(quoteTemplate)); }
// ReSharper restore InconsistentNaming public override void SetupTeam() { this.SetUpCob(); this.SetUpTermsNCondition(); this.SetUpLinks(); this.SetUpUser(); QuoteTemplate01 = _consoleRepository.Query <QuoteTemplate>(qtmpl => qtmpl.Name == "Marine & Energy Liabilities").SingleOrDefault(); QuoteTemplate01 = QuoteTemplate01 ?? new QuoteTemplate { Name = "Marine & Energy Liabilities", RdlPath = "/Underwriting/Console/QuoteSheet_ME" }; SubmissionType01 = _consoleRepository.Query <SubmissionType>(styp => styp.Id == "ME").SingleOrDefault(); SubmissionType01 = SubmissionType01 ?? new SubmissionType { Id = "ME", Title = "Marine&EnergyLiabilities_Submission" }; Team01 = _consoleRepository.Query <Team>(team => team.Title == "Marine & Energy Liability").SingleOrDefault(); if (Team01 == null) { Team01 = new Team { Title = "Marine & Energy Liability", QuoteExpiryDaysDefault = 30, RelatedCOBs = new List <COB> { COB_CL, COB_CR }, Links = new List <Link> { Link_01, Link_02, Link_03, Link_04, Link_05, Link_06, Link_07, Link_08, Link_09, Link_10, Link_11, Link_12, Link_13, Link_14, Link_15 }, RelatedQuoteTemplates = new List <QuoteTemplate> { QuoteTemplate01 }, Memberships = new Collection <TeamMembership> { new TeamMembership { StartDate = DateTime.Now, User = User01 }, new TeamMembership { StartDate = DateTime.Now, User = User02 }, new TeamMembership { StartDate = DateTime.Now, User = User03 }, new TeamMembership { StartDate = DateTime.Now, User = User04 }, new TeamMembership { StartDate = DateTime.Now, User = User05 }, new TeamMembership { StartDate = DateTime.Now, User = User06 }, new TeamMembership { StartDate = DateTime.Now, User = User07 }, new TeamMembership { StartDate = DateTime.Now, User = User08 }, new TeamMembership { StartDate = DateTime.Now, User = User09 }, new TeamMembership { StartDate = DateTime.Now, User = User10 }, new TeamMembership { StartDate = DateTime.Now, User = User11 }, new TeamMembership { StartDate = DateTime.Now, User = User12 }, new TeamMembership { StartDate = DateTime.Now, User = User13 }, new TeamMembership { StartDate = DateTime.Now, User = User14 }, new TeamMembership { StartDate = DateTime.Now, User = User15 }, new TeamMembership { StartDate = DateTime.Now, User = User16 }, new TeamMembership { StartDate = DateTime.Now, User = User17 }, }, RelatedOffices = new List <Office> { _consoleRepository.Query <Office>(off => off.Id == "LON").Single(), _consoleRepository.Query <Office>(off => off.Id == "MIA").Single(), _consoleRepository.Query <Office>(off => off.Id == "LAB").Single(), _consoleRepository.Query <Office>(off => off.Id == "NYC").Single(), _consoleRepository.Query <Office>(off => off.Id == "SNG").Single(), _consoleRepository.Query <Office>(off => off.Id == "DUB").Single(), }, CreatedBy = "InitialSetup", CreatedOn = DateTime.Now, ModifiedBy = "InitialSetup", ModifiedOn = DateTime.Now, SubmissionTypeId = SubmissionType01.Id, DefaultPolicyType = "MARINE" }; var teamOfficeSetting01 = new TeamOfficeSetting { Team = Team01, Office = _consoleRepository.Query <Office>(off => off.Id == "LON").Single(), TermsNConditionWordingSettings = new Collection <TermsNConditionWordingSetting> { new TermsNConditionWordingSetting { DisplayOrder = 1, TermsNConditionWording = TnC01 }, new TermsNConditionWordingSetting { DisplayOrder = 2, TermsNConditionWording = TnC02 }, new TermsNConditionWordingSetting { DisplayOrder = 3, TermsNConditionWording = TnC03 }, new TermsNConditionWordingSetting { DisplayOrder = 4, TermsNConditionWording = TnC04 }, new TermsNConditionWordingSetting { DisplayOrder = 5, TermsNConditionWording = TnC05 } } }; var teamOfficeSetting02 = new TeamOfficeSetting { Team = Team01, Office = _consoleRepository.Query <Office>(off => off.Id == "MIA").Single(), TermsNConditionWordingSettings = new Collection <TermsNConditionWordingSetting> { new TermsNConditionWordingSetting { DisplayOrder = 1, TermsNConditionWording = TnC01 }, new TermsNConditionWordingSetting { DisplayOrder = 2, TermsNConditionWording = TnC02 }, new TermsNConditionWordingSetting { DisplayOrder = 3, TermsNConditionWording = TnC03 }, new TermsNConditionWordingSetting { DisplayOrder = 4, TermsNConditionWording = TnC04 }, new TermsNConditionWordingSetting { DisplayOrder = 5, TermsNConditionWording = TnC05 } } }; var teamOfficeSetting03 = new TeamOfficeSetting { Team = Team01, Office = _consoleRepository.Query <Office>(off => off.Id == "LAB").Single(), TermsNConditionWordingSettings = new Collection <TermsNConditionWordingSetting> { new TermsNConditionWordingSetting { DisplayOrder = 1, TermsNConditionWording = TnC01 }, new TermsNConditionWordingSetting { DisplayOrder = 2, TermsNConditionWording = TnC02 }, new TermsNConditionWordingSetting { DisplayOrder = 3, TermsNConditionWording = TnC03 }, new TermsNConditionWordingSetting { DisplayOrder = 4, TermsNConditionWording = TnC04 }, new TermsNConditionWordingSetting { DisplayOrder = 5, TermsNConditionWording = TnC05 } } }; var teamOfficeSetting04 = new TeamOfficeSetting { Team = Team01, Office = _consoleRepository.Query <Office>(off => off.Id == "NYC").Single(), TermsNConditionWordingSettings = new Collection <TermsNConditionWordingSetting> { new TermsNConditionWordingSetting { DisplayOrder = 1, TermsNConditionWording = TnC01 }, new TermsNConditionWordingSetting { DisplayOrder = 2, TermsNConditionWording = TnC02 }, new TermsNConditionWordingSetting { DisplayOrder = 3, TermsNConditionWording = TnC03 }, new TermsNConditionWordingSetting { DisplayOrder = 4, TermsNConditionWording = TnC04 }, new TermsNConditionWordingSetting { DisplayOrder = 5, TermsNConditionWording = TnC05 } } }; var teamOfficeSetting05 = new TeamOfficeSetting { Team = Team01, Office = _consoleRepository.Query <Office>(off => off.Id == "SNG").Single(), TermsNConditionWordingSettings = new Collection <TermsNConditionWordingSetting> { new TermsNConditionWordingSetting { DisplayOrder = 1, TermsNConditionWording = TnC01 }, new TermsNConditionWordingSetting { DisplayOrder = 2, TermsNConditionWording = TnC02 }, new TermsNConditionWordingSetting { DisplayOrder = 3, TermsNConditionWording = TnC03 }, new TermsNConditionWordingSetting { DisplayOrder = 4, TermsNConditionWording = TnC04 }, new TermsNConditionWordingSetting { DisplayOrder = 5, TermsNConditionWording = TnC05 } } }; var teamOfficeSetting06 = new TeamOfficeSetting { Team = Team01, Office = _consoleRepository.Query <Office>(off => off.Id == "DUB").Single(), TermsNConditionWordingSettings = new Collection <TermsNConditionWordingSetting> { new TermsNConditionWordingSetting { DisplayOrder = 1, TermsNConditionWording = TnC01 }, new TermsNConditionWordingSetting { DisplayOrder = 2, TermsNConditionWording = TnC02 }, new TermsNConditionWordingSetting { DisplayOrder = 3, TermsNConditionWording = TnC03 }, new TermsNConditionWordingSetting { DisplayOrder = 4, TermsNConditionWording = TnC04 }, new TermsNConditionWordingSetting { DisplayOrder = 5, TermsNConditionWording = TnC05 } } }; Team01.TeamOfficeSettings = new Collection <TeamOfficeSetting> { teamOfficeSetting01, teamOfficeSetting02, teamOfficeSetting03, teamOfficeSetting04, teamOfficeSetting05, teamOfficeSetting06 }; //filters foreach (var teamMembership in Team01.Memberships) { var membershipLocal = teamMembership; _consoleRepository.Query <User>(u => u.Id == membershipLocal.User.Id, u => u.FilterMembers, u => u.FilterCOBs, u => u.FilterOffices).FirstOrDefault(); if (teamMembership.User.FilterMembers == null) { teamMembership.User.FilterMembers = new Collection <User>(); } foreach (var membership in Team01.Memberships.Where(membership => membershipLocal.User.DomainLogon != membership.User.DomainLogon)) { if (teamMembership.User.FilterMembers.All(fm => fm.DomainLogon != membership.User.DomainLogon)) { teamMembership.User.FilterMembers.Add(membership.User); } } if (teamMembership.User.FilterCOBs == null) { teamMembership.User.FilterCOBs = new Collection <COB>(); } foreach (var relatedCoB in Team01.RelatedCOBs) { if (teamMembership.User.FilterCOBs.All(fc => fc.Id != relatedCoB.Id)) { teamMembership.User.FilterCOBs.Add(relatedCoB); } } if (teamMembership.User.FilterOffices == null) { teamMembership.User.FilterOffices = new Collection <Office>(); } foreach (var relatedOffice in Team01.RelatedOffices) { if (teamMembership.User.FilterOffices.All(fo => fo.Id != relatedOffice.Id)) { teamMembership.User.FilterOffices.Add(relatedOffice); } } } _consoleRepository.Add(Team01); } _consoleRepository.SaveChanges(); }