public async void LoadProductUnits()
        {
            List <ProductMeasureUnit> productMeasureUnits = await ProductsServices.GetUnits();

            txtSistemaDeMedida.ItemsSource       = productMeasureUnits;
            txtSistemaDeMedida.DisplayMemberPath = "Title";
            txtSistemaDeMedida.SelectedValuePath = "Id";
            if (productMeasureUnits != null && productMeasureUnits.Count > 0)
            {
                txtSistemaDeMedida.SelectedIndex = 0;
            }
        }
        public async void LoadProductTypes()
        {
            List <ProductType> productTypes = await ProductsServices.GetTypes();

            txtProductoTipo.ItemsSource       = productTypes;
            txtProductoTipo.DisplayMemberPath = "Name";
            txtProductoTipo.SelectedValuePath = "Id";
            if (productTypes != null && productTypes.Count > 0)
            {
                txtProductoTipo.SelectedIndex = 0;
            }
        }
        public async void getItem(int id)
        {
            product = await ProductsServices.GetItem(id);

            txtTitulo.Text                   = product.Title;
            txtDescripcion.Text              = product.Descripcion;
            txtProductoTipo.SelectedValue    = product.ProductTypeId;
            txtSistemaDeMedida.SelectedValue = product.MeasureUnitId;

            txtIVA.Text          = product.IVA.ToString("F2");
            txtCostoPrecio.Text  = product.CostoPrecio.ToString("F2");
            txtCostoImporte.Text = product.CostoImporte.ToString("F2");
            txtVentaPrecio.Text  = product.VentaPrecio.ToString("F2");
            txtVentaImporte.Text = product.VentaImporte.ToString("F2");
        }
Beispiel #4
0
        public async void LoadData()
        {
            grdLoader.Visibility = Visibility.Visible;
            GenericResponse genericResponse = await ProductsServices.GetList(Filter, OrderBy, OrderType, Page);

            TotalPages = genericResponse.TotalPages;

            if (genericResponse.Items.Count > 0)
            {
                grdNoRegisters.Visibility = Visibility.Collapsed;
            }
            else
            {
                grdNoRegisters.Visibility = Visibility.Visible;
            }

            lstItems.ItemsSource = genericResponse.Items;
            grdLoader.Visibility = Visibility.Collapsed;

            if (Page == 1)
            {
                btnFirst.IsEnabled    = false;
                btnPrevious.IsEnabled = false;
            }
            if (Page > 1)
            {
                btnFirst.IsEnabled    = true;
                btnPrevious.IsEnabled = true;
            }
            if (Page < TotalPages)
            {
                btnNext.IsEnabled = true;
                btnLast.IsEnabled = true;
            }
            if (Page == TotalPages)
            {
                btnNext.IsEnabled = false;
                btnLast.IsEnabled = false;
            }

            txtRegister.Text = genericResponse.PageString;
        }
        private async void Guardar()
        {
            double IVA          = 0;
            double CostoPrecio  = 0;
            double CostoImporte = 0;
            double VentaPrecio  = 0;
            double VentaImporte = 0;

            if (product == null)
            {
                product    = new ProductService();
                product.Id = 0;
            }

            double.TryParse(txtIVA.Text, out IVA);
            double.TryParse(txtCostoPrecio.Text, out CostoPrecio);
            double.TryParse(txtCostoImporte.Text, out CostoImporte);
            double.TryParse(txtVentaPrecio.Text, out VentaPrecio);
            double.TryParse(txtVentaImporte.Text, out VentaImporte);

            product.ProductTypeId = (int)txtProductoTipo.SelectedValue;
            product.MeasureUnitId = (int)txtSistemaDeMedida.SelectedValue;
            product.Title         = txtTitulo.Text;
            product.Descripcion   = txtDescripcion.Text;
            product.IVA           = IVA;
            product.CostoPrecio   = CostoPrecio;
            product.CostoImporte  = CostoImporte;
            product.VentaPrecio   = VentaPrecio;
            product.VentaImporte  = VentaImporte;
            if (images != null)
            {
                product.Images = images;
            }
            product.Stock = productStocks;

            if (await ProductsServices.save(product))
            {
                CloureManager.GoBack();
            }
        }
Beispiel #6
0
        private async void DisplayDeleteDialog(int id)
        {
            ContentDialog deleteFileDialog = new ContentDialog
            {
                Title             = "¿Está seguro que desea eliminar este registro?",
                Content           = "El registro se borrará de forma permanente",
                PrimaryButtonText = "Borrar",
                CloseButtonText   = "Cancelar"
            };

            ContentDialogResult result = await deleteFileDialog.ShowAsync();

            // Delete the file if the user clicked the primary button.
            /// Otherwise, do nothing.
            if (result == ContentDialogResult.Primary)
            {
                bool api_result = await ProductsServices.Delete(id);

                if (api_result)
                {
                    LoadData();
                }
            }
        }
        public async void LoadStock()
        {
            productStocks = await ProductsServices.GetStock(id);

            lstStock.ItemsSource = productStocks;
        }