예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="month"></param>
        /// <param name="year"></param>
        /// <returns></returns>
        //   public static bool ViewReport(int month, int year)
        // {
        //first check to see if there is a summary file
        //    string[] myreport = { "" };
        //    string thismonth = getMonthName(month.ToString());
        //    string filename = year.ToString() + "_" + thismonth + ".txt";

        //    // first try to open the summary file
        //    try
        //    {
        //        myreport = FileSupport.ReadAllLines(@"c:/ooems/BillingFiles/MonthlySummaries/" + filename);

        //        return BillingSummary.DisplayBillingSummary(myreport);
        //    }
        //    // First catch a directory not found exception this means a directory does not exist for that location
        //    catch (DirectoryNotFoundException)
        //    {
        //        // Create directory.
        //        DirectoryInfo di = Directory.CreateDirectory(@"c:/ooems/BillingFiles/MonthlySummaries/");

        //        try
        //        {
        //            //If by some miracle that creating the directory and this call the file was placed there.
        //            myreport = FileSupport.ReadAllLines(@"c:/ooems/BillingFiles/MonthlySummaries/" + filename);
        //            return BillingSummary.DisplayBillingSummary(myreport);
        //        }
        //        // created the directory however the file does not exist, then we must read the response file, parse it, save the summary then
        //        // display the summary
        //        catch (FileNotFoundException)
        //        {
        //            try
        //            {
        //                myreport = FileSupport.ReadAllLines(@"c:/ooems/BillingFiles/MonthlyResponse/" + filename);

        //                BillingSummary.CalculateResponse(myreport, filename);
        //            }
        //            catch (FileNotFoundException)
        //            {
        //                Console.WriteLine("No response file found.\n");
        //                return false;
        //            }
        //            catch (Exception ex)
        //            {
        //                Console.WriteLine(ex.Message);
        //                return false;
        //            }
        //        }
        //        catch (Exception ex)
        //        {
        //            Console.WriteLine(ex.Message);
        //            return false;
        //        }
        //    }
        //    // Basically does the same thing again as above
        //    catch (FileNotFoundException)
        //    {
        //        try
        //        {
        //            myreport = FileSupport.ReadAllLines(@"c:/ooems/BillingFiles/MonthlyResponse/" + filename);

        //            BillingSummary.CalculateResponse(myreport, filename);
        //        }
        //        catch
        //        {
        //            Console.WriteLine("No response file found.\n");
        //            return false;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.WriteLine(ex.Message);
        //        return false;
        //    }
        //    //this function always returns true.
        //    return true;
        //}

        /// <summary>
        /// Parses the billing record database, and pulls all of the records into a single monthly bill.
        /// </summary>
        /// <param name="month"> month for the bill to be made</param>
        private void GenerateMonthlyBillRecord()
        {
            // Billing accessor to add line to the
            BillingRecordsAccessor dal    = new BillingRecordsAccessor();
            BillingRecord          record = new BillingRecord();

            dal.InsertNewRecord(record);
        }
예제 #2
0
        public static bool AddBillingCode(Appointment apt, string[] codes1)
        {
            BillingRecordsAccessor dal = new BillingRecordsAccessor();

            string money = "";

            try
            {
                //This is to be comented out if the date arrives in the correct format, otherwise use it
                string day   = apt.DateTime.Day.ToString();
                string month = apt.DateTime.Month.ToString();
                string year  = apt.DateTime.Year.ToString();
                if (apt.DateTime.Day.ToString().Length < 2)
                {
                    day = "0" + day;
                }
                if (apt.DateTime.Month.ToString().Length < 2)
                {
                    month = "0" + month;
                }
                if (apt.DateTime.Year.ToString().Length < 2)
                {
                    year = "0" + year;
                }

                string Date = year + month + day;

                //Now get the info from the appointment object,
                string Gender = apt.PatientHCN.Sex.ToString();

                foreach (string code in codes1)
                {
                    // here we search the database for the code
                    if (dal.CheckBillingCode(code))
                    {
                        money = dal.SearchBillingCode(code);
                    }
                    else
                    {
                        throw new ArgumentException(string.Format("Invalid Billing Code: {0}", code));
                    }

                    Billing BillingEntry = new Billing(month, Date, apt.PatientHCN.HCN.ToString(), char.Parse(Gender), code, money);
                    BillingEntry.GenerateMonthlyBillRecord();
                }
            }
            catch (ArgumentException e)
            {
                throw e;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            throw new BillingRecallException("Flag For Recall?");
        }