Exemple #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     switch (tableName)
     {
         case "otdel":
             frmOtdel frmOtd = new frmOtdel();
             frmOtd.recordId = "";
             frmOtd.ShowDialog();
             break;
         case "sotrudnik":
             frmSotrudnik frmSotr = new frmSotrudnik();
             frmSotr.recordId = "";
             frmSotr.ShowDialog();
             break;
         case "tehnika":
             frmTehnika frmTeh = new frmTehnika();
             frmTeh.recordId = "";
             frmTeh.ShowDialog();
             break;
         default:
             break;
     }
 }
Exemple #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int row = dataGridView1.CurrentCellAddress.Y;

            switch (tableName)
            {
                case "otdel":
                    frmOtdel frmOtd = new frmOtdel();
                    frmOtd.recordId = dataGridView1[0,row].Value.ToString();
                    frmOtd.name = dataGridView1[1, row].Value.ToString();
                    frmOtd.description = dataGridView1[2, row].Value.ToString();
                    frmOtd.ShowDialog();
                    break;
                case "sotrudnik":
                    frmSotrudnik frmSotr = new frmSotrudnik();
                    frmSotr.recordId = dataGridView1[0, row].Value.ToString();
                    frmSotr.otdel_id = dataGridView1[1, row].Value.ToString();
                    frmSotr.firstname = dataGridView1[2, row].Value.ToString();
                    frmSotr.lastname = dataGridView1[3, row].Value.ToString();
                    frmSotr.description = dataGridView1[4, row].Value.ToString();
                    frmSotr.ShowDialog();
                    break;
                case "tehnika":
                    frmTehnika frmTeh = new frmTehnika();
                    frmTeh.recordId = dataGridView1[0, row].Value.ToString();
                    frmTeh.sotrudnik_id = dataGridView1[1, row].Value.ToString();
                    frmTeh.inv_num = dataGridView1[2, row].Value.ToString();
                    frmTeh.name = dataGridView1[3, row].Value.ToString();
                    frmTeh.description = dataGridView1[4, row].Value.ToString();
                    frmTeh.ShowDialog();
                    break;
                default:
                    break;
            }
        }