コード例 #1
0
        private void btnAgregarProducto_Click(object sender, EventArgs e)
        {
            if (ProductoSeleccionado.ProductoId != 0 && !string.IsNullOrEmpty(txtCant.Text))
            {
                ListGrid.Add(CrearNuevaLinea());

                RecargarDatagrid();

                LimpiarControles();
            }
            else
            {
                if (!string.IsNullOrEmpty(txtCodProd.Text) && !string.IsNullOrEmpty(txtCant.Text))
                {
                    ProductoSeleccionado = productoBLL.ObtenerProductoPorCodigo(txtCodProd.Text);

                    if (ProductoSeleccionado != null)
                    {
                        ListGrid.Add(CrearNuevaLinea());

                        RecargarDatagrid();

                        LimpiarControles();
                    }
                    else
                    {
                        Alert.ShowSimpleAlert("El codigo de producto no existe", "MSJ080");
                    }
                }
                else
                {
                    Alert.ShowSimpleAlert("Debe Seleccionar al menos un producto y la cantidad", "MSJ082");
                }
            }
        }
コード例 #2
0
        public async void ViewEstimate_Ok()
        {
            if (SelectedEstimate.EstimateID != null && SelectedEstimate.EstimateID != 0)
            {
                App.Current.Properties["Action"] = "ViewEstimate";
                List <EstimateModel> _ListGrid_Temp = new List <EstimateModel>();
                HttpClient           client         = new HttpClient();
                client.BaseAddress = new Uri(GlobalData.gblApiAdress);
                client.DefaultRequestHeaders.Accept.Add(
                    new MediaTypeWithQualityHeaderValue("application/json"));
                client.Timeout = new TimeSpan(500000000000);
                int id = SelectedEstimate.EstimateID;
                HttpResponseMessage response = client.GetAsync("api/EstimateAPI/ViewEstimateItem?id=" + SelectedEstimate.EstimateID + "").Result;
                if (response.IsSuccessStatusCode)
                {
                    data = JsonConvert.DeserializeObject <EstimateModel[]>(await response.Content.ReadAsStringAsync());
                    int x = 0;
                    if (data.Length > 0)
                    {
                        for (int i = 0; i < data.Length; i++)
                        {
                            SelectedEstimate.EstimateNo       = data[i].EstimateNo;
                            SelectedEstimate.EstimateID       = data[i].EstimateID;
                            SelectedEstimate.Barcode          = data[i].Barcode;
                            SelectedEstimate.BusinessLocation = data[i].BusinessLocation;
                            SelectedEstimate.CashRegister     = data[i].CashRegister;
                            SelectedEstimate.CountItem        = data[i].CountItem;
                            SelectedEstimate.CustomerName     = data[i].CustomerName;
                            SelectedEstimate.EmployeeLogin    = data[i].EmployeeLogin;
                            SelectedEstimate.TotalItemQty     = data[i].TotalItemQty;
                            SelectedEstimate.TotalPrice       = data[i].TotalPrice;
                            SelectedEstimate.EstimateDate     = data[i].EstimateDate;
                            //SelectedEstimate.TotalTax = data[i].TotalTax;
                        }
                        ListGrid.Add(new EstimateModel
                        {
                            Barcode          = SelectedEstimate.Barcode,
                            EstimateID       = SelectedEstimate.EstimateID,
                            EstimateNo       = SelectedEstimate.EstimateNo,
                            BusinessLocation = SelectedEstimate.BusinessLocation,
                            CashRegister     = SelectedEstimate.CashRegister,
                            CountItem        = SelectedEstimate.CountItem,
                            CustomerName     = SelectedEstimate.CustomerName,
                            EmployeeLogin    = SelectedEstimate.EmployeeLogin,
                            TotalItemQty     = SelectedEstimate.TotalItemQty,
                            TotalPrice       = SelectedEstimate.TotalPrice,
                            ItemName         = SelectedEstimate.ItemName
                        });
                        App.Current.Properties["ViewEstimate"] = SelectedEstimate;
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.TotalAmount.Text = SelectedEstimate.TotalPrice.ToString();
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.EstimateNo.Text = SelectedEstimate.EstimateNo.ToString();
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.EstimateDate.Text = SelectedEstimate.EstimateDate.ToString();
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.TotalQty.Text = SelectedEstimate.TotalItemQty.ToString();
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.TaxAmount.Text = SelectedEstimate.TotalTax.ToString();
                        //List<EstimateModel> _hft = App.Current.Properties["ViewEstimate"] as List<EstimateModel>;
                        //Estimate.ListGridRef.ItemsSource = _hft;
                        //ListGrid = _hft;
                        ViewEstimateClick_Ok();
                    }
                }
            }


            else
            {
                MessageBox.Show("Select Customer first", "Customer Selection", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }