public AppointmentStatusListForm() { InitializeComponent(); _apoBLL = new AppointmentBLL(); _apoAllBLL = new AppointmentAllBLL(); _command = new SqlCommand(); }
public AppointmentSave() { InitializeComponent(); command = new SqlCommand(); hospitalBLL = new HospitalDetailBLL(); hospitalDetails = new HospitalDetail(); buttonList = new List <Button>(); apoBLL = new AppointmentBLL(); }
public bool Insert(AppointmentBLL p) { //Creating Boolean Variable and set its default value to false bool isSuccess = false; //Sql Connection for Database SqlConnection conn = new SqlConnection(myconnstrng); try { //SQL Query to insert Patients into database String sql = "INSERT INTO tbl_Appointment (FirstName, LastName, IdNumber, Gender, Contact, AddedDate, Reason, Email, Address ) VALUES (@FirstName, @LastName, @IdNumber, @Gender, @Contact, @AddedDate, @Reason, @Email, @Address)"; //Creating SQL Command to pass the values SqlCommand cmd = new SqlCommand(sql, conn); //Passign the values through parameters cmd.Parameters.AddWithValue("@FirstName", p.FirstName); cmd.Parameters.AddWithValue("@LastName", p.LastName); cmd.Parameters.AddWithValue("@IdNumber", p.IdNumber); cmd.Parameters.AddWithValue("@Gender", p.Gender); cmd.Parameters.AddWithValue("@Contact", p.Contact); cmd.Parameters.AddWithValue("@AddedDate", p.AddedDate); cmd.Parameters.AddWithValue("@Reason", p.Reason); cmd.Parameters.AddWithValue("@Email", p.Email); cmd.Parameters.AddWithValue("@Address", p.Address); //Opening the Database connection conn.Open(); int rows = cmd.ExecuteNonQuery(); //If the query is executed successfully then the value of rows will be greater than 0 else it will be less than 0 if (rows > 0) { //Query Executed Successfully isSuccess = true; } else { //Failed to Execute Query isSuccess = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); } return(isSuccess); }
public void SaveAppointmet(Appointment appointment) { try { AppointmentBLL appointmentBll = new AppointmentBLL(); int result = appointmentBll.InsertAppointment(appointment); if (result > 0) { appointment.DayCount++; MessageBox.Show("Successfully Saved"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private Appointment GetAppointment() { AppointmentBLL appointmentBll = new AppointmentBLL(); return(appointmentBll.GetNextAppointment()); }