示例#1
0
 public ActionResult Modifybook(Areas.Admin.Models.OfflinePropertyBookingModel.SimpleBookingModel Model)
 {
     try
     {
         BookAccommodation(Model);
     }
     catch (Exception ex)
     {
         Common.LogHandler.HandleError(ex);
     }
     return(RedirectToAction("BookingModify", "BookingofflineRequestTransactions", new { Area = "Admin", BookingId = Model.BookingId_OffLine }));
 }
示例#2
0
        private int BookAccommodation(Areas.Admin.Models.OfflinePropertyBookingModel.SimpleBookingModel data)
        {
            long userId    = data.BookingUserId_OffLine;
            long bookingId = data.BookingId_OffLine;

            if (data.BookingData == "")
            {
                return(0);
            }

            string[] bookitems = data.BookingData.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries);
            if (bookitems.Length == 0)
            {
                return(0);
            }
            long    id;
            int     nums, kids, adults, guests;
            decimal Cus_sup_amt, Cus_Total_amt, Cus_Tax_amt, Cus_grdtotal_amt;
            List <CLayer.BookingAccDetails> bookings = new List <CLayer.BookingAccDetails>();
            List <long> accIds = new List <long>();

            CLayer.BookingAccDetails tmp;
            foreach (string s in bookitems)
            {
                if (s == "")
                {
                    continue;
                }
                string[] ids = s.Split(new char[] { ',' });
                if (ids.Length != 9)
                {
                    continue;
                }


                id               = 0;
                adults           = 0;
                kids             = 0;
                guests           = 0;
                nums             = 0;
                Cus_sup_amt      = 0;
                Cus_Total_amt    = 0;
                Cus_Tax_amt      = 0;
                Cus_grdtotal_amt = 0;

                long.TryParse(ids[0], out id);
                if (id == 0)
                {
                    continue;
                }
                if (accIds.Contains(id))
                {
                    continue;
                }
                int.TryParse(ids[1], out nums);
                if (nums == 0)
                {
                    continue;
                }
                int.TryParse(ids[2], out adults);
                //   if (adults == 0) continue;
                int.TryParse(ids[3], out kids);
                int.TryParse(ids[4], out guests);


                decimal.TryParse(ids[5], out Cus_sup_amt);
                decimal.TryParse(ids[6], out Cus_Total_amt);
                decimal.TryParse(ids[7], out Cus_Tax_amt);
                decimal.TryParse(ids[8], out Cus_grdtotal_amt);

                tmp                      = new CLayer.BookingAccDetails();
                tmp.AccCount             = nums;
                tmp.AccommodationId      = id;
                tmp.Adults               = adults;
                tmp.Children             = kids;
                tmp.Guest                = guests;
                tmp.Cus_SupplierAmount   = Cus_sup_amt;
                tmp.Cus_TotalAmount      = Cus_Total_amt;
                tmp.Cus_TaxAmount        = Cus_Tax_amt;
                tmp.Cus_GrandTotalAmount = Cus_grdtotal_amt;


                accIds.Add(id);
                bookings.Add(tmp);
            }
            if (accIds.Count == 0)
            {
                return(1);
            }
            //  List<CLayer.Rates> accrates = BLayer.Rate.GetTotalRates(accIds, data.BookCheckIn, data.BookCheckOut, BLayer.User.GetRole(userId), userId);
            return(BookAccommodations(bookings, data.BookCheckIn, data.BookCheckOut, userId, bookingId));
        }