[HttpPost, Authorize(Roles = AuthorizationRoles.Role_Adviser)] //Role_Adviser --> Role_Preadviser public ActionResult AdviserProfile(AdviserRegistrationBindingModel model) { ViewBag.professTypes = cmRepo.GetAllProfessionTypes().Select(p => new SelectListItem { Text = p.ProfessionType1, Value = p.ProfessionTypeId.ToString() }).ToList(); if (ModelState.IsValid) { Adviser adviser = new Adviser(edisRepo) { AdviserNumber = User.Identity.GetUserId(), ABNACN = model.ABN, CompanyName = model.companyName, Country = model.country, AddressLn1 = model.addressLine1, AddressLn2 = model.addressLine2, AddressLn3 = model.addressLine3, CreatedOn = DateTime.Now, CurrentTitle = model.currentPositionTitle, ExperienceStartDate = model.industryExperienceStartDate, Fax = model.businessFax, FirstName = model.firstName, Gender = model.gender, LastName = model.lastName, RoleAndServicesSummary = model.roleAndServicesSummary, GroupName = model.dealerGroupName, LastUpdate = DateTime.Now, Lat = new GoogleGeoService(model.addressLine1 + " " + model.addressLine2 + " " + model.addressLine3 + " " + model.suburb + " " + model.state + " " + model.country).GetCoordinatesLat(), Lng = new GoogleGeoService(model.addressLine1 + " " + model.addressLine2 + " " + model.addressLine3 + " " + model.suburb + " " + model.state + " " + model.country).GetCoordinatesLng(), MiddleName = model.middleName, Mobile = model.businessMobile, Phone = model.businessPhone, PostCode = model.postCode, State = model.state, Suburb = model.suburb, Title = model.title, VerifiedId = BusinessLayerParameters.verificationStatus_NotVerified, IndustryExperienceStartDate = model.industryExperienceStartDate, BusinessPhone = model.businessPhone, BusinessMobile = model.businessMobile, BusinessFax = model.businessFax, DAddressLine1 = model.dealerGroup_addressLine1, DAddressLine2 = model.dealerGroup_addressLine2, DAddressLine3 = model.dealerGroup_addressLine3, DPostcode = model.dealerGroup_postCode, DState = model.dealerGroup_state, DSuburb = model.dealerGroup_suburb, DCountry = model.dealerGroup_country, Asfl = model.asfl, AuthorizedRepresentativeNumber = model.authorizedRepresentativeNumber, DealerGroupName = model.dealerGroupName, DealerGroupHasDerivativesLicense = model.dealerGroupHasDerivativesLicense ? true : false, IsAuthorizedRepresentative = model.isAuthorizedRepresentative ? true : false, TotalAssetUnderManagement = model.totalAssetUnderManagement, TotalInvestmentUndermanagement = model.totalInvestmentUndermanagement, TotalDirectAustralianEquitiesUnderManagement = model.totalDirectAustralianEquitiesUnderManagement, TotalDirectInterantionalEquitiesUnderManagement = model.totalDirectInterantionalEquitiesUnderManagement, TotalDirectFixedInterestUnderManagement = model.totalDirectFixedInterestUnderManagement, TotalDirectLendingBookInterestUnderManagement = model.totalDirectLendingBookInterestUnderManagement, ApproximateNumberOfClients = model.approximateNumberOfClients, ProfessiontypeId = model.professiontypeId, RemunerationMethodSpecified = model.remunerationMethodSpecified, RemunerationMethod = model.remunerationMethod, NumberOfClientsId = model.numberOfClientsId, AnnualIncomeLevelId = model.annualIncomeLevelId, InvestibleAssetLevel = model.investibleAssetLevel, TotalAssetLevel = ((EDIS_DOMAIN.Enum.Enums.TotalAssetLevels)model.totalAssetLevelId).ToString(), TotalAssetLevelId = model.totalAssetLevelId, }; foreach (var news in model.newsLetterServices) { if (news.selected == true) { adviser.NewsLetterServiceId = news.newsLetterServiceId; adviser.NewsLetterServiceName = news.serviceName; } } if (model.educations != null && model.educations.Count != 0) { adviser.Institution = model.educations[0].institution; adviser.CourseTitle = model.educations[0].courseTitle; adviser.CourseStatus = model.educations[0].courseStatus; adviser.EducationLevelId = model.educations[0].educationLevelId; } if (edisRepo.UpdateAdviser(adviser) != null) { TempData["success"] = "Profile has been updated"; } else { TempData["error"] = "Profile update failed. Please try again."; } } //ViewBag.professTypes = cmRepo.GetAllProfessionTypes().Select(p => new SelectListItem //{ // Text = p.ProfessionType1, // Value = p.ProfessionTypeId.ToString() //}).ToList(); //if (model != null) //{ // checkEducationList(model); //} //if (ModelState.IsValid && model != null) //{ // var userid = User.Identity.GetUserId(); // try // { // adviserRepo.InsertOrUpdateAdviserProfile_Complete(model); // adviserRepo.Save(); // TempData["success"] = "Profile has been successfully updated"; // } // catch (Exception e) // { // TempData["error"] = "Update failed: " + e.Message; // } //} return(View(model)); }
public ActionResult Create(AdviserRegistrationBindingModel model) { ViewBag.professTypes = cmRepo.GetAllProfessionTypes().Select(p => new SelectListItem { Text = p.ProfessionType1, Value = p.ProfessionTypeId.ToString() }).ToList(); var allErrors = ModelState.Values.Where(v => v.Errors.Count > 0).ToList(); if (ModelState.IsValid) { Adviser adviser = new Adviser(edisRepo) { AdviserNumber = User.Identity.GetUserId(), ABNACN = model.ABN, CompanyName = model.companyName, Country = model.country, AddressLn1 = model.addressLine1, AddressLn2 = model.addressLine2, AddressLn3 = model.addressLine3, CreatedOn = DateTime.Now, CurrentTitle = model.currentPositionTitle, ExperienceStartDate = model.industryExperienceStartDate, Fax = model.businessFax, FirstName = model.firstName, Gender = model.gender, LastName = model.lastName, RoleAndServicesSummary = model.roleAndServicesSummary, GroupName = model.dealerGroupName, LastUpdate = DateTime.Now, Lat = new GoogleGeoService(model.addressLine1 + " " + model.addressLine2 + " " + model.addressLine3 + " " + model.suburb + " " + model.state + " " + model.country).GetCoordinatesLat(), Lng = new GoogleGeoService(model.addressLine1 + " " + model.addressLine2 + " " + model.addressLine3 + " " + model.suburb + " " + model.state + " " + model.country).GetCoordinatesLng(), MiddleName = model.middleName, Mobile = model.businessMobile, Phone = model.businessPhone, PostCode = model.postCode, State = model.state, Suburb = model.suburb, Title = model.title, VerifiedId = BusinessLayerParameters.verificationStatus_NotVerified, IndustryExperienceStartDate = model.industryExperienceStartDate, BusinessPhone = model.businessPhone, BusinessMobile = model.businessMobile, BusinessFax = model.businessFax, DAddressLine1 = model.dealerGroup_addressLine1, DAddressLine2 = model.dealerGroup_addressLine2, DAddressLine3 = model.dealerGroup_addressLine3, DPostcode = model.dealerGroup_postCode, DState = model.dealerGroup_state, DSuburb = model.dealerGroup_suburb, DCountry = model.dealerGroup_country, Asfl = model.asfl, AuthorizedRepresentativeNumber = model.authorizedRepresentativeNumber, DealerGroupName = model.dealerGroupName, DealerGroupHasDerivativesLicense = model.dealerGroupHasDerivativesLicense ? true : false, IsAuthorizedRepresentative = model.isAuthorizedRepresentative ? true : false, TotalAssetUnderManagement = model.totalAssetUnderManagement, TotalInvestmentUndermanagement = model.totalInvestmentUndermanagement, TotalDirectAustralianEquitiesUnderManagement = model.totalDirectAustralianEquitiesUnderManagement, TotalDirectInterantionalEquitiesUnderManagement = model.totalDirectInterantionalEquitiesUnderManagement, TotalDirectFixedInterestUnderManagement = model.totalDirectFixedInterestUnderManagement, TotalDirectLendingBookInterestUnderManagement = model.totalDirectLendingBookInterestUnderManagement, ApproximateNumberOfClients = model.approximateNumberOfClients, ProfessiontypeId = model.professiontypeId, RemunerationMethodSpecified = model.remunerationMethodSpecified, RemunerationMethod = model.remunerationMethod, NumberOfClientsId = model.numberOfClientsId, AnnualIncomeLevelId = model.annualIncomeLevelId, InvestibleAssetLevel = model.investibleAssetLevel, TotalAssetLevel = ((EDIS_DOMAIN.Enum.Enums.TotalAssetLevels)model.totalAssetLevelId).ToString(), TotalAssetLevelId = model.totalAssetLevelId, }; if (model.educations != null && model.educations.Count != 0) { adviser.Institution = model.educations[0].institution; adviser.CourseTitle = model.educations[0].courseTitle; adviser.CourseStatus = model.educations[0].courseStatus; adviser.EducationLevelId = model.educations[0].educationLevelId; } if (edisRepo.CreateAdviserSync(adviser) != null) { TempData["success"] = "Profile has been updated"; } else { TempData["error"] = "Profile update failed. Please try again."; } } checkEducationList(model); return View(model); }
[Authorize(Roles = AuthorizationRoles.Role_Adviser)] //Role_Adviser --> Role_Preadviser public ActionResult AdviserProfile() { ViewBag.professTypes = cmRepo.GetAllProfessionTypes().Select(p => new SelectListItem { Text = p.ProfessionType1, Value = p.ProfessionTypeId.ToString() }).ToList(); Adviser adviser = edisRepo.GetAdviserSync(User.Identity.GetUserId(), DateTime.Now); AdviserRegistrationBindingModel adviserModel = new AdviserRegistrationBindingModel { adviserUserId = adviser.Id, ABN = adviser.ABNACN, addressLine1 = adviser.AddressLn1, addressLine2 = adviser.AddressLn2, addressLine3 = adviser.AddressLn3, annualIncomeLevelId = adviser.AnnualIncomeLevelId, approximateNumberOfClients = adviser.ApproximateNumberOfClients, approxNumberOfClients = adviser.ApproximateNumberOfClients, asfl = adviser.Asfl, authorizedRepresentativeNumber = adviser.AuthorizedRepresentativeNumber, businessFax = adviser.BusinessFax, businessMobile = adviser.BusinessMobile, businessPhone = adviser.BusinessPhone, companyName = adviser.CompanyName, country = adviser.Country, currentPositionTitle = adviser.CurrentTitle, dealerGroup_addressLine1 = adviser.DAddressLine1, dealerGroup_addressLine2 = adviser.DAddressLine2, dealerGroup_addressLine3 = adviser.DAddressLine3, dealerGroup_country = adviser.DCountry, dealerGroup_postCode = adviser.DPostcode, dealerGroup_state = adviser.DState, dealerGroup_suburb = adviser.DSuburb, dealerGroupHasDerivativesLicense = adviser.DealerGroupHasDerivativesLicense, dealerGroupName = adviser.DealerGroupName, firstName = adviser.FirstName, gender = adviser.Gender, industryExperienceStartDate = adviser.IndustryExperienceStartDate, investibleAssetLevel = adviser.InvestibleAssetLevel, isAuthorizedRepresentative = adviser.IsAuthorizedRepresentative, lastName = adviser.LastName, middleName = adviser.MiddleName, postCode = adviser.PostCode, professiontypeId = adviser.ProfessiontypeId, remunerationMethod = adviser.RemunerationMethod, remunerationMethodSpecified = adviser.RemunerationMethodSpecified, roleAndServicesSummary = adviser.RoleAndServicesSummary, state = adviser.State, suburb = adviser.Suburb, title = adviser.Title, totalAssetLevelId = adviser.TotalAssetLevelId, totalAssetUnderManagement = adviser.TotalAssetUnderManagement, totalDirectAustralianEquitiesUnderManagement = adviser.TotalDirectAustralianEquitiesUnderManagement, totalDirectFixedInterestUnderManagement = adviser.TotalDirectFixedInterestUnderManagement, totalDirectInterantionalEquitiesUnderManagement = adviser.TotalDirectInterantionalEquitiesUnderManagement, totalDirectLendingBookInterestUnderManagement = adviser.TotalDirectLendingBookInterestUnderManagement, totalInvestmentUndermanagement = adviser.TotalInvestmentUndermanagement, AnnualIncomeLevel = ((EDIS_DOMAIN.Enum.Enums.AnnualIncomeLevel)adviser.AnnualIncomeLevelId).ToString(), numberOfClientsId = adviser.NumberOfClientsId, InvestibleAssetLevelString = adviser.InvestibleAssetLevel.ToString(), TotalAssetLevel = ((EDIS_DOMAIN.Enum.Enums.TotalAssetLevels)adviser.TotalAssetLevelId).ToString(), }; List <NewsletterServiceModel> newsModelList = new List <NewsletterServiceModel>(); foreach (var news in cmRepo.GetNewsletterService()) { if (adviser.NewsLetterServiceId == news.NewsletterServicesId) { newsModelList.Add(new NewsletterServiceModel { newsLetterServiceId = news.NewsletterServicesId, serviceName = news.NewsletterServices, selected = true, }); } else { newsModelList.Add(new NewsletterServiceModel { newsLetterServiceId = news.NewsletterServicesId, serviceName = news.NewsletterServices, selected = false, }); } } adviserModel.newsLetterServices = newsModelList; #region add education level select drop down list List <SelectListItem> educationLevelSelect = new List <SelectListItem>(); educationLevelSelect.Add(new SelectListItem() { Text = "Please select", Value = "" }); cmRepo.GetAllEducationLevels().ToList().ForEach(level => { SelectListItem item = new SelectListItem(); item.Text = level.EducationLevels; item.Value = level.EducationLevelsId.ToString(); }); ViewBag.educationLevelSelect = educationLevelSelect; //generate number of education viewbag details checkEducationList(adviserModel); #endregion return(View(adviserModel)); }