private void editPersonBtn_Click(object sender, EventArgs e) { try { pers.Close(); Worker transfer = new Worker(); string item = infTable.SelectedRows[0].Cells[0].Value.ToString(); string where = "idperson=" + dbConnect.Transform(item); List <string>[] selection = dbConnect.Select("person", 13, "", where); transfer.id = new Guid(selection[0][0]); transfer.name = selection[0][1]; transfer.gender = selection[0][2]; transfer.dateBirth = Convert.ToDateTime(selection[0][3]); transfer.married = Convert.ToBoolean(Convert.ToInt32(selection[0][4])); transfer.photo = selection[0][5]; Department transfDept = new Department(); if (selection[0][6].Equals("")) { transfDept.id = new Guid(); } else { transfDept.id = new Guid(selection[0][6]); } transfer.dept = transfDept; Job transfJob = new Job(); if (selection[0][7].Equals("")) { transfJob.id = new Guid(); } else { transfJob.id = new Guid(selection[0][7]); } transfer.job = transfJob; transfer.statusIsFired = Convert.ToBoolean(Convert.ToInt32(selection[0][8])); transfer.archiveData = selection[0][9]; Schedule transfSched = new Schedule(); if (selection[0][10].Equals("")) { transfSched.id = new Guid(); } else { transfSched.id = new Guid(selection[0][10]); } transfer.schedule = transfSched; pers = new PersonForm(transfer, rules, user); pers.Show(); } catch (Exception) { MessageBox.Show("Выделите всю строку"); }; }
private void plusPersonBtn_Click(object sender, EventArgs e) { pers.Close(); pers = new PersonForm(rules, user); pers.Show(); }