Ejemplo n.º 1
0
        private void LoadNewsletters_button_Click(object sender, RoutedEventArgs e)
        {
            DataSet dataset = ShowingsClass.getAllShowingsPastCurrentDate();

            foreach (DataRow row in dataset.Tables[0].Rows)
            {
                this.Newsletters_txt.Text = this.Newsletters_txt.Text + row["Name"].ToString() + " " + row["Date"].ToString() + "\n";
            }
        }
        private void Generate2_button_Click(object sender, RoutedEventArgs e)
        {
            DataSet dataSet = ShowingsClass.getAllShowingsPastCurrentDate();

            this.Report_txt.ItemsSource           = dataSet.Tables[0].DefaultView;
            this.Report_txt.Columns[0].Visibility = Visibility.Collapsed;
            this.Report_txt.Columns[1].Visibility = Visibility.Collapsed;
            this.Report_txt.Columns[6].Visibility = Visibility.Collapsed;
        }
Ejemplo n.º 3
0
        private void fillDatePicker(DatePicker pDatePicker)
        {
            pDatePicker.BlackoutDates.Clear();
            pDatePicker.BlackoutDates.AddDatesInPast();
            List <DateTime> dateList = new List <DateTime>();
            DataSet         dataSet  = ShowingsClass.getAllShowingsPastCurrentDate();

            foreach (DataRow row in dataSet.Tables[0].Rows)
            {
                dateList.Add(ShowingsClass.turnSqlLiteDateStringIntoDateTime(row["Date"].ToString()));
            }
            dateList.Sort();

            if (dateList.Count == 0)
            {
                pDatePicker.BlackoutDates.Add(new CalendarDateRange(DateTime.Now, DateTime.Now.AddYears(1)));
            }
            else
            {
                DateTime startDate = DateTime.Now;
                for (int i = 0; i < dateList.Count; i++)
                {
                    if (startDate.Date != dateList[i].Date)
                    {
                        pDatePicker.BlackoutDates.Add(new CalendarDateRange(startDate, dateList[i].AddDays(-1)));
                    }
                    startDate = dateList[i].AddDays(1);
                }
                pDatePicker.BlackoutDates.Add(new CalendarDateRange(startDate, startDate.AddMonths(12)));
            }


            //pDatePicker.BlackoutDates.Clear();
            //pDatePicker.BlackoutDates.AddDatesInPast();
            //List<DateTime> dateList = new List<DateTime>();
            //DataSet dataSet = ShowingsClass.getAllShowings();
            //foreach (DataRow row in dataSet.Tables[0].Rows)
            //{
            //    int tempShowingId = int.Parse(row["Showing_Id"].ToString());
            //    DateTime showingDate = ShowingsClass.turnSqlLiteDateStringIntoDateTime(row["Date"].ToString());
            //    if (showingDate >= DateTime.Now)
            //    {
            //        dateList.Add(showingDate);
            //    }
            //}
            //dateList.Sort();
            //if (dateList.Count != 0)
            //{
            //    DateTime nextStartDate = DateTime.Now;
            //    bool addDate = true;
            //    int count = 1;
            //    foreach (DateTime showingDateFromList in dateList)
            //    {
            //        nextStartDate = showingDateFromList;
            //        if (count < dateList.Count)
            //        {
            //            //nextStartDate = showingDateFromList;
            //            if (showingDateFromList.AddDays(1).Date == dateList[count].Date)
            //            {
            //                //next date in list is for next day so do nothing
            //            }
            //            else
            //            {
            //                pDatePicker.BlackoutDates.Add(new CalendarDateRange(nextStartDate.AddDays(1), dateList[count].AddDays(-1)));
            //            }
            //            count = count + 1;
            //        }
            //    }
            //    pDatePicker.BlackoutDates.Add(new CalendarDateRange(DateTime.Now, dateList[0].AddDays(-1)));
            //    //pDatePicker.BlackoutDates.Add(new CalendarDateRange(dateList[dateList.Count - 1].AddDays(1), dateList[dateList.Count - 1].AddMonths(12)));
            //    try
            //    {
            //        pDatePicker.BlackoutDates.Add(new CalendarDateRange(dateList[count - 1].AddDays(1), nextStartDate.AddYears(1)));
            //    }
            //    catch (Exception)
            //    {
            //        //pDatePicker.BlackoutDates.Add(new CalendarDateRange(dateList[count - 1].AddDays(1), nextStartDate.AddYears(1)));
            //        pDatePicker.BlackoutDates.Add(new CalendarDateRange(nextStartDate.AddDays(1), nextStartDate.AddYears(1)));
            //    }
            //}
            //else
            //{
            //    pDatePicker.BlackoutDates.Add(new CalendarDateRange(DateTime.Now, DateTime.Now.AddYears(500)));
            //}
        }