Example #1
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;
 }
        public static void approveBookingRequest(User approver, int requestID, int eventID,
            int facReqDetailID, string remarks, string purpose)
        {
            bool success;
            if ((!approver.isFacilityAdmin) && (!approver.isSystemAdmin))
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To View such requests!"));
            }

            DAL dalDataContext = new DAL();
            Table<FacilityBookingConfirmed> facReqConfirmed = dalDataContext.facConfirmedBookings;
            FacilityBookingRequest fbr = GetBookingRequest(eventID, requestID);
            try
            {
                using (TransactionScope tScope = new TransactionScope(TransactionScopeOption.Required))
                {
                    FacilityBookingConfirmed fbc = new FacilityBookingConfirmed(fbr,
                        FaciReqDetailsController.GetBookingRequestDetails(facReqDetailID), remarks, purpose);

                    facReqConfirmed.InsertOnSubmit(fbc);
                    facReqConfirmed.Context.SubmitChanges();

                    FaciRequestController.UpdateFacilityRequestStatus(approver, fbr, BookingStatus.Approved, remarks);

                    tScope.Complete();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                success = false;
                throw new FaultException<SException>(new SException(),
                   new FaultReason(ex.Message));
            }
            if (success)
            {
                string msg = "Your application for the facility for Event ID: " + fbr.EventID +
                            " On " + fbr.RequestStartDateTime.ToString("dd MMM yyyy") +
                            " has been approved.";

                NotificationController.sendNotification(approver.UserID, fbr.RequestorID,
                    "Facility Request Approved", msg);
            }
        }