Esempio n. 1
0
 protected void btn_Guardar_Click(object sender, EventArgs e)
 {
     Reservation r = new Reservation(Int32.Parse(txb_starTime.Text), Int32.Parse(txb_endTime.Text), txb_course.Text, txb_Observation.Text,Cld_Date.SelectedDate.ToShortDateString(),12);
     lbl_muestra.Text = r.Date.ToString();
     ReservationBusiness rb = new ReservationBusiness();
     rb.Insert(r);
 }
Esempio n. 2
0
        public void InsertReservation(Reservation reservation)
        {
            try
            {
                SqlConnection con = DataBaseConnection("open");
                SqlCommand sqlcommand;
                string databaseCommand = " INSERT INTO Reservation (StartTime,EndTime,Course,Observation,Date,User_id) values (" + "'" + reservation.StarTime + "'" + "," + "'" + reservation.EndTime + "'" + "," + "'" + reservation.Course + "'" + "," + "'" + reservation.Observation + "'" + "," + "'" + reservation.Date + "'" + ",'"+reservation.User_id+"')";
                sqlcommand = new SqlCommand(databaseCommand, con);
                sqlcommand.ExecuteNonQuery();
                sqlcommand.Dispose();
                DataBaseConnection("close");
            }
            catch (SqlException sqlException)
            {
                Console.WriteLine("Database error:" + sqlException.ToString());

            }
        }
Esempio n. 3
0
 public void Update(Reservation reservation)
 {
     SqlConnection con = DataBaseConnection("open");
     try
     {
         SqlCommand cmdIns = new SqlCommand("UPDATE Reservation SET StartTime=@StartTime ,EndTime=@EndTime,Course=@Course,Observation=@Observation,Date=@Date User_id=@User_id", con);
         cmdIns.Parameters.Add("@StartTime", reservation.StarTime);
         cmdIns.Parameters.Add("@EndTime", reservation.EndTime);
         cmdIns.Parameters.Add("@Course", reservation.Course);
         cmdIns.Parameters.Add("@Observation", reservation.Observation);
         cmdIns.Parameters.Add("@Date", reservation.Date);
         cmdIns.Parameters.Add("@User_id", reservation.User_id);
         cmdIns.ExecuteNonQuery();
         cmdIns.Dispose();
         cmdIns = null;
     }
     catch (SqlException ex)
     {
         throw new Exception(ex.ToString(), ex);
     }
     finally
     {
         DataBaseConnection("close");
     }
 }
Esempio n. 4
0
 public void Update(Reservation reservation)
 {
     reservationData.Update(reservation);
 }
Esempio n. 5
0
 public void Insert(Reservation reservation)
 {
     reservationData.InsertReservation(reservation);
 }