private void comboBoxAccounts_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxAccounts.SelectedIndex == -1) { return; } m_account = (_Ekskursovody)comboBoxAccounts.SelectedItem; }
public void refreshAccounts() { string account_id = ""; if (comboBoxAccounts.SelectedIndex != -1) { account_id = m_account.id.ToString(); } comboBoxAccounts.Items.Clear(); queueAccounts.Clear(); try { mainWin.m_dbConnector.Lock(); MySqlConnection conn = mainWin.m_dbConnector.getMySqlConnection(); string sql = "SELECT `id`, `name` FROM `tbl_accounts` 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]; _Ekskursovody c = new _Ekskursovody(); foreach (DataRow dataRow in dataTable.Rows) { c.id = dataRow["id"].ToString(); c.name = dataRow["name"].ToString().Trim(); comboBoxAccounts.Items.Add(c); if (account_id != "" && account_id == c.id.ToString()) { comboBoxAccounts.SelectedItem = c; } queueAccounts.Enqueue(c); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { mainWin.m_dbConnector.Unlock(); } }
public void refreshAccounts() { string account_id = ""; if (comboBoxAccounts.SelectedIndex != -1) { account_id = m_account.id.ToString(); } comboBoxAccounts.Items.Clear(); queueAccounts.Clear(); try { mainWin.m_dbConnector.Lock(); MySqlConnection conn = mainWin.m_dbConnector.getMySqlConnection(); string sql = "SELECT `id`, `name` FROM `tbl_accounts` 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]; _Ekskursovody c = new _Ekskursovody(); foreach (DataRow dataRow in dataTable.Rows) { c.id = dataRow["id"].ToString(); c.name = dataRow["name"].ToString().Trim(); comboBoxAccounts.Items.Add(c); if (account_id != "" && account_id == c.id.ToString()) { comboBoxAccounts.SelectedItem = c; } queueAccounts.Enqueue(c); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { mainWin.m_dbConnector.Unlock(); } }
private void listViewMarks_SelectedIndexChanged(object sender, EventArgs e) { buttonApply.Enabled = true; buttonExcel.Enabled = true; buttonDelete.Enabled = true; textBoxStudent.Enabled = true; textBoxGroup.Enabled = true; textBoxSum.Enabled = true; comboBoxPaymentNames.Enabled = true; comboBoxAccounts.Enabled = true; comboBoxEduYear.Enabled = true; comboBoxHostel.Enabled = true; comboBoxSemester.Enabled = true; comboBoxPdv.Enabled = true; bNew = false; if (listViewJournal.FocusedItem == null) return; int k = queueJournal.Count; for (int i = 0; i < k; i++) { m_journal = (_Journal)queueJournal.Dequeue(); if (m_journal.id.ToString() == (string)listViewJournal.Items[listViewJournal.FocusedItem.Index].Tag) { textBoxStudent.Text = m_journal.student; //MessageBox.Show(m_journal.student); textBoxGroup.Text = m_journal.group; textBoxSum.Text = m_journal.sum.ToString(); _PaymentNames c; int k2 = queuePaymentNames.Count; for (int i2 = 0; i2 < k2; i2++) { c = (_PaymentNames)queuePaymentNames.Dequeue(); if (c.id.ToString() == m_journal.payment_name_id.ToString()) { for (int iii = 0; iii < comboBoxPaymentNames.Items.Count; iii++) { if (((_PaymentNames)comboBoxPaymentNames.Items[iii]).id == c.id) { comboBoxPaymentNames.SelectedIndex = iii; m_payment_name = c; break; } } }; queuePaymentNames.Enqueue(c); } dateTimePickerDate.Value = DateTime.Parse(m_journal.date); dateTimePickerDate.Enabled = true; _Ekskursovody a; k2 = queueAccounts.Count; for (int i2 = 0; i2 < k2; i2++) { a = (_Ekskursovody)queueAccounts.Dequeue(); if (a.id.ToString() == m_journal.account_id.ToString()) { for (int iii = 0; iii < comboBoxAccounts.Items.Count; iii++) { if (((_Ekskursovody)comboBoxAccounts.Items[iii]).id == a.id) { comboBoxAccounts.SelectedIndex = iii; m_account = a; break; } } }; queueAccounts.Enqueue(a); } _Semester s; k2 = queueSemesters.Count; for (int i2 = 0; i2 < k2; i2++) { s = (_Semester)queueSemesters.Dequeue(); if (s.id.ToString() == m_journal.semester.ToString()) { for (int iii = 0; iii < comboBoxSemester.Items.Count; iii++) { if (((_Semester)comboBoxSemester.Items[iii]).id == s.id) { comboBoxSemester.SelectedIndex = iii; m_semester = s; break; } } }; queueSemesters.Enqueue(s); } _Pdv p; k2 = queuePdv.Count; for (int i2 = 0; i2 < k2; i2++) { p = (_Pdv)queuePdv.Dequeue(); if (p.id.ToString() == m_journal.pdv.ToString()) { for (int iii = 0; iii < comboBoxPdv.Items.Count; iii++) { if (((_Pdv)comboBoxPdv.Items[iii]).id == p.id) { comboBoxPdv.SelectedIndex = iii; m_pdv = p; break; } } }; queuePdv.Enqueue(p); } _Hostel h; k2 = queueHostel.Count; for (int i2 = 0; i2 < k2; i2++) { h = (_Hostel)queueHostel.Dequeue(); if (h.id.ToString() == m_journal.hostel_id.ToString()) { for (int iii = 0; iii < comboBoxHostel.Items.Count; iii++) { if (((_Hostel)comboBoxHostel.Items[iii]).id == h.id) { comboBoxHostel.SelectedIndex = iii; m_hostel = h; break; } } }; queueHostel.Enqueue(h); } _EduYears ey; k2 = queueEduYears.Count; for (int i2 = 0; i2 < k2; i2++) { ey = (_EduYears)queueEduYears.Dequeue(); if (ey.id.ToString() == m_journal.edu_year_id.ToString()) { for (int iii = 0; iii < comboBoxEduYear.Items.Count; iii++) { if (((_EduYears)comboBoxEduYear.Items[iii]).id == ey.id) { comboBoxEduYear.SelectedIndex = iii; m_edu_year = ey; break; } } }; queueEduYears.Enqueue(ey); } queueJournal.Enqueue(m_journal); break; }; queueJournal.Enqueue(m_journal); } }
private void comboBoxAccounts_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxAccounts.SelectedIndex == -1) return; m_account = (_Ekskursovody)comboBoxAccounts.SelectedItem; }
private void listViewMarks_SelectedIndexChanged(object sender, EventArgs e) { buttonApply.Enabled = true; buttonExcel.Enabled = true; buttonDelete.Enabled = true; textBoxStudent.Enabled = true; textBoxGroup.Enabled = true; textBoxSum.Enabled = true; comboBoxPaymentNames.Enabled = true; comboBoxAccounts.Enabled = true; comboBoxEduYear.Enabled = true; comboBoxHostel.Enabled = true; comboBoxSemester.Enabled = true; comboBoxPdv.Enabled = true; bNew = false; if (listViewJournal.FocusedItem == null) { return; } int k = queueJournal.Count; for (int i = 0; i < k; i++) { m_journal = (_Journal)queueJournal.Dequeue(); if (m_journal.id.ToString() == (string)listViewJournal.Items[listViewJournal.FocusedItem.Index].Tag) { textBoxStudent.Text = m_journal.student; //MessageBox.Show(m_journal.student); textBoxGroup.Text = m_journal.group; textBoxSum.Text = m_journal.sum.ToString(); _PaymentNames c; int k2 = queuePaymentNames.Count; for (int i2 = 0; i2 < k2; i2++) { c = (_PaymentNames)queuePaymentNames.Dequeue(); if (c.id.ToString() == m_journal.payment_name_id.ToString()) { for (int iii = 0; iii < comboBoxPaymentNames.Items.Count; iii++) { if (((_PaymentNames)comboBoxPaymentNames.Items[iii]).id == c.id) { comboBoxPaymentNames.SelectedIndex = iii; m_payment_name = c; break; } } } ; queuePaymentNames.Enqueue(c); } dateTimePickerDate.Value = DateTime.Parse(m_journal.date); dateTimePickerDate.Enabled = true; _Ekskursovody a; k2 = queueAccounts.Count; for (int i2 = 0; i2 < k2; i2++) { a = (_Ekskursovody)queueAccounts.Dequeue(); if (a.id.ToString() == m_journal.account_id.ToString()) { for (int iii = 0; iii < comboBoxAccounts.Items.Count; iii++) { if (((_Ekskursovody)comboBoxAccounts.Items[iii]).id == a.id) { comboBoxAccounts.SelectedIndex = iii; m_account = a; break; } } } ; queueAccounts.Enqueue(a); } _Semester s; k2 = queueSemesters.Count; for (int i2 = 0; i2 < k2; i2++) { s = (_Semester)queueSemesters.Dequeue(); if (s.id.ToString() == m_journal.semester.ToString()) { for (int iii = 0; iii < comboBoxSemester.Items.Count; iii++) { if (((_Semester)comboBoxSemester.Items[iii]).id == s.id) { comboBoxSemester.SelectedIndex = iii; m_semester = s; break; } } } ; queueSemesters.Enqueue(s); } _Pdv p; k2 = queuePdv.Count; for (int i2 = 0; i2 < k2; i2++) { p = (_Pdv)queuePdv.Dequeue(); if (p.id.ToString() == m_journal.pdv.ToString()) { for (int iii = 0; iii < comboBoxPdv.Items.Count; iii++) { if (((_Pdv)comboBoxPdv.Items[iii]).id == p.id) { comboBoxPdv.SelectedIndex = iii; m_pdv = p; break; } } } ; queuePdv.Enqueue(p); } _Hostel h; k2 = queueHostel.Count; for (int i2 = 0; i2 < k2; i2++) { h = (_Hostel)queueHostel.Dequeue(); if (h.id.ToString() == m_journal.hostel_id.ToString()) { for (int iii = 0; iii < comboBoxHostel.Items.Count; iii++) { if (((_Hostel)comboBoxHostel.Items[iii]).id == h.id) { comboBoxHostel.SelectedIndex = iii; m_hostel = h; break; } } } ; queueHostel.Enqueue(h); } _EduYears ey; k2 = queueEduYears.Count; for (int i2 = 0; i2 < k2; i2++) { ey = (_EduYears)queueEduYears.Dequeue(); if (ey.id.ToString() == m_journal.edu_year_id.ToString()) { for (int iii = 0; iii < comboBoxEduYear.Items.Count; iii++) { if (((_EduYears)comboBoxEduYear.Items[iii]).id == ey.id) { comboBoxEduYear.SelectedIndex = iii; m_edu_year = ey; break; } } } ; queueEduYears.Enqueue(ey); } queueJournal.Enqueue(m_journal); break; } ; queueJournal.Enqueue(m_journal); } }