public List <MedicineModel> SearchProduct(MedicineViewModel vm) { List <MedicineModel> result = new List <MedicineModel>(); vm.SearchText = "%" + vm.SearchText + "%"; if (String.IsNullOrEmpty(vm.ProductCode)) { vm.ProductCode = "All"; } PractitionerData dataLayer = new PractitionerData(); //MedicineModel row = new MedicineModel(); //row.ProductCode = "ABC"; //row.ProductName = "Testing"; //row.ExpiryDate = DateTime.Now; //row.ExpiryDateString = row.ExpiryDate.ToString("dd/MM/yyyy"); //row.TotalAmount = 15; //row.Threshold = 3; //result.Add(row); result = dataLayer.SearchProduct(vm); return(result); }
public int AppointmentAbsent(AppointmentModel appointmentModel) { int result = 0; try { //Change Appointment Status to absent PractitionerData dataLayer = new PractitionerData(); AppointmentModel model = new AppointmentModel(); model = dataLayer.AppointmentAbsent(appointmentModel); if (!model.PatientId.Equals(Guid.Empty)) { //Get PatientId to retrieve email PatientData patientDataLayer = new PatientData(); string patientEmailAddress = patientDataLayer.GetPatientEmail(model.PatientId); result = SentAppointmentAbsentNotificationEmail(patientEmailAddress, model.AppointmentDateString, model.AppointmentTimeString); } } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.AppointmentAbsent : " + err); } return(result); }
public int AppointmentRejected(AppointmentModel appointmentModel) { int result = 0; try { //Change Appointment Status to rejected PractitionerData dataLayer = new PractitionerData(); AppointmentModel model = new AppointmentModel(); //model is with appointmentdatestring and appointmenttimestring and PatientId + RejectReasons + PracitionerId model = dataLayer.AppointmentRejected(appointmentModel); if (!model.PatientId.Equals(Guid.Empty)) { //Get PatientId to retrieve email PatientData patientDataLayer = new PatientData(); string patientEmailAddress = patientDataLayer.GetPatientEmail(model.PatientId); PractitionerBaseViewModel companyDetails = new PractitionerBaseViewModel(); PractitionerBaseViewModel temp = new PractitionerBaseViewModel(); temp.AccId = appointmentModel.PractitionerId; companyDetails = dataLayer.GetProfile(temp); result = SentAppointmentRejectedNotificationEmail(patientEmailAddress, model.AppointmentDateString, model.AppointmentTimeString, model.RejectReasons, companyDetails); } } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.AppointmentAccepted : " + err); } return(result); }
public LoginInfo PractitionerLogin(LoginInfo loginInfo) { LoginInfo result = new LoginInfo(); result = loginInfo; try { PractitionerData dataLayer = new PractitionerData(); //hashing password result = dataLayer.PractitionerLogin(loginInfo); var hashedPassword = HashingHelper.ComputeHMAC_SHA256(Encoding.UTF8.GetBytes(loginInfo.Password), result.Salt); loginInfo.Password = Convert.ToBase64String(hashedPassword); if (loginInfo.Password.Equals(result.Password)) { result.Salt = null; return(result); } } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.PractitionerLogin : " + err); } return(result); }
public PatientRecordModel GetMedicinesDropDown(Guid companyId) { PractitionerData data = new PractitionerData(); PatientRecordModel result = new PatientRecordModel(); result = data.GetMedicinesList(companyId); return(result); }
public void GetDatabaseConnectionString() { PractitionerData controller = new PractitionerData(); //string actualConnStr = controller.connString; //string expectedConnStr = "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=FYP;User ID=admin;Password=admin123"; //Assert.AreEqual(expectedConnStr, actualConnStr); }
public List <AppointmentModel> GetAppointmentsTable(Guid practitionerId) { List <AppointmentModel> result = new List <AppointmentModel>(); PractitionerData data = new PractitionerData(); result = data.GetAppointmentsTable(practitionerId); return(result); }
public List <PractitionerRecordsDirectory> GetRecordsDirectory(Guid practitionerId) { PractitionerData dataLayer = new PractitionerData(); List <PractitionerRecordsDirectory> result = new List <PractitionerRecordsDirectory>(); result = dataLayer.GetRecordsDirectory(practitionerId); return(result); }
public List <PatientsDirectory> SearchPatients(PatientsDirectorySearch search) { List <PatientsDirectory> result = new List <PatientsDirectory>(); PractitionerData data = new PractitionerData(); result = data.SearchPatients(search); return(result); }
public List <PatientsDirectory> GetPatientsDirectory(Guid practitionerId) { List <PatientsDirectory> result = new List <PatientsDirectory>(); PractitionerData data = new PractitionerData(); result = data.GetPatientsDirectory(practitionerId); return(result); }
public List <PractitionerRecordsDirectory> PatientPractitionerRecords(Guid practitionerId, Guid patientId) { List <PractitionerRecordsDirectory> result = new List <PractitionerRecordsDirectory>(); PractitionerData data = new PractitionerData(); result = data.PatientPractitionerRecords(practitionerId, patientId); return(result); }
public int UpdateProduct(MedicineModel medicine) { int result = 0; PractitionerData dataLayer = new PractitionerData(); result = dataLayer.UpdateProduct(medicine); return(result); }
public MedicineModel GetProduct(MedicineModel medicine) { MedicineModel result = new MedicineModel(); PractitionerData dataLayer = new PractitionerData(); result = dataLayer.GetProduct(medicine); 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 int CreateProduct(MedicineModel newMedicine) { int result = 0; PractitionerData dataLayer = new PractitionerData(); result = dataLayer.CreateProduct(newMedicine); return(result); }
public int StoreRecordToDB(RecordFileSystem fileSystem) { int result = 0; PractitionerData data = new PractitionerData(); result = data.StoreRecordToDB(fileSystem); return(result); }
public int CloseAppointment(Guid appointmentId) { int result = 0; PractitionerData data = new PractitionerData(); result = data.CloseAppointment(appointmentId); return(result); }
public int ProfileEdit(PractitionerBaseViewModel profile) { PractitionerData dataLayer = new PractitionerData(); profile.DateOfBirth = Convert.ToDateTime(profile.DateOfBirthString); int result = 0; result = dataLayer.ProfileEdit(profile); return(result); }
public List <PractitionerRecordsDirectory> SearchRecords(PractitionerRecordSearch vm) { List <PractitionerRecordsDirectory> result = new List <PractitionerRecordsDirectory>(); PractitionerData dataLayer = new PractitionerData(); if (String.IsNullOrEmpty(vm.Year.ToString())) { vm.Year = 0; } result = dataLayer.SearchRecords(vm); return(result); }
public void PractitionerLoginAccountFound() { //Positive Case PractitionerData controller = new PractitionerData(); LoginInfo sampleUser = new LoginInfo(); sampleUser.EmailAddress = "*****@*****.**"; sampleUser.Password = "******"; string expectedPassword = "******"; //copied from database LoginInfo result = new LoginInfo(); result = controller.PractitionerLogin(sampleUser); Assert.AreNotEqual(Guid.Empty, result.AccountNo); Assert.AreEqual(expectedPassword, result.Password); Assert.IsNotNull(result.Salt); Assert.IsNotNull(result.AccountStatus); //Negative Case - Wrong Email LoginInfo sampleUser2 = new LoginInfo(); sampleUser2.EmailAddress = "*****@*****.**"; sampleUser2.Password = "******"; result = new LoginInfo(); result = controller.PractitionerLogin(sampleUser2); Assert.AreEqual(Guid.Empty, result.AccountNo); Assert.IsNull(result.AccountStatus); Assert.IsNull(result.Salt); //Negative Case - Wrong Password LoginInfo sampleUser3 = new LoginInfo(); sampleUser3.EmailAddress = "*****@*****.**"; sampleUser3.Password = "******"; result = new LoginInfo(); result = controller.PractitionerLogin(sampleUser3); Assert.AreNotEqual(Guid.Empty, result.AccountNo); Assert.AreEqual(expectedPassword, result.Password); Assert.IsNotNull(result.AccountStatus); Assert.IsNotNull(result.Salt); }
public PractitionerBaseViewModel GetProfile(PractitionerBaseViewModel vm) { PractitionerBaseViewModel result = new PractitionerBaseViewModel(); try { PractitionerData dataLayer = new PractitionerData(); result = dataLayer.GetProfile(vm); } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.GetProfile : " + err); } return(result); }
public string PractitionerRejected(Guid accId) { string result = String.Empty; try { PractitionerData dataLayer = new PractitionerData(); result = dataLayer.PractitionerRejected(accId); } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.PractitioenrRejected : " + err); } return(result); }
public CompanyViewModel CompanyRegister(CompanyViewModel newCompany) { CompanyViewModel result = new CompanyViewModel(); try { PractitionerData dataLayer = new PractitionerData(); result = dataLayer.CreateCompany(newCompany); } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.CompanyRegister : " + err); } return(result); }
public RecordFileSystem GetRecord(RecordFileSystem record) { PractitionerData dataLayer = new PractitionerData(); RecordFileSystem result = new RecordFileSystem(); result = dataLayer.GetRecord(record); if (result != null) { if (result.FileContents != null) { result.FileContentsString = Convert.ToBase64String(result.FileContents); } } return(result); }
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 List <MedicineModel> GetProducts(Guid profileId) { List <MedicineModel> result = new List <MedicineModel>(); PractitionerData dataLayer = new PractitionerData(); //MedicineModel row = new MedicineModel(); //row.ProductCode = "ABC"; //row.ProductName = "Testing"; //row.ExpiryDate = DateTime.Now; //row.ExpiryDateString = row.ExpiryDate.ToString("dd/MM/yyyy"); //row.TotalAmount = 15; //row.Threshold = 3; //result.Add(row); result = dataLayer.GetProducts(profileId); return(result); }
public void SentEmailNotification(AppointmentModel model, PractitionerBaseViewModel ptResult) { string mailFrom = ConstantHelper.AppSettings.MailFrom; string userName = ConstantHelper.AppSettings.UserName; string password = ConstantHelper.AppSettings.Password; try { PatientData patientDataLayer = new PatientData(); string patientEmail = patientDataLayer.GetPatientEmail(model.PatientId); if (!String.IsNullOrEmpty(patientEmail)) { //Sent notification email to patient string patientEmailSubject = ConstantHelper.Email.AppointmentVerification.AppointmentMadeSubject; string patientEmailBody = ConstantHelper.Email.AppointmentVerification.AppointmentMadeBody; //replace with appointment details DateTime tempAppointmentDateTime = Convert.ToDateTime(model.AppointmentDate.ToString()); string appointmentDetailsTable = "<table><caption>Appointment Details</caption><tr><th>Appointment Date</th><td>" + tempAppointmentDateTime.ToString("dd/MM/yyyy") + "</td></tr><tr><th>Appointment Time</th><td>" + tempAppointmentDateTime.ToString("hh:mm tt") + "</td></tr><tr><th>Company</th><td>" + ptResult.CompanyName + "</td></tr><tr><th>City</th><td>" + ptResult.City + "</td></tr><tr><th>Postal Code</th><td>" + ptResult.PostalCode + "</td></tr><tr><th>State</th><td>" + ptResult.State + "</td></tr><tr><th>Appointment Description</th><td>" + model.Description + "</td></tr><tr><th>Appointment Remarks</th><td>" + model.Remarks + "</td></tr></table>"; patientEmailBody = patientEmailBody.Replace(ConstantHelper.Email.Keyword.AppointmentDetails, appointmentDetailsTable); EmailHelper.SentMail(mailFrom, patientEmail, patientEmailSubject, patientEmailBody, userName, password); } PractitionerData practitionerDataLayer = new PractitionerData(); string practitionerEmail = practitionerDataLayer.GetPractitionerEmail(model.PractitionerId); if (!String.IsNullOrEmpty(practitionerEmail)) { //Sent notification email to practitioner string practitionerEmailSubject = ConstantHelper.Email.AppointmentVerification.NewAppointmentSubject; string practitionerEmailBody = ConstantHelper.Email.AppointmentVerification.NewAppointmentBody; //replace maybe link to practitionerLogin string practitionerLoginPage = "<a href='" + ConstantHelper.AppSettings.RootSiteUrl + ConstantHelper.API.Practitioner.PractitionerLogin + "'>Practitioner Login Page</a>"; practitionerEmailBody = practitionerEmailBody.Replace(ConstantHelper.Email.Keyword.PractitionerLoginPage, practitionerLoginPage); EmailHelper.SentMail(mailFrom, practitionerEmail, practitionerEmailSubject, practitionerEmailBody, userName, password); } } catch (Exception err) { new LogHelper().LogMessage("PatientBusiness.SentEmailNotification : " + err); } }
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 int AppointmentPending(AppointmentModel appointmentModel) { int result = 0; try { //Change Appointment Status to pending PractitionerData dataLayer = new PractitionerData(); AppointmentModel model = new AppointmentModel(); model = dataLayer.AppointmentPending(appointmentModel); if (!model.PatientId.Equals(Guid.Empty)) { result = 1; } } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.AppointmentPending : " + err); } return(result); }
public NewPatientRecordViewModel CreateNewRecord(PatientRecordModel vm) { NewPatientRecordViewModel result = new NewPatientRecordViewModel(); PractitionerData practitionerData = new PractitionerData(); PatientData patientData = new PatientData(); //Retrieve practitioner and company information PractitionerBaseViewModel practitionerId = new PractitionerBaseViewModel(); practitionerId.AccId = vm.PractitionerId; result.PractitionerDetails = practitionerData.GetProfile(practitionerId); // Retrieve patient information result.PatientDetails = patientData.PatientProfile(vm.PatientId); vm.CreatedOn = DateTime.UtcNow; RecordFileSystem fileRecord = new RecordFileSystem(); fileRecord.ContentType = ConstantHelper.AppSettings.RecordFileType; fileRecord.FileContents = new byte[1]; fileRecord.FileDownloadname = DateTime.Now.Date.ToString() + "-" + result.PractitionerDetails.CompanyId; fileRecord.PatientId = result.PatientDetails.AccId; fileRecord.PractitionerId = result.PractitionerDetails.AccId; //Get medicines list in the company result.NewPatientRecord = practitionerData.GetMedicinesList(result.PractitionerDetails.CompanyId); result.NewPatientRecord.AppointmentId = vm.AppointmentId; result.NewPatientRecord.PatientId = vm.PatientId; result.NewPatientRecord.PractitionerId = vm.PractitionerId; //Creating a record in the database result.NewPatientRecord.RecordId = practitionerData.CreatePatientRecord(fileRecord); return(result); }