protected void addPrescriptionButton_Click(object sender, EventArgs e) { Prescription prescription = new Prescription(); prescription.PrescriptionDate = prescriptionDateTextBox.Text; prescription.PatientId = int.Parse(patientNameDropDownList.Text); prescription.DoctorId = int.Parse(doctorNameDropDownList.Text); prescription.PrescriptionDetails = prescriptionDetailsTextArea.InnerText; message.InnerHtml = prescriptionManager.Save(prescription); }
public int Save(Prescription prescription) { SqlConnection connection = new SqlConnection(databaseConString); string query = "INSERT INTO tbl_prescription VALUES ('" + prescription.PrescriptionDate + "','" + prescription.PatientId + "','" + prescription.DoctorId + "','" + prescription.PrescriptionDetails + "')"; SqlCommand command = new SqlCommand(query,connection); connection.Open(); int rowAffected = command.ExecuteNonQuery(); connection.Close(); return rowAffected; }
public string Save(Prescription prescription) { if (prescriptionGateway.Save(prescription) > 0) { return "Added Successfully"; } else { return "Could Not Added"; } }