コード例 #1
0
ファイル: RegistroAsientos.aspx.cs プロジェクト: estf/Examen1
 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);
 }
コード例 #2
0
ファイル: ReservationData.cs プロジェクト: estf/Examen1
        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());

            }
        }
コード例 #3
0
ファイル: ReservationData.cs プロジェクト: estf/Examen1
 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");
     }
 }
コード例 #4
0
ファイル: ReservationBusiness.cs プロジェクト: estf/Examen1
 public void Update(Reservation reservation)
 {
     reservationData.Update(reservation);
 }
コード例 #5
0
ファイル: ReservationBusiness.cs プロジェクト: estf/Examen1
 public void Insert(Reservation reservation)
 {
     reservationData.InsertReservation(reservation);
 }