Exemplo n.º 1
0
 public async Task <Response> guardar(DescuentoEnviar param)
 {
     try
     {
         // localhost:8080/admeli/xcore2/xcore/services.php/descuento/guardar
         return(await webService.POST <DescuentoEnviar, Response>("descuento", "guardar", param));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
        private async void executeGuardar()
        {
            bloquear(true);
            if (!validarCampos())
            {
                bloquear(false); return;
            }
            try
            {
                crearObjetoSucursal();
                if (nuevo)
                {
                    currentDescuento = new DescuentoEnviar();

                    string dateFin = String.Format("{0:u}", dtpFechaFin.Value);
                    dateFin = dateFin.Substring(0, dateFin.Length - 1);

                    string dateInicio = String.Format("{0:u}", dtpFechaInicio.Value);
                    dateInicio = dateInicio.Substring(0, dateInicio.Length - 1);


                    // asignar al decuento
                    currentDescuento.cantidadMaxima   = textMaximaVenta.Text.Trim();
                    currentDescuento.cantidadMinima   = textMinimaVenta.Text.Trim();
                    currentDescuento.codigo           = textCodigo.Text.Trim();
                    currentDescuento.descuento        = textDescuento.Text.Trim();
                    currentDescuento.estado           = 1;
                    currentDescuento.fechaFin         = dateFin;
                    currentDescuento.fechaInicio      = dateInicio;
                    currentDescuento.idAfectoProducto = 0;
                    currentDescuento.tipo             = "General";
                    currentDescuento.idGrupoCliente   = (int)cbxGrupoCliente.SelectedValue;
                    currentDescuento.idSucursal       = (int)cbxSucursal.SelectedValue;
                    currentDescuento.idPresentacion   = formProductoNuevo.currentIDProducto;

                    Response response = await descuentoModel.guardar(currentDescuento);

                    MessageBox.Show(response.msj, "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    //Response response = await descuentoModel.modificar(currentDescuento);
                    Response response = null;
                    MessageBox.Show(response.msj, "Modificar", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            bloquear(false);
        }