Пример #1
0
        public static DataSet findAllShowingsOfPlay(int pId)
        {
            //queryString = "SELECT Date" +
            //       " From Plays, Showings" +
            //       " WHERE Plays.Play_Id = Showings.Play_Id" +
            //       " AND Plays.Play_Id = @pId";
            //   SQLiteCommand command = new SQLiteCommand(queryString, this.getConnectionString());

            //   this.getConnectionString().Open();
            //   command.Parameters.AddWithValue("@pId", pId);
            //   sqlReader = command.ExecuteReader();
            //   this.getConnectionString().Close();

            //   return sqlReader;
            DataSet dataSet = new DataSet();

            queryString = "SELECT * From Plays, Showings" +
                          " WHERE Plays.Play_Id = Showings.Play_Id" +
                          " AND Plays.Play_Id = @pId";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@pId", pId);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
        private static DataSet getSeatsLinkedToBooking(int pBookingId)
        {
            //queryString = "Select Section, Row, Number" +
            //    " From Bookings, Seats" +
            //    " Where Bookings.Booking_Id = Seats.Booking_Id" +
            //    " And Bookings.Booking_Id = @bookingID";
            //SQLiteConnection connection = new SQLiteConnection(this.getConnectionString());
            //SQLiteCommand command = new SQLiteCommand(queryString, connection);

            //connection.Open();
            //command.Parameters.AddWithValue("@booking_Id", pBookingId);
            //sqlReader = command.ExecuteReader();
            //connection.Close();

            //return sqlReader;

            DataSet dataSet = new DataSet();

            queryString = "Select *" +
                          " From Seats" +
                          " Where Bookings.Booking_Id = Seats.Booking_Id" +
                          " And Bookings.Booking_Id = @bookingID";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@booking_Id", pBookingId);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
Пример #3
0
        public static DataSet getPlayDetailsByName(string pPlayName)
        {
            //queryString = "SELECT * FROM Plays WHERE Name = @playName";
            //SQLiteCommand command = new SQLiteCommand(queryString, this.getConnectionString());

            //this.getConnectionString().Open();
            //command.Parameters.AddWithValue("@playName", pPlayName);
            //sqlReader = command.ExecuteReader();
            //this.getConnectionString().Close();

            //return sqlReader;

            DataSet dataSet = new DataSet();

            queryString = "SELECT * FROM Plays WHERE Name = @playName";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@playName", pPlayName);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
Пример #4
0
        public static DataSet getShowingByShowingId(int pShowing_Id)
        {
            //queryString = "Select Name, Length, Date, Price" +
            //    " FROM Plays, Showings" +
            //    " WHERE Plays.Play_Id = Showings.Play_Id" +
            //    " AND Showing_Id = @showingId";
            //SQLiteCommand command = new SQLiteCommand(queryString, this.getConnectionString());

            //this.getConnectionString().Open();
            //command.Parameters.AddWithValue("@showingId", pShowing_Id);
            //sqlReader =  command.ExecuteReader();
            //this.getConnectionString().Close();

            //return sqlReader;

            DataSet dataSet = new DataSet();

            queryString = "Select *" +
                          " FROM Plays, Showings" +
                          " WHERE Plays.Play_Id = Showings.Play_Id" +
                          " AND Showing_Id = @showingId";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@showingId", pShowing_Id);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
Пример #5
0
        public static DataSet getCustomerByLastName(string pLastName)
        {
            //queryString = "Select * From Customers Where Last_Name = @lastName";
            //   SQLiteCommand command = new SQLiteCommand(queryString, this.getConnectionString());

            //   this.getConnectionString().Open();
            //   command.Parameters.AddWithValue("@lastName", pLastName);
            //   sqlReader = command.ExecuteReader();
            //   this.getConnectionString().Close();

            //   return sqlReader;

            DataSet dataSet = new DataSet();

            queryString = "Select * From Customers Where Last_Name = @lastName";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@lastName", pLastName);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
        public static DataSet getAllSeatsForShowing(int pShowingId)
        {
            //queryString = "SELECT * FROM Seats" +
            //       " Where Showing_Id = @showingID";
            //   SQLiteCommand command = new SQLiteCommand(queryString, this.getConnectionString());

            //   this.getConnectionString().Open();
            //   command.Parameters.AddWithValue("@Showing_Id", pShowingId);
            //   command.ExecuteNonQuery();
            //   this.getConnectionString().Close();
            //   return sqlReader;

            DataSet dataSet = new DataSet();

            queryString = "SELECT * FROM Seats" +
                          " Where Showing_Id = @showingID";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@Showing_Id", pShowingId);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
        public static DataSet seatsSoldUnsold()
        {
            DataSet dataSet = new DataSet();

            queryString = "SELECT * FROM Showings, Plays" +
                          " Where Plays.Play_Id = Showings.Play_Id";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }


            dataSet.Tables[0].Columns.Add("SeatsSold", typeof(int));
            dataSet.Tables[0].Columns.Add("SeatsUnSold", typeof(int));
            for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
            {
                int showingId        = int.Parse(dataSet.Tables[0].Rows[i]["Showing_Id"].ToString());
                int numOfSeatsSold   = getNumOfSoldSeatsForShowing(showingId);
                int numOfUnSeatsSold = getNumOfUnSoldSeatsForShowing(showingId);
                dataSet.Tables[0].Rows[i]["SeatsSold"]   = numOfSeatsSold;
                dataSet.Tables[0].Rows[i]["SeatsUnSold"] = numOfUnSeatsSold;
            }
            return(dataSet);
        }
Пример #8
0
 public static DataSet getAllShowings()
 {
     //queryString = "SELECT Showing_Id,Name, Length, Date" +
     //    " FROM Plays, Showings" +
     //    " WHERE Plays.Play_Id = Showings.Play_Id";
     queryString = "SELECT *" +
                   " FROM Plays, Showings" +
                   " WHERE Plays.Play_Id = Showings.Play_Id";
     //test
     return(SqlClassBase.commitSqlQuerryNonParameterized(queryString));
 }
Пример #9
0
        public static void deleteSeatsLinkedToShowing(int pShowingId)
        {
            queryString = "DELETE FROM Seats Where Showing_Id = @showing_Id";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@showing_Id", pShowingId);
            command.ExecuteNonQuery();
            connection.Close();
        }
Пример #10
0
        public static void addPlay(string pName, int pLength)
        {
            queryString = "INSERT INTO Plays(Name, Length) VALUES(@name, @length)";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@name", pName);
            command.Parameters.AddWithValue("@length", pLength);
            command.ExecuteNonQuery();
            connection.Close();
        }
Пример #11
0
        private static void makeDeletePlayRecord()
        {
            queryString = "INSERT INTO Plays(Name, Length) VALUES(@name, @length)";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@name", "DeletedPlay");
            command.Parameters.AddWithValue("@length", 0);
            command.ExecuteNonQuery();
            connection.Close();
        }
Пример #12
0
        public static void deletePlay(int pPlay_Id)
        {
            changeShowingsOfPlayToDeletedShowing(pPlay_Id);
            queryString = "DELETE FROM Plays WHERE Play_Id = @play_Id";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@play_Id", pPlay_Id);
            command.ExecuteNonQuery();
            connection.Close();
        }
        private static void setSeatsLinkedToBookingToEmpty(int pBookingId)
        {
            queryString = "UPDATE Seats SET Booking_Id = 0" +
                          " Where Booking_Id = @bookingId";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@bookingId", pBookingId);
            command.ExecuteNonQuery();
            connection.Close();
        }
        public static void insertTotalPriceForBooking(int pBookingId, float pTotalPrice)
        {
            queryString = "UPDATE Bookings SET Total_Amount = @totalAmount WHERE Booking_Id = @booking_Id";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@totalAmount", pTotalPrice);
            command.Parameters.AddWithValue("@booking_Id", pBookingId);
            command.ExecuteNonQuery();
            connection.Close();
        }
        public static void payBooking(int pBookingId)
        {
            queryString = "UPDATE Bookings SET Paid = @paid WHERE Booking_Id = @booking_Id";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@paid", 1);
            command.Parameters.AddWithValue("@booking_Id", pBookingId);
            command.ExecuteNonQuery();
            connection.Close();
        }
        private static void generateUpperCircleSeats(int pShowing_Id)
        {
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());

            using (connection)
            {
                connection.Open();
                using (SQLiteTransaction transaction = connection.BeginTransaction())
                {
                    string seatSection = "UpperCircle";
                    for (int i = 0; i < UpperCircleDictonary.Count(); i++)
                    {
                        for (int seatNumber = 1; seatNumber < UpperCircleDictonary.Values.ElementAt(i) + 1; seatNumber++)
                        {
                            string seatRow = UpperCircleDictonary.Keys.ElementAt(i);
                            queryString = "INSERT INTO Seats(Section, Row, Number, Showing_Id, Booking_Id) VALUES(@section, @row, @number, @showing_Id, @booking_Id)";
                            SQLiteCommand command = new SQLiteCommand(queryString, connection);

                            command.Parameters.AddWithValue("@section", seatSection);
                            command.Parameters.AddWithValue("@row", seatRow);
                            command.Parameters.AddWithValue("@number", seatNumber);
                            command.Parameters.AddWithValue("@showing_Id", pShowing_Id);
                            command.Parameters.AddWithValue("@booking_Id", 0);
                            command.ExecuteNonQuery();
                        }
                    }
                    transaction.Commit();
                }
                connection.Close();
            }

            //string seatSection = "UpperCircle";
            //for (int i = 0; i < UpperCircleDictonary.Count(); i++)
            //{
            //    for (int seatNumber = 1; seatNumber < UpperCircleDictonary.Values.ElementAt(i) + 1; seatNumber++)
            //    {
            //        string seatRow = UpperCircleDictonary.Keys.ElementAt(i);
            //        queryString = "INSERT INTO Seats(Section, Row, Number, Showing_Id, Booking_Id) VALUES(@section, @row, @number, @showing_Id, @booking_Id)";
            //        SQLiteConnection connection = new SQLiteConnection(this.getConnectionString());
            //        SQLiteCommand command = new SQLiteCommand(queryString, connection);

            //        connection.Open();
            //        command.Parameters.AddWithValue("@section", seatSection);
            //        command.Parameters.AddWithValue("@row", seatRow);
            //        command.Parameters.AddWithValue("@number", seatNumber);
            //        command.Parameters.AddWithValue("@showing_Id", pShowing_Id);
            //        command.Parameters.AddWithValue("@booking_Id", null);
            //        command.ExecuteNonQuery();
            //        connection.Close();
            //    }
            //}
        }
        public static float getTotalPriceOfBooking(int pBookingId)
        {
            DataSet dataSet = new DataSet();
            string  query   = "Select UpperCirclePrice, DressCirclePrice, StallsPrice From Showings, Seats, Bookings" +
                              " Where Seats.Showing_Id = Showings.Showing_Id" +
                              " And Seats.Booking_Id = Bookings.Booking_Id" +
                              " And Bookings.Booking_Id = @bookingId";

            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(query, connection);
                command.Parameters.AddWithValue("@bookingId", pBookingId);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }

            float UpperCirclePrice = float.Parse(dataSet.Tables[0].Rows[0]["UpperCirclePrice"].ToString());
            float DreesCirclePrice = float.Parse(dataSet.Tables[0].Rows[0]["DressCirclePrice"].ToString());
            float StallsPrice      = float.Parse(dataSet.Tables[0].Rows[0]["StallsPrice"].ToString());

            dataSet = new DataSet();
            query   = "Select * From Seats Where Booking_Id = @bookingId";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(query, connection);
                command.Parameters.AddWithValue("@bookingId", pBookingId);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }

            float totalPrice = 0;

            foreach (DataRow row in dataSet.Tables[0].Rows)
            {
                if (row["Section"].ToString() == "Stall")
                {
                    totalPrice = totalPrice + StallsPrice;
                }
                else if (row["Section"].ToString() == "DressCircle")
                {
                    totalPrice = totalPrice + DreesCirclePrice;
                }
                else
                {
                    totalPrice = totalPrice + UpperCirclePrice;
                }
            }

            return(totalPrice);
        }
Пример #18
0
        private static int getIdOfDeleteCustomerRecord()
        {
            //   queryString = "Select Customer_Id From Customers Where Last_Name = @deletedPlayName";
            //   SQLiteConnection connection = new SQLiteConnection(this.getConnectionString());
            //   SQLiteCommand command = new SQLiteCommand(queryString, connection);

            //   connection.Open();
            //   command.Parameters.AddWithValue("@deletedPlayName", "DeletedCustomerLastName");
            //   sqlReader = command.ExecuteReader();

            //int deletedCustomerRecordId = 0;
            //   try
            //   {
            //       while (sqlReader.Read())
            //       {
            //           deletedCustomerRecordId = int.Parse(sqlReader["Customer_Id"].ToString());
            //           connection.Close();
            //       }
            //   }
            //   catch (Exception)
            //   {
            //       makeDeletePlayRecord();
            //       deletedCustomerRecordId = getIdOfDeleteCustomerRecord();
            //   }
            //   connection.Close();
            //   return deletedCustomerRecordId;

            DataSet dataSet = new DataSet();

            queryString = "Select Customer_Id From Customers Where Last_Name = @deletedPlayName";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@deletedPlayName", "DeletedCustomerLastName");
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }

            int deletedCustomerId;

            if (dataSet.Tables[0].Rows.Count == 0)
            {
                makeDeleteCustomerRecord();
                deletedCustomerId = getIdOfDeleteCustomerRecord();
            }
            else
            {
                deletedCustomerId = int.Parse(dataSet.Tables[0].Rows[0]["Customer_Id"].ToString());
            }
            return(deletedCustomerId);
        }
        public static void deleteBooking(int pBookingId)
        {
            setSeatsLinkedToBookingToEmpty(pBookingId);
            queryString = "Delete From Bookings" +
                          " Where Booking_Id = @bookingId";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@bookingId", pBookingId);
            command.ExecuteNonQuery();
            connection.Close();
        }
Пример #20
0
        public static void editPlay(int pPlay_Id, string pName, int pLength)
        {
            queryString = "UPDATE Plays SET Name = @name, Length = @length WHERE Play_Id = @play_Id";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@play_Id", pPlay_Id);
            command.Parameters.AddWithValue("@name", pName);
            command.Parameters.AddWithValue("@length", pLength);
            command.ExecuteNonQuery();
            connection.Close();
        }
Пример #21
0
        private static void makeDeleteCustomerRecord()
        {
            queryString = "INSERT INTO Customers(First_Name, Last_Name, Email, Membership_Expiry_Date) VALUES(@firstName, @lastName, @email, @membershipExpiryDate)";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@firstName", "DeletedCustomerFirstName");
            command.Parameters.AddWithValue("@lastName", "DeletedCustomerLastName");
            command.Parameters.AddWithValue("@email", "DeletedCustomerEmail");
            command.Parameters.AddWithValue("@membershipExpiryDate", null);
            command.ExecuteNonQuery();
            connection.Close();
        }
Пример #22
0
        public static void upgradeCustomer(int pCustomerId)
        {
            string memberShipExpiryDate = ShowingsClass.formatDateTimeToSqlLiteDateString(DateTime.Now.AddMonths(12));

            queryString = "UPDATE Customers SET Membership_Expiry_Date = @membershipExpiryDate" +
                          " WHERE Customer_Id = @customerId";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@membershipExpiryDate", memberShipExpiryDate);
            command.Parameters.AddWithValue("@customerId", pCustomerId);
            command.ExecuteNonQuery();
            connection.Close();
        }
Пример #23
0
        public static DataSet getCustomerById(int pId)
        {
            DataSet dataSet = new DataSet();

            queryString = "Select * From Customers Where Customer_Id = @customerId";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@customerId", pId);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
Пример #24
0
        private static void setAllBookingsToDeletedCustomer(int pCustomerId)
        {
            int deletedCustomerId = getIdOfDeleteCustomerRecord();

            queryString = "UPDATE Bookings Set Customer_Id = @deletedCustomerRecordId" +
                          " Where Customer_Id = @customerId";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@customerId", pCustomerId);
            command.Parameters.AddWithValue("@deletedCustomerRecordId", deletedCustomerId);
            command.ExecuteNonQuery();
            connection.Close();
        }
Пример #25
0
        public static DataSet getAllShowingOnDate(string pDate)
        {
            DataSet dataSet     = new DataSet();
            string  queryString = "Select * From Showings Where Date BETWEEN @startDate AND @endDate";

            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@startDate", pDate + " 00:00");
                command.Parameters.AddWithValue("@endDate", pDate + " 24:00");
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
        public static DataSet getAllSeatsForBooking(int pBookingId)
        {
            DataSet dataSet = new DataSet();

            queryString = "SELECT * FROM Seats" +
                          " Where Booking_Id = @booking_Id";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@booking_Id", pBookingId);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
        public static DataSet getAllBookingsBetweenDates(string pStartDate, string pEndDate)
        {
            DataSet dataSet = new DataSet();
            string  query   = "Select * From Bookings Where Date_Of_Booking BETWEEN @startDate AND @endDate";

            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(query, connection);
                command.Parameters.AddWithValue("@startDate", pStartDate + " 00:00");
                command.Parameters.AddWithValue("@endDate", pEndDate + "24:00");
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
Пример #28
0
        public static void editCustomerDetails(int pCustomerId, string pFirstName, string pLastName, string pEmail, string pMembershipExpiryDate)
        {
            queryString = "UPDATE Customers SET First_name = @firstName, Last_Name = @lastName, Email = @email, Membership_Expiry_Date = @membershipExpiryDate" +
                          " WHERE Customer_Id = @customerId";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@firstName", pFirstName);
            command.Parameters.AddWithValue("@lastName", pLastName);
            command.Parameters.AddWithValue("@email", pEmail);
            command.Parameters.AddWithValue("@membershipExpiryDate", pMembershipExpiryDate);
            command.Parameters.AddWithValue("@customerId", pCustomerId);
            command.ExecuteNonQuery();
            connection.Close();
        }
        public static DataSet getAllBookingsForCustomer(int pCustomerId)
        {
            DataSet dataSet = new DataSet();

            queryString = "SELECT * FROM Bookings, Seats" +
                          " WHERE Customer_Id = @customer_Id";
            using (SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString()))
            {
                SQLiteDataAdapter adapter = new SQLiteDataAdapter();
                SQLiteCommand     command = new SQLiteCommand(queryString, connection);
                command.Parameters.AddWithValue("@customer_Id", pCustomerId);
                adapter.SelectCommand = command;
                adapter.Fill(dataSet);
            }
            return(dataSet);
        }
Пример #30
0
        public static void addShowing(int pPlay_Id, string pDate, double pUpperCirclepricePrice, double pDressCirclePrice, double pStallsPrice)
        {
            queryString = "INSERT INTO Showings(Play_Id, Date, UpperCirclePrice, DressCirclePrice, StallsPrice) VALUES(@play_Id, @date, @upperCirclePrice, @dressCirclePrice, @stallsPrice)";
            SQLiteConnection connection = new SQLiteConnection(SqlClassBase.getConnectionString());
            SQLiteCommand    command    = new SQLiteCommand(queryString, connection);

            connection.Open();
            command.Parameters.AddWithValue("@play_Id", pPlay_Id);
            command.Parameters.AddWithValue("@date", pDate);
            command.Parameters.AddWithValue("@upperCirclePrice", pUpperCirclepricePrice);
            command.Parameters.AddWithValue("@dressCirclePrice", pDressCirclePrice);
            command.Parameters.AddWithValue("@stallsPrice", pStallsPrice);
            command.ExecuteNonQuery();
            connection.Close();

            SeatsClass.generateSeats(getLastShowingId());
        }