private void GuardarProcedimientos() { BLL.Tables.PRO_PROCEDIMIENTO _proc = new BLL.Tables.PRO_PROCEDIMIENTO(); Entities.Tables.PRO_PROCEDIMIENTO _item = new Entities.Tables.PRO_PROCEDIMIENTO(); for (int i = 0; i < this.dataGridViewProc.Rows.Count - 1; i++) { DataGridViewCheckBoxCell cellSelecion = dataGridViewProc.Rows[i].Cells[(int)Col_Procedimiento.INACTIVO] as DataGridViewCheckBoxCell; _item.PROCEDIMIENTO_ID = Convert.ToInt32(dataGridViewProc.Rows[i].Cells[(int)Col_Procedimiento.PROCEDIMIENTO_ID].Value); _item.DESCRIPCION = dataGridViewProc.Rows[i].Cells[(int)Col_Procedimiento.PROCEDIMIENTO].Value.ToString(); _item.TIPOPROCEDIMIENTO_ID = Convert.ToInt32(dataGridViewProc.Rows[i].Cells[(int)Col_Procedimiento.TIPO_PROCEDIMIENTO_ID].Value);; if (Convert.ToBoolean(cellSelecion.Value) == true) { _item.INACTIVO = true; } else { _item.INACTIVO = false; } _proc.UpdateItem(_item); } MessageBox.Show("Se actualizaron todos los procedimientos", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); Get_Procedimiento(""); }
private void button1_Click(object sender, EventArgs e) { try { BLL.Tables.PRO_PROCEDIMIENTO _proc = new BLL.Tables.PRO_PROCEDIMIENTO(); Entities.Tables.PRO_PROCEDIMIENTO _item = new Entities.Tables.PRO_PROCEDIMIENTO(); _item.DESCRIPCION = txtAgregar.Text.ToUpper(); _item.TIPOPROCEDIMIENTO_ID = 3; _proc.AddItem(_item); MessageBox.Show("Se agrego correctamente el procedimiento", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); Get_Procedimiento(""); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }