Exemplo n.º 1
0
        private void EditShowing_button_Click(object sender, RoutedEventArgs e)
        {
            if (SelectDate_EditDelShow.SelectedDate == null)
            {
                MessageBox.Show("Please select a date for the required showing");
            }
            else
            {
                int    showingId       = ShowingsClass.getShowingIdByDate(ShowingsClass.formatDateTimeToSqlLiteDateString((DateTime)SelectDate_EditDelShow.SelectedDate));
                string startTime       = this.TimeOfShowing_EditDeleteShowing_txt.Text;
                string timeToBeChecked = ValidationClass.TimeChecker(startTime);

                if (timeToBeChecked != null)
                {
                    MessageBox.Show(timeToBeChecked);
                }
                else
                {
                    double upperCirclePrice = double.Parse(this.UpperCircle_EditDelShow_txt.Text);
                    string priceToBeChecked = UpperCircle_EditDelShow_txt.Text.ToString();
                    priceToBeChecked = ValidationClass.FloatChecker(priceToBeChecked);
                    if (priceToBeChecked != null)
                    {
                        MessageBox.Show(priceToBeChecked);
                    }
                    else
                    {
                        double dressCirclePrice = double.Parse(this.DressCircle_EditDelShow_txt.Text);
                        priceToBeChecked = DressCircle_EditDelShow_txt.Text.ToString();
                        priceToBeChecked = ValidationClass.FloatChecker(priceToBeChecked);
                        if (priceToBeChecked != null)
                        {
                            MessageBox.Show(priceToBeChecked);
                        }
                        else
                        {
                            double stallPrice = double.Parse(this.Stalls_EditDelShow_txt.Text);
                            priceToBeChecked = Stalls_EditDelShow_txt.Text.ToString();
                            priceToBeChecked = ValidationClass.FloatChecker(priceToBeChecked);
                            if (priceToBeChecked != null)
                            {
                                MessageBox.Show(priceToBeChecked);
                            }
                            else
                            {
                                dataSet = ShowingsClass.getShowingByShowingId(showingId);
                                string unedditedSqlDateTimeString = dataSet.Tables[0].Rows[0]["Date"].ToString();
                                string newDateTimeSqlString       = ShowingsClass.replaceSqlDateTimeWithNewTime(unedditedSqlDateTimeString, startTime);
                                ShowingsClass.editShowingDetails(showingId, newDateTimeSqlString, upperCirclePrice, dressCirclePrice, stallPrice);
                                MessageBox.Show("Showing edited");
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void CreateShowing_button_Click(object sender, RoutedEventArgs e)
        {
            if (Play_AddShowing_combo.Items.Count == 0)
            {
                MessageBox.Show("Please enter a play to search for");
            }
            else
            {
                KeyValuePair <int, string> test = (KeyValuePair <int, string>) this.Play_AddShowing_combo.SelectedValue;
                int playId = int.Parse((test.Key).ToString());

                dataSet = PlaysClass.getPlayDetailsById(playId);
                int playLength = int.Parse(dataSet.Tables[0].Rows[0]["Length"].ToString());

                string startTime       = StartTime_AddShowing_txt.Text;
                string timeToBeChecked = ValidationClass.TimeChecker(startTime);

                if (timeToBeChecked != null)
                {
                    MessageBox.Show(timeToBeChecked);
                }
                else
                {
                    //var startTimeCharArray = startTime.ToCharArray();
                    //string startHour = startTimeCharArray[0].ToString() + startTimeCharArray[1].ToString();
                    //string startMinutes = startTimeCharArray[3].ToString() + startTimeCharArray[4].ToString();

                    //DateTime startDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,
                    //    int.Parse(startHour), int.Parse(startMinutes), 0);

                    //DateTime endDateTime = startDateTime.AddMinutes(playLength);
                    //string endTime = endDateTime.Hour + ":" + endDateTime.Minute;

                    DateTime?startDate = this.StartDate_AddShowing.SelectedDate;
                    DateTime?endDate   = this.EndDate_AddShowing.SelectedDate;
                    if (startDate > endDate)
                    {
                        MessageBox.Show("Start date must be earlier than End date");
                    }
                    else
                    {
                        string priceToBeChecked = UpperCircle_AddShowing_txt.Text.ToString();
                        priceToBeChecked = ValidationClass.FloatChecker(priceToBeChecked);
                        if (priceToBeChecked != null)
                        {
                            MessageBox.Show(priceToBeChecked);
                        }
                        else
                        {
                            float upperCirclePrice = float.Parse(this.UpperCircle_AddShowing_txt.Text.ToString());

                            priceToBeChecked = DressCircle_AddShowing_txt.Text.ToString();
                            priceToBeChecked = ValidationClass.FloatChecker(priceToBeChecked);
                            if (priceToBeChecked != null)
                            {
                                MessageBox.Show(priceToBeChecked);
                            }
                            else
                            {
                                float dressCirclePrice = float.Parse(this.DressCircle_AddShowing_txt.Text.ToString());

                                priceToBeChecked = Stalls_AddShowing_txt.Text.ToString();
                                priceToBeChecked = ValidationClass.FloatChecker(priceToBeChecked);
                                if (priceToBeChecked != null)
                                {
                                    MessageBox.Show(priceToBeChecked);
                                }
                                else
                                {
                                    float stallPrice = float.Parse(this.Stalls_AddShowing_txt.Text.ToString());
                                    if (this.StartDate_AddShowing.SelectedDate == null || this.EndDate_AddShowing.SelectedDate == null)
                                    {
                                        MessageBox.Show("please enter start and end date");
                                    }
                                    else
                                    {
                                        bool sqlQuerryState = ShowingsClass.makeShowings((DateTime)startDate, (DateTime)endDate, startTime, playId, upperCirclePrice, dressCirclePrice, stallPrice);
                                        if (sqlQuerryState == true)
                                        {
                                            MessageBox.Show("Showing added");
                                            fillDatePicker(this.SelectDate_EditDelShow);
                                        }
                                        else
                                        {
                                            MessageBox.Show("conclict with current showing");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }