public static void AddBudgetItems(int BudgetId, List<Items> itemList)
        {
            DAL dalDataContext = new DAL();

            List<OptimizedBudgetItemsDetails> bItemList = new List<OptimizedBudgetItemsDetails>();
            try
            {
                foreach (Items item in itemList)
                {
                    OptimizedBudgetItemsDetails bItem = new OptimizedBudgetItemsDetails(
                        BudgetId, item.EventID, item.typeString, item.ItemName);
                    bItemList.Add(bItem);
                }

                Table<OptimizedBudgetItemsDetails> budItems = dalDataContext.optimizedBudgetItemDetails;
                budItems.InsertAllOnSubmit(bItemList);
                budItems.Context.SubmitChanges();
            }
            catch (TransactionAbortedException tAbortedex)
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Saving Optimal Budget List: " + tAbortedex.Message));
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(),
                  new FaultReason("An Error occured While Saving Optimal Budget List: " + ex.Message));
            }
        }
Example #2
0
        public static Items GetItem(OptimizedBudgetItemsDetails bItem)
        {
            DAL dalDataContext = new DAL();

            Items matchedItem = (from item in dalDataContext.items
                                 where item.typeString == bItem.typeString
                                 && item.EventID == bItem.EventID
                                 && item.ItemName == bItem.ItemName
                                 select item).FirstOrDefault<Items>();
            return matchedItem;
        }
Example #3
0
 public Items GetItemDetail(OptimizedBudgetItemsDetails bItem)
 {
     return ItemsController.GetItem(bItem);
 }