public PatientForPayment GetPaymentInfo(PatientForPayment patient) { Query = "SELECT Total,Date FROM PatientRecord INNER JOIN BillingInfo ON PatientRecord.PatientId=BillingInfo.PatientId WHERE (Status='unpaid' AND MobileNo=@mobileNo) OR (Status='unpaid' AND BillNo=@billNo)"; // Query = "SELECT Total,Date FROM PatientRecord INNER JOIN BillingInfo ON PatientRecord.PatientId=BillingInfo.PatientId WHERE (Status='unpaid' AND MobileNo='" + patient.MobileNo + "') OR (Status='unpaid' AND BillNo='" + patient.BillNo + "')"; Command = new SqlCommand(Query, Connection); Connection.Open(); Command.Parameters.Clear(); Command.Parameters.Add("mobileNo", SqlDbType.VarChar); Command.Parameters["mobileNo"].Value = patient.MobileNo; Command.Parameters.Add("billNo", SqlDbType.VarChar); Command.Parameters["billNo"].Value = patient.BillNo; Reader = Command.ExecuteReader(); PatientForPayment aPatient = new PatientForPayment(); while (Reader.Read()) { aPatient.Total = (double)Reader["Total"]; aPatient.DOB = (DateTime)Reader["Date"]; } Reader.Close(); Connection.Close(); return(aPatient); }
protected void payButton_Click(object sender, EventArgs e) { PatientForPayment patient = new PatientForPayment(); patient.BillNo = billNoTextBox.Text; patient.MobileNo = mobileNoTextBox.Text; messageLabel.Text = aPaymentManager.PayAmmount(patient); payButton.Enabled = false; ClearTextBoxes(); }
public string PayAmmount(PatientForPayment patient) { int rowAffected = aPaymentGateway.PayAmmount(patient); if (rowAffected > 0) { return("Successfully paid"); } else { return("failed"); } }
protected void searchButton_Click(object sender, EventArgs e) { messageLabel.Text = String.Empty; patient.BillNo = billNoTextBox.Text; patient.MobileNo = mobileNoTextBox.Text; double result; if (patient.BillNo != "" || patient.MobileNo != "") { if (patient.BillNo != "" && patient.MobileNo != "") { ClearTextBoxes(); messageLabel.Text = "Please Enter only one input"; } else { if (((double.TryParse(patient.MobileNo, out result)) && (patient.MobileNo.Length == 11)) == false && patient.BillNo == "") { ClearTextBoxes(); messageLabel.Text = "Plz enter a valid mobile number or bill number"; } else { PatientForPayment aPatient = aPaymentManager.GetPaymentInfo(patient); if (Math.Abs(aPatient.Total) > 0) { amountTextBox.Text = aPatient.Total.ToString(); dueDateTextBox.Text = aPatient.DOB.ToString("dd-MM-yy"); payButton.Enabled = true; } else { ClearTextBoxes(); messageLabel.Text = "The patient does not exist "; } } } } else { ClearTextBoxes(); messageLabel.Text = "Plz enter the input"; } }
public int PayAmmount(PatientForPayment patient) { Query = "UPDATE PatientRecord SET Status='paid' WHERE MobileNo='" + patient.MobileNo + "' OR BillNo='" + patient.BillNo + "'"; // Query = "UPDATE PatientRecord SET Status=@paid WHERE MobileNo=@mobileNo OR BillNo=@billNo"; Command = new SqlCommand(Query, Connection); Connection.Open(); //Command.Parameters.Clear(); //Command.Parameters.Add("paid", SqlDbType.VarChar); //Command.Parameters["paid"].Value = "paid"; //Command.Parameters.Add("mobileNo", SqlDbType.VarChar); //Command.Parameters["mobileNo"].Value = patient.MobileNo; //Command.Parameters.Add("billNo", SqlDbType.VarChar); //Command.Parameters["billNo"].Value = patient.BillNo; int rowAffected = Command.ExecuteNonQuery(); Connection.Close(); return(rowAffected); }
public PatientForPayment GetPaymentInfo(PatientForPayment patient) { PatientForPayment aPatient = aPaymentGateway.GetPaymentInfo(patient); return(aPatient); }