示例#1
0
        public void AddNewItem_Complete()
        {
            string brandText = "Generic"; string uomText = "Generic";
            if (modelBrand != null) {
                brandText = modelBrand.Value;
            }
            if (modelUOM != null) {
                uomText = modelUOM.Value;
            }
            if (IsRequesting) {
                ItemModel newItem = new ItemModel()
                {
                    Id = item.Id,
                    ItemNumber = item.ItemNumber,
                    Description = item.Description,
                    Quantity = txtQuantity.Text.ToInt(),
                    Brand = brandText,
                    CodeSize = CodeSize,
                    UOM = uomText,
                    CostObjectiveId = this.CostObjectiveId,
                    CostObjective = tbCostObjectiveName.Text,
                    StockOnHand = txtStockOnHand.Text.ToInt()
                };
                //Add an item
                if (requestScreen != null) {
                    requestScreen.dgItems.Items.Add(newItem);
                }

                if (editRequisition != null) {
                    editRequisition.AddItemRequest(newItem);
                }
            }
            else {
                MessageBox.Show("Item has been successfully added.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            this.Close();
        }
示例#2
0
 private void PopulateItems()
 {
     items = new List<ItemModel>();
     IQueryable<mItemsRequest> AllItems = db.mItemsRequests;
     var itemRequests = AllItems.Where(x => x.RequestId == model.Id);
     foreach (var itemRequest in itemRequests) {
         IQueryable<Item> tmpItem = db.Items;
         var item = tmpItem.Where(x => x.Id == itemRequest.ItemId).SingleOrDefault();
         var requestItem = new ItemModel()
         {
             Id = item.Id,
             ext_id = itemRequest.Id,
             ItemNumber = item.ItemNumber,
             Description = item.Description,
             Brand = item.ItemBrand.Name,
             CodeSize = item.CodeSize,
             CostObjective = itemRequest.CostObjective.Name,
             CostObjectiveId = itemRequest.CostObjective.Id,
             Quantity = itemRequest.Quantity,
             StockOnHand = itemRequest.StockOnHand,
             EnableEdit = EnableEditing && !item.is_active.Value
         };
         items.Add(requestItem);
     }
 }
示例#3
0
 private void LoadData()
 {
     CsItems = new List<ItemModel>();
     IQueryable<mItemsRequest> AllItems = db.mItemsRequests;
     var itemRequests = AllItems.Where(x => x.RequestId == RequestId);
     foreach (var itemRequest in itemRequests) {
         IQueryable<Item> tmpItem = db.Items;
         var item = tmpItem.Where(x => x.Id == itemRequest.ItemId).SingleOrDefault();
         var requestItem = new ItemModel()
         {
             ItemNumber = item.ItemNumber,
             ext_id = itemRequest.Id,
             Description = item.Description,
             Brand = item.ItemBrand.Name,
             CodeSize = item.CodeSize,
             CostObjective = itemRequest.CostObjective.Name,
             Quantity = itemRequest.Quantity,
             Status = itemRequest.IsQuoteSent == true ? "Quoted" : "Not-Quoted",
             UOM = item.UnitOfMeasurement.Name
         };
         CsItems.Add(requestItem);
     }
 }