public void Load() { Thread.CurrentThread.CurrentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone(); Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern = "ddd, MMM dd, yyyy"; select_dPicker.SelectedDate = DateTime.Now; note_tBox.Text = note; time_TPicker.Value = Convert.ToDateTime(hour.Replace(".", ":")); if (Connection.MyConnection.State == ConnectionState.Broken) { Connection.MyConnection.Open(); } if (Connection.MyConnection.State == ConnectionState.Open) { using (OdbcCommand MyCommand = new OdbcCommand("SELECT `tms_projects`.`project_name`,`tms_reminders`.`project` ,`tms_category`.`category_name` ,`tms_reminders`.`category` FROM `tms_reminders` INNER JOIN `tms_projects` ON `tms_projects`.`project_id`=`tms_reminders`.`project` INNER JOIN `tms_category` ON `tms_category`.`category_id`=`tms_reminders`.`category` WHERE `tms_reminders`.`rid`='" + id + "'", Connection.MyConnection)) { OdbcDataReader MyDataReader; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Read(); proname_wTBox.Text = MyDataReader.GetString(0); proid = MyDataReader.GetInt32(1); catename_wTBox.Text = MyDataReader.GetString(2); catid = MyDataReader.GetInt32(3); MyDataReader.Close(); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (Connection.MyConnection.State == ConnectionState.Broken) { Connection.MyConnection.Open(); } if (Connection.MyConnection.State == ConnectionState.Open) { using (OdbcCommand MyCommand = new OdbcCommand("SELECT duedate,priority,reminder,minute,note FROM tms_reminders WHERE rid='" + TaskReminderCount.rid + "'", Connection.MyConnection)) { OdbcDataReader MyDataReader; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Read(); duedateLab.Content = MyDataReader.GetDateTime(0).ToString("yyyy-MM-dd hh:mm tt "); priolab.Content = MyDataReader.GetString(1); title_Lab.Content = MyDataReader.GetString(2); noofhourlab.Content = TimeDisplay(MyDataReader.GetInt32(3)); string tempcomment = MyDataReader.GetString(4); if (tempcomment.Length == 0) { commentlab.Text = "<no descrption>"; } else { commentlab.Text = MyDataReader.GetString(4); } MyDataReader.Close(); } } }
// Retourne le total par station public static Dictionary <int, double> getMoyenne() { Dictionary <int, double> result = new Dictionary <int, double>(); if (!connection) { setConnection(); if (!connection) { return(result); } } //Desc de la table donnees OdbcCommand MyCommand = new OdbcCommand("select station, avg(available + free) from donnees where valid='1' group by station;", MyConnection); OdbcDataReader MyDataReader; MyDataReader = MyCommand.ExecuteReader(); Console.WriteLine("Executed : " + MyDataReader.RecordsAffected); while (MyDataReader.Read()) { result[MyDataReader.GetInt32(0)] = MyDataReader.GetDouble(1); } //Close all resources MyDataReader.Close(); return(result); }
// Retourne les vecteurs pour les jours ouvres public static void getRemplissageByHourOuvresHisto(DateTime start, DateTime end) { Dictionary <int, Dictionary <int, KeyValuePair <double, double> > > result = new Dictionary <int, Dictionary <int, KeyValuePair <double, double> > >(); if (!connection) { setConnection(); } //Desc de la table donnees string s = " and date >= " + convertToTimestamp(start) + " and date <= " + convertToTimestamp(end) + " "; s += "and day < 6 "; OdbcCommand MyCommand = new OdbcCommand("select station as Station, hour as Hour, cast(avg(available) * 100 as unsigned) as Valeur, cast(std(available) * 100 as unsigned) as Variance from donnees where valid='1' and free!=\"\" " + s + "group by station, hour;", MyConnection); OdbcDataReader MyDataReader; MyDataReader = MyCommand.ExecuteReader(); Console.WriteLine("Executed : " + MyDataReader.RecordsAffected); while (MyDataReader.Read()) { int valeur = 0; int station = MyDataReader.GetInt32(0); int hour = MyDataReader.GetInt32(1); int variance = 0; try { valeur = MyDataReader.GetInt32(2); } catch (Exception e) { Console.WriteLine("Error : " + e.Message); continue; } try { variance = MyDataReader.GetInt32(3); } catch (Exception e) { Console.WriteLine("Error : " + e.Message); continue; } if (!result.ContainsKey(station)) { result[station] = new Dictionary <int, KeyValuePair <double, double> >(); } result[station][hour] = new KeyValuePair <double, double>((valeur / 100.0) / (double)tailles[station], (variance / 100.0) / (double)tailles[station]); } //Close all resources MyDataReader.Close(); statsTabHeureOuvre = result; }
// Initialize the connection to the DB private static void setConnection() { try { //Connect to MySQL using MyODBC MyConnection = new OdbcConnection(MyConString); MyConnection.Open(); connection = true; tailles = new Dictionary <int, int>(); OdbcCommand MyCommand = new OdbcCommand("select id,max(total) from stations group by id;", MyConnection); //OdbcCommand MyCommand = new OdbcCommand( "select station, max(free+available) from donnees where free !=\"\" group by station;", MyConnection ); OdbcDataReader MyDataReader; MyDataReader = MyCommand.ExecuteReader(); Console.WriteLine("Executed : " + MyDataReader.RecordsAffected); while (MyDataReader.Read()) { int valeur = 0; int station = MyDataReader.GetInt32(0); //int hour = MyDataReader.GetInt32(1); try { valeur = MyDataReader.GetInt32(1); } catch (Exception e) { Console.WriteLine("Pas de base : " + e.Message); continue; } tailles.Add(station, valeur); } //Close all resources MyDataReader.Close(); } catch (OdbcException MyOdbcException)//Catch any ODBC exception .. { connection = false; for (int i = 0; i < MyOdbcException.Errors.Count; i++) { MessageBox.Show("Aucune connection à la base de données n'a pu être établie"); Console.Write("ERROR #" + i + "\n" + "Message: " + MyOdbcException.Errors[i].Message + "\n" + "Native: " + MyOdbcException.Errors[i].NativeError.ToString() + "\n" + "Source: " + MyOdbcException.Errors[i].Source + "\n" + "SQL: " + MyOdbcException.Errors[i].SQLState + "\n"); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { outt_TPicker.Value = Convert.ToDateTime(Login.etimehh + ":" + Login.etimemm); using (OdbcCommand MyCommand = new OdbcCommand("select date_year,date_month,date_day from tms_logsheet where logsheet_id='" + lgid + "'", Connection.MyConnection)) { OdbcDataReader MyDataReader; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Read(); load_lab.Content = "You haven't sign-out on " + (MyDataReader.GetInt32(2).ToString()) + "/" + (MyDataReader.GetInt32(1).ToString()) + "/" + (MyDataReader.GetInt32(0).ToString()) + "."; MyDataReader.Close(); } }
// Retourne les vecteurs par jour public static Dictionary <int, Dictionary <int, double> > getRemplissageByDay(DateTime start, DateTime end) { Dictionary <int, Dictionary <int, double> > result = new Dictionary <int, Dictionary <int, double> >(); if (!connection) { setConnection(); if (!connection) { return(result); } } //Desc de la table donnees string s = " and date >= " + convertToTimestamp(start) + " and date <= " + convertToTimestamp(end) + " "; OdbcCommand MyCommand = new OdbcCommand("select station as Station, day as Day, cast(avg(available) * 100 as unsigned) as Valeur from donnees where valid='1' and free!=\"\" " + s + "group by station, day;", MyConnection); OdbcDataReader MyDataReader; MyDataReader = MyCommand.ExecuteReader(); Console.WriteLine("Executed : " + MyDataReader.RecordsAffected); while (MyDataReader.Read()) { int valeur = 0; int station = MyDataReader.GetInt32(0); int hour = MyDataReader.GetInt32(1); try { valeur = MyDataReader.GetInt32(2); } catch (Exception e) { Console.WriteLine("Error : " + e.Message); continue; } if (!result.ContainsKey(station)) { result[station] = new Dictionary <int, double>(); } result[station][hour] = valeur / 100.0; result[station][hour] = result[station][hour] / (double)tailles[station]; } //Close all resources MyDataReader.Close(); return(result); }
public void Zapros(string CommandText) { MySqlCommand myCommand = new MySqlCommand(); MySqlDataReader MyDataReader; MySqlConnection myConnection = new MySqlConnection(CONNECT); listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); }
// Effectue les requetes private static Dictionary <int, Dictionary <int, KeyValuePair <double, double> > > sendRequest(String query, int select) { Dictionary <int, Dictionary <int, KeyValuePair <double, double> > > result = new Dictionary <int, Dictionary <int, KeyValuePair <double, double> > >(); if (!connection) { setConnection(); if (!connection) { return(result); } } //Console.WriteLine("\n !!! success, connected successfully !!!\n"); ////Display connection information //Console.WriteLine("Connection Information:"); //Console.WriteLine("\tConnection String:" + MyConnection.ConnectionString); //Console.WriteLine("\tConnection Timeout:" + MyConnection.ConnectionTimeout); //Console.WriteLine("\tDatabase:" + MyConnection.Database); //Console.WriteLine("\tDataSource:" + MyConnection.DataSource); //Console.WriteLine("\tDriver:" + MyConnection.Driver); //Console.WriteLine("\tServerVersion:" + MyConnection.ServerVersion); //Desc de la table donnees OdbcCommand MyCommand = new OdbcCommand(query, MyConnection); OdbcDataReader MyDataReader; MyDataReader = MyCommand.ExecuteReader(); Console.WriteLine("Executed : " + MyDataReader.RecordsAffected); while (MyDataReader.Read()) { KeyValuePair <double, double> temp1 = new KeyValuePair <double, double>(MyDataReader.GetDouble(1), MyDataReader.GetDouble(2)); Dictionary <int, KeyValuePair <double, double> > temp = new Dictionary <int, KeyValuePair <double, double> >(); temp[select] = temp1; result[MyDataReader.GetInt32(0)] = temp; //result.Add(MyDataReader.GetInt32(0), temp); } //Close all resources MyDataReader.Close(); //MyConnection.Close(); return(result); }
public bool WebAuth(string login, string password, AccessLevel accl) { if (login != null && password != null) { MySqlDataReader MyDataReader; cmd.CommandText = "SELECT login, password, access_level FROM `accounts`;"; MyDataReader = cmd.ExecuteReader(); while (MyDataReader.Read()) { int _access_level = MyDataReader.GetInt32(2); string _login = MyDataReader.GetString(0); string _password = MyDataReader.GetString(1); if (_login == login && _password == password) { if (accl == AccessLevel.Admin) { MyDataReader.Close(); if (_access_level == ((int)AccessLevel.Admin)) { return(true); } else { return(false); } } else { MyDataReader.Close(); return(true); } } } if (!MyDataReader.IsClosed) { MyDataReader.Close(); } } return(false); }
// Retourne toute la base public static Dictionary <int, ArrayList> getAllToFile() { Dictionary <int, ArrayList> result = new Dictionary <int, ArrayList>(); if (!connection) { setConnection(); if (!connection) { return(result); } } //Desc de la table donnees OdbcCommand MyCommand = new OdbcCommand("select station, available from donnees where valid='1' and free!=\"\";", MyConnection); OdbcDataReader MyDataReader; MyDataReader = MyCommand.ExecuteReader(); Console.WriteLine("Executed : " + MyDataReader.RecordsAffected); while (MyDataReader.Read()) { int station = MyDataReader.GetInt32(0); int hour = MyDataReader.GetInt32(1); if (!result.ContainsKey(station)) { result[station] = new ArrayList(); } result[station].Add(hour); } //Close all resources MyDataReader.Close(); return(result); }
private void button1_Click(object sender, EventArgs e) { // создаём объект для подключения к БД MySqlConnection conn = new MySqlConnection(connStr); // устанавливаем соединение с БД conn.Open(); // запрос string auth = "SELECT * FROM Sotrudnic WHERE Login = ''"; if (comboBox1.SelectedIndex == 0) { auth = "SELECT * FROM Sotrudnic WHERE Login = '******' AND RoleID = '0'"; } if (comboBox1.SelectedIndex == 1) { auth = "SELECT * FROM Sotrudnic WHERE Login = '******' AND RoleID = '1'"; } try { MySqlCommand commandauth = new MySqlCommand(auth, conn); MySqlDataReader MyDataReader; MyDataReader = commandauth.ExecuteReader(); while (MyDataReader.Read()) { id = MyDataReader.GetInt32(0); name = MyDataReader.GetString(1); surname = MyDataReader.GetString(2); otchestvo = MyDataReader.GetString(3); login = MyDataReader.GetString(5); password = MyDataReader.GetString(6); phone = MyDataReader.GetString(4); roleid = MyDataReader.GetInt32(7); } MyDataReader.Close(); // закрываем соединение с БД conn.Close(); if (id == 0) { MessageBox.Show("Пользователь не найден", "ЖД Вокзал", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string notshapass = textBox2.Text; string shapass = ""; //ПОЛУЧАЕМ ХЭШ ПАРОЛЯ byte[] hash = Encoding.ASCII.GetBytes(notshapass); MD5 md5 = new MD5CryptoServiceProvider(); byte[] hashenc = md5.ComputeHash(hash); string result = ""; foreach (var b in hashenc) { result += b.ToString("x2"); } shapass = result; if (shapass == password) { if (roleid == 0) { //Админ Form adminka = new adminka(); this.Visible = false; adminka.ShowDialog(); this.Visible = true; Application.Exit(); } if (roleid == 1) { //Оператор Form operator_form = new operator_form(); this.Visible = false; operator_form.ShowDialog(); this.Visible = true; Application.Exit(); } } else { MessageBox.Show("Пароль введен неверно", "ЖД Вокзал", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show("Ошибка работы с базой данных" + ex, "ЖД Вокзал", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public List <GetPhoneCallsData> getPhoneCalls(String Date) { List <GetPhoneCallsData> PhoneCalls = new List <GetPhoneCallsData>(); connect(); MySqlCommand sql_cmd = new MySqlCommand(String.Format("SELECT pc.* FROM phone_calls pc LEFT JOIN call_status cs ON pc.PhoneCallId = cs.phoneCallId WHERE STR_TO_DATE(pc.DateEvent, '%d.%m.%Y') >= STR_TO_DATE('{0}', '%d.%m.%Y') AND cs.id IS NULL", Date), MySQL); MySqlDataReader MyDataReader; MyDataReader = sql_cmd.ExecuteReader(); int count = 0; while (MyDataReader.Read()) { try { GetPhoneCallsData phone_call = new GetPhoneCallsData(); if (!String.IsNullOrEmpty(MyDataReader.GetString("CompanyId").ToString())) { phone_call.CompanyId = new Guid(MyDataReader.GetString("CompanyId")); } if (!String.IsNullOrEmpty(MyDataReader.GetString("CompanyName").ToString())) { phone_call.CompanyName = MyDataReader.GetString("CompanyName"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("PhoneCallId").ToString())) { phone_call.PhoneCallId = new Guid(MyDataReader.GetString("PhoneCallId")); } if (!String.IsNullOrEmpty(MyDataReader.GetString("PhoneCallNr").ToString())) { phone_call.PhoneCallNr = MyDataReader.GetString("PhoneCallNr"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("Pin").ToString())) { phone_call.Pin = MyDataReader.GetString("Pin"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("CustomerName").ToString())) { phone_call.CustomerName = MyDataReader.GetString("CustomerName"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("Inn").ToString())) { phone_call.Inn = MyDataReader.GetString("Inn"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("Kpp").ToString())) { phone_call.Kpp = MyDataReader.GetString("Kpp"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("Email").ToString())) { phone_call.Email = MyDataReader.GetString("Email"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("BitrixId").ToString())) { phone_call.BitrixId = MyDataReader.GetString("BitrixId"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("ScheduledStart").ToString().Trim())) { phone_call.ScheduledStart = DateTime.Parse(MyDataReader.GetString("ScheduledStart")); } if (!String.IsNullOrEmpty(MyDataReader.GetString("Overview").ToString())) { phone_call.Overview = MyDataReader.GetString("Overview"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("Priority").ToString())) { phone_call.Priority = MyDataReader.GetInt16("Priority"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("EventNr").ToString())) { phone_call.EventNr = MyDataReader.GetInt32("EventNr"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("DateEvent").ToString())) { phone_call.DateEvent = DateTime.Parse(MyDataReader.GetString("DateEvent").ToString()); } if (!String.IsNullOrEmpty(MyDataReader.GetString("ProductEvent").ToString())) { phone_call.ProductEvent = MyDataReader.GetString("ProductEvent"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("Phone").ToString())) { phone_call.Phone = MyDataReader.GetString("Phone"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("EventName").ToString())) { phone_call.EventName = MyDataReader.GetString("EventName"); } if (!String.IsNullOrEmpty(MyDataReader.GetString("TimeDifference").ToString())) { phone_call.TimeDifference = MyDataReader.GetInt16("TimeDifference"); } PhoneCalls.Add(phone_call); } catch (Exception e) { } count++; } MyDataReader.Close(); return(PhoneCalls); }
public SpavkaRazmetka(string NamWindows) { InitializeComponent(); Title = NamWindows; string CommandText = ""; MySqlCommand myCommand = new MySqlCommand(); MySqlDataReader MyDataReader; MySqlConnection myConnection = new MySqlConnection(CONNECT); try { switch (NamWindows) { case "Документы, удостоверяющие личность": CommandText = "SELECT * FROM nzzGtRxVKL.Koddoc;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Класификаторы СОАТО": break; case "Типы улиц": CommandText = "SELECT * FROM nzzGtRxVKL.Tipul;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Налоговые инспекции": CommandText = "SELECT * FROM nzzGtRxVKL.Ngni;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Статусы плательщика": CommandText = "SELECT * FROM nzzGtRxVKL.Statplat;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Страны мира": CommandText = "SELECT * FROM nzzGtRxVKL.Country;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Авторские вознагрождения": CommandText = "SELECT * FROM nzzGtRxVKL.Author;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Доходы по операциям с ценными бумагами": CommandText = "SELECT * FROM nzzGtRxVKL.Stock;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Доходы, не облагаемые в устан. пределах": CommandText = "SELECT * FROM nzzGtRxVKL.Taxlimit;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Доходы от резидентов(не резидентов) ПВТ": CommandText = "SELECT* FROM nzzGtRxVKL.Parkvt;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Стандартные вычеты": CommandText = "SELECT * FROM nzzGtRxVKL.Standart;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Социальные вычеты": CommandText = "SELECT * FROM nzzGtRxVKL.Social;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Имущественные вычеты": CommandText = "SELECT * FROM nzzGtRxVKL.Property;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Доходы, полученные гражданами ЕАЭС": CommandText = "SELECT * FROM nzzGtRxVKL.Ecunion;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; case "Доходы, полученные в Могилевской области": CommandText = "SELECT * FROM nzzGtRxVKL.Mogilev;"; listSpravka.ItemsSource = null; myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open(); MyDataReader = myCommand.ExecuteReader(); while (MyDataReader.Read()) { norma.Add(new Norma(MyDataReader.GetInt32(0), MyDataReader.GetInt32(1), MyDataReader.GetString(2))); } MyDataReader.Close(); listSpravka.ItemsSource = norma; break; } } catch (Exception e) { MessageBox.Show(e.ToString(), "Oшибка", MessageBoxButton.OK, MessageBoxImage.Error); this.Close(); } }