Beispiel #1
0
        private void Manp_ItemPriceByItem_Shown(object sender, EventArgs e)
        {
            spPurchasePrice.Visible = StaticData.IsPermitted(16);
            spSalePrice.Visible     = StaticData.IsPermitted(17);
            gcCards.Visible         = StaticData.IsPermitted(18);
            btnOk.Visible           = StaticData.IsPermitted(19);

            List <CardView>      cards      = OperationHandler.GetCards().Value.Where(x => x.CardTypeId == 1 || x.CardTypeId == 2).ToList();
            List <ItemPrice>     ItemPrices = OperationHandler.GetItemPrices(item.Id).Value;
            List <ItemPriceView> priceView  = new List <ItemPriceView>();

            foreach (CardView card in cards)
            {
                ItemPriceView price = new ItemPriceView();
                price.CardId     = card.Id;
                price.CardName   = card.CardName;
                price.CardNumber = card.CardNumber;
                ItemPrice priceForCard = ItemPrices.Where(x => x.CardId == card.Id).FirstOrDefault();
                if (priceForCard != null)
                {
                    price.IsSpecial = true;
                    price.Price     = priceForCard.Price;
                }
                priceView.Add(price);
            }
            gcCards.DataSource    = priceView;
            txtItemCode.Text      = item.ItemCode;
            txtItemName.Text      = item.ItemName;
            txtItemType.Text      = item.ItemTypeName;
            spPurchasePrice.Value = item.DefaultPurchasePrice;
            spSalePrice.Value     = item.DefaultSalePrice;
        }