示例#1
0
        public CancelBookingViewModel GetCancelledBooking(int transId)
        {
            CancelBookingViewModel cancelledBooking = null;

            var booking = (from b in _dbcontext.Bookings where b.trn_Id.Equals(transId) select b).FirstOrDefault();

            if (booking != null)
            {
                cancelledBooking = new CancelBookingViewModel()
                {
                    TransId          = booking.trn_Id,
                    CustomerFullname = Utilities.getfullname(booking.Customer.lastname, booking.Customer.firstname, booking.Customer.middle),
                    EventDate        = (DateTime)booking.startdate,
                    PackageDesc      = booking.Package.p_descripton,
                    NoofPax          = (int)booking.noofperson,
                    Venue            = booking.venue,
                    CancelDate       = DateTime.Now,
                    AmountDue        = bookingPayments.Get_TotalAmountBook(transId),
                    AmountPaid       = transdetails.GetTotalPaymentByTrans(transId),
                };
            }

            _dbcontext.Dispose();

            return(cancelledBooking);
        }
示例#2
0
        public IEnumerable <Course_PackageSelectionViewModel> GetAllCoursesforPackage(int packageId)
        {
            var dbcontext = new PegasusEntities();

            int _packageid = packageId;


            var coursecat = (from cc in dbcontext.CourseCategories select cc).ToList();

            var listofcourses = (from cc in coursecat select new Course_PackageSelectionViewModel()
            {
                courseId = cc.CourserId,
                coursename = cc.Course,
                isSelected = CheckCourseisSelected(_packageid, cc.CourserId)
            })
                                .ToList();

            dbcontext.Dispose();

            return(listofcourses);
        }
示例#3
0
        public IEnumerable <AddonsViewModel> GetListofAddonDetails()
        {
            var dbcontext = new PegasusEntities();

            List <AddonsViewModel> list = new List <AddonsViewModel>();

            list = (from a in dbcontext.AddonDetails join b in dbcontext.AddonCategories on a.addoncatId equals b.addoncatId
                    select new AddonsViewModel()
            {
                No = a.addonId,
                addoncatId = (int)a.addoncatId,
                addoncategory = b.addoncatdesc,
                AddonsDescription = a.addondescription,
                AddonAmount = (decimal)a.amount,
                Unit = a.unit
            }).ToList();

            dbcontext.Dispose();

            return(list);
        }
示例#4
0
        public bool CheckCourseisSelected(int packageId, int courseId)
        {
            var dbcontext = new PegasusEntities();

            int  _pId;
            int  _cId;
            bool is_selected = false;

            _pId = packageId;
            _cId = courseId;

            var course_exist = dbcontext.PackageBodies.Any(x => x.courseId == _cId && x.p_id == _pId);

            if (course_exist)
            {
                is_selected = true;
            }


            dbcontext.Dispose();

            return(is_selected);
        }
示例#5
0
        public IEnumerable <BookMenusViewModel> LisofMenusBook(int transid)
        {
            IOrderedEnumerable <BookMenusViewModel> bookMenusList;

            var _dbentities = new PegasusEntities();

            try
            {
                var bookmenus = (from bkm in _dbentities.Book_Menus select bkm).Where(t => t.trn_Id == transid).ToList();

                //join m in _dbentities.Menus on bkm.menuid equals m.menuid
                //select bkm);

                bookMenusList = (from bm in bookmenus
                                 select new BookMenusViewModel()
                {
                    menu_No = bm.No,
                    transId = (int)bm.trn_Id,
                    menuId = bm.menuid,
                    menu_name = bm.Menu.menu_name,
                    courseid = (int)bm.Menu.CourserId,
                    coursename = bm.Menu.CourseCategory.Course,
                    dept = bm.Menu.Department.deptName,
                    menuImageFilename = bm.Menu.image,
                    servingstringpax = get_servingstrpax(bm.No)
                }).ToList().OrderBy(x => x.courseid);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            _dbentities.Dispose();

            return(bookMenusList);
        }
示例#6
0
 protected override void Dispose(bool disposing)
 {
     dbEntities.Dispose();
 }
示例#7
0
 protected override void Dispose(bool disposing)
 {
     _dbcontext.Dispose();
 }