Esempio n. 1
0
        private void BtnInsumos_Click(object sender, RoutedEventArgs e)
        {
            insumosPro insu = new insumosPro();

            insu.Show();
            this.Close();
        }
Esempio n. 2
0
        private async void BtnAgregar_Click(object sender, RoutedEventArgs e)
        {
            NaturalWSClient cliente = new NaturalWSClient();
            insumo          insu    = new insumo();

            try
            {
                var random = new Random();
                var value  = random.Next(0, 1000);

                int Codigo = value;
                insu.codInsumo = Codigo;

                if (cboProyecto.Text.Equals(""))
                {
                    await this.ShowMessageAsync("Advertencia", "Porfavor Seleccione un Proyecto");
                }
                else if (txtRut.Text.Equals(""))
                {
                    await this.ShowMessageAsync("Advertencia", "Porfavor Ingrese Rut del Cliente");
                }
                else if (txtDescripcion.Text.Equals(""))
                {
                    await this.ShowMessageAsync("Advertencia", "Porfavor Ingrese una Descripcion");
                }
                else if (txtPrecio.Text.Equals(""))
                {
                    await this.ShowMessageAsync("Advertencia", "Porfavor Ingrese Precio del Producto");
                }
                else if (txtCantidad.Text.Equals(""))
                {
                    await this.ShowMessageAsync("Advertencia", "Porfavor Ingrese la Cantidad a Comprar del Producto");
                }
                else if (txtTienda.Text.Equals(""))
                {
                    await this.ShowMessageAsync("Advertencia", "Porfavor Ingrese la Tienda a Comprar");
                }
                else
                {
                    insu.descripcion     = txtDescripcion.Text.ToUpper();
                    insu.tienda          = txtTienda.Text.ToUpper();
                    insu.cantidad        = int.Parse(txtCantidad.Text);
                    insu.precio          = int.Parse(txtPrecio.Text);
                    insu.nombre_Proyecto = cboProyecto.Text.ToUpper();

                    if (cliente.agregarInsumo(insu))
                    {
                        await this.ShowMessageAsync("Exito", "Insumo ingresado Correctamente");

                        insumosPro insumo = new insumosPro();
                        insumo.Show();
                        this.Close();
                    }
                    else
                    {
                        await this.ShowMessageAsync("Error", "No se pudo ingresar Insumo");
                    }
                }
            }
            catch
            {
                await this.ShowMessageAsync("Error", "Tenemos problemas al ingresar Insumo");
            }
        }