public NewPractitionerViewModel GetCompanyList(NewPractitionerViewModel vm) { PractitionerBusiness businessLayer = new PractitionerBusiness(); NewPractitionerViewModel result = businessLayer.GetCompanyList(vm); return(result); }
public void RetrievingCompaniesList() { NewPractitionerViewModel vm = new NewPractitionerViewModel(); PractitionerData controller = new PractitionerData(); NewPractitionerViewModel result = controller.GetCompanyList(vm); Assert.IsNotNull(result.CompanyIdList); Assert.IsNotNull(result.CompanyNameList); }
public ActionResult PractitionerRegister() { NewPractitionerViewModel newUser = new NewPractitionerViewModel(); PractitionerProcess process = new PractitionerProcess(); NewPractitionerViewModel result = process.GetCompanyList(newUser); TempData["ConflictEmailAddress"] = ""; return(View(result)); }
public int PractitionerRegister(NewPractitionerViewModel newUser) { var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl); RestRequest request = new RestRequest(ConstantHelper.API.Practitioner.PractitionerRegister, Method.POST); request.RequestFormat = DataFormat.Json; request.AddBody(newUser); IRestResponse <int> response = client.Execute <int>(request); int result = response.Data; return(result); }
public NewPractitionerViewModel GetCompanyList(NewPractitionerViewModel vm) { var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl); RestRequest request = new RestRequest(ConstantHelper.API.Practitioner.GetCompanyList, Method.POST); request.RequestFormat = DataFormat.Json; request.AddBody(vm); IRestResponse <NewPractitionerViewModel> response = client.Execute <NewPractitionerViewModel>(request); NewPractitionerViewModel result = response.Data; return(result); }
public int CreateNewPractitioner(NewPractitionerViewModel newUser) { PractitionerBusiness businessLayer = new PractitionerBusiness(); NewPractitionerViewModel result = businessLayer.PractitionerRegister(newUser); if (result.ConflictEmailAddress == 1) { return(2); } if (result != null) { try { //Sent to Practitioner to inform waiting company actions string mailFrom = ConstantHelper.AppSettings.MailFrom; string emailSubject = ConstantHelper.Email.AccountVerification.EmailSubject; string emailBody = ConstantHelper.Email.AccountVerification.PractitionerEmailBody; string userName = ConstantHelper.AppSettings.UserName; string password = ConstantHelper.AppSettings.Password; EmailHelper.SentMail(mailFrom, result.EmailAddress, emailSubject, emailBody, userName, password); //Sent to Company to request actions string practitionerDetailsTable = "<table><tr><th>" + "Practitioner First Name" + "</th><td>" + result.FirstName + "</td></tr><tr><th>" + "Practitioner Last Name" + "</th><td>" + result.LastName + "</td></tr><tr><th>" + "Practitioner Gender" + "</th><td>" + result.Gender + "</td></tr><tr><th>" + "Practiitoner Email Address" + "</th><td>" + result.EmailAddress + "</td></tr><tr><th>" + "Role" + "</th><td>" + result.Role + "</td></tr><tr><th>" + "Specialist" + "</th><td>" + result.Specialist + "</td></tr></table>"; string linkToApprove = ConstantHelper.AppSettings.BackEndUrl + ConstantHelper.API.Practitioner.PractitionerApproved + "?accId=" + result.AccId; string linkToReject = ConstantHelper.AppSettings.BackEndUrl + ConstantHelper.API.Practitioner.PractitionerRejected + "?accId=" + result.AccId; string companyEmailSubject = ConstantHelper.Email.AccountVerification.PractitionerConfirmEmailSubject; string companyEmailBody = ConstantHelper.Email.AccountVerification.PractitionerConfirmEmailBody; companyEmailBody = companyEmailBody.Replace(ConstantHelper.Email.Keyword.PractitionerDetailsTable, practitionerDetailsTable); companyEmailBody = companyEmailBody.Replace(ConstantHelper.Email.Keyword.LinkToApprove, linkToApprove); companyEmailBody = companyEmailBody.Replace(ConstantHelper.Email.Keyword.LinkToReject, linkToReject); EmailHelper.SentMail(mailFrom, result.CompanyEmailAddress, companyEmailSubject, companyEmailBody, userName, password); } catch (Exception err) { new LogHelper().LogMessage("RegistrationController.CreateNewPatient : " + err); } return(1); } else { return(0); } }
public NewPractitionerViewModel GetCompanyList(NewPractitionerViewModel vm) { NewPractitionerViewModel result = new NewPractitionerViewModel(); try { PractitionerData dataLayer = new PractitionerData(); result = dataLayer.GetCompanyList(vm); //Form key value pair for drop down result.CompanyDropDown = result.CompanyIdList.Zip(result.CompanyNameList, (k, v) => new { k, v }).ToDictionary(x => x.k, x => x.v); } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.GetCompanyList : " + err); } return(result); }
public void NewPractitionerRegistration() { //Created Successfully NewPractitionerViewModel vm = new NewPractitionerViewModel(); TestHelper helper = new TestHelper(); PractitionerData controller = new PractitionerData(); vm.CompanyEmailAddress = helper.RandomString(50, false); vm.FirstName = helper.RandomString(20, false); vm.LastName = helper.RandomString(20, false); string rdmPassword = helper.RandomString(16, false); vm.Password = rdmPassword; vm.Gender = helper.RandomString(20, false); vm.DateOfBirth = DateTime.UtcNow; Array values = Enum.GetValues(typeof(State)); Religion rdmReligion = (Religion)values.GetValue(helper.RandomNumber(0, 4)); vm.Religion = rdmReligion; vm.EmailAddress = helper.RandomString(50, false); vm.OfficePhoneNumber = helper.RandomString(12, false); string hrdCodedCompanyId = "14694BBE-A650-EA11-B77B-28C2DDBBBA40"; vm.CompanyId = Guid.Parse(hrdCodedCompanyId); vm.Role = helper.RandomString(10, false); Specialist rdmSpecialist = (Specialist)values.GetValue(helper.RandomNumber(0, 24)); vm.Specialist = rdmSpecialist; vm.Qualification = String.Empty; vm.UserName = helper.RandomString(15, false); NewPractitionerViewModel result = controller.CreatePractitioner(vm); Assert.AreNotEqual(Guid.Empty, result.AccId); Assert.IsNotNull(result.CompanyEmailAddress); }
public NewPractitionerViewModel PractitionerRegister(NewPractitionerViewModel vm) { NewPractitionerViewModel result = new NewPractitionerViewModel(); try { var salt = HashingHelper.GenerateSalt(); vm.Salt = salt; var hashedPassword = HashingHelper.ComputeHMAC_SHA256(Encoding.UTF8.GetBytes(vm.Password), vm.Salt); vm.Password = Convert.ToBase64String(hashedPassword); //Convert back aligned date time due to restsharp vm.DateOfBirth = vm.DateOfBirth.ToLocalTime(); PractitionerData dataLayer = new PractitionerData(); result = dataLayer.CreatePractitioner(vm); } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.PractitionerRegister : " + err); } return(result); }
public ActionResult PractitionerRegister(NewPractitionerViewModel newUser) { PractitionerProcess process = new PractitionerProcess(); TempData["ConflictEmailAddress"] = ""; if (Request.Form["Submit"] != null) { if (newUser.EmailAddress.Equals(newUser.ReconfirmEmail) && newUser.Password.Equals(newUser.RetypePassword)) { if (ModelState.IsValid) { int result = process.PractitionerRegister(newUser); if (result == 1) { return(RedirectToAction("AccCreateSuccess", "HomePage", null)); } else if (result == 2) { TempData["ConflictEmailAddress"] = "ConflictEmailAddress"; return(View(newUser)); } else { return(View(newUser)); } } } else { return(View(newUser)); } } return(View(newUser)); }