private void button3_Click(object sender, EventArgs e)
        {
            Kunde k = new Kunde();
                    XmlDocument doc = new XmlDocument();
                    String CsOG = "";

                    buginCity = b.FillCity(); //Бүгінгі қалалардың тізімін алу

                    foreach (var item in buginCity) //Бүгінгі
                    {
                        k.Id = item.Id;
                        CsOG = CsOG + " " + item.CityId;
                        buginWeather = b.GetWeatherID(item.CityId); // Аңықтамадан қала кодын алу, болмаса 0 береді
                        foreach (var item2 in buginWeather)
                        {
                            k.WeatherId = item2.WeatherId;
                        }

                        if (buginWeather.Count() == 1)
                        {
                            doc.Load("https://export.yandex.ru/weather-ng/forecasts/" + k.WeatherId + ".xml");
                            k.Auaraiu = doc.GetElementsByTagName("fact").Item(0).ChildNodes.Item(4).InnerText;
                            k.ImageV3 = doc.GetElementsByTagName("fact").Item(0).ChildNodes.Item(8).InnerText + ".png";
                            b.Update(k, k, 1);
                            b.Update(k, k, 2);

                        }
                    }

                    b.WriteMyLOG(CsOG);
                   // k.Id = 131006;
                    //b.Insert(k);
        }
        public List<Kunde> FillCity()
        {
            DateTime bugin = DateTime.Today;
            List<Kunde> KundeList = new List<Kunde>();

            string buginStr = bugin.Year.ToString() + '-' + bugin.Month.ToString() + '-' + bugin.Day.ToString();

            try
            {
                command.CommandText = "SELECT Daily_Values.Daily_ID, Daily_Values_1.Value " +
                    "FROM Daily_Values AS Daily_Values_2 INNER JOIN (Daily_Values AS Daily_Values_1 INNER JOIN Daily_Values ON Daily_Values_1.Daily_ID = Daily_Values.Daily_ID) ON Daily_Values_2.Daily_ID = Daily_Values_1.Daily_ID " +
                    "WHERE (((Daily_Values.Value) Like '" + buginStr +"%') AND ((Daily_Values.Field)='actual') AND ((Daily_Values_1.Field)='city') AND ((Daily_Values_2.Field)='qualifier') AND ((Daily_Values_2.Value)='S' Or (Daily_Values_2.Value)='VP'))";
             //   command.CommandText = "SELECT * FROM Daily_Values;";
             //   command.CommandType = CommandType.Text;

                connection.Open();

                OleDbDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    Kunde k = new Kunde();
                    k.Id = Convert.ToInt32(reader["Daily_ID"].ToString());
                    k.CityId = reader["Value"].ToString();

                    KundeList.Add(k);
                }

                return KundeList;

            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
        public List<Kunde> GetWeatherID(String CityIATA)
        {
            DateTime bugin = DateTime.Today;
            List<Kunde> KundeList = new List<Kunde>();

            try
            {
                command.CommandText = "SELECT Field_Values.Value " +
                    "FROM Field_Values " +
                    "WHERE (Field='city') AND ([Language]='en')" +
                    "AND (Value_Type='WeatherID') AND (Code='" + CityIATA + "')";

                //   command.CommandText = "SELECT * FROM Daily_Values;";
                //command.CommandType = CommandType.Text;

                connection.Open();

                OleDbDataReader reader2 = command.ExecuteReader();

                while (reader2.Read())
                {
                    Kunde k = new Kunde();
                    k.WeatherId = reader2["Value"].ToString();

                    KundeList.Add(k);
                }
                return KundeList;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }

            }
        }
        public void Update(Kunde oldKunde, Kunde newJunde, int JolID)
        {
            try
            {
                if (JolID == 1)
                command.CommandText = "SELECT * FROM Daily_Values WHERE Field='auaraiu1' and Daily_ID=" + oldKunde.Id;
                else command.CommandText = "SELECT * FROM Daily_Values WHERE Field='auaraiu' and Daily_ID=" + oldKunde.Id;
                //command.CommandType = CommandType.Text;

                connection.Open();

                OleDbDataReader maginasiBar = command.ExecuteReader();

                if (maginasiBar.Read())
                {
                    connection.Close();
                    if (JolID == 1)
                    command.CommandText = "UPDATE Daily_Values SET Daily_Values.value='" + newJunde.Auaraiu + "' WHERE Field='auaraiu1' and Daily_ID=" + oldKunde.Id;
                    else command.CommandText = "UPDATE Daily_Values SET Daily_Values.value='" + newJunde.ImageV3 + "' WHERE Field='auaraiu' and Daily_ID=" + oldKunde.Id;
                    command.CommandType = CommandType.Text;
                    connection.Open();

                    command.ExecuteNonQuery();
                }
                else
                {
                    connection.Close();
                    newJunde.Id = oldKunde.Id;
                    Insert(newJunde, JolID);
                }

            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }

            }
        }
        public void Insert(Kunde k, int JolID)
        {
            try
            {
                if (JolID == 1)
                command.CommandText = "INSERT INTO Daily_Values VALUES(" + k.Id + ",'auaraiu1',1,'" + k.Auaraiu + "',Null,128);";
                else command.CommandText = "INSERT INTO Daily_Values VALUES(" + k.Id + ",'auaraiu',1,'" + k.ImageV3 + "',Null,128);";
                command.CommandType = CommandType.Text;
                connection.Open();

                command.ExecuteNonQuery();

            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }

            }
        }
        private void button5_Click(object sender, EventArgs e)
        {
            Kunde oldKunde = new Kunde();
                    Kunde newJunde = new Kunde();

                    oldKunde = comboBox1.SelectedItem as Kunde;

                    newJunde.Auaraiu = textBox2.Text;

                    b.Update(oldKunde, newJunde, 1);
        }