Ejemplo n.º 1
0
 protected void botonGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable tablaTandaItemsAgregados = (DataTable)Session["tablaTandaItemsAgregadosCrearEntidad"];
         if (tablaTandaItemsAgregados.Rows.Count > 0)
         {
             int      codigoTanda   = Convert.ToInt32(Session["codigoTandaCrearEntrega"]);
             int      codigoEntrega = Convert.ToInt32(Session["codigoEntregaAuxCrearEntrega"]);
             DateTime fechaInicio   = Convert.ToDateTime(dateInicio.Value);
             DateTime?fechaFin      = Convert.ToDateTime(dateFin.Value);
             int      codigoTaller  = Convert.ToInt32(comboTaller.SelectedValue);
             if (fechaFin == Convert.ToDateTime("01/01/0001 00:00:00"))
             {
                 fechaFin = null;
             }
             ControladorGeneral.InsertarActualizarEntrega(codigoEntrega, codigoTanda, codigoTaller, fechaInicio, fechaFin, tablaTandaItemsAgregados);
             Page.ClientScript.RegisterStartupScript(this.GetType(),
                                                     "scriptValidacion", "<script>alert('Se guardó la entrega correctamente');window.location.assign('GestionEntregas.aspx');</script>");
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(),
                                                     "scriptValidacion", "<script>alert('Debe agregar al menos un item a la entrega');</script>");
         }
     }
     catch (Exception ex)
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(),
                                                 "scriptValidacion", "<script>alert('" + ex.Message.ToString() + "');</script>");
     }
 }
Ejemplo n.º 2
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            DataTable tablaItemsEntrega = (DataTable)Session["tablaItemsEntrega"];
            int       codigoEntrega     = 0;

            if (Session["tablaEntrega"] != null)
            {
                DataTable tablaEntrega = (DataTable)Session["tablaEntrega"];
                codigoEntrega = Convert.ToInt32(tablaEntrega.Rows[0]["codigoEntrega"]);
            }

            if (txtFechaEmision.Value.ToString() == "" || cbNotaDePedido.SelectedIndex < 0 || txtCodigoRemito.Text == "" || tablaItemsEntrega.Rows.Count == 0 || cbTransporte.SelectedIndex < 0 || cbDireccion.SelectedIndex < 0)
            {
                pcError.ShowOnPageLoad = true;
                lblError.Text          = "Debe completar todos los campos y elegir al menos un artículo";
            }
            else
            {
                DataTable dtDatosEmpresa          = ControladorGeneral.RecuperarTodosDatosEmpresa(false);
                string    caiAfip                 = Convert.ToString(dtDatosEmpresa.Rows[0]["cai"]);
                DateTime  fechaVencimientoCaiAfip = Convert.ToDateTime(dtDatosEmpresa.Rows[0]["fechaVencimientoCai"]);

                ControladorGeneral.InsertarActualizarEntrega(codigoEntrega, Convert.ToDateTime(txtFechaEmision.Value), Convert.ToInt32(cbNotaDePedido.Value), Convert.ToInt32(txtCodigoRemito.Text), txtObservacion.InnerText, tablaItemsEntrega, Convert.ToInt32(cbTransporte.Value), Convert.ToInt32(cbDireccion.SelectedItem.Value), caiAfip, fechaVencimientoCaiAfip);

                Response.Redirect("listado.aspx");
            }
        }
Ejemplo n.º 3
0
 protected void grillaEntregas_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
 {
     try
     {
         ASPxGridView grillaEntregas = sender as ASPxGridView;
         int          codigoTaller   = Convert.ToInt32(e.NewValues["codigoTaller"]);
         DateTime     fechaInicio    = Convert.ToDateTime(e.NewValues["fechaInicio"]);
         DateTime?    fechaFin       = Convert.ToDateTime(e.NewValues["fechaFin"]);
         if (fechaFin == Convert.ToDateTime("01/01/0001 00:00:00"))
         {
             fechaFin = null;
         }
         ControladorGeneral.InsertarActualizarEntrega(0, Convert.ToInt32(grillaEntregas.GetMasterRowKeyValue()), codigoTaller, fechaInicio, fechaFin);
         e.Cancel = true;
         grillaEntregas.CancelEdit();
         CargarGrillaEntregas(grillaEntregas, Convert.ToInt32(grillaEntregas.GetMasterRowKeyValue()));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }