private void DlgPostmetn_Load(object sender, EventArgs e) { string text = null; try { clWork = new CPostment(connect); if (oldData != null) { mode = 1; } else { mode = 0; } if (mode == 0) { text = "Добавить должность"; int n = clWork.GetFreeId(); textBoxId.Text = n.ToString(); textBoxName.Focus(); } if (mode == 1) { text = "Редактировать должность"; set_data((STPostment)oldData); } this.Text = text; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void Postment_Load(object sender, EventArgs e) { try { clWork = new CPostment(connect); this.WindowState = FormWindowState.Maximized; init_data(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void DlgParticipant_Load(object sender, EventArgs e) { string text = null; try { clWork = new CParticipant(connect); clParam = new CParamApp(); clPost = new CPostment(connect); if (oldData != null) { mode = 1; } else { mode = 0; } if (mode == 0) { text = "Ќовый участник"; int n = clWork.GetFreeId(); textBoxId.Text = n.ToString(); textBoxFamily.Focus(); } if (mode == 1) { text = "–едактировать данные участника"; set_data((STParticipant)oldData); } this.Text = text; init_combo_country(); init_list_post(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void init_data() { string text; DateTime dt; List <int> arr; bool fl; CCountry clCo = new CCountry(connect); clPost = new CPostment(connect); g_f = false; try { dataGridViewPart.Rows.Clear(); list = new List <STParticipant>(); list = clParticipant.GetList(); if (list.Count > 0) { g_f = true; dataGridViewPart.Rows.Add(list.Count); for (int i = 0; i < list.Count; i++) { dataGridViewPart.Rows[i].Cells[0].Value = (i + 1).ToString(); text = list[i].family + " " + list[i].name + " " + list[i].payname; dataGridViewPart.Rows[i].Cells[1].Value = text; if (list[i].datebirth != null) { dt = (DateTime)list[i].datebirth; dataGridViewPart.Rows[i].Cells[2].Value = dt.ToShortDateString(); } dataGridViewPart.Rows[i].Cells[3].Value = list[i].personalnum; if (list[i].idcountry != null) { clCo = new CCountry(connect, (int)list[i].idcountry); dataGridViewPart.Rows[i].Cells[4].Value = clCo.stCountry.shortname; } dataGridViewPart.Rows[i].Cells[5].Value = list[i].namefoto; if (list[i].post != null) { arr = clParticipant.GetArrayPost(list[i].post); if (arr.Count > 0) { text = null; string hd = null; fl = false; foreach (int n in arr) { STPostment st = clPost.GetPost(n); if (fl == false) { text = st.namepost; fl = true; } else { text += ", " + st.namepost; } } } dataGridViewPart.Rows[i].Cells[6].Value = text; } if (list[i].adminflag == 1) { dataGridViewPart.Rows[i].Cells[7].Value = " * "; } dataGridViewPart.Rows[i].Cells[8].Value = list[i].idpart.ToString(); if (list[i].vf != null) { if (list[i].vf == 1) { dataGridViewPart.Rows[i].Cells[9].Value = "*"; } } if (flawour.Equals(list[i])) { gpos = i; } } dataGridViewPart.AllowUserToAddRows = false; } else { dataGridViewPart.AllowUserToAddRows = false; } toolStripStatusLabel1.Text = string.Format("Число персонала: {0}", list.Count); } catch (Exception ex) { MessageBox.Show(ex.Message); } }