protected void uploadXray(object sender, EventArgs e) { if ("".Equals(name.Text)) { alertAndGoback("Pleas, input a name of X-ray"); return; } if( "".Equals(xRay.Value)) { alertAndGoback("Pleas, input a file of X-ray"); return; } if (xRay.Value.IndexOf(".asp") > -1 || xRay.Value.IndexOf(".jsp") > -1 || xRay.Value.IndexOf(".html") > -1) { alertAndGoback("Pleas, it is a wrong file"); return; } Data data = new Data(); data.add("pId", pId.Value); data.add("historyId", historyId.Value); data.add("TestResultID", testId.Value); data.add("path", WriteFile(xRay, testId.Value)); data.add("name", name.Text); biz.create(data); Data result = biz.view(data); xrayView.DataSource = result.Source; xrayView.DataBind(); }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isDoctor(Session)) { alertAndGoback("you are not a doctor. Please login"); return; } DBC dbc = new DBC(); Data data = new Data(); data.add("doctorId", UserInfo.getId(Session)); data.add("surgeryId", Param.get("surgeryId")); /*dbc.open(); result = dbc.select("SELECT * FROM DoctorsSurgery A, Users B WHERE A.UserID = B.UserID AND A.SurgeryID = @surgeryId", data); dbc.close();*/ SurgeryBiz biz = new SurgeryBiz(); Data result = biz.view(data); type.DataSource = biz.getType(data).Source; type.DataBind(); userNameLabel.Text = result.getString("UserSurName") + "," + result.getString("UserFirstName") + ",ID:" + result.getString("UserID"); ROS.Text = result.getString("UserROS"); DOS.Text = result.getString("UserDOS"); surgery_description.Text = result.getString("UserSD"); surgeryse.Text = result.getString("UserSSE"); Memo.Text = result.getString("Memo"); UserID.Text = result.getString("UserID"); SurgeryID.Text = result.getString("SurgeryID"); type.SelectedValue = result.getString("type"); ROS.SelectedValue = result.getString("ROS"); }
/// <summary> /// get a report for items /// </summary> /// <param name="data"></param> /// <returns></returns> public Data getItemReport(Data data) { String startDate = data.getString("startDate"); String endDate = data.getString("endDate"); String today = DateTime.Now.Date.ToString().Substring(0,10); if ("".Equals(startDate)) { data.add("startDate",today); } if ("".Equals(startDate)) { data.add("endDate", today); } String query = @"SELECT G.Item, G.Price, COUNT(M.ItemId) AS How_many_times, SUM(G.Price) AS Total FROM Medicine M, GeneralPayment G, history H WHERE H.historyId = M.historyId AND M.ItemId = G.ID AND M.state < 9 AND H.date >= CONVERT(datetime, @startDate, 103) AND H.date <= CONVERT(datetime, @endDate, 103) GROUP BY G.Item, G.price ORDER BY G.Item ASC"; return select(query, data); }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isMriOperator(Session)) { alertAndGoback("you are not a MRI operator. Please login"); return; } //DBC dbc = new DBC(); //dbc.open(); String hId = Param.getString("hId"); Data data = new Data(); data.add("doctorId", UserInfo.getId(Session)); //Data result = dbc.select("Select * From Users WHERE JobCode = 0 and UserID in (SELECT patientId FROM history WHERE staffId = @doctorId)", data); //dbc.close(); DoctorPatientsBiz biz = new DoctorPatientsBiz(); if (!"".Equals(hId)) { data.add("hId", hId); biz.done(data); } Data result = biz.list(Param.getString("searchField"), Param.getString("searchValue"), data); Patientlist.DataSource = result.Source; Patientlist.DataBind(); //error.Text = result.ErrorMessage; }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isReceptionist(Session)) { alertAndGoback("PLEASE, LOGIN"); return; } if (Text.isEmpty(Param.getString("historyId"))) { alertAndGoback("please, select a history id"); } Receptionist rec = new Receptionist(); Data result = rec.view(Param); Data pParam = new Data(); pParam.add("searchValue", result.get("UserID")); pParam.add("searchField", "UserID"); Data patient = rec.getPatient(pParam); Data staffList = rec.getStaff(Param); patientId.DataSource = patient.Source; patientId.DataBind(); staffId.DataSource = staffList.Source; staffId.DataBind(); historyId.Text = result.getString("historyId"); memo.Text = result.getString("memo"); patientId.SelectedValue = result.getString("patientId"); staffId.SelectedValue = result.getString("staffId"); date.Text = result.getString("date").Substring(0, 10); }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isDoctor(Session)) { alertAndGoback("you are not a doctor. Please login"); return; } DBC dbc = new DBC(); //dbc.open(); Data data = new Data(); data.add("doctorId", UserInfo.getId(Session)); data.add("orderId", Param.get("orderId")); OrderBiz doctor = new OrderBiz(); Data result = doctor.view(data); //result = dbc.select("SELECT * FROM DoctorsOrder A, Users B WHERE A.UserID = B.UserID AND A.orderId = @orderId", data); //dbc.close(); userNameLabel.Text = result.getString("UserID"); UserOD.Text = result.getString("UserOD"); UsermedCheck.SelectedValue = result.getString("UsermedCheck"); Usermed.Text = result.getString("Usermed"); Usernas.SelectedValue = result.getString("Usernas"); Userdosage.Text = result.getString("Userdosage"); Userside.Text = result.getString("Userside"); UserNAA.SelectedValue = result.getString("UserNAA"); Memo.Text = result.getString("Memo"); UserID.Text = result.getString("UserID"); OrderID.Text = result.getString("orderId"); }
protected void delete(string pId, string roomId) { Data data = new Data(); data.add("PatientID", pId); data.add("RoomID", roomId); AssignBiz assign = new AssignBiz(); assign.delete(data); go("/hospital/aspx/nurse/patientroom/assign.aspx?RoomID=" + roomId); }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isReceptionist(Session)) { alertAndGoback("PLEASE, LOGIN"); return; } float rate; Data data = new Data(); pId.Value = Param.getString("pId"); data.add("patientId", Param.getString("pId")); List<Data> result = biz.view(data); rate = float.Parse(result[2].getString("rate")); rate = 100 - rate; int count = result[0].Count; float total = 0; for (int i = 0; i < count; i++) { float price = float.Parse(result[0].getString(i,"Price")); if ("0".Equals(result[0].getString(i, "insuranceState"))) { price = (price * rate) / 100; } price = (price - price % (float)0.01); result[0].add(i, "afterPrice", price); result[0].add(i, "date", result[0].getString(i, "date").Substring(0, 10)); total += price; } count = result[1].Count; for (int i = 0; i < count; i++) { float price = float.Parse(result[1].getString(i, "T_Price")); if ("0".Equals(result[1].getString(i, "insuranceState"))) { price = (price * rate) / 100; } price = (price - price % (float)0.01); result[1].add(i, "afterPrice", price); result[1].add(i, "date", result[1].getString(i, "date").Substring(0, 10)); total += price; } historyView.DataSource = result[0].Source; historyView.DataBind(); medicineView.DataSource = result[1].Source; medicineView.DataBind(); User userBiz = new User(); data.add("userId", pId.Value ); Data pData = userBiz.view(data); userInfo.Text = pData.getString("UserID") + " [" + pData.getString("UserFirstName") + ", " + pData.getString("UserSurName") + "]"; totalPrice.Text = total.ToString(); USEREMAIL.Text = pData.getString("Email"); INSURANNUMBER.Text = pData.getString("InsuranceNumber"); CREATEDDATE.Text = DateTime.Now.Date.ToString().Substring(0, 10); }
protected void onLogin(object sender, EventArgs e) { Data param = new Data(); param.add("id", id.Text); param.add("pwd", pwd.Text); User user = new User(); user.login(param, Session); if (!UserInfo.getLoginState(Session).Equals("OK")) { alertAndGoback(UserInfo.getLoginState(Session)); } if (UserInfo.IsAdmin(Session)) { go("/hospital/aspx/admin/user/list.aspx"); } else if (UserInfo.isReceptionist(Session)) { go("/hospital/aspx/receptionist/book/list.aspx"); } else if (UserInfo.isXrayOperator(Session)) { go("~/aspx/xray/patients/list.aspx"); } else if (UserInfo.isPharmacist(Session)) { go("/hospital/aspx/pharmacist/patients/list.aspx"); } else if (UserInfo.isCheif(Session)) { go("/hospital/aspx/nurse/patientroom/list.aspx"); } else if (UserInfo.isMriOperator(Session)) { go("~/aspx/MRI/patients/list.aspx"); } else if (UserInfo.IsSysAdmin(Session)) { go("~/aspx/payment/general/list.aspx"); } else if (UserInfo.isDoctor(Session)) { go("~/aspx/doctor/patients/list.aspx"); } else if (UserInfo.isNurse(Session)) { go("~/aspx/nurse/patients/list.aspx"); } }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isNurse(Session)) { alertAndGoback("you are not a nurse. Please login"); return; } Data data = new Data(); data.add("nurseId", UserInfo.getId(Session)); nurseID.Text = UserInfo.getId(Session); data.add("pID", Param.getString("pId")); UserID.Text = Param.getString("pId"); userNameLabel.Text = Param.getString("pId"); }
/// <summary> /// select patient /// </summary> /// <param name="field"></param> /// <param name="value"></param> /// <param name="data"></param> /// <returns></returns> public Data list(Data data) { String today = DateTime.Now.Date.ToString().Substring(0, 10); data.add("today", today); String query = @"SELECT *, (SELECT COUNT(*) FROM NursesForm N WHERE N.UserID = P.PatientID AND N.state = 0 AND N.date = convert(datetime, @today, 103) )AS Observation FROM Room R, patientRoom P, Users U WHERE P.Room = R.RoomID AND R.UserId = @NurseID AND U.UserID = P.PatientID AND P.StartDate <= convert(datetime, @today, 103) AND P.EndDate >= convert(datetime, @today, 103) ORDER BY P.PatientID ASC"; Data result = select(query, data); int count = result.Count; for (int i = 0; i < count; i++) { result.add(i, "StartDate", result.getString(i, "StartDate").Substring(0,10)); result.add(i, "EndDate", result.getString(i, "EndDate").Substring(0, 10)); } return result; }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isDoctor(Session)) { alertAndGoback("you are not a doctor. Please login"); return; } Data result = new Data(); DBC dbc = new DBC(); Data data = new Data(); data.add("doctorId", UserInfo.getId(Session)); data.add("testresultId", Param.get("testresultId")); /*dbc.open(); result = dbc.select("SELECT * FROM DoctorsTestResult A, Users B WHERE A.UserID = B.UserID AND A.TestResultID = @testresultId", data); dbc.close();*/ TestResultBiz biz = new TestResultBiz(); result = biz.view(data); userNameLabel.Text = result.getString("UserSurName") + "," + result.getString("UserFirstName") + ",ID:" + result.getString("UserID"); DOT.Text = result.getString("DOT"); OR1.SelectedValue = result.getString("UserOR1"); OR2.SelectedValue = result.getString("UserOR2"); OR3.SelectedValue = result.getString("UserOR3"); OR4.SelectedValue = result.getString("UserOR4"); OR5.SelectedValue = result.getString("UserOR5"); OR6.SelectedValue = result.getString("UserOR6"); ORT1.Text = result.getString("UserORT1"); ORT2.Text = result.getString("UserORT2"); ORT3.Text = result.getString("UserORT3"); ORT4.Text = result.getString("UserORT4"); ORT5.Text = result.getString("UserORT5"); ORT6.Text = result.getString("UserORT6"); other_abnormalities.Text = result.getString("other_abnormalities"); Memo.Text = result.getString("Memo"); UserID.Text = result.getString("UserID"); TestResultID.Text = result.getString("TestResultID"); XrayBiz xBiz = new XrayBiz(); Data xData = new Data(); xData.add("TestResultID", Param.get("testresultId")); Data xrayData = xBiz.view(xData); xrayView.DataSource = xrayData.Source; xrayView.DataBind(); MRIBiz mBiz = new MRIBiz(); Data MriData = mBiz.view(xData); MRIView.DataSource = MriData.Source; MRIView.DataBind(); }
protected override void Fire(object sender, EventArgs e) { bool isOkay = false; if (UserInfo.isNurse(Session) || UserInfo.isDoctor(Session)) { isOkay = true; } if (!isOkay) { alertAndGoback("you are not a nurse. Please login"); return; } Data data = new Data(); data.add("nurseId", UserInfo.getId(Session)); if (!"".Equals(Param.getString("pId"))) { data.add("pID", Param.get("pId")); } else { data.add("cntId", Param.get("cntId")); } ObservationBiz updateview = new ObservationBiz(); Data result = updateview.view(data); userNameLabel.Text = result.getString("UserID"); head.SelectedValue = result.getString("head"); ear.SelectedValue = result.getString("ear"); drum.SelectedValue = result.getString("drum"); nose.SelectedValue = result.getString("nose"); sinus.SelectedValue = result.getString("sinus"); mouth.SelectedValue = result.getString("mouth"); eye.SelectedValue = result.getString("eye"); opthal.SelectedValue = result.getString("opthal"); pupil.SelectedValue = result.getString("pupil"); ocular.SelectedValue = result.getString("ocular"); lung.SelectedValue = result.getString("lung"); heart.SelectedValue = result.getString("heart"); vascular.SelectedValue = result.getString("vascular"); abdomen.SelectedValue = result.getString("abdomen"); memo.Text = result.getString("memo"); UserID.Text = result.getString("UserID"); ObservationID.Text = result.getString("id"); date.Text = result.getString("date"); }
/// <summary> /// create a new surgery data /// </summary> /// <param name="data"></param> /// <returns></returns> public override bool create(Data data) { dbc = new DBC(); dbc.open(); Object SurgeryID = dbc.select("SELECT COUNT(SurgeryID) + 1 AS MAX_ID FROM DoctorsSurgery", data).get("MAX_ID"); data.add("SurgeryID", SurgeryID); dbc.update(@"INSERT INTO DoctorsSurgery (DoctorID, SurgeryID, type, UserID, UserDOS, UserROS, UserSD, UserSSE, Memo, state) VALUES (@DoctorID, @SurgeryID, @type, @UserID, convert(datetime, @DOS, 103), @ROS, @surgery_description, @surgeryse, @Memo, 0)", data); data.add("historyId", dbc.select(@"SELECT MAX(historyId) +1 AS MAX_ID FROM history", data).get("MAX_ID")); // based on the type, patient's payment price will be decided. dbc.update(@"INSERT INTO history (patientId, historyId, staffId, memo, type, cntId, date, payId) VALUES (@UserID, @historyId, @DoctorID, @Memo, 2, @SurgeryID, CONVERT(datetime, @DOS, 103), @type)", data); dbc.close(); return true; }
protected void onComplete(object sender, EventArgs e) { Data data = new Data(); DoctorPatientsBiz dBiz = new DoctorPatientsBiz(); data.add("hId", Param.getString("historyId")); dBiz.done(data); go("~/aspx/xray/patients/list.aspx"); }
protected override void Fire(object sender, EventArgs e) { Data data = new Data(); data.add("DeptName", Param.get("DeptName")); RoomBiz biz = new RoomBiz(); Data result = biz.list(data); RoomList.DataSource = result.Source; RoomList.DataBind(); }
/// <summary> /// create new data for nurse form and update patient history /// </summary> /// <param name="data"></param> /// <returns></returns> public override bool create(Data data) { String today = DateTime.Now.Date.ToString().Substring(0, 10); data.add("today", today); dbc = new DBC(); dbc.open(); Object ID = dbc.select("SELECT COUNT(id) + 1 AS MAX_ID FROM NursesForm", data).get("MAX_ID"); data.add("id", ID); dbc.update(@"INSERT INTO NursesForm (UserID, id, head, ear, drum, nose, sinus, mouth, eye, opthal, pupil, ocular, lung, heart, vascular, abdomen, memo, date, state) VALUES (@UserID, @id, @head, @ear, @drum, @nose, @sinus, @mouth, @eye, @opthal, @pupil, @ocular, @lung, @heart, @vascular, @abdomen, @memo, convert(datetime, @today, 103), 0)", data); data.add("historyId", dbc.select(@"SELECT MAX(historyId) +1 AS MAX_ID FROM history", data).get("MAX_ID")); dbc.update(@"INSERT INTO history (patientId, historyId, staffId, memo, type, cntId, date, payId) VALUES (@UserID, @historyId, @nurseID, @memo, 3, @id, getDate(), 14)", data); dbc.close(); return true; }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isNurse(Session)) { alertAndGoback("you are not a nurse. Please login"); return; } Data data = new Data(); roomLabel.Text = Param.getString("Room"); data.add("nurseId", UserInfo.getId(Session)); data.add("RoomID", Param.get("RoomID")); NurseID.Text = Param.getString("nurseId"); AssignBiz assign = new AssignBiz(); Data patients = assign.getPatients(data); patientroom.DataSource = patients.Source; patientroom.DataBind(); }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.IsSysAdmin(Session)) { alertAndGoback("you are not a system administrator. Please login"); return; } Data data = new Data(); data.add("insuranceId", Param.get("insuranceId")); }
protected void onChange(object sender, EventArgs e) { Data data = new Data(); data.add("doctorId", UserInfo.getId(Session)); data.add("pID", Param.get("pId")); data.add("pre", pre.SelectedValue); DoctorBiz doctor = new DoctorBiz(); Data result = doctor.list(Param.getString("searchFiled"), Param.getString("searchValue"), data); pId.Value = data.getString("pID"); DoctorID.Value = data.getString("doctorId"); int count = result.Count; for (int i = 0; i < count; i++) { result.add(i, "date", result.getString(i, "date").Substring(0, 10)); } patienthistory.DataSource = result.Source; patienthistory.DataBind(); userNameLabel.Text = result.getString("UserSurName") + "," + result.getString("UserFirstName") + ",ID:" + result.getString("UserID"); }
/// <summary> /// create a report for payment /// </summary> /// <param name="data"></param> /// <returns></returns> public override bool create(Data data) { String date = DateTime.Now.Date.ToString().Substring(0, 10); data.add("date", date); data.add("total", float.Parse(data.getString("total"))); String getId = "SELECT COUNT(*) + 1 AS NEW_ID FROM PaymentReport"; String query = "UPDATE history SET payState = 1 WHERE PatientID = @PatientID"; String mQuery = "UPDATE Medicine SET state = 1 WHERE historyId in (SELECT historyId FROM history WHERE PatientID = @PatientID)"; String createQuery = @"INSERT INTO PaymentReport (PaymentReportID, UserID, reportFilePath, total, date) VALUES (@PaymentReportID, @PatientID, @reportFilePath, @total, convert(datetime, @date, 103))"; dbc = new DBC(); dbc.open(); Object id = dbc.select(getId, new Data()).get("NEW_ID"); data.add("PaymentReportID", id); dbc.update(query, data); dbc.update(mQuery, data); dbc.update(createQuery, data); dbc.close(); return true; }
/// <summary> /// delete a patient from a room /// </summary> /// <param name="data"></param> /// <returns></returns> public override bool delete(Data data) { String today = DateTime.Now.Date.ToString().Substring(0, 10); data.add("today", today); String query = "UPDATE PatientRoom SET EndDate = convert(datetime, @today, 103) WHERE Room = @RoomID AND PatientID = @PatientID"; DBC dbc = new DBC(); dbc.open(); dbc.update(query, data); //dbc.update(@"DELETE From PatientRoom WHERE PatientID = @PatientID", data); dbc.close(); return true; }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isDoctor(Session)) { alertAndGoback("you are not a doctor. Please login"); return; } Data data = new Data(); data.add("doctorId", UserInfo.getId(Session)); data.add("pID", Param.get("pId")); DoctorBiz doctor = new DoctorBiz(); Data result = doctor.list(Param.getString("searchFiled"), Param.getString("searchValue"), data); pId.Value = data.getString("pID"); DoctorID.Value = data.getString("doctorId"); patienthistory.DataSource = result.Source; patienthistory.DataBind(); userNameLabel.Text = result.getString("UserSurName") + "," + result.getString("UserFirstName") + ",ID:" + result.getString("UserID"); }
/// <summary> /// create a new X-ray data /// </summary> /// <param name="data"></param> /// <returns></returns> public override bool create(Data data) { String getId = "SELECT COUNT(*) + 1 AS NEW_ID FROM XRay"; String query = "INSERT INTO XRay (XRayID, TestResultID, name, path) VALUES (@XRayID, @TestResultID, @name, @path)"; dbc = new DBC(); dbc.open(); String id = dbc.select(getId, new Data()).getString("NEW_ID"); data.add("XRayID", id); dbc.update(query, data); dbc.close(); return true; }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isPharmacist(Session)) { alertAndGoback("you are not a Pharmacist. Please login"); return; } String hId = Param.getString("hId"); Data data = new Data(); data.add("doctorId", UserInfo.getId(Session)); PharmacistBiz biz = new PharmacistBiz(); if (!"".Equals(hId)) { data.add("hId", hId); biz.done(data); } Data result = biz.list(Param.getString("searchField"), Param.getString("searchValue"), data); Patientlist.DataSource = result.Source; Patientlist.DataBind(); }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isCheif(Session)) { alertAndGoback("you are not a cheif nurse. Please login"); return; } if( !"".Equals(Param.getString("pId"))) { delete(Param.getString("pId"), Param.getString("RoomID")); return; } String today = DateTime.Now.Date.ToString().Substring(0, 10); DBC dbc = new DBC(); Data data = new Data(); data.add("RoomID", Param.get("RoomID")); data.add("CaptID", UserInfo.getId(Session)); //data.add("PatientID", Param.get("PatientID")); AssignBiz assign = new AssignBiz(); Data result = assign.view(data); Data patients = assign.getPatients(data); roomLabel.Text = result.getString("RoomID"); Room.Text = result.getString("RoomID"); BedNumber.Text = result.getString("Beds"); Level.Text = result.getString("LevelNumber"); DeptName.Text = result.getString("DeptID"); Data newPatient = assign.patientlist(data); for (int i = 0; i < patients.Count; i++) { patients.add(i, "StartDate", patients.getString(i, "StartDate").Substring(0, 10)); patients.add(i, "EndDate", patients.getString(i, "EndDate").Substring(0, 10)); } PatientList.DataSource = patients.Source; PatientList.DataBind(); historyId.DataSource = newPatient.Source; historyId.DataBind(); StartDate.Text = today; }
/// <summary> /// create a new item /// </summary> /// <param name="data"></param> /// <returns></returns> public override bool create(Data data) { String getId = "SELECT MAX(ID) + 1 AS NEW_ID FROM GeneralPayment"; String query = @"INSERT INTO GeneralPayment (ID, Item, Type, Price) VALUES (@NEW_ID, @ItemTextBox, @TypeDropDownList, @PriceTextBox)"; dbc = new DBC(); dbc.open(); Object id = dbc.select(getId, new Data()).get("NEW_ID"); data.add("NEW_ID", id); dbc.update(query, data); dbc.close(); return true; }
/// <summary> /// select patient /// </summary> /// <param name="field"></param> /// <param name="value"></param> /// <param name="data"></param> /// <returns></returns> public Data list(Data data) { string today = DateTime.Now.Date.ToString().Substring(0, 10); data.add("today", today); String query = @"Select R.*, (SELECT COUNT(*) FROM PatientRoom WHERE Room = R.RoomID AND StartDate <= convert(datetime, @today, 103) AND EndDate >= convert(datetime, @today, 103)) AS P_COUNT FROM Room R WHERE DeptID = 'Oncology' ORDER BY RoomID DESC"; return select(query, data); }
/// <summary> /// create a medicine data /// </summary> /// <param name="data"></param> /// <returns></returns> public override bool create(Data data) { String getId = "SELECT COUNT(*) + 1 AS NEW_ID FROM Medicine "; String query = @"INSERT INTO Medicine (medicineId, UserID, historyId, Quantity, itemId) VALUES (@medicineId, @UserID, @historyId, @Quantity, @itemId)"; dbc = new DBC(); dbc.open(); Object id = dbc.select(getId, new Data()).get("NEW_ID"); data.add("medicineId", id); dbc.update(query, data); dbc.close(); return true; }
/// <summary> /// create a new insurance data /// </summary> /// <param name="data"></param> /// <returns></returns> public override bool create(Data data) { String getId = "SELECT MAX(insuranceId) + 1 AS NEW_ID FROM Insurance"; String query = @"INSERT INTO Insurance (insuranceId, insuranceName, rate, state) VALUES (@insuranceId, @insuranceName, @rate, 0)"; dbc = new DBC(); dbc.open(); Object id = dbc.select(getId, new Data()).get("NEW_ID"); data.add("insuranceId", id); dbc.update(query, data); dbc.close(); return true; }