Пример #1
0
        protected void Check(object sender, EventArgs e)
        {
            time.Items.Clear();
            string date      = Calendar1.SelectedDate.ToShortDateString();
            string mySQLDate = date.Split('.')[2] +
                               '-' + date.Split('.')[1] +
                               '-' + date.Split('.')[0];

            Debug.WriteLine(mySQLDate);

            List <string> items = MySQLServer.get_times(mySQLDate);

            bool[] used = new bool[12];
            foreach (string item in items)
            {
                int begin = int.Parse(item.Split(':')[0]);


                for (int hour = begin - 1; hour < begin + 2; ++hour)
                {
                    if (hour - 10 >= 0)
                    {
                        used[hour - 10] = true;
                    }
                }
            }
            for (int hour = 10; hour < 22; ++hour)
            {
                if (!used[hour - 10])
                {
                    string h = hour.ToString() + ":00:00";
                    time.Items.Add(new ListItem(h));
                }
            }
        }