private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { timeStops.Items.Clear(); List <string> List = new List <string>(); List = DBselect.CalculateTimes(connstr, label11.Text, selectTimes + label11.Text + "' and DateofStop>='" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "' order by DateofStop,Time").Result; foreach (string s in List) { timeStops.Items.Add(s); } }
//Функция объединяющая весь сбор информации по всем рестам кроме перцев //Из-за особенностей хранения данных по Акция для Перцев не возможно передавать при нажатии на кнопку каждого ресторана Имя ресторана, потому что нужно слово 'Перцы' для всех 7 кнопок void GetAllInfo(object sender, string[] tParams, string oname) { string bluez, lightgreenz, greenz, yellowz, orangez, redz, grayz; this.Refresh(); dateTimePicker1.Text = DateTime.Now.ToShortDateString(); button16.Visible = false; TimeWindowResize(); restName.Text = ((Button)sender).Text; string zname = ((Button)sender).Name; label11.Text = zname; DateTime TZ = DateTime.Now; curTime.Text = TZ.ToLongTimeString(); List <string> ListTimes = new List <string>(); List <string> ListDish = new List <string>(); List <string> ListOffers = new List <string>(); string whenStops = DateTime.Now.ToString("yyyy-MM-dd"); ListTimes = DBselect.CalculateTimes(connstr, zname, selectTimes + zname + "' and DateofStop>='" + whenStops + "' order by DateOfStop,Time").Result; ListDish = DBselect.SelectDishStops(connstr, zname, selectDishes + zname + "'order by Dish").Result; ListOffers = DBselect.SelectOffers(connstr, zname, selectOffers + oname + "'").Result; double TADelay = DBselect.CalculateDelay(connstr, zname, selectTADelays + zname + "'").Result; double DDelay = DBselect.CalculateDelay(connstr, zname, selectDDelays + zname + "'").Result; if (DDelay != 0) { delay_label.Text = "+" + DDelay.ToString(); } else { delay_label.Text = ""; } TimeSpan timeFrom = new TimeSpan(Convert.ToInt32(ReadS("timeFromHour")), Convert.ToInt32(ReadS("timeFromMinutes")), 0); TimeSpan timeTo = new TimeSpan(Convert.ToInt32(ReadS("timeToHour")), Convert.ToInt32(ReadS("timeToMinutes")), 0); TimeSpan timeAdd = new TimeSpan(Convert.ToInt32(ReadS("timeAddHour")), Convert.ToInt32(ReadS("timeAddMinutes")), 0); bluez = CalculateFinal.CalcBlueZoneTime(TZ, tParams[0], tParams[7], zname, ListTimes).Result; lightgreenz = CalculateFinal.CalcZoneTime(TZ, tParams[1], tParams[7], zname, ListTimes).Result; greenz = CalculateFinal.CalcZoneTime(TZ, tParams[2], tParams[7], zname, ListTimes).Result; yellowz = CalculateFinal.CalcZoneTime(TZ, tParams[3], tParams[7], zname, ListTimes).Result; orangez = CalculateFinal.CalcZoneTime(TZ, tParams[4], tParams[7], zname, ListTimes).Result; redz = CalculateFinal.CalcZoneTime(TZ, tParams[5], tParams[7], zname, ListTimes).Result; grayz = CalculateFinal.CalcZoneTime(TZ, tParams[6], tParams[7], zname, ListTimes).Result; if (bluez != "") { blueTZ.Text = bluez + ReturnMinutes(tParams[0]); } else { blueTZ.Text = bluez; } if (lightgreenz != "") { lgreenTZ.Text = lightgreenz + ReturnMinutes(tParams[1]); } else { lgreenTZ.Text = lightgreenz; } if (greenz != "") { greenTZ.Text = greenz + ReturnMinutes(tParams[2]); } else { greenTZ.Text = greenz; } if (yellowz != "") { yellowTZ.Text = yellowz + ReturnMinutes(tParams[3]); } else { yellowTZ.Text = yellowz; } if (orangez != "") { orangeTZ.Text = orangez + ReturnMinutes(tParams[4]); } else { orangeTZ.Text = orangez; } if (redz != "") { redTZ.Text = redz + ReturnMinutes(tParams[5]); } else { redTZ.Text = redz; } if (grayz != "") { grayTZ.Text = grayz + ReturnMinutes(tParams[6]); } else { grayTZ.Text = grayz; } /*blueTZ.Text = bluez + ReturnMinutes(tParams[0]); * lgreenTZ.Text = lightgreenz + ReturnMinutes(tParams[1]); * //lgreenTZ.Text = ""; * greenTZ.Text = greenz + ReturnMinutes(tParams[2]); * yellowTZ.Text = yellowz + ReturnMinutes(tParams[3]); * orangeTZ.Text = orangez + ReturnMinutes(tParams[4]); * redTZ.Text = redz + ReturnMinutes(tParams[5]); * grayTZ.Text = grayz + ReturnMinutes(tParams[6]);*/ tawayTZ.Text = CalculateFinal.CalcZoneTATime(TZ, tParams[8], tParams[9], zname).Result; foreach (string dish in ListDish) { dishStops.Items.Add(dish); } foreach (string time in ListTimes) { timeStops.Items.Add(time); } foreach (string offer in ListOffers) { richTextBox1.AppendText(offer); richTextBox1.AppendText("\n"); offersList.Items.Add(offer); bool isInt = Int32.TryParse(offer.Substring(0, 1), out int r); if (isInt == true) { offersList.SetSelected(offersList.FindString(offer), true); } } }