public List <Paymentbalance> getAllPaymentsbalance() { List <Paymentbalance> paymentbalance = new List <Paymentbalance>(); string quary = "exec searchAllpaymentbalance"; SqlDataReader reader = new SystemDAL().executeQueryS(quary); // for many records go with while loop while (reader.Read()) { paymentbalance.Add(new Paymentbalance( reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), reader[4].ToString(), Convert.ToDouble(reader[5].ToString()), Convert.ToDouble(reader[6].ToString()), Convert.ToDouble(reader[7].ToString()))); } reader.Close(); return(paymentbalance); }
public List <MemPayments> getAllPayments() { List <MemPayments> Payment = new List <MemPayments>(); string quary = "exec searchAllPayments"; SqlDataReader reader = new SystemDAL().executeQueryS(quary); // for many records go with while loop while (reader.Read()) { Payment.Add(new MemPayments( reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), Convert.ToDouble(reader[4].ToString()), reader[5].ToString(), reader[6].ToString())); } reader.Close(); return(Payment); }
public MemPayments getAllPaymentsId(string Id) { MemPayments pro = null; string quary = "exec searchpaymentbyId '" + Id + "'"; SqlDataReader reader = new SystemDAL().executeQueryS(quary); // for many records go with while loop if (reader.Read()) { pro = new MemPayments( reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), Convert.ToDouble(reader[4].ToString()), reader[5].ToString(), reader[6].ToString()); } reader.Close(); return(pro); }
public List <schedule> getAllScheduledetails() { // TODO: Get All Schedule details List <schedule> schedules = new List <schedule>(); string quary = "exec searchAllSchedule"; SqlDataReader reader = new SystemDAL().executeQueryS(quary); // for many records go with while loop while (reader.Read()) { schedules.Add(new schedule( reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), reader[4].ToString(), reader[5].ToString(), reader[6].ToString())); } reader.Close(); return(schedules); }
public List <Order> getAllProducts() { List <Order> Order = new List <Order>(); string quary = "exec searchAllOrders"; SqlDataReader reader = new SystemDAL().executeQueryS(quary); while (reader.Read()) { Order.Add(new Order( reader[0].ToString(), reader[1].ToString(), Convert.ToDouble(reader[2].ToString()))); } reader.Close(); return(Order); }
public double addToOrder(LineProduct line, string oid) { double amount = 0.0; String quary = "insert into LineProductTb values('" + oid + "','" + line._product.EquipID + "'," + line._Quantity + "," + line._total + ")"; bool result = new SystemDAL().executeNonQueryS(quary); if (result) { string getTotalAmount = "select sum(Total) from LineProductTb where orderId='" + oid + "'"; SqlDataReader reader = new SystemDAL().executeQueryS(getTotalAmount); if (reader.Read()) { amount = Convert.ToDouble(reader[0]); } reader.Close(); } return(amount); }
private void btnSave_Click(object sender, RoutedEventArgs e) { int DocID = Convert.ToInt32(cmbDocs.SelectedValue); var doc = db.Doctor.Find(DocID); decimal HospitalFee = 500; decimal TotFee = doc.Fee + HospitalFee; int channelNum = 1; string query = "GetAppoinmentNum '" + DocID + "','" + dtpChannelDate.SelectedDate.ToString() + "'"; SqlDataReader reader = new SystemDAL().executeQuerys(query); if (reader.Read()) { string a = reader[0].ToString(); if (a != "") { channelNum = Convert.ToInt32(reader[0]) + 1; } } int roomNum = 0; string query1 = "makeAppoinment '" + dtpChannelDate.SelectedDate + "','" + DateTime.Now.ToShortTimeString() + "','" + TotFee + "','" + roomNum + "','" + channelNum + "','" + Convert.ToInt32(txtContact.Text) + "','" + DocID + "'"; bool res = new SystemDAL().executeNonQuerys(query1); if (res == true) { MessageBox.Show("You have successfully Made the Appoinment your Appoinment number is : " + channelNum); } else { MessageBox.Show("Something isnt ok please try again"); } // BIZ.Patient_Channel _Channel = new BIZ.Patient_Channel(); // //_Channel.ChannelDate = dtpChannelDate.SelectedDate.ToString(); // //_Channel.ChannelTime = DateTime.Now.ToShortTimeString(); // _Channel.Fee = TotFee; // _Channel.RoomNumber = 0; // _Channel.ChannelNumber = channelNum; //// _Channel.p }
private void Appoinmnets(int contact) { string query = "select * from [dbo].[Patient_Channel] where [Patient_Contact]='" + contact + "'"; SqlDataReader reader = new SystemDAL().executeQuerys(query); List <BIZ.Patient_Channel> channelList = new List <BIZ.Patient_Channel>(); BIZ.Patient_Channel channel = new BIZ.Patient_Channel(); while (reader.Read()) { channel = new BIZ.Patient_Channel(); channel.ID = Convert.ToInt32(reader[0]); channel.ChannelDate = Convert.ToDateTime(reader[1]); channel.ChannelTime = Convert.ToDateTime(reader[2]); channel.Fee = Convert.ToDecimal(reader[3]); channel.RoomNumber = Convert.ToInt32(reader[4]); channel.ChannelNumber = Convert.ToInt32(reader[5]); channelList.Add(channel); } dgvAppoinmnets.ItemsSource = channelList; }
public SalesReport rptSum() { SalesReport rpt = new SalesReport(); string query = "GetSumSalesReportDay '" + Date + "'"; SqlDataReader reader = new SystemDAL().executeQuerys(query); if (reader.Read()) { try { rpt.Price = Convert.ToDecimal(reader[0]); } catch (Exception) { rpt.Price = 0; } } return(rpt); }
public List <SalesReport> salesRpt() { List <SalesReport> pro = new List <SalesReport>(); string query = "GetSalesReportDay '" + Date + "'"; SqlDataReader reader = new SystemDAL().executeQuerys(query); while (reader.Read()) { try { pro.Add(new SalesReport(Convert.ToInt32(reader[0]), reader[1].ToString(), Convert.ToInt32(reader[2]), Convert.ToInt32(reader[3]), Convert.ToDecimal(reader[4]))); } catch (Exception ex) { Console.WriteLine(ex); } } reader.Close(); return(pro); }
public List <Drug_Report> DrugInvRpt() { List <Drug_Report> pro = new List <Drug_Report>(); string query = "drugInventryReportData"; SqlDataReader reader = new SystemDAL().executeQuerys(query); while (reader.Read()) { try { pro.Add(new Drug_Report(Convert.ToInt32(reader[0]), reader[1].ToString(), Convert.ToDecimal(reader[2]), reader[3].ToString(), Convert.ToInt32(reader[4]), reader[5].ToString(), reader[6].ToString(), Convert.ToInt32(reader[7]))); } catch (Exception ex) { Console.WriteLine(ex); } } reader.Close(); return(pro); }
public List <Purchase_Report> purchaseRptChart() { List <Purchase_Report> pro = new List <Purchase_Report>(); string query = "GetPurchaseReportChart '" + Date + "','" + Date2 + "'"; SqlDataReader reader = new SystemDAL().executeQuerys(query); while (reader.Read()) { try { pro.Add(new Purchase_Report(Convert.ToDateTime(reader[0]).ToShortDateString() + " " + reader[2].ToString(), Convert.ToInt32(reader[1]))); } catch (Exception ex) { Console.WriteLine(ex); } } reader.Close(); return(pro); }
private void dgvProductList_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (dgvProductList.SelectedItem != null) { if (dgvProductList.SelectedItem is BIZ.Drug_Inventory) { var row = (BIZ.Drug_Inventory)dgvProductList.SelectedItem; if (row != null) { id = row.ID; txtName.Text = row.Name; txtDiscription.Text = row.Description; cmbCategory.SelectedValue = row.Drug_Category; txtSellingPrice.Text = row.Unit_Selling_Price.ToString(); txtReorder.Text = row.Reorder_Level.ToString(); txtbuyingPrice.Text = row.Unit_Buying_Price.ToString(); txtType.Text = row.Drug_Type; txtShelf.Text = row.Shelf; string query = "select[Drug_Category_ID] from [dbo].[Drug_Inventory] where [ID]='" + id + "'"; SqlDataReader reader = new SystemDAL().executeQuerys(query); if (reader.Read()) { cmbCategory.SelectedValue = Convert.ToInt32(reader[0]); } } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void cmbDocs_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cmbDocs.SelectedIndex != -1) { int DocID = Convert.ToInt32(cmbDocs.SelectedValue); //BIZ.Doctor doctor = db.Doctor.Where(d => d.ID == DocID).FirstOrDefault(); //txtSpeclization.Text = doctor.Specilization.Name; var doc = db.Doctor.Find(DocID); decimal HospitalFee = 500; decimal TotFee = doc.Fee + HospitalFee; txtamount.Text = TotFee.ToString(); string query = "SELECT Specilizations.Name FROM Doctors INNER JOIN Specilizations" + " ON Doctors.Specilization_ID = Specilizations.ID where Doctors.ID = '" + DocID + "'"; SqlDataReader reader = new SystemDAL().executeQuerys(query); if (reader.Read()) { txtSpeclization.Text = reader[0].ToString(); } } }
public List <Drug_Report> DrugPurchasedMontlyAll() { List <Drug_Report> pro = new List <Drug_Report>(); string query = "DrugqtyPurchasedForTheMonthAll"; SqlDataReader reader = new SystemDAL().executeQuerys(query); while (reader.Read()) { try { string month = System.Globalization.CultureInfo. CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(reader[1])); pro.Add(new Drug_Report(reader[0].ToString(), month, reader[2].ToString(), reader[3].ToString(), Convert.ToInt32(reader[4]))); } catch (Exception ex) { Console.WriteLine(ex); } } reader.Close(); return(pro); }
private void btnFind_Click(object sender, RoutedEventArgs e) { try { int track = Convert.ToInt32(txtTrackNo.Text); dgvPresDetails.ItemsSource = db.Prescription_details.Where(p => p.TrackNo == track).ToList(); var sum = db.Prescription_details.Where(p => p.TrackNo == track).Sum(p1 => p1.Price); txtTotal.Text = sum.ToString(); string query = "select [Patient_Contact] from [dbo].[Prescriptions] where [TrackNo]='" + track + "'"; SqlDataReader reader = new SystemDAL().executeQuerys(query); if (reader.Read()) { txtContact.Text = reader[0].ToString(); } var priscription = db.Prescription.Where(p => p.TrackNo == track).FirstOrDefault(); } catch (Exception) { MessageBox.Show("Invalid Tracking No."); } }
public List <SalesReport> salesRptMonthlyRpt() { List <SalesReport> pro = new List <SalesReport>(); string query = "monthlySales"; SqlDataReader reader = new SystemDAL().executeQuerys(query); while (reader.Read()) { try { string month = System.Globalization.CultureInfo. CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(reader[1])); pro.Add(new SalesReport(reader[0].ToString(), month, Convert.ToDecimal(reader[2]))); } catch (Exception ex) { Console.WriteLine(ex); } } reader.Close(); return(pro); }