protected void BtnDesignar_Click(object sender, EventArgs e) { int aux = 0; if (LblTecnico.Text != "") { EXT_DesignacionOrg DsOrg = new EXT_DesignacionOrg(); DB_EXT_DesignacionOrg ins = new DB_EXT_DesignacionOrg(); CheckBox myCheckBox = new CheckBox(); foreach (GridViewRow dgi in GVOrg.Rows) { myCheckBox = (CheckBox)dgi.Cells[8].Controls[1]; if (myCheckBox.Checked == true) { GVOrg.Columns[0].Visible = true; Llenar_GVORG_REG_CAMP(); DsOrg.Id_Usuario = DDLTecnicos.SelectedValue; DsOrg.Id_InscripcionOrg = Convert.ToInt32(GVOrg.Rows[dgi.RowIndex].Cells[0].Text); GVOrg.Columns[0].Visible = false; Llenar_GVORG_REG_CAMP(); DsOrg.Num_Productores = 0; DsOrg.Superficie = Convert.ToDecimal(GVOrg.Rows[dgi.RowIndex].Cells[7].Text); DsOrg.Estado = "SELECCIONADO"; ins.DA_Registrar_DESIGNACION_ORG(DsOrg); aux = 1; } } if (aux == 0) { LblMsj.Text = "Debe seleccionar una organización para designar al técnico"; } else { LblMsj.Text = string.Empty; } } else { LblMsj.Text = "Debe seleccionar un técnico para continuar"; } Llenar_GVDESIGNADO(); }
public void DA_Registrar_DESIGNACION_ORG(EXT_DesignacionOrg d) { try { using (SqlConnection conexion = new SqlConnection(conexionString)) { SqlCommand cmd = new SqlCommand("GAP_DESIGNACION_ORG_INSERT", conexion); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Id_Usuario", d.Id_Usuario); cmd.Parameters.AddWithValue("@Id_InscripcionOrg", d.Id_InscripcionOrg); cmd.Parameters.AddWithValue("@Superficie", d.Superficie); cmd.Parameters.AddWithValue("@Num_Productores", d.Num_Productores); cmd.Parameters.AddWithValue("@Estado", d.Estado); conexion.Open(); cmd.ExecuteNonQuery(); conexion.Close(); } } catch (Exception err) { throw (new Exception(err.ToString() + "-" + err.Source.ToString() + "-" + err.Message.ToString())); } }
public void DA_Registrar_DESIGNACION_ORG(EXT_DesignacionOrg d) { DA_EXT_DesignacionOrg Ins = new DA_EXT_DesignacionOrg(); Ins.DA_Registrar_DESIGNACION_ORG(d); }