Ejemplo n.º 1
0
        private void listViewZhitie_SelectedIndexChanged(object sender, EventArgs e)
        {
            buttonApply.Enabled  = true;
            buttonDelete.Enabled = true;

            textBoxName.Enabled = true;
            textBoxCena.Enabled = true;

            bNew = false;

            if (listViewZhitie.FocusedItem == null)
            {
                return;
            }

            int k = queueZhitie.Count;

            for (int i = 0; i < k; i++)
            {
                m_zhitie = (_Zhitie)queueZhitie.Dequeue();
                if (m_zhitie.id.ToString() == (string)listViewZhitie.Items[listViewZhitie.FocusedItem.Index].Tag)
                {
                    textBoxName.Text = m_zhitie.nazvanie;
                    textBoxCena.Text = m_zhitie.cena;
                    queueZhitie.Enqueue(m_zhitie);
                    break;
                }
                ;

                queueZhitie.Enqueue(m_zhitie);
            }
        }
Ejemplo n.º 2
0
 private void comboBoxZhitie_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBoxZhitie.SelectedIndex == -1)
     {
         return;
     }
     m_zhitie = (_Zhitie)comboBoxZhitie.SelectedItem;
 }
Ejemplo n.º 3
0
        public void refreshZhitie()
        {
            string Zhitie = "";

            if (comboBoxZhitie.SelectedIndex != -1)
            {
                Zhitie = m_zhitie.nazvanie.ToString();
            }

            comboBoxZhitie.Items.Clear();
            queueZhitie.Clear();

            try
            {
                mainWin.m_dbConnector.Lock();
                MySqlConnection conn = mainWin.m_dbConnector.getMySqlConnection();

                string           sql       = "SELECT `id`, `nazvanie` FROM `zhitie` ORDER BY `id`";
                MySqlDataAdapter myAdapter = new MySqlDataAdapter();
                myAdapter.SelectCommand = new MySqlCommand(sql, conn);
                DataSet dataSet = new DataSet();
                myAdapter.Fill(dataSet);
                DataTable dataTable = dataSet.Tables[0];

                _Zhitie c = new _Zhitie();

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    c.id       = dataRow["id"].ToString();
                    c.nazvanie = dataRow["nazvanie"].ToString().Trim();

                    comboBoxZhitie.Items.Add(c);


                    if (Zhitie != "" && Zhitie == c.nazvanie.ToString())
                    {
                        comboBoxZhitie.SelectedItem = c;
                    }


                    queueZhitie.Enqueue(c);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                mainWin.m_dbConnector.Unlock();
            }
        }
Ejemplo n.º 4
0
        public void refreshZhitie()
        {
            listViewZhitie.Items.Clear();
            queueZhitie.Clear();


            try
            {
                mainWin.m_dbConnector.Lock();
                MySqlConnection conn = mainWin.m_dbConnector.getMySqlConnection();

                string           sql       = "SELECT `id`, `nazvanie`, `cena` FROM `zhitie` ORDER BY `id`";
                MySqlDataAdapter myAdapter = new MySqlDataAdapter();
                myAdapter.SelectCommand = new MySqlCommand(sql, conn);
                DataSet dataSet = new DataSet();
                myAdapter.Fill(dataSet);
                DataTable dataTable = dataSet.Tables[0];

                listViewZhitie.Items.Clear();
                queueZhitie.Clear();
                _Zhitie t = new _Zhitie();

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    ListViewItem item1 = new ListViewItem(dataRow["id"].ToString().Trim(), 0);
                    t.id = dataRow["id"].ToString();
                    item1.SubItems.Add(dataRow["nazvanie"].ToString().Trim());
                    t.nazvanie = dataRow["nazvanie"].ToString().Trim();
                    item1.SubItems.Add(dataRow["cena"].ToString().Trim());
                    t.cena = dataRow["cena"].ToString().Trim();

                    listViewZhitie.Items.Add(item1);
                    listViewZhitie.Items[listViewZhitie.Items.Count - 1].Tag = dataRow["id"].ToString();
                    queueZhitie.Enqueue(t);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                mainWin.m_dbConnector.Unlock();
            }
        }
