private void button3_Click(object sender, EventArgs e) { if (DescansosT.SelectedRows.Count > 0) { Models.workBreakModel w = new Models.workBreakModel(); PatientModel p = new PatientModel(); for (int i = 0; i < DescansosT.SelectedRows[0].Cells.Count; i++) { Console.WriteLine(i + " - " + DescansosT.SelectedRows[0].Cells[i].Value.ToString()); } w.Id = int.Parse(DescansosT.SelectedRows[0].Cells[0].Value.ToString()); p.Name = (DescansosT.SelectedRows[0].Cells[1].Value.ToString()); p.Last_name = (DescansosT.SelectedRows[0].Cells[2].Value.ToString()); w.Doc_status = (DescansosT.SelectedRows[0].Cells[3].Value.ToString()); w.Date_pmi = (DescansosT.SelectedRows[0].Cells[4].Value.ToString()); w.Start_date = (DescansosT.SelectedRows[0].Cells[5].Value.ToString()); w.End_date = (DescansosT.SelectedRows[0].Cells[6].Value.ToString()); w.Situation = (DescansosT.SelectedRows[0].Cells[7].Value.ToString()); p.Unit = (DescansosT.SelectedRows[0].Cells[9].Value.ToString()); DescansoForm frmDescanso = new DescansoForm(this.currentUser, w, p, true); frmDescanso.ShowDialog(); } else { MessageBox.Show("Selecciona un paciente en la tabla"); } dataLoader(); }
public DescansoForm(User user, Models.workBreakModel workModel, PatientModel patient, bool edit) { InitializeComponent(); this.edit = true; this.user = user; this.workModel = workModel; this.Patient = patient; this.workModel = workC.searchWorkBreak(workModel.Id); chargeData(edit); lbTitle.Text = "Editar Descanso"; btnSave.Text = "Actualizar"; }