private void btnDarAlta_Click(object sender, EventArgs e) { var hospitalizacionId = grdData.Selected.Rows[0].Cells["v_HopitalizacionId"].Value.ToString(); DateTime?fechaAlta = (DateTime?)(grdData.Selected.Rows[0].Cells["d_FechaAlta"].Value == null ? (ValueType)null : DateTime.Parse(grdData.Selected.Rows[0].Cells["d_FechaAlta"].Value.ToString())); var comentario = grdData.Selected.Rows[0].Cells["v_Comentario"].Value == null ?"" : grdData.Selected.Rows[0].Cells["v_Comentario"].Value.ToString(); var frm = new frmDarAlta(hospitalizacionId, "Edit", fechaAlta, comentario); frm.ShowDialog(); btnFilter_Click(sender, e); }
private void btnDarAlta_Click(object sender, EventArgs e) { try { var hospitalizacionId = grdData.Selected.Rows[0].Cells["v_HopitalizacionId"].Value.ToString(); DateTime?fechaAlta = (DateTime?)(grdData.Selected.Rows[0].Cells["d_FechaAlta"].Value == null ? (ValueType)null : DateTime.Parse(grdData.Selected.Rows[0].Cells["d_FechaAlta"].Value.ToString())); var comentario = grdData.Selected.Rows[0].Cells["v_Comentario"].Value == null ? "" : grdData.Selected.Rows[0].Cells["v_Comentario"].Value.ToString(); var frm = new frmDarAlta(hospitalizacionId, "Edit", fechaAlta, comentario); frm.ShowDialog(); btnFilter_Click(sender, e); } catch (Exception ex) { //Console.WriteLine(ex); MessageBox.Show("NO SE PUEDE DAR DE ALTA - YA ASIGNADO", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information); //throw; } }