public ReportBO GetReportsByAppt(int id) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } var re = objHmsDataContext.Reports.Where(rprt => (rprt.Appointment_ID == id)).ToList(); var reportDetails = ConvertReportToBO(re.Last()); reportDetails.patientFirstName = objHmsDataContext.Patients.Where(p => p.Patient_ID == reportDetails.patient_ID) .Select(pat => pat.First_Name).First(); if (reportDetails != null) { reportDetails.reportRequested = objHmsDataContext.Appointments.Where(a => a.Appointment_ID == reportDetails.appointment_ID).Select(r => r.RequestedReportNotes).First(); } return(reportDetails); } } catch (Exception e) { ReportBO report_BO = new ReportBO(); return(report_BO); } }
public void DepositCash(UserO usr) { WriteLine("Enter the amount to deposit:"); string amo = ReadLine(); int amount; if (int.TryParse(amo, out amount)) { amount = System.Convert.ToInt32(amo); UserBLL bll = new UserBLL(); UserBO obj = new UserBO(bll.SearchByObject(usr)); UserBO Deposit = new UserBO(obj); Deposit.Starting_balance = Deposit.Starting_balance + amount; bll.Save_User(Deposit); WriteLine("Deposit successful."); DateTime dateTime = DateTime.UtcNow.Date; string dat = dateTime.ToString("dd/MM/yyyy"); ReportBO repobj = new ReportBO { Type = "Cash Deposit", User_Id = obj.UsrAccNum, Name = obj.Name, Amount = amount.ToString(), Date = dat }; TransactionBLL tll = new TransactionBLL(); tll.Save_Transaction(repobj); WriteLine("Do you wish to print a reciept?(y/n)"); char ans2 = ReadKey().KeyChar; if (ans2.Equals('y') || ans2.Equals('Y')) { bll.Receipt_Deposit(obj, amount); } } else { WriteLine("Amount enetered was not in a correct format"); } }
public bool Is24Hours(UserO usr) { ReportBO obj = SearchByObject(usr); DateTime temp; CultureInfo provider = CultureInfo.InvariantCulture; DateTime today = DateTime.UtcNow.Date; if (obj.IsEmpty()) { return(false); } try { temp = DateTime.ParseExact(obj.Date, "d/MM/yyyy", provider); } catch (Exception ex) { temp = temp = DateTime.ParseExact(obj.Date, "dd/MM/yyyy", provider); } DateTime NoOfHours = temp.AddDays(1); int Amount = System.Convert.ToInt32(obj.Amount); if (Amount > 20000 && today < NoOfHours) { return(true); } return(false); }
//View by Incharge ID public IEnumerable <ReportBO> ViewAllReports(ReportBO reportBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } IEnumerable <ReportBO> report = objHmsDataContext.Reports.Join(objHmsDataContext.Patients, p => p.Patient_ID, r => r.Patient_ID, (r, p) => new ReportBO { appointment_ID = r.Appointment_ID, patient_ID = r.Patient_ID, labResult = r.Lab_Result, date = r.Report_Date, report_ID = r.Report_ID, reportTime = Convert.ToString(r.Report_Time), patientFirstName = p.First_Name }).ToList(); return(report); } } catch (Exception e) { IEnumerable <ReportBO> report_BO = null; return(report_BO); } }
//Method to Insert a new report, with report business object as return type and report Business as parameter public ReportBO InsertNewReport(ReportBO reportBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } //reportBO.labResult = "Blood test, No signs of Virus"; Report report = new Report(); Report newReport = ConvertBOToReport(report, reportBO); objHmsDataContext.Reports.InsertOnSubmit(newReport); var a = objHmsDataContext.Appointments.Where(app => app.Appointment_ID == reportBO.appointment_ID).FirstOrDefault(); a.RequestedReport = false; //objHmsDataContext.Appointments objHmsDataContext.SubmitChanges(); return(GetRecentInsertedReport(reportBO)); } } catch (Exception e) { ReportBO rprtBO = new ReportBO(); return(rprtBO); } }
//Method to convert Report to Business object public ReportBO ConvertReportToBO(Report report) { ReportBO reportBO = new ReportBO(report.Report_ID, report.LabIncharge_ID, report.Lab_Result, Convert.ToString(report.Report_Time), report.Patient_ID, report.Report_Date, report.Appointment_ID); return(reportBO); }
public Int32 Update(Report obj) { ReportBO reportBO = new ReportBO(obj); reportDao.Update(reportBO); return(obj.Id); }
//Method to delete Report, with string return type and report business object as parameter public string DeleteRepoprt(ReportBO reportBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Report report = objHmsDataContext.Reports.SingleOrDefault(rprt => (rprt.Report_ID == reportBO.report_ID)); objHmsDataContext.Reports.DeleteOnSubmit(report); objHmsDataContext.SubmitChanges(); return("Report Deleted successfully"); } } catch (Exception e) { return("Unable to delete report Please try again Later"); } }
//Method to update Report, with string return type and report business object as parameter public IEnumerable <ReportBO> UpdatePatientReport_DAL(ReportBO reportBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Report report = objHmsDataContext.Reports.SingleOrDefault(rprt => (rprt.Report_ID == reportBO.report_ID)); Report updatedReport = ConvertBOToReport(report, reportBO); objHmsDataContext.SubmitChanges(); return(GetPatientReports_DAL(reportBO.patient_ID)); } } catch { return(null); } }
public void NormalCash(UserO usr, ref bool MaxAmount) { WriteLine("Enter the amount of money You want to withdraw"); string amo = ReadLine(); int amount; if (int.TryParse(amo, out amount)) { amount = System.Convert.ToInt32(amo); UserBLL bll = new UserBLL(); if (bll.CheckDate(amount)) { MaxAmount = true; return; } WriteLine($"Are you sure you want to withdraw Rs.{amount}(Y/N)? "); char ans = ReadKey().KeyChar; if (ans.Equals('y') || ans.Equals('Y')) { UserBO obj = new UserBO(bll.SearchByObject(usr)); UserBO cop = new UserBO(obj); if (bll.CheckBalance(obj, amount)) { obj.Starting_balance = obj.Starting_balance - amount; bll.Test_Save(obj); WriteLine("Ammount Withdrawn sucessfully"); DateTime dateTime = DateTime.UtcNow.Date; string dat = dateTime.ToString("dd/MM/yyyy"); ReportBO repobj = new ReportBO { Type = "Cash Withdrawl", User_Id = obj.UsrAccNum, Name = obj.Name, Amount = amount.ToString(), Date = dat }; TransactionBLL tll = new TransactionBLL(); tll.Save_Transaction(repobj); WriteLine("Do You wish to print a receipt(y/n)"); char ans2 = ReadKey().KeyChar; if (ans2.Equals('y') || ans2.Equals('Y')) { Display_Recipt(amount, obj); } } else { bll.Test_Save(cop); WriteLine("You dont have enough balance in your account"); } } else { return; } } else { WriteLine("Please Enter a valid amount i.e, digits"); } }
public void FastCash(UserO usr, ref bool MaxAmount) { Console.Clear(); WriteLine("1----500"); WriteLine("2----1000"); WriteLine("3----2000"); WriteLine("4----5000"); WriteLine("5----10000"); WriteLine("6----15000"); WriteLine("7----20000"); int opt = System.Convert.ToInt32(ReadLine()); UserBLL bll = new UserBLL(); int amount = Place_Balance(opt); if (bll.CheckDate(amount)) { MaxAmount = true; return; } WriteLine($"Are you sure you want to withdraw Rs.{amount}(Y/N)? "); char ans = ReadKey().KeyChar; if (ans.Equals('y') || ans.Equals('Y')) { UserBO obj = new UserBO(bll.SearchByObject(usr)); UserBO cop = new UserBO(obj); if (bll.CheckBalance(obj, amount)) { obj.Starting_balance = obj.Starting_balance - amount; bll.Test_Save(obj); WriteLine("Ammount Withdrawn sucessfully"); DateTime dateTime = DateTime.UtcNow.Date; string dat = dateTime.ToString("dd/MM/yyyy"); ReportBO repobj = new ReportBO { Type = "Cash Withdrawl", User_Id = obj.UsrAccNum, Name = obj.Name, Amount = amount.ToString(), Date = dat }; TransactionBLL tll = new TransactionBLL(); tll.Save_Transaction(repobj); WriteLine("Do You wish to print a receipt(y/n)"); char ans2 = ReadKey().KeyChar; if (ans2.Equals('y') || ans2.Equals('Y')) { Display_Recipt(amount, obj); } } else { bll.Test_Save(cop); WriteLine("You dont have enough balance in your account"); } } else { WriteLine("GoodLuck"); } }
// DELETE: api/Report/5 //Delete action which accepts int as input parameter and void as return type public void Delete(int id) { ReportBO report_BO = new ReportBO(); report_BO.report_ID = id; ReportBLLFactory rprtBLLFactory = new ReportBLLFactory(); string rprt = rprtBLLFactory.CreateReportBLL().DeleteReportBLL().CreateReportDAL().DeleteRepoprt(report_BO); }
public ReportBO GetReportsByAppt(AppointmentBO app) { //ReportBO reportBO = new ReportBO(); //reportBO.report_ID = app.appointment_ID; ReportBLLFactory rprtBLLFactory = new ReportBLLFactory(); ReportBO rprtBO = rprtBLLFactory.CreateReportBLL().GetReportBLL().CreateReportDAL().GetReportsByAppt(app.appointment_ID); return(rprtBO); }
public ReportBO GetReportsByPatient(int id) { ReportBO reportBO = new ReportBO(); reportBO.report_ID = id; // reportBO.patient_ID = pat.pid; ReportBLLFactory rprtBLLFactory = new ReportBLLFactory(); ReportBO rprtBO = rprtBLLFactory.CreateReportBLL().GetReportBLL().CreateReportDAL().GetReport(reportBO); return(rprtBO); }
public IEnumerable <ReportBO> GetAllReportsByPatient(PatientBO pat) { ReportBO reportBO = new ReportBO(); //reportBO.report_ID = id; reportBO.patient_ID = pat.pid; ReportBLLFactory rprtBLLFactory = new ReportBLLFactory(); IEnumerable <ReportBO> rprtBO = rprtBLLFactory.CreateReportBLL().GetReportBLL().CreateReportDAL().GetPatientReports_DAL(pat.pid); return(rprtBO); }
// POST: api/Report //Post action which accepts report business object as input parameter and void as return type public void Post([FromBody] ReportBO reportBO) { ReportBO report_BO = new ReportBO(); report_BO.labIncharge_ID = 4001; report_BO.patient_ID = 7002; report_BO.reportTime = "08:08:08"; report_BO.date = DateTime.Parse("2017/08/15"); ReportBLLFactory rprtBLLFactory = new ReportBLLFactory(); ReportBO rprt = rprtBLLFactory.CreateReportBLL().CreateReportBLL().CreateReportDAL().InsertNewReport(report_BO); }
// PUT: api/Report/5 //Put action which accepts int and report business object as input parameter and void as return type public void Put(int id, [FromBody] ReportBO reportBO) { ReportBO report_BO = new ReportBO(); report_BO.labIncharge_ID = 4001; report_BO.patient_ID = 7002; report_BO.reportTime = "10:10:10"; report_BO.date = DateTime.Parse("2010/10/10"); ReportBLLFactory rprtBLLFactory = new ReportBLLFactory(); var rprt = rprtBLLFactory.CreateReportBLL().UpdateReportBLL().CreateReportDAL().UpdatePatientReport_DAL(report_BO); }
public void Transfer_Cash(UserO usr, int num, int amount) { int idx = 0; List <UserBO> lst = Read_User(); if (SearchAcc(lst, num, ref idx)) { WriteLine($"You wish to transfer money to the account of {lst[idx].Name}. If this information is correct please re-enter the account number:"); int num2 = System.Convert.ToInt32(ReadLine()); if (num == num2) { UserBO obj = new UserBO(SearchByObject(usr)); UserBO from = new UserBO(obj); if (from.Starting_balance >= amount) { UserBO towards = new UserBO(lst[idx]); DeleteAcc(idx); towards.Starting_balance = towards.Starting_balance + amount; from.Starting_balance = from.Starting_balance - amount; Save_User(towards); Save_User(from); WriteLine("transaction confirmed."); DateTime dateTime = DateTime.UtcNow.Date; string dat = dateTime.ToString("dd/MM/yyyy"); ReportBO repobj = new ReportBO { Type = "Cash Transferred", User_Id = from.UsrAccNum, Name = from.Name, Amount = amount.ToString(), Date = dat }; TransactionBLL tll = new TransactionBLL(); tll.Save_Transaction(repobj); WriteLine("Do You wish to print a receipt(y/n)"); char ans2 = ReadKey().KeyChar; if (ans2.Equals('y') || ans2.Equals('Y')) { Display_Transfer_Receipt(amount, obj); } } else { Save_User(from); WriteLine("You dont have enough money in your account"); return; } } } else { WriteLine("This account does not exists."); } }
public ReportBO SearchByObject(UserO usr) { List <ReportBO> list = Read_Report(); for (int i = 0; i < list.Count; i++) { if (String.Equals(list[i].Name, usr.Login)) { ReportBO obj = new ReportBO(list[i]); DeleteAcc(i); return(list[i]); } } return(new ReportBO()); }
public List <ReportBO> ReadReport() { List <String> stringList = Read("ReportsData.csv"); List <ReportBO> repList = new List <ReportBO>(); foreach (string s in stringList) { string[] data = s.Split(","); ReportBO e = new ReportBO(); e.Type = data[0]; e.User_Id = System.Convert.ToInt32(data[1]); e.Name = data[2]; e.Amount = data[3]; e.Date = data[4]; repList.Add(e); } return(repList); }
public ReportBO GetRecentInsertedReport(ReportBO reportBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } ReportBO rBO = objHmsDataContext.Reports. Where(rt => rt.Report_Time == TimeSpan.Parse(reportBO.reportTime) && rt.Report_Date == reportBO.date && rt.Patient_ID == reportBO.patient_ID && rt.Lab_Result == reportBO.labResult ).Join(objHmsDataContext.Patients, r => r.Patient_ID, p => p.Patient_ID, (r, p) => new ReportBO { reportTime = Convert.ToString(r.Report_Time), date = r.Report_Date, patient_ID = r.Patient_ID, labResult = r.Lab_Result, report_ID = r.Report_ID, patientFirstName = p.First_Name }).ToArray()[0]; return(rBO); } } catch (Exception e) { ReportBO report_BO = new ReportBO(); return(report_BO); } }
//Method to get Report, with report Business object as return type and report Business object as parameter public ReportBO GetReport(ReportBO reportBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Report report = objHmsDataContext.Reports.SingleOrDefault(rprt => (rprt.Patient_ID == reportBO.patient_ID)); return(ConvertReportToBO(report)); } } catch (Exception e) { ReportBO report_BO = new ReportBO(); return(report_BO); } }
public void DeletePatientReport(ReportBO reportBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Report report = objHmsDataContext.Reports.SingleOrDefault(rprt => (rprt.Report_ID == reportBO.report_ID)); objHmsDataContext.Reports.DeleteOnSubmit(report); objHmsDataContext.SubmitChanges(); } } catch (Exception e) { } }
//Method to convert BO to Report public Report ConvertBOToReport(Report report, ReportBO reportBO) { if (reportBO.report_ID != 0) { report.Report_ID = reportBO.report_ID; } if (reportBO.labIncharge_ID != 0) { report.LabIncharge_ID = reportBO.labIncharge_ID; } if (reportBO.patient_ID != 0) { report.Patient_ID = reportBO.patient_ID; } if (!string.IsNullOrEmpty(reportBO.labResult)) { report.Lab_Result = reportBO.labResult; } if (!string.IsNullOrEmpty(reportBO.reportTime)) { report.Report_Time = TimeSpan.Parse((reportBO.reportTime)); } if (reportBO.date != DateTime.MinValue) { report.Report_Date = reportBO.date; } if (reportBO.appointment_ID != 0) { report.Appointment_ID = reportBO.appointment_ID; } return(report); }
public ReportBO GetReportForID(ReportBO reportBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Report report = objHmsDataContext.Reports.SingleOrDefault(rprt => (rprt.Patient_ID == reportBO.patient_ID && rprt.Lab_Result == reportBO.labResult && (rprt.LabIncharge_ID == reportBO.labIncharge_ID && rprt.Report_Time == TimeSpan.Parse(reportBO.reportTime) && rprt.Report_Date == reportBO.date))); return(ConvertReportToBO(report)); } } catch (Exception e) { ReportBO report_BO = new ReportBO(); return(report_BO); } }
public void DeletePatientReport(ReportBO report) { ReportBLLFactory rprtBLLFactory = new ReportBLLFactory(); rprtBLLFactory.CreateReportBLL().DeleteReportBLL().CreateReportDAL().DeletePatientReport(report); }
public IEnumerable <ReportBO> ViewPatientReports(ReportBO report) { LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory(); return(inchargeBLLFactory.CreateLabInchargeBLL().GetPatientReportsBLL().CreateReportDAL().ViewAllReports(report)); }
public ReportBO CreateNewReport(ReportBO patientReport) { LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory(); return(inchargeBLLFactory.CreateLabInchargeBLL().GetPatientReportsBLL().CreateReportDAL().InsertNewReport(patientReport)); }
public IEnumerable <ReportBO> UpdatePatientReport(ReportBO patientReport) { LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory(); return(inchargeBLLFactory.CreateLabInchargeBLL().GetPatientReportsBLL().CreateReportDAL().UpdatePatientReport_DAL(patientReport)); }
public void Save_Transaction(ReportBO bo) { ReportDAL dal = new ReportDAL(); dal.SaveReport(bo); }