protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             LblIdInsOrg.Text  = Session["IdInsOrg"].ToString();
             LblIdInsProd.Text = Session["IdInsProd"].ToString();
             LblIdUsuario.Text = Session["IdUser"].ToString();
             LblEtapa.Text     = Session["Etapa"].ToString();
             Datos_Org_ENCABEZADO();
             Desplegar_PROVEEDOR();
             /*************************************/
             DataTable dtListaPartida = new DataTable();
             dtListaPartida.Columns.AddRange(new DataColumn[8] {
                 new DataColumn("NumBoleta"), new DataColumn("Variedad"), new DataColumn("Categoria"), new DataColumn("Lote"), new DataColumn("Germinacion"), new DataColumn("FechCaducidad"), new DataColumn("Unidad"), new DataColumn("Cantidad")
             });
             GVDistribSemilla.DataSource = dtListaPartida;
             GVDistribSemilla.DataBind();
             Session["datos"] = dtListaPartida;
             /****************************************/
             //Seleccionar_CONTRATO_PROV();
         }
     }
     catch
     {
         Response.Redirect("~/About.aspx");
     }
 }
 protected void BtnRegistrar_Click(object sender, EventArgs e)
 {
     LblMsj2.Text = string.Empty;
     if (TxtNumBoleta.Text != "")
     {
         if (TxtVariedad.Text != "")
         {
             if (TxtCategoria.Text != "")
             {
                 if (TxtLote.Text != "")
                 {
                     if (TxtFechaCaducidad.Text != "")
                     {
                         if (TxtCantidad.Text != "")
                         {
                             if (TxtPorcentGermi.Text != "")
                             {
                                 DataTable dt  = Session["datos"] as DataTable;
                                 DataRow   row = dt.NewRow();
                                 row["NumBoleta"]     = TxtNumBoleta.Text;
                                 row["Cantidad"]      = TxtCantidad.Text;
                                 row["Unidad"]        = DDLUnidad.Text;
                                 row["Variedad"]      = TxtVariedad.Text;
                                 row["Categoria"]     = TxtCategoria.Text;
                                 row["Lote"]          = TxtLote.Text;
                                 row["Germinacion"]   = TxtPorcentGermi.Text;
                                 row["FechCaducidad"] = TxtFechaCaducidad.Text;
                                 dt.Rows.Add(row);
                                 GVDistribSemilla.DataSource = dt;
                                 GVDistribSemilla.DataBind();
                                 Session["datos"] = dt;
                                 Vaciar_CAMPOS();
                                 LblMsj.Text       = string.Empty;
                                 BtnEnviar.Enabled = true;
                             }
                             else
                             {
                                 LblMsj.Text = "Debe ingresar el porcentaje de germinación que presenta la semilla";
                             }
                         }
                         else
                         {
                             LblMsj.Text = "Debe ingresar la cantidad de semilla que se le distribuyo al productor";
                         }
                     }
                     else
                     {
                         LblMsj.Text = "Debe ingresar la fecha de caducidad de la semilla";
                     }
                 }
                 else
                 {
                     LblMsj.Text = "Debe ingresar el número de lote de la semilla";
                 }
             }
             else
             {
                 LblMsj.Text = "Debe ingresas la categoría de la semilla";
             }
         }
         else
         {
             LblMsj.Text = "Debe ingresar la variedad de semilla";
         }
     }
     else
     {
         LblMsj.Text = "Es necesario ingresar el número de boleta de distribución de semilla";
     }
 }