Пример #1
0
        private void LoadListChosen(BusinessProductUC para)
        {
            bool flag = true;
            int  id   = int.Parse(para.txbId.Text);

            if (ListProductChosen != null)
            {
                foreach (Product item in ListProductChosen)
                {
                    if (item.ID == id)
                    {
                        flag = false;
                        break;
                    }
                }
            }
            else
            {
                ListProductChosen = new List <Product>();
            }

            if (flag == true)
            {
                Product item = DataProvider.Instance.DB.Products.Where(x => x.ID == id).First();
                ListProductChosen.Add(item);
                BusinessProductChosenUC uc = new BusinessProductChosenUC();

                uc.txbID.Text     = item.ID.ToString();
                uc.txbName.Text   = item.Name.ToString();
                uc.txbPrice.Text  = SeparateThousands(item.ExportPrice.Value.ToString());
                uc.txbUnit.Text   = item.Unit;
                uc.txbAmount.Text = "1";
                uc.txbTotal.Text  = SeparateThousands(item.ExportPrice.Value.ToString());

                this.HomeWindow.stkListProductChosenBusiness.Children.Add(uc);
            }
            else
            {
                foreach (BusinessProductChosenUC item in this.HomeWindow.stkListProductChosenBusiness.Children)
                {
                    if (item.txbID.Text == id.ToString())
                    {
                        int  amount = int.Parse(item.txbAmount.Text) + 1;
                        long total  = ConvertToNumber(item.txbPrice.Text) * amount;
                        item.txbAmount.Text = amount.ToString();
                        item.txbTotal.Text  = SeparateThousands(total.ToString());
                    }
                }
            }
            LoadTotalofPayment();
            LoadPayment(this.HomeWindow.txtRetainerPaymment);
        }
Пример #2
0
        private void LoadBusiness(HomeWindow para)
        {
            this.HomeWindow = para;

            foreach (Product item in ListProduct)
            {
                BusinessProductUC uc = new BusinessProductUC();
                uc.txbId.Text = item.ID.ToString();
                uc.txbNameProductBusinessUC.Text = item.Name.ToString();
                uc.txbPriceProduct.Text          = SeparateThousands(item.ExportPrice.Value.ToString());

                ImageBrush imageBrush = new ImageBrush();
                imageBrush.ImageSource = Converter.Instance.ConvertByteToBitmapImage(item.Image);

                uc.imgProduct.Background = imageBrush;
                para.stkListProductBusiness.Children.Add(uc);
            }
        }