public static List <Bill> GetAllBillingRecords() { BillTableAdapter taBilling = new BillTableAdapter(); var dtBilling = taBilling.GetData(); List <Bill> allBilling = new List <Bill>(); foreach (dsUltimateMedDB.BillRow billingRow in dtBilling.Rows) { Bill currentBill = new Bill { PatientType = billingRow.PatientType, DoctorCharge = billingRow.DoctorCharge, LabCharge = billingRow.LabCharge, OperationCharge = billingRow.OperationCharge, RoomCharge = billingRow.RoomCharge, MedicineCharge = billingRow.MedicineCharge, NursingCharge = billingRow.NursingCharge, InsuranceCarrier = billingRow.InsuranceCarrier }; decimal total = currentBill.DoctorCharge + currentBill.LabCharge + currentBill.OperationCharge + currentBill.NursingCharge + currentBill.MedicineCharge + currentBill.RoomCharge; currentBill.BillTotal = total; currentBill.AddBill(currentBill); allBilling.Add(currentBill); } return(allBilling); }
public static void AssignNewBill(Bill newBill, string Name) { PatientTableAdapter taBill = new PatientTableAdapter(); int pid = (int)taBill.GetPatientID(Name); BillTableAdapter taNewBill = new BillTableAdapter(); //Returns the Bill_id so that we may assign it in the Patient_Bill Connector Table. var ScopeID = taNewBill.AddBillReturnScopeID(newBill.PatientType, newBill.MedicineCharge, newBill.DoctorCharge, newBill.RoomCharge, newBill.OperationCharge, newBill.NursingCharge, newBill.LabCharge, newBill.BillTotal, newBill.InsuranceCarrier); //Add row to Patient_Bill table using PID and Bill_id taNewBill.InsertBillByPidScopeID(pid, Convert.ToInt32(ScopeID)); //Add Bill to our Bills list //Bills.Add(newBill); }
public static List <Bill> GetBillsByPid(int pid) { List <Bill> PatientBills = new List <Bill>(); BillTableAdapter taBills = new BillTableAdapter(); var dtBills = taBills.GetBillingByPID(pid); foreach (dsUltimateMedDB.BillRow billingRow in dtBills) { Bill currentBill = new Bill { PatientType = billingRow.PatientType, DoctorCharge = billingRow.DoctorCharge, LabCharge = billingRow.LabCharge, OperationCharge = billingRow.OperationCharge, RoomCharge = billingRow.RoomCharge, MedicineCharge = billingRow.MedicineCharge, NursingCharge = billingRow.NursingCharge, InsuranceCarrier = billingRow.InsuranceCarrier }; PatientBills.Add(currentBill); } return(PatientBills); }
protected void btn_confirm_click(object sender, EventArgs e) { Connect connect = new Connect(); string sql; //为了将bookpath完整的表现出来,目前差一个后缀 string[] book = new string[200]; string[] cbook = new string[200]; Corporation corporation = (Corporation)Session["corporation"]; int corporationid = corporation.id; CorpoBooktypeTableAdapter ta_corpo = new CorpoBooktypeTableAdapter(); DataTable dt_corpo = ta_corpo.GetCBookTypeByTwo(Convert.ToInt32(rbl_menu.SelectedItem.Value), corporationid); if (dt_corpo.Rows.Count > 0) { //避免目录的重复购买 Response.Write("<script language='javascript'>alert('您已经购买过此目录,不能继续进行购买');</script>"); } else { if (Convert.ToInt32(lbl_allprice.Text) > 0) { string name; int price; if (rbl_menu.SelectedItem != null) { name = rbl_menu.SelectedItem.Text.ToString(); AdminBooktypeTableAdapter ta_book = new AdminBooktypeTableAdapter(); DataTable dt_book = ta_book.GetAdminBooktypeByName(name); price = Convert.ToInt32(dt_book.Rows[0]["price"]); int buycount = Convert.ToInt32(txtBuycount.Value); int allprice = price * buycount; lbl_allprice.Text = allprice.ToString(); int day = buycount; int book_type = Convert.ToInt32(rbl_menu.SelectedItem.Value); //通过insertbill数据来表明账单已经产生 BillTableAdapter ta_bill = new BillTableAdapter(); ta_bill.InsertBill(DateTime.Now.ToString(), day, allprice, 1, corporationid); DataTable dt_bill = ta_bill.GetCurrentBill(); //bill_id是在企业中显示他们买了哪些目录,以便显示出他们拥有的目录 int bill_id = Convert.ToInt32(dt_bill.Rows[0]["id"]); sql = "insert into Billtype (bill_id,abooktype_id) values (" + bill_id + "," + book_type + ")"; connect.ExecuteSql(sql); string book_path = "corporation/upload/" + corporation.name; /*购买了目录,那么目录就会全部移植到cbooktype和cbook,cbt中*/ //开始进行booktype表的转移 a[i] = Convert.ToInt32(rbl_menu.SelectedItem.Value); //递归来进行booktype的转移 MoveMenu(a[i]); //得到a数组中保存的booktype的id,全部insert到子公司目录中 int j = 0; while (j <= i) { sql = "insert into CorpoBooktype (abooktype_id,name,price,parent_id,corporation_id) select id,name,price,parent_id," + corporationid + " as corporation_id from AdminBooktype where id=" + a[j]; connect.ExecuteSql(sql); j++; } //开始进行book表的转移 int k = 0; int n = -1; int q = 0; while (k <= i) { AdminBookTableAdapter ta_admin = new AdminBookTableAdapter(); DataTable dt_admin = ta_admin.GetBookByBooktypeId(a[k]); if (dt_admin.Rows.Count > 0) { for (q = 0; q < dt_admin.Rows.Count; q++) { ++n; book[n] = dt_admin.Rows[q]["url"].ToString(); string[] split = book[n].Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); cbook[n] = book_path + "/" + split[3]; } } ++k; } k = 0; while (k <= n) { sql = "insert into CorpoBook (abook_id,corporation_id,name,url,star,author,keyword,score,filetype) " + "select id," + corporationid + " as corporation_id,name,'" + cbook[k] + "' as book_path,star,author,keyword,score,filetype FROM AdminBook inner join AdminBT on AdminBT.abook_id = AdminBook.id " + " where AdminBook.url='" + book[k] + "'"; connect.ExecuteSql(sql); ++k; } //开始进行bt表的转移 int m = 0; while (m <= i) { sql = "insert into CorpoBT (cbook_id,cbooktype_id,corporation_id) select abook_id,abooktype_id," + corporationid + " as corporation_id from AdminBT where abooktype_id = " + a[m]; connect.ExecuteSql(sql); m++; } Response.Write("<script language='javascript'>alert('购买成功,可进入订单列表查看');</script>"); } else { Response.Write("<script language='javascript'>alert('未选定目录');</script>"); } } } }