public List <Patient> GetUnPaidBiilInfo(UnPaidBill unPaidBill) { Query = "SELECT DISTINCT BillNo,NameOfPatient, MobileNo, Total FROM PatientRecord INNER JOIN BillingInfo ON PatientRecord.PatientId=BillingInfo.PatientId WHERE Status='unpaid' AND Date BETWEEN @fromdate AND @todate"; Command = new SqlCommand(Query, Connection); Connection.Open(); Command.Parameters.Clear(); Command.Parameters.Add("fromdate", SqlDbType.DateTime); Command.Parameters["fromdate"].Value = unPaidBill.FromDate; Command.Parameters.Add("todate", SqlDbType.DateTime); Command.Parameters["todate"].Value = unPaidBill.ToDate; Reader = Command.ExecuteReader(); List <Patient> aList = new List <Patient>(); while (Reader.Read()) { Patient aPatient = new Patient(); aPatient.PatientName = Reader["NameOfPatient"].ToString(); aPatient.BillNo = Reader["BillNo"].ToString(); aPatient.MobileNo = Reader["MobileNo"].ToString(); aPatient.Total = (double)Reader["Total"]; aList.Add(aPatient); } Connection.Close(); return(aList); }
public List <Patient> GetUnPaidBiilInfo(UnPaidBill aBill) { UnpaidGateWay aGateWay = new UnpaidGateWay(); return(aGateWay.GetUnPaidBiilInfo(aBill)); }
protected void showButton_Click(object sender, EventArgs e) { UnpaidManager aManager = new UnpaidManager(); List <Patient> unPaidBilList = new List <Patient>(); UnPaidBill aBill = new UnPaidBill(); aBill.FromDate = Convert.ToDateTime(fromDateTextBox.Value); aBill.ToDate = Convert.ToDateTime(toDateTextBox.Value); double total = 0; unPaidBilList = aManager.GetUnPaidBiilInfo(aBill); showGridView.DataSource = unPaidBilList; showGridView.DataBind(); foreach (GridViewRow row in showGridView.Rows) { total += Convert.ToDouble(((Label)row.FindControl("totalLabel")).Text); } totalTextBox.Text = total.ToString(); }