Beispiel #1
0
        private void listViewProviders_SelectedIndexChanged(object sender, EventArgs e)
        {
            buttonApply.Enabled  = true;
            buttonDelete.Enabled = true;

            textBoxEduYears.Enabled = true;

            bNew = false;

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

            int k = queueEduYears.Count;

            for (int i = 0; i < k; i++)
            {
                m_EduYears = (_EduYears)queueEduYears.Dequeue();
                if (m_EduYears.id.ToString() == (string)listViewEduYears.Items[listViewEduYears.FocusedItem.Index].Tag)
                {
                    textBoxEduYears.Text = m_EduYears.name;
                    queueEduYears.Enqueue(m_EduYears);
                    break;
                }
                ;

                queueEduYears.Enqueue(m_EduYears);
            }
        }
Beispiel #2
0
        public void refreshEduYears()
        {
            string edu_years_id = "";

            if (comboBoxEduYear.SelectedIndex != -1)
            {
                edu_years_id = m_edu_year.id.ToString();
            }

            comboBoxEduYear.Items.Clear();
            queueEduYears.Clear();

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

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

                _EduYears c = new _EduYears();

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

                    comboBoxEduYear.Items.Add(c);


                    if (edu_years_id != "" && edu_years_id == c.id.ToString())
                    {
                        comboBoxEduYear.SelectedItem = c;
                    }


                    queueEduYears.Enqueue(c);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                mainWin.m_dbConnector.Unlock();
            }
        }
Beispiel #3
0
        public void refreshEduYears()
        {
            listViewEduYears.Items.Clear();
            queueEduYears.Clear();


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

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

                listViewEduYears.Items.Clear();
                queueEduYears.Clear();
                _EduYears p = new _EduYears();

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    ListViewItem item1 = new ListViewItem(dataRow["id"].ToString().Trim(), 0);
                    p.id = int.Parse(dataRow["id"].ToString());
                    item1.SubItems.Add(dataRow["name"].ToString().Trim());
                    p.name = dataRow["name"].ToString().Trim();
                    listViewEduYears.Items.Add(item1);
                    listViewEduYears.Items[listViewEduYears.Items.Count - 1].Tag = dataRow["id"].ToString();
                    queueEduYears.Enqueue(p);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                mainWin.m_dbConnector.Unlock();
            }
        }
Beispiel #4
0
        private void listViewProviders_SelectedIndexChanged(object sender, EventArgs e)
        {
            buttonApply.Enabled = true;
            buttonDelete.Enabled = true;

            textBoxEduYears.Enabled = true;

            bNew = false;

            if (listViewEduYears.FocusedItem == null)
                return;

            int k = queueEduYears.Count;
            for (int i = 0; i < k; i++)
            {
                m_EduYears = (_EduYears)queueEduYears.Dequeue();
                if (m_EduYears.id.ToString() == (string)listViewEduYears.Items[listViewEduYears.FocusedItem.Index].Tag)
                {
                    textBoxEduYears.Text = m_EduYears.name;
                    queueEduYears.Enqueue(m_EduYears);
                    break;
                };

                queueEduYears.Enqueue(m_EduYears);
            }
        }
Beispiel #5
0
        public void refreshEduYears()
        {
            listViewEduYears.Items.Clear();
            queueEduYears.Clear();

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

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

                listViewEduYears.Items.Clear();
                queueEduYears.Clear();
                _EduYears p = new _EduYears();

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    ListViewItem item1 = new ListViewItem(dataRow["id"].ToString().Trim(), 0);
                    p.id = int.Parse(dataRow["id"].ToString());
                    item1.SubItems.Add(dataRow["name"].ToString().Trim());
                    p.name = dataRow["name"].ToString().Trim();
                    listViewEduYears.Items.Add(item1);
                    listViewEduYears.Items[listViewEduYears.Items.Count - 1].Tag = dataRow["id"].ToString();
                    queueEduYears.Enqueue(p);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                mainWin.m_dbConnector.Unlock();
            }
        }
Beispiel #6
0
        public void refreshEduYears()
        {
            string edu_years_id = "";
            if (comboBoxEduYear.SelectedIndex != -1)
            {
                edu_years_id = m_edu_year.id.ToString();
            }

            comboBoxEduYear.Items.Clear();
            queueEduYears.Clear();

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

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

                _EduYears c = new _EduYears();

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

                    comboBoxEduYear.Items.Add(c);

                    if (edu_years_id != "" && edu_years_id == c.id.ToString())
                    {
                        comboBoxEduYear.SelectedItem = c;
                    }

                    queueEduYears.Enqueue(c);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                mainWin.m_dbConnector.Unlock();
            }
        }