Ejemplo n.º 1
0
        bool IDeleteReservation.DeleteReservation(int reservationId)
        {
            var    deleteReservation = SDeleteReservationScript.SqlLiteDBDeleteReservation(reservationId);
            string result            = DBConnectAndExecute.ExecuteQuery(deleteReservation);

            if (result != string.Empty)
            {
                SLogToFile.SaveInfoInFile(result);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
 public static string ExecuteQuery(TableScripts tableScripts)
 {
     using (var com0 = new SqliteCommand(tableScripts.script, tableScripts.connectionProperties))
     {
         try
         {
             tableScripts.connectionProperties.Open();
             com0.ExecuteNonQuery();
             tableScripts.connectionProperties.Close();
             return(string.Empty);
         }
         catch (SqliteException ex)
         {
             SLogToFile.SaveInfoInFile("|ExecuteQuery|" + ex.Message);
             return(ex.Message);
         }
     }
 }
Ejemplo n.º 3
0
 public static string ExecuteQuery(string query, SqliteConnection connection)
 {
     using (var com0 = new SqliteCommand(query, connection))
     {
         try
         {
             connection.Open();
             com0.ExecuteNonQuery();
             connection.Close();
             return(string.Empty);
         }
         catch (SqliteException ex)
         {
             SLogToFile.SaveInfoInFile("|ExecuteQuery|" + ex.Message);
             string er = ex.Message;
             return(er);
         }
     }
 }
Ejemplo n.º 4
0
        public bool GetReservationIdAndInsertToDB(DateTime reservationDate, int reservationHour, int reservationMinute, int clientID, int servicesID, int employeeID)
        {
            int         reservationID = selectReservation.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestReservationID());
            Reservation reservation   = new Reservation()
            {
                reservation_id   = reservationID,
                reservation_date = reservationDate,
                reservation_time = new TimeSpan(reservationHour, reservationMinute, 0),
                client_id        = clientID,
                services_id      = servicesID,
                employee_id      = employeeID
            };

            if (selectReservation.GetRowsForTable(SGetAllRowsFromSpecificTable.ReservationSelectAllRowsQuery())
                .Any(x => x.reservation_date == reservation.reservation_date &&
                     x.reservation_time == reservation.reservation_time &&
                     x.employee_id == reservation.employee_id))
            {
                return(false);
            }
            SLogToFile.SaveDataTebleInToFile("reservation", reservation.ToString());
            insertReservation.InsertObjectToDB(reservation);
            return(true);
        }