예제 #1
0
        public ActionResult Index(Models.BookingModel model)
        {
            string url = this.Request.UrlReferrer.AbsolutePath;

            if (DataProvider.bookingValidator(model) && ModelState.IsValid)
            {
                Booking book = new Booking();
                book.employee_id     = model.employee_id;
                book.massage_slot_id = model.massage_slot_id;
                book.phone           = model.phone;
                book.has_attended    = false;
                book.has_paid        = false;

                DataProvider.addBooking(book);


                //the booking is made
                result = 1;
            }
            else
            {
                //booking not made
                result             = 0;
                ViewData["booked"] = result;
                return(View(model));
            }

            return(Redirect(url));
        }
예제 #2
0
        public Models.BookingModel LoadVal(long bookingId)
        {
            Models.BookingModel data = new Models.BookingModel();
            //    CLayer.Address wh = BLayer.Bookings.GetBookedByUser(bookingId);
            //List<CLayer.Address> adr = BLayer.Bookings.GetOfflineBookedForUser(bookingId);//This is for offlineboookings
            List <CLayer.Address> adr = BLayer.Bookings.GetBookedForUser(bookingId);//This is for API booking

            if (adr.Count == 0)
            {
                adr.Add(new CLayer.Address());
            }
            data.OrderedBy = adr[0];
            // data.Items = BLayer.BookingItem.GetAllDetails(bookingId);
            //long propertyId = BLayer.BookingExternalInventory.GetPropertyIdByOfflineBookingId(bookingId);//*this is for getting property id of offline_booking
            long propertyId       = BLayer.BookingExternalInventory.GetPropertyIdByBookingId(bookingId);//this is for getting property id of booking
            int  InventoryAPIType = BLayer.Property.GetInventoryAPITypeId(BLayer.Bookings.GetPropertyId(bookingId));

            ViewBag.InventoryAPIType = InventoryAPIType;
            if (InventoryAPIType == (int)CLayer.ObjectStatus.InventoryAPIType.Amadeus)
            {
                data.Items = BLayer.BookingItem.GetAllDetails(bookingId, true);
            }
            else
            {
                //data.Items = BLayer.BookingItem.GetAllOfflineDetails(bookingId);
                data.Items = BLayer.BookingItem.GetAllDetails(bookingId);//*This is getting details for booking or API Booking
            }
            //CLayer.Booking bdata = BLayer.Bookings.GetOfflineBookingDetails(bookingId);//*This is for getting orderno and other details of Offline bookings
            CLayer.Booking bdata = BLayer.Bookings.GetDetails(bookingId);//*This is for getting orderno and other details of online bookings or API booking
            data.BookingDetails.OrderNo     = bdata.OrderNo;
            data.BookingDetails.BookingDate = bdata.BookingDate;
            if (InventoryAPIType == (int)CLayer.ObjectStatus.InventoryAPIType.Amadeus)
            {
                data.Supplier = BLayer.Bookings.GetSupplierDetailsAmadeus(bookingId);
            }
            else
            {
                // data.Supplier = BLayer.Bookings.GetSupplierDetailsofOfflineBooking(bookingId);//This is for getting supplier detials of Offline Booking
                data.Supplier = BLayer.Bookings.GetSupplierDetails(bookingId);//This is for getting supplier detials of Online Booking or API booking
            }

            data.BookingId = bookingId;

            //data.LoggedInUserName = BLayer.Bookings.GetCurrentApproverNameForMailOfOfflineBooking(bookingId);//*This is for getting userid of OfflineBooking
            data.LoggedInUserName = BLayer.Bookings.GetCurrentApproverNameForMail(bookingId);//*this is for getting user id of Online booking or APi

            ViewBag.propertyId = propertyId;

            //Models.SimpleBookingModel Amedusdata = (Models.SimpleBookingModel)TempData["AmedusData"];
            //List<CLayer.Tax> objAmadeusTaxRates = (List<CLayer.Tax>)Session["Amedustaxrates"];
            //ViewBag.Amadeustaxrates = Session["Amedustaxrates"];
            return(data);
        }
예제 #3
0
        public static bool bookingValidator(Models.BookingModel bkg)
        {
            //checks if the massage slot is entered
            if (bkg.massage_slot_id == 0)
            {
                return(false);
            }

            using (Massage_BookingEntities context = new Massage_BookingEntities())
            {
                var massageDay = (from md in context.Massage_Days
                                  where md.id == (from ms in context.Massage_Slots where ms.id == bkg.massage_slot_id select ms.massage_day_id).FirstOrDefault()
                                  select md).FirstOrDefault();

                var massageList = from ms in context.Massage_Slots
                                  where ms.massage_day_id == massageDay.id
                                  join b in context.Bookings on ms.id equals b.massage_slot_id
                                  where b.employee_id == bkg.employee_id
                                  select new
                {
                    justHere = "I live"
                };

                int massageCount = massageList.ToList().Count();



                DateTime timeCheckDown = new DateTime(massageDay.date.Year, massageDay.date.Month, massageDay.date.Day, 10, 0, 0);
                DateTime timeCheckUp   = new DateTime(massageDay.date.Year, massageDay.date.Month, massageDay.date.Day, 17, 0, 0);

                if (massageCount == 0)
                {
                    return(true);
                }
                else if (massageCount == 1 && DateTime.Now >= timeCheckDown && DateTime.Now <= timeCheckUp)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
예제 #4
0
        public Models.BookingModel LoadVal(long bookingId)
        {
            Models.BookingModel data = new Models.BookingModel();
            //    CLayer.Address wh = BLayer.Bookings.GetBookedByUser(bookingId);
            List <CLayer.Address> adr = BLayer.Bookings.GetBookedForUser(bookingId);

            if (adr.Count == 0)
            {
                adr.Add(new CLayer.Address());
            }
            data.OrderedBy = adr[0];
            data.Items     = BLayer.BookingItem.GetAllDetails(bookingId);
            CLayer.Booking bdata = BLayer.Bookings.GetDetails(bookingId);
            data.BookingDetails.OrderNo     = bdata.OrderNo;
            data.BookingDetails.BookingDate = bdata.BookingDate;
            data.Supplier  = BLayer.Bookings.GetSupplierDetails(bookingId);
            data.BookingId = bookingId;
            return(data);
        }
예제 #5
0
        public async Task <string> Email()
        {
            WebClient wc = new WebClient();

            try
            {
                Models.BookingModel   data    = new Models.BookingModel();
                List <CLayer.Booking> dt      = BLayer.Bookings.GetPartialBookingDetails();
                string         url            = ConfigurationManager.AppSettings.Get(URL_PARTIALPAYMENT);
                long           BookId         = 0;
                CLayer.Booking PaymentDetails = null;
                MailMessage    mm             = new MailMessage();
                mm.Bcc.Add(ConfigurationManager.AppSettings.Get("CustomerCareMail"));
                mm.From = new MailAddress(ConfigurationManager.AppSettings.Get("CustomerCareMail"));
                Common.Mailer mlr = new Common.Mailer();
                mm.IsBodyHtml = true;
                mm.Subject    = "Reminder: Payment pending";
                foreach (CLayer.Booking book in dt)
                {
                    PaymentDetails = book;
                    BookId         = book.BookingId;
                    string result = wc.DownloadString(url + BookId);
                    mm.To.Clear();
                    mm.To.Add(book.Email);
                    //mm.ReplyToList.Add("*****@*****.**");
                    mm.Body = result;
                    await mlr.SendMailAsyncWithoutFields(mm);
                }
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return("false");
            }
            return("true");
            //return View();
        }