Ejemplo n.º 5
0
        private void listViewZhitie_SelectedIndexChanged(object sender, EventArgs e)
        {
            buttonApply.Enabled = true;
            buttonDelete.Enabled = true;

            textBoxName.Enabled = true;
            textBoxCena.Enabled = true;

            bNew = false;

            if (listViewZhitie.FocusedItem == null)
                return;

            int k = queueZhitie.Count;
            for (int i = 0; i < k; i++)
            {
                m_zhitie = (_Zhitie)queueZhitie.Dequeue();
                if (m_zhitie.id.ToString() == (string)listViewZhitie.Items[listViewZhitie.FocusedItem.Index].Tag)
                {
                    textBoxName.Text = m_zhitie.nazvanie;
                    textBoxCena.Text = m_zhitie.cena;
                    queueZhitie.Enqueue(m_zhitie);
                    break;
                };

                queueZhitie.Enqueue(m_zhitie);
            }
        }
Ejemplo n.º 6
0
        public void refreshZhitie()
        {
            listViewZhitie.Items.Clear();
            queueZhitie.Clear();

            try
            {
                mainWin.m_dbConnector.Lock();
                MySqlConnection conn = mainWin.m_dbConnector.getMySqlConnection();

                string sql = "SELECT `id`, `nazvanie`, `cena` FROM `zhitie` ORDER BY `id`";
                MySqlDataAdapter myAdapter = new MySqlDataAdapter();
                myAdapter.SelectCommand = new MySqlCommand(sql, conn);
                DataSet dataSet = new DataSet();
                myAdapter.Fill(dataSet);
                DataTable dataTable = dataSet.Tables[0];

                listViewZhitie.Items.Clear();
                queueZhitie.Clear();
                _Zhitie t = new _Zhitie();

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    ListViewItem item1 = new ListViewItem(dataRow["id"].ToString().Trim(), 0);
                    t.id = dataRow["id"].ToString();
                    item1.SubItems.Add(dataRow["nazvanie"].ToString().Trim());
                    t.nazvanie = dataRow["nazvanie"].ToString().Trim();
                    item1.SubItems.Add(dataRow["cena"].ToString().Trim());
                    t.cena = dataRow["cena"].ToString().Trim();

                    listViewZhitie.Items.Add(item1);
                    listViewZhitie.Items[listViewZhitie.Items.Count - 1].Tag = dataRow["id"].ToString();
                    queueZhitie.Enqueue(t);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                mainWin.m_dbConnector.Unlock();
            }
        }
