Example #1
0
 //guardar pedido
 private void savePedido()
 {
     try
     {
         TBL_PEDIDO _infoPedido = new TBL_PEDIDO();
         _infoPedido.ped_cliente        = txtNombres.Text.ToUpper();
         _infoPedido.ped_direccion      = txtDireccion.Text.ToUpper();
         _infoPedido.ped_fecha          = DateTime.Parse(txtFechaPed.Text);
         _infoPedido.ped_identificacion = txtIdentificacion.Text;
         _infoPedido.ped_numero         = Convert.ToInt32(txtNumeroPed.Text);
         _infoPedido.ped_subtotal       = Convert.ToDecimal(txtSubtotal.Text);
         _infoPedido.ped_telefono       = txtTelefono.Text;
         _infoPedido.ped_total          = Convert.ToDecimal(txtTotal.Text);
         _infoPedido.cli_id             = int.Parse(txtIdCliente.Text);
         Task <bool> _taskSavePedido = Task.Run(() => LogicaPedido.savePedido(_infoPedido));
         _taskSavePedido.Wait();
         var resultado = _taskSavePedido.Result;
         if (resultado)
         {
             lblMensaje.Text = "Pedido Guardado Correctamente";
             lnkGuardar.Attributes.Add("disabled", "disabled");
             lnkGuardar.Enabled = false;
             ImbGuardar.Attributes["disabled"] = "disabled";
         }
     }
     catch (Exception ex)
     {
         lblMensaje.Text = "" + ex.Message;
     }
 }