/// <summary> /// This method is used to save and update the Sub Site Office Configuration Details /// </summary> /// <param name="dto"></param> /// <returns></returns> public Guid SaveSubSiteOfficeConfigInfo(SubSiteOfficeConfigDTO dto) { db = new DatabaseEntities(); Guid MyId = Guid.Empty; int entityState = 0; bool prevBS = false; SubSiteOfficeConfig model = new SubSiteOfficeConfig(); if (dto != null) { Guid Id, refId; if (Guid.TryParse(dto.Id, out Id)) { model = db.SubSiteOfficeConfigs.Where(a => a.Id == Id).FirstOrDefault(); if (model != null) { prevBS = model.HasBusinessSoftware; entityState = (int)System.Data.Entity.EntityState.Modified; } else { return(Guid.Empty); } } else { model.Id = Guid.NewGuid(); entityState = (int)System.Data.Entity.EntityState.Added; } bool IsRefId = Guid.TryParse(dto.RefId, out refId); if (!IsRefId) { return(Guid.Empty); } model.RefId = refId; model.EFINListedOtherOffice = dto.EFINListedOtherOffice ?? false; model.SiteOwnthisEFIN = dto.SiteOwnthisEFIN ?? false; model.EFINOwnerSite = dto.EFINOwnerSite; int SOorSSorEFIN = 0; if (int.TryParse(dto.SOorSSorEFIN, out SOorSSorEFIN)) { model.SOorSSorEFIN = SOorSSorEFIN; } else { return(Guid.Empty); } model.CanSubSiteLoginToEmp = true; model.SubSiteSendTaxReturn = dto.SubSiteSendTaxReturn ?? false; model.SiteanMSOLocation = dto.SiteanMSOLocation ?? false; model.LastUpdatedBy = dto.UserId ?? Guid.Empty; model.LastUpdatedDate = System.DateTime.Now; ///// Main Site Data model.IsMainSiteTransmitTaxReturn = dto.IsMainSiteTransmitTaxReturn; model.NoofTaxProfessionals = dto.NoofTaxProfessionals; model.IsSoftwareOnNetwork = dto.IsSoftwareOnNetwork; model.NoofComputers = dto.NoofComputers; model.PreferredLanguage = dto.PreferredLanguage; model.HasBusinessSoftware = dto.IsBusinessSoftware; model.IsSharingEFIN = dto.IsSharingEFIN; if (entityState == (int)System.Data.Entity.EntityState.Added) { model.CreatedBy = dto.UserId ?? Guid.Empty; model.CreatedDate = System.DateTime.Now; db.SubSiteOfficeConfigs.Add(model); } else { db.Entry(model).State = System.Data.Entity.EntityState.Modified; } //var enrollconfig = db.EnrollmentOfficeConfigurations.Where(x => x.CustomerId == refId && x.StatusCode == EMPConstants.Active).FirstOrDefault(); //if (enrollconfig != null) //{ // enrollconfig.IsSoftwareOnNetwork = dto.IsSoftwareOnNetwork; // enrollconfig.LastUpdatedBy = dto.UserId ?? Guid.Empty; // enrollconfig.LastUpdatedDate = DateTime.Now; // enrollconfig.NoofComputers = dto.NoofComputers; // enrollconfig.NoofTaxProfessionals = dto.NoofTaxProfessionals; // enrollconfig.PreferredLanguage = dto.PreferredLanguage; //} //if (model.SOorSSorEFIN == 3 && model.LastUpdatedBy != Guid.Empty) //{ // var emp_Info = db.emp_CustomerInformation.Where(o => o.Id == dto.UserId).FirstOrDefault(); // if (emp_Info != null) // { // emp_Info.IsAdditionalEFINAllowed = true; // db.Entry(emp_Info).State = System.Data.Entity.EntityState.Modified; // } //} var emp_MyInfo = db.emp_CustomerInformation.Where(o => o.Id == refId).FirstOrDefault(); if (emp_MyInfo != null) { var emp_ParentInfo = db.emp_CustomerInformation.Where(o => o.Id == emp_MyInfo.ParentId).FirstOrDefault(); if (emp_ParentInfo != null) { MyId = emp_MyInfo.Id; if (emp_ParentInfo.EntityId == (int)EMPConstants.Entity.MO) { if (model.SOorSSorEFIN == 1) { emp_MyInfo.EROType = "Multi Office - Single Office"; emp_MyInfo.EntityId = (int)EMPConstants.Entity.MO_SO; } else if (model.SOorSSorEFIN == 3) { emp_MyInfo.EROType = "Multi Office - Additional EFIN"; emp_MyInfo.EntityId = (int)EMPConstants.Entity.MO_AE; } } else if (emp_ParentInfo.EntityId == (int)EMPConstants.Entity.SVB_MO) { if (model.SOorSSorEFIN == 1) { emp_MyInfo.EROType = "Service Bureau - Multi Office - Single Office"; emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_MO_SO; } else if (model.SOorSSorEFIN == 3) { emp_MyInfo.EROType = "Service Bureau - Multi Office - Additional EFIN"; emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_MO_AE; } } else if (emp_ParentInfo.EntityId == (int)EMPConstants.Entity.SVB) { if (model.SOorSSorEFIN == 1) { emp_MyInfo.EROType = "Service Bureau - Single Office"; emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_SO; } else if (model.SOorSSorEFIN == 2) { emp_MyInfo.EROType = "Service Bureau - Multi Office"; emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_MO; } else if (model.SOorSSorEFIN == 3) { emp_MyInfo.EROType = "Service Bureau - Additional EFIN"; emp_MyInfo.EntityId = (int)EMPConstants.Entity.SVB_AE; } } if (model.SOorSSorEFIN == 3) { emp_MyInfo.IsAdditionalEFINAllowed = true; } if (emp_MyInfo.EFINStatus == (int)EMPConstants.EFINStatus_ForSub.Sharing && model.SiteOwnthisEFIN == false) { var UserId = model.EFINOwnerSite; if (!string.IsNullOrEmpty(UserId)) { var UserMain = (from emp in db.emp_CustomerInformation join emplog in db.emp_CustomerLoginInformation on emp.Id equals emplog.CustomerOfficeId where emplog.EMPUserId == UserId select new { emp.EFIN }).FirstOrDefault(); if (UserMain != null) { emp_MyInfo.EFIN = UserMain.EFIN ?? 0; } } } db.Entry(emp_MyInfo).State = System.Data.Entity.EntityState.Modified; } if (emp_MyInfo.IsActivationCompleted == 1) { if (prevBS != dto.IsBusinessSoftware && dto.IsBusinessSoftware) { var loginfo = db.emp_CustomerLoginInformation.Where(x => x.CustomerOfficeId == refId).FirstOrDefault(); var sy = db.SalesYearMasters.Where(x => x.Id == emp_MyInfo.SalesYearID).Select(x => x.SalesYear).FirstOrDefault(); CustomerInformationService cis = new CustomerInformation.CustomerInformationService(); cis.SaveEmpCsrData(refId, "Business Software", emp_MyInfo.SalesforceAccountID, sy.Value.ToString()); EmailNotification _email = new EmailNotification(); _email.CreatedBy = dto.UserId ?? Guid.Empty; _email.CreatedDate = DateTime.Now; _email.EmailCC = ""; _email.EmailContent = ""; _email.EmailSubject = "Business Software"; _email.EmailTo = EMPConstants.SupportutaxEmail; _email.EmailType = (int)EMPConstants.EmailTypes.BusinessSoftware; _email.IsSent = false; _email.Parameters = loginfo.EMPUserId + "$|$" + loginfo.MasterIdentifier + "$|$" + dto.IsBusinessSoftware; db.EmailNotifications.Add(_email); } } if (prevBS != dto.IsBusinessSoftware && dto.IsBusinessSoftware && emp_MyInfo.EntityId != (int)EMPConstants.Entity.SO) { var loginfo = db.emp_CustomerLoginInformation.Where(x => x.CustomerOfficeId == refId).FirstOrDefault(); var parentinfo = db.emp_CustomerInformation.Where(x => x.Id == emp_MyInfo.ParentId).FirstOrDefault(); var parentsb = db.MainOfficeConfigurations.Where(x => x.emp_CustomerInformation_ID == emp_MyInfo.ParentId).Select(x => x.HasBusinessSoftware).FirstOrDefault(); if (parentinfo != null) { if (parentinfo.QuoteSoftwarePackage != EMPConstants.EnterprisePackage && !parentsb) { EmailNotification _email = new EmailNotification(); _email.CreatedBy = dto.UserId ?? Guid.Empty; _email.CreatedDate = DateTime.Now; _email.EmailCC = ""; _email.EmailContent = ""; _email.EmailSubject = "Business Software"; _email.EmailTo = EMPConstants.accountutaxEmail; _email.EmailType = (int)EMPConstants.EmailTypes.BusinessSoftware; _email.IsSent = false; _email.Parameters = loginfo.EMPUserId + "$|$" + loginfo.MasterIdentifier + "$|$" + dto.IsBusinessSoftware; db.EmailNotifications.Add(_email); } } } } } try { db.SaveChanges(); db.Dispose(); if (MyId != Guid.Empty) { DropDownService ddService = new DropDownService(); var items = ddService.GetBottomToTopHierarchy(MyId); } return(model.Id); } catch (Exception ex) { EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "CustomerPaymentOptionsService/SaveSubSiteOfficeConfigInfo", Guid.Empty); return(Guid.Empty); } }
/// <summary> /// This method is used to Save the main office details /// </summary> /// <param name="dto"></param> /// <returns></returns> public Guid BankServiceSave(SubSiteBankServiceDTO dto) { int entityState = 0; SubSiteConfiguration model = new SubSiteConfiguration(); if (dto != null) { Guid Id, refId; bool IsRefId = Guid.TryParse(dto.refId, out refId); if (!IsRefId) { return(Guid.Empty); } if (Guid.TryParse(dto.Id, out Id)) { model = db.SubSiteConfigurations.Where(a => a.ID == Id).FirstOrDefault(); if (model.IsuTaxManageOnboarding != null && model.IsuTaxCustomerSupport != null) { Guid SiteMapId; int EntityType = 0; if (Guid.TryParse("68882c05-5914-4fdb-b284-e33d6c029f5a", out SiteMapId)) { CustomerConfigurationStatu ConfigStatusModel = new CustomerConfigurationStatu(); ConfigStatusModel = db.CustomerConfigurationStatus.Where(o => o.CustomerId == refId && o.SitemapId == SiteMapId).FirstOrDefault(); if (ConfigStatusModel == null) { ConfigStatusModel = new CustomerConfigurationStatu(); ConfigStatusModel.Id = Guid.NewGuid(); } else { EntityType = (int)System.Data.Entity.EntityState.Modified; } ConfigStatusModel.CustomerId = dto.UserId ?? Guid.Empty; ConfigStatusModel.SitemapId = SiteMapId; ConfigStatusModel.StatusCode = "done"; ConfigStatusModel.UpdatedBy = dto.UserId ?? Guid.Empty; ConfigStatusModel.UpdatedDate = DateTime.Now; if (EntityType == (int)System.Data.Entity.EntityState.Modified) { db.Entry(ConfigStatusModel).State = System.Data.Entity.EntityState.Modified; } else { db.CustomerConfigurationStatus.Add(ConfigStatusModel); } } } if (model != null) { entityState = (int)System.Data.Entity.EntityState.Modified; } else { return(Guid.Empty); } } else { model.ID = Guid.NewGuid(); entityState = (int)System.Data.Entity.EntityState.Added; } model.emp_CustomerInformation_ID = refId; // newguid; if (dto.IsuTaxManageingEnrolling != null) { model.IsuTaxManageingEnrolling = dto.IsuTaxManageingEnrolling.Value; } if (dto.IsuTaxPortalEnrollment != null) { model.IsuTaxPortalEnrollment = dto.IsuTaxPortalEnrollment.Value; } if (dto.IsSubSiteEFINAllow != null) { model.IsSubSiteEFINAllow = dto.IsSubSiteEFINAllow.Value; } else { model.IsSubSiteEFINAllow = false; } model.EnrollmentEmails = dto.EnrollmentEmails; model.CanSubSiteLoginToEmp = true; model.StatusCode = EMPConstants.Active; model.LastUpdatedBy = dto.UserId ?? Guid.Empty; model.LastUpdatedDate = System.DateTime.Now; if (entityState == (int)System.Data.Entity.EntityState.Added) { model.CreatedBy = dto.UserId ?? Guid.Empty; model.CreatedDate = System.DateTime.Now; db.SubSiteConfigurations.Add(model); } else { db.Entry(model).State = System.Data.Entity.EntityState.Modified; var Bank = db.SubSiteBankConfigs.Where(o => o.SubSiteConfiguration_ID == model.ID).ToList(); if (Bank.ToList().Count > 0) { db.SubSiteBankConfigs.RemoveRange(Bank); } } List <SubSiteBankConfig> SubSiteBankConfigs = new List <SubSiteBankConfig>(); foreach (var item in dto.SubSiteBankQuestions) { SubSiteBankConfig SubSiteBank = new SubSiteBankConfig(); SubSiteBank.ID = Guid.NewGuid(); SubSiteBank.emp_CustomerInformation_ID = model.emp_CustomerInformation_ID; SubSiteBank.BankMaster_ID = item.BankId; SubSiteBank.SubSiteConfiguration_ID = model.ID; SubSiteBank.SubQuestion_ID = item.QuestionId; SubSiteBank.CreatedBy = dto.UserId ?? Guid.Empty; SubSiteBank.CreatedDate = DateTime.Now; SubSiteBank.LastUpdatedBy = dto.UserId ?? Guid.Empty; SubSiteBank.LastUpdatedDate = DateTime.Now; SubSiteBankConfigs.Add(SubSiteBank); } if (dto.SubSiteBankQuestions.ToList().Count > 0) { db.SubSiteBankConfigs.AddRange(SubSiteBankConfigs); } if (dto.IsuTaxManageingEnrolling ?? false) { var custinfo = (from s in db.emp_CustomerInformation join sy in db.SalesYearMasters on s.SalesYearID equals sy.Id where s.Id == refId select new { s.IsMSOUser, s.SalesforceAccountID, sy.SalesYear } ).FirstOrDefault(); CustomerInformation.CustomerInformationService objCIS = new CustomerInformation.CustomerInformationService(); string desc = (custinfo.IsMSOUser ?? false) ? "Automated MSO " + custinfo.SalesYear ?? 0 + " Enrollment Case " : "Automated Desktop " + custinfo.SalesYear ?? 0 + " Enrollment Case"; objCIS.SaveCSRCase(custinfo.SalesforceAccountID, (custinfo.SalesYear ?? 0).ToString(), true, desc, false); } } try { db.SaveChanges(); db.Dispose(); return(model.ID); } catch (Exception ex) { EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "SubSiteConfigService/BankServiceSave", model.ID); return(Guid.Empty); throw; } }
/// <summary> /// This method is used to Save the main office details /// </summary> /// <param name="dto"></param> /// <returns></returns> public Guid OnBoardingServiceSave(SubSiteOnBoardingDTO dto) { int entityState = 0; SubSiteConfiguration model = new SubSiteConfiguration(); if (dto != null) { Guid Id, refId; bool IsRefId = Guid.TryParse(dto.refId, out refId); if (!IsRefId) { return(Guid.Empty); } if (Guid.TryParse(dto.Id, out Id)) { model = db.SubSiteConfigurations.Where(a => a.ID == Id).FirstOrDefault(); if (model.IsuTaxManageingEnrolling != null && model.IsuTaxCustomerSupport != null) { Guid SiteMapId; int EntityType = 0; if (Guid.TryParse("68882c05-5914-4fdb-b284-e33d6c029f5a", out SiteMapId)) { CustomerConfigurationStatu ConfigStatusModel = new CustomerConfigurationStatu(); ConfigStatusModel = db.CustomerConfigurationStatus.Where(o => o.CustomerId == refId && o.SitemapId == SiteMapId).FirstOrDefault(); if (ConfigStatusModel == null) { ConfigStatusModel = new CustomerConfigurationStatu(); ConfigStatusModel.Id = Guid.NewGuid(); } else { EntityType = (int)System.Data.Entity.EntityState.Modified; } ConfigStatusModel.CustomerId = refId; ConfigStatusModel.SitemapId = SiteMapId; ConfigStatusModel.StatusCode = "done"; ConfigStatusModel.UpdatedBy = dto.UserId ?? Guid.Empty; ConfigStatusModel.UpdatedDate = DateTime.Now; if (EntityType == (int)System.Data.Entity.EntityState.Modified) { db.Entry(ConfigStatusModel).State = System.Data.Entity.EntityState.Modified; } else { db.CustomerConfigurationStatus.Add(ConfigStatusModel); } } } if (model != null) { entityState = (int)System.Data.Entity.EntityState.Modified; } else { return(Guid.Empty); } } else { model.ID = Guid.NewGuid(); entityState = (int)System.Data.Entity.EntityState.Added; } model.emp_CustomerInformation_ID = refId; // newguid; if (dto.IsuTaxManageOnboarding != null) { model.IsuTaxManageOnboarding = dto.IsuTaxManageOnboarding.Value; } model.StatusCode = EMPConstants.Active; model.LastUpdatedBy = dto.UserId ?? Guid.Empty; model.LastUpdatedDate = System.DateTime.Now; if (entityState == (int)System.Data.Entity.EntityState.Added) { model.CreatedBy = dto.UserId ?? Guid.Empty; model.CreatedDate = System.DateTime.Now; db.SubSiteConfigurations.Add(model); } else { db.Entry(model).State = System.Data.Entity.EntityState.Modified; } var custinfo = (from s in db.emp_CustomerInformation join sy in db.SalesYearMasters on s.SalesYearID equals sy.Id where s.Id == refId select new { s.IsMSOUser, s.SalesforceAccountID, sy.SalesYear }).FirstOrDefault(); CustomerInformation.CustomerInformationService objCIS = new CustomerInformation.CustomerInformationService(); string desc = (custinfo.IsMSOUser ?? false) ? "Automated MSO " + custinfo.SalesYear ?? 0 + " Onboarding Case " : "Automated Desktop " + custinfo.SalesYear ?? 0 + " Onboarding Case"; var caseId = objCIS.SaveCSRCase(custinfo.SalesforceAccountID, (custinfo.SalesYear ?? 0).ToString(), dto.IsuTaxManageOnboarding ?? false, desc); var cinfo = db.emp_CustomerInformation.Where(x => x.Id == refId).FirstOrDefault(); cinfo.OnBoardPrimaryKey = caseId; } try { db.SaveChanges(); db.Dispose(); return(model.ID); } catch (Exception ex) { EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "SubSiteConfigService/OnBoardingServiceSave", Guid.Empty); return(Guid.Empty); throw; } }
/// <summary> /// This method is used to Save the main office details /// </summary> /// <param name="dto"></param> /// <returns></returns> public bool Save(MainOfficeDTO dto) { try { int entityState = 0; bool prevBS = false; Guid newguid, newguid2; MainOfficeConfiguration mainofficeconfigurationDto = new MainOfficeConfiguration(); if (dto != null) { if (Guid.TryParse(dto.Id, out newguid)) { mainofficeconfigurationDto = db.MainOfficeConfigurations.Where(a => a.Id == newguid).FirstOrDefault(); if (mainofficeconfigurationDto != null) { prevBS = mainofficeconfigurationDto.HasBusinessSoftware; entityState = (int)System.Data.Entity.EntityState.Modified; } else { return(false); } } else { mainofficeconfigurationDto.Id = Guid.NewGuid(); entityState = (int)System.Data.Entity.EntityState.Added; } bool IsRefId = Guid.TryParse(dto.refId, out newguid2); mainofficeconfigurationDto.emp_CustomerInformation_ID = newguid2; // newguid; mainofficeconfigurationDto.IsSiteTransmitTaxReturns = dto.IsSiteTransmitTaxReturns; mainofficeconfigurationDto.IsSiteOfferBankProducts = dto.IsSiteOfferBankProducts; mainofficeconfigurationDto.TaxProfessionals = dto.TaxProfessionals; mainofficeconfigurationDto.IsSoftwarebeInstalledNetwork = dto.IsSoftwarebeInstalledNetwork; mainofficeconfigurationDto.ComputerswillruninSoftware = dto.ComputerswillruninSoftware; mainofficeconfigurationDto.PreferredSupportLanguage = dto.PreferredSupportLanguage; mainofficeconfigurationDto.StatusCode = EMPConstants.Active; mainofficeconfigurationDto.LastUpdatedBy = dto.UserId ?? Guid.Empty; mainofficeconfigurationDto.LastUpdatedDate = System.DateTime.Now; mainofficeconfigurationDto.HasBusinessSoftware = dto.IsBusinessSoftware; mainofficeconfigurationDto.IsSharingEfin = dto.IsSharingEFIN; if (entityState == (int)System.Data.Entity.EntityState.Added) { mainofficeconfigurationDto.CreatedBy = dto.UserId ?? Guid.Empty; mainofficeconfigurationDto.CreatedDate = System.DateTime.Now; db.MainOfficeConfigurations.Add(mainofficeconfigurationDto); } else { db.Entry(mainofficeconfigurationDto).State = System.Data.Entity.EntityState.Modified; } var enrollconfig = db.EnrollmentOfficeConfigurations.Where(x => x.CustomerId == newguid2 && x.StatusCode == EMPConstants.Active).FirstOrDefault(); if (enrollconfig != null) { enrollconfig.IsSoftwareOnNetwork = dto.IsSoftwarebeInstalledNetwork; enrollconfig.LastUpdatedBy = dto.UserId ?? Guid.Empty; enrollconfig.LastUpdatedDate = DateTime.Now; enrollconfig.NoofComputers = dto.ComputerswillruninSoftware; enrollconfig.NoofTaxProfessionals = dto.TaxProfessionals; enrollconfig.PreferredLanguage = dto.PreferredSupportLanguage; } } else { newguid2 = Guid.Empty; } db.SaveChanges(); var custinfo = db.emp_CustomerInformation.Where(x => x.Id == newguid2).FirstOrDefault(); if (custinfo != null) { if (custinfo.IsActivationCompleted == 1) { if (prevBS != dto.IsBusinessSoftware && dto.IsBusinessSoftware) { var loginfo = db.emp_CustomerLoginInformation.Where(x => x.CustomerOfficeId == newguid2).FirstOrDefault(); var sy = db.SalesYearMasters.Where(x => x.Id == custinfo.SalesYearID).Select(x => x.SalesYear).FirstOrDefault(); CustomerInformationService cis = new CustomerInformation.CustomerInformationService(); cis.SaveEmpCsrData(newguid2, "Business Software", custinfo.SalesforceAccountID, sy.Value.ToString()); EmailNotification _email = new EmailNotification(); _email.CreatedBy = dto.UserId ?? Guid.Empty; _email.CreatedDate = DateTime.Now; _email.EmailCC = ""; _email.EmailContent = ""; _email.EmailSubject = "Business Software"; _email.EmailTo = EMPConstants.SupportutaxEmail; _email.EmailType = (int)EMPConstants.EmailTypes.BusinessSoftware; _email.IsSent = false; _email.Parameters = loginfo.EMPUserId + "$|$" + loginfo.MasterIdentifier + "$|$" + dto.IsBusinessSoftware; db.EmailNotifications.Add(_email); db.SaveChanges(); } } //if (prevBS != dto.IsBusinessSoftware && dto.IsBusinessSoftware && (custinfo.EntityId!=(int)EMPConstants.Entity.MO && custinfo.EntityId!=(int)EMPConstants.Entity.SVB && custinfo.EntityId != (int)EMPConstants.Entity.SO)) //{ // var parentinfo = db.emp_CustomerInformation.Where(x => x.Id == custinfo.ParentId).FirstOrDefault(); // var parentsb = db.MainOfficeConfigurations.Where(x=>x) // if(parentinfo!=null) //} } db.Dispose(); return(true); } catch (Exception ex) { EMPPortal.Core.Utilities.ExceptionLogger.LogException(ex.ToString(), "CustomerPaymentOptionsService/Save", dto.UserId); return(false); } }