Exemplo n.º 1
0
        public static List<OptimizedBudgetItemsDetails> GetBudgetItems(OptimizedBudgetItems Budget)
        {
            DAL dalDataContext = new DAL();
            List<OptimizedBudgetItemsDetails> BudgetItems;

            BudgetItems = (from BudgetDetails in dalDataContext.optimizedBudgetItemDetails
                              where BudgetDetails.BudgetID == Budget.BudgetID
                              && BudgetDetails.EventID == Budget.EventID
                              orderby BudgetDetails.typeString ascending
                              select BudgetDetails).ToList<OptimizedBudgetItemsDetails>();

            return BudgetItems;
        }
Exemplo n.º 2
0
 public ExportData(Events evnt, EventDay[] days, Task[] tasks, FacilityBookingConfirmed[][] facilities, Program[][] programs, Guest[][] guests, Participant[] participants
     , OptimizedBudgetItems optitems, BudgetIncome[] budgetincomes, Field[] field)
 {
     this.evnts = evnt;
     this.days = days;
     this.tasks = tasks;
     this.facilities = facilities;
     this.programs = programs;
     this.guests = guests;
     this.participants = participants;
     this.optitems = optitems;
     this.budgetincomes = budgetincomes;
     this.field = field;
 }
Exemplo n.º 3
0
        public static void SaveBudgetItemList(User saver, int eventID, int totalSat,
            decimal totalPrice, List<Items> itemList)
        {
            //Check if user has rights to manage Budget
            //if no throw exception

            try
            {
                DAL dalDataContext = new DAL();
                Table<OptimizedBudgetItems> facReq = dalDataContext.optimizedBudgetItems;
                using (TransactionScope tScope = new TransactionScope(TransactionScopeOption.Required))
                {
                    RemoveExistingBudget(eventID); //Remove if it exist, causing overwrite

                    //Create a new one
                    OptimizedBudgetItems Budget = new OptimizedBudgetItems(eventID, saver.UserID, totalSat, totalPrice);

                    facReq.InsertOnSubmit(Budget);
                    facReq.Context.SubmitChanges();

                    Budget = (from bgt in dalDataContext.optimizedBudgetItems
                              where bgt.EventID == eventID &&
                              bgt.Generator == saver.UserID
                              orderby bgt.GeneratedDate descending
                              select bgt).FirstOrDefault<OptimizedBudgetItems>();

                    BudgetDetailsController.AddBudgetItems(Budget.BudgetID, itemList);

                    tScope.Complete();
                }
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(),
                  new FaultReason("An Error occured While Saving Optimal Item List: " + ex.Message));
            }
        }