Ejemplo n.º 7
0
        private void listViewRasselenie_SelectedIndexChanged(object sender, EventArgs e)
        {
            buttonApply.Enabled  = true;
            buttonDelete.Enabled = true;

            textBoxName.Enabled          = true;
            comboBoxZhitie.SelectedIndex = -1;
            dateTimePicker1.Enabled      = true;
            comboBoxZhitie.Enabled       = true;
            textBoxKolDays.Enabled       = true;
            textBoxKolCzel.Enabled       = true;
            textBoxPark.Enabled          = true;
            textBoxNkvit.Enabled         = true;
            comboBoxCity.Enabled         = true;
            comboBoxZakazczik.Enabled    = true;
            textBoxBron.Enabled          = true;
            textBoxBez.Enabled           = true;

            bNew = false;

            if (listViewRasselenie.FocusedItem == null)
            {
                return;
            }

            int k = queueRasselenie.Count;

            for (int i = 0; i < k; i++)
            {
                m_rasselenie = (_Rasselenie)queueRasselenie.Dequeue();
                if (m_rasselenie.id.ToString() == (string)listViewRasselenie.Items[listViewRasselenie.FocusedItem.Index].Tag)
                {
                    textBoxName.Text = m_rasselenie.FiO;

                    textBoxKolDays.Text    = m_rasselenie.Kol_dney;
                    textBoxKolCzel.Text    = m_rasselenie.Kol_czel;
                    textBoxPark.Text       = m_rasselenie.parkovka;
                    textBoxNkvit.Text      = m_rasselenie.N_kvit;
                    comboBoxCity.Text      = m_rasselenie.City;
                    comboBoxZakazczik.Text = m_rasselenie.zakazczik;
                    //if (m_rasselenie.zhitie_bez == "")
                    comboBoxZhitie.Text = m_rasselenie.zhitie;
                    //else comboBoxZhitie.Text = m_rasselenie.zhitie_bez;
                    //if (m_rasselenie.bron_bez == "")
                    textBoxBron.Text = m_rasselenie.bron;
                    //else textBoxBron.Text = m_rasselenie.bron_bez;
                    textBoxBez.Text       = m_rasselenie.bron_bez;
                    dateTimePicker1.Value = DateTime.Parse(m_rasselenie.date);

                    _Zhitie c;
                    int     k2 = queueZhitie.Count;
                    for (int i2 = 0; i2 < k2; i2++)
                    {
                        c = (_Zhitie)queueZhitie.Dequeue();
                        if (c.nazvanie.ToString() == m_rasselenie.zhitie.ToString())
                        {
                            for (int iii = 0; iii < comboBoxZhitie.Items.Count; iii++)
                            {
                                if (((_Zhitie)comboBoxZhitie.Items[iii]).nazvanie == c.nazvanie)
                                {
                                    comboBoxZhitie.SelectedIndex = iii;
                                    m_zhitie = c;
                                    break;
                                }
                            }
                        }
                        ;
                        queueZhitie.Enqueue(c);
                    }
                    queueRasselenie.Enqueue(m_rasselenie);
                    break;
                }
                ;

                queueRasselenie.Enqueue(m_rasselenie);
            }
        }
Ejemplo n.º 8
0
        private void listViewRasselenie_SelectedIndexChanged(object sender, EventArgs e)
        {
            buttonApply.Enabled = true;
            buttonDelete.Enabled = true;

            textBoxName.Enabled = true;
            comboBoxZhitie.SelectedIndex = -1;
            dateTimePicker1.Enabled = true;
            comboBoxZhitie.Enabled = true;
            textBoxKolDays.Enabled = true;
            textBoxKolCzel.Enabled = true;
            textBoxPark.Enabled = true;
            textBoxNkvit.Enabled = true;
            comboBoxCity.Enabled = true;
            comboBoxZakazczik.Enabled = true;
            textBoxBron.Enabled = true;
            textBoxBez.Enabled = true;

            bNew = false;

            if (listViewRasselenie.FocusedItem == null)
                return;

            int k = queueRasselenie.Count;
            for (int i = 0; i < k; i++)
            {
                m_rasselenie = (_Rasselenie)queueRasselenie.Dequeue();
                if (m_rasselenie.id.ToString() == (string)listViewRasselenie.Items[listViewRasselenie.FocusedItem.Index].Tag)
                {
                    textBoxName.Text = m_rasselenie.FiO;

                    textBoxKolDays.Text = m_rasselenie.Kol_dney;
                    textBoxKolCzel.Text = m_rasselenie.Kol_czel;
                    textBoxPark.Text = m_rasselenie.parkovka;
                    textBoxNkvit.Text = m_rasselenie.N_kvit;
                    comboBoxCity.Text = m_rasselenie.City;
                    comboBoxZakazczik.Text = m_rasselenie.zakazczik;
                    //if (m_rasselenie.zhitie_bez == "")
                    comboBoxZhitie.Text = m_rasselenie.zhitie;
                    //else comboBoxZhitie.Text = m_rasselenie.zhitie_bez;
                    //if (m_rasselenie.bron_bez == "")
                    textBoxBron.Text = m_rasselenie.bron;
                    //else textBoxBron.Text = m_rasselenie.bron_bez;
                    textBoxBez.Text = m_rasselenie.bron_bez;
                    dateTimePicker1.Value = DateTime.Parse(m_rasselenie.date);

                    _Zhitie c;
                    int k2 = queueZhitie.Count;
                    for (int i2 = 0; i2 < k2; i2++)
                    {
                        c = (_Zhitie)queueZhitie.Dequeue();
                        if (c.nazvanie.ToString() == m_rasselenie.zhitie.ToString())
                        {
                            for (int iii = 0; iii < comboBoxZhitie.Items.Count; iii++)
                            {
                                if (((_Zhitie)comboBoxZhitie.Items[iii]).nazvanie == c.nazvanie)
                                {
                                    comboBoxZhitie.SelectedIndex = iii;
                                    m_zhitie = c;
                                    break;
                                }
                            }
                        };
                        queueZhitie.Enqueue(c);
                    }
                    queueRasselenie.Enqueue(m_rasselenie);
                    break;
                };

                queueRasselenie.Enqueue(m_rasselenie);

            }
        }
Ejemplo n.º 9
0
 private void comboBoxZhitie_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBoxZhitie.SelectedIndex == -1)
         return;
     m_zhitie = (_Zhitie)comboBoxZhitie.SelectedItem;
 }
Ejemplo n.º 10
0
        public void refreshZhitie()
        {
            string Zhitie = "";
            if (comboBoxZhitie.SelectedIndex != -1)
            {
                Zhitie = m_zhitie.nazvanie.ToString();
            }

            comboBoxZhitie.Items.Clear();
            queueZhitie.Clear();

            try
            {
                mainWin.m_dbConnector.Lock();
                MySqlConnection conn = mainWin.m_dbConnector.getMySqlConnection();

                string sql = "SELECT `id`, `nazvanie` FROM `zhitie` ORDER BY `id`";
                MySqlDataAdapter myAdapter = new MySqlDataAdapter();
                myAdapter.SelectCommand = new MySqlCommand(sql, conn);
                DataSet dataSet = new DataSet();
                myAdapter.Fill(dataSet);
                DataTable dataTable = dataSet.Tables[0];

                _Zhitie c = new _Zhitie();

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    c.id = dataRow["id"].ToString();
                    c.nazvanie = dataRow["nazvanie"].ToString().Trim();

                    comboBoxZhitie.Items.Add(c);

                    if (Zhitie != "" && Zhitie == c.nazvanie.ToString())
                    {
                        comboBoxZhitie.SelectedItem = c;
                    }

                    queueZhitie.Enqueue(c);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                mainWin.m_dbConnector.Unlock();
            }
        }
Ejemplo n.º 11
0
        private void listViewReportsRasselenie_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewReportsRasselenie.FocusedItem == null)
                return;

            int k = queueReportsRasselenie.Count;
            for (int i = 0; i < k; i++)
            {
                m_reportsrasselenie = (_ReportsRasselenie)queueReportsRasselenie.Dequeue();
                if (m_reportsrasselenie.date.ToString() == (string)listViewReportsRasselenie.Items[listViewReportsRasselenie.FocusedItem.Index].Tag)
                {
                   // textBoxName.Text = m_reportsrasselenie.date;
                  //  textBoxCity.Text = m_reportsrasselenie.city;

                    _Zhitie c;
                    int k2 = queueZhitie.Count;
                    for (int i2 = 0; i2 < k2; i2++)
                    {
                        c = (_Zhitie)queueZhitie.Dequeue();
                        if (c.nazvanie.ToString() == m_reportsrasselenie.zhitie.ToString())
                        {
                            for (int iii = 0; iii < comboBoxZhitie.Items.Count; iii++)
                            {
                                if (((_Zhitie)comboBoxZhitie.Items[iii]).nazvanie == c.nazvanie)
                                {
                                    comboBoxZhitie.SelectedIndex = iii;
                                    m_zhitie = c;
                                    break;
                                }
                            }
                        };
                        queueZhitie.Enqueue(c);
                    }
                    queueReportsRasselenie.Enqueue(m_reportsrasselenie);
                    break;
                };

                queueReportsRasselenie.Enqueue(m_reportsrasselenie);
            }
        }