コード例 #1
0
        public async Task <IActionResult> PutHotelRooms([FromRoute] int id, [FromBody] HotelRooms hotelRooms)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != hotelRooms.RoomId)
            {
                return(BadRequest());
            }

            _context.Entry(hotelRooms).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HotelRoomsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public IHttpActionResult PutHotelRooms(int id, HotelRooms hotelRooms)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != hotelRooms.Hotel_No)
            {
                return(BadRequest());
            }

            db.Entry(hotelRooms).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HotelRoomsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("HotelsID,RoomsID,RoomNumber,Rate,PetFriendly")] HotelRooms hotelRooms)
        {
            if (id != hotelRooms.HotelsID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hotelRooms);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HotelRoomsExists(hotelRooms.HotelsID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["HotelsID"] = new SelectList(_context.Hotels, "ID", "ID", hotelRooms.HotelsID);
            ViewData["RoomsID"]  = new SelectList(_context.Rooms, "ID", "ID", hotelRooms.RoomsID);
            return(View(hotelRooms));
        }
        public IHttpActionResult PostHotelRooms(HotelRooms hotelRooms)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.HotelRooms.Add(hotelRooms);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (HotelRoomsExists(hotelRooms.Hotel_No))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = hotelRooms.Hotel_No }, hotelRooms));
        }
コード例 #5
0
        private void btnRooms_Click(object sender, EventArgs e)
        {
            var rooms = new HotelRooms();

            rooms.FormClosed += new FormClosedEventHandler(rooms_FormClosed);
            this.Hide();
            rooms.Show();
        }
コード例 #6
0
        public ActionResult DeleteConfirmed(long id)
        {
            HotelRooms hotelRooms = db.HotelRooms.Find(id);

            db.HotelRooms.Remove(hotelRooms);
            db.SaveChanges();
            return(RedirectToAction("Index", "MyAccount"));
        }
コード例 #7
0
        public ActionResult UpdateStatusFalse(long?id)
        {
            HotelRooms forsale = db.HotelRooms.Find(id);

            forsale.Status          = false;
            db.Entry(forsale).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("AddsManage", "MyAccount"));
        }
コード例 #8
0
        public async Task <IActionResult> PostHotelRooms([FromBody] HotelRooms hotelRooms)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.HotelRooms.Add(hotelRooms);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetHotelRooms", new { id = hotelRooms.RoomId }, hotelRooms));
        }
コード例 #9
0
        public async Task <IActionResult> Create([Bind("HotelsID,RoomsID,RoomNumber,Rate,PetFriendly")] HotelRooms hotelRooms)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hotelRooms);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["HotelsID"] = new SelectList(_context.Hotels, "ID", "ID", hotelRooms.HotelsID);
            ViewData["RoomsID"]  = new SelectList(_context.Rooms, "ID", "ID", hotelRooms.RoomsID);
            return(View(hotelRooms));
        }
コード例 #10
0
        public void Apply(RoomTypeChanged e)
        {
            var room = HotelRooms.FirstOrDefault(x => x.Number == e.RoomNumber);

            if (room == null)
            {
                HotelRooms.Add(new HotelRoom(e));
            }
            else
            {
                room.Type = e.Type;
            }
        }
        public IHttpActionResult DeleteHotelRooms(int id)
        {
            HotelRooms hotelRooms = db.HotelRooms.Find(id);

            if (hotelRooms == null)
            {
                return(NotFound());
            }

            db.HotelRooms.Remove(hotelRooms);
            db.SaveChanges();

            return(Ok(hotelRooms));
        }
コード例 #12
0
        public ViewResult ViewDetails(int id)
        {
            HotelRooms hotelRooms = context.HotelRooms.Where(x => x.RoomId == id).SingleOrDefault();

            ViewBag.HotelRoom = hotelRooms;
            int    hid    = ViewBag.HotelRoom.HotelId;
            Hotels hotels = context.Hotels.Where(x => x.HotelId == hid).SingleOrDefault();

            ViewBag.Hotel = hotels;
            RoomFacilities roomFacilities = context.RoomFacilities.Where(x => x.RoomId == id).SingleOrDefault();

            ViewBag.RoomFacility = roomFacilities;
            return(View());
        }
コード例 #13
0
        public ViewResult RoomsDetails(int id)
        {
            int    hotelId = int.Parse(TempData["hotel"].ToString());
            Hotels hotel   = _context.Hotels.Where(x => x.HotelId == hotelId).SingleOrDefault();

            ViewBag.Hotel = hotel;

            HotelRooms hotelRoom = _context.HotelRooms.Where(x => x.RoomId == id).SingleOrDefault();

            ViewBag.HotelRoom = hotelRoom;
            RoomFacilities roomFacilities = _context.RoomFacilities.Where(x => x.RoomId == id).SingleOrDefault();

            ViewBag.RoomFacilities = roomFacilities;
            return(View());
        }
コード例 #14
0
        public IActionResult HistoryDetails(int id)
        {
            var bking = context.BookingRecords.Where(x => x.BookingId == id).ToList();

            ViewBag.HistoryDetails = bking;
            List <HotelRooms> hotelroom = new List <HotelRooms>();

            foreach (var item in ViewBag.HistoryDetails)
            {
                int        idd = Convert.ToInt32(item.RoomId);
                HotelRooms hr  = context.HotelRooms.Where(x => x.RoomId == idd).SingleOrDefault();
                hotelroom.Add(hr);
            }
            ViewBag.HotelRoom = hotelroom;
            return(View());
        }
コード例 #15
0
        public IActionResult HotelRoomsIndex(int id)
        {
            List <HotelRooms>     hroom   = new List <HotelRooms>();
            List <RoomFacilities> rf      = new List <RoomFacilities>();
            List <Item>           booking = SessionHelper.GetObjectFromJson <List <Item> >(HttpContext.Session, "Booking");

            ViewBag.Booking = booking;
            int count = 0;

            if (booking != null)
            {
                foreach (var item in booking)
                {
                    count++;
                }
                if (count != 0)
                {
                    HttpContext.Session.SetString("CartItem", count.ToString());
                }
            }
            var hotelRoom = _context.HotelRooms.Where(x => x.HotelId == id).ToList();

            ViewBag.HotelRoom = hotelRoom;

            foreach (var item in ViewBag.HotelRoom)
            {
                int            idd       = item.RoomId;
                RoomFacilities rfacility = _context.RoomFacilities.Where(x => (x.IsAvilable == true) && (x.RoomId == idd)).SingleOrDefault();
                if (rfacility != null)
                {
                    rf.Add(rfacility);
                }
            }

            ViewBag.rf = rf;

            foreach (var item in ViewBag.rf)
            {
                int        idd           = item.RoomId;
                HotelRooms RoomAvailable = _context.HotelRooms.Where(x => (x.RoomId == idd)).SingleOrDefault();
                hroom.Add(RoomAvailable);
            }

            ViewBag.HotelRoomIndex = hroom;
            TempData["hotel"]      = id;
            return(View(hotelRoom));
        }
コード例 #16
0
        public ActionResult Pay(long?prime, long?vid, long?id, string userid, string amnt)
        {
            HotelRooms forsale = db.HotelRooms.Find(id);
            DateTime   _date   = Convert.ToDateTime(DateTime.Now);

            _date = _date.AddDays(365);


            forsale.UserId = User.Identity.GetUserId();

            forsale.Status    = true;
            forsale.Date      = DateTime.Now;
            forsale.EndDate   = _date;
            forsale.StratDate = DateTime.Now;

            db.Entry(forsale).State = EntityState.Modified;
            db.SaveChanges();
            var            ids    = DateTime.Now.ToString("mmddyyyy");
            RazorpayClient client = new RazorpayClient(RazorPayConst.Api_Key, RazorPayConst.Key_Secret);
            Dictionary <string, object> options = new Dictionary <string, object>();

            options.Add("amount", amnt); // amount in the smallest currency unit
            options.Add("receipt", "order_id" + ids);
            options.Add("currency", "INR");
            options.Add("payment_capture", "1");
            Order order = client.Order.Create(options);

            List <Order> payments = client.Order.All();
            string       datas    = payments[0]["id"];

            ViewBag.receipt = datas;

            RazorPayPaymentDetails clients = new RazorPayPaymentDetails();

            clients.Amount          = Convert.ToDouble(amnt);
            clients.Currency        = "INR";
            clients.Captured        = "Paid";
            clients.RazorpayOrderId = ids;
            clients.MerchantOrderId = "vooq.com";
            clients.PaymentId       = User.Identity.GetUserId();
            clients.PaymentDate     = DateTime.Now;
            db.RazorPayPaymentDetails.Add(clients);
            db.SaveChanges();

            return(View());
        }
コード例 #17
0
        // GET: HotelRooms/Details/5
        public ActionResult Details(string id)
        {
            id = id == null ? "" : id;
            SqlParameter[] Parameters =
            {
                new SqlParameter("@HotelRoomId", id.ToString())
            };
            ViewBag.data = db.Database.SqlQuery <HotelRoomsModel>(" [dbo].[spGetListingData_HotelRooms_Details] @HotelRoomId", Parameters).ToList();
            long       ids     = Convert.ToInt64(id);
            HotelRooms forsale = db.HotelRooms.Find(ids);

            forsale.Views           = forsale.Views + 1;
            db.Entry(forsale).State = EntityState.Modified;
            db.SaveChanges();

            return(View());
        }
コード例 #18
0
        // GET: HotelRooms/Edit/5
        public ActionResult Edit(long?id)
        {
            ViewBag.HotelRoomPropertyType = db.HotelRoomPropertyType.ToList();
            ViewBag.HotelRoomClassType    = db.HotelRoomClassType.ToList();
            ViewBag.HotelRoomInternetType = db.HotelRoomInternetType.ToList();
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HotelRooms hotelRooms = db.HotelRooms.Find(id);

            if (hotelRooms == null)
            {
                return(HttpNotFound());
            }
            return(View(hotelRooms));
        }
コード例 #19
0
        public IActionResult Buy(int id)
        {
            if (SessionHelper.GetObjectFromJson <List <Item> >(HttpContext.Session, "Book") == null)
            {
                List <Item> book = new List <Item>();
                book.Add(new Item
                {
                    HotelRooms = context.HotelRooms.Find(id),
                    Quantity   = 1
                });

                SessionHelper.SetObjectAsJon(HttpContext.Session, "Book", book);
            }


            else
            {
                List <Item> book = SessionHelper.GetObjectFromJson <List <Item> >
                                       (HttpContext.Session, "Book");
                int index = isExit(id);
                if (index != -1)
                {
                    book[index].Quantity++;
                }

                else
                {
                    book.Add(new Item
                    {
                        HotelRooms = context.HotelRooms.Find(id),
                        Quantity   = 1
                    });
                    SessionHelper.SetObjectAsJon(HttpContext.Session, "Book", book);
                }
            }

            HotelRooms hotelRooms = context.HotelRooms.Where(x => x.RoomId == id).SingleOrDefault();

            ViewBag.HotelRoom = hotelRooms;
            int    hid    = ViewBag.HotelRoom.HotelId;
            Hotels hotels = context.Hotels.Where(x => x.HotelId == id).SingleOrDefault();

            ViewBag.Hotel = hotels;
            return(RedirectToAction("Details", "HotelRoom", new { @id = hid }));
        }
コード例 #20
0
        public IActionResult Buy(int id)
        {
            if (SessionHelper.GetObjectFromJson <List <Item> >(HttpContext.Session, "Booking") == null)
            {
                List <Item> booking = new List <Item>();
                booking.Add(new Item
                {
                    HotelRooms = context.HotelRooms.Find(id),
                    Quantity   = 1
                });
                SessionHelper.SetObjectAsJson(HttpContext.Session, "Booking", booking);
            }
            else
            {
                List <Item> booking = SessionHelper.GetObjectFromJson <List <Item> >(HttpContext.Session, "Booking");
                int         index   = isExist(id);
                if (index != -1)
                {
                    booking[index].Quantity++;
                }
                else
                {
                    booking.Add(new Item
                    {
                        HotelRooms = context.HotelRooms.Find(id),
                        Quantity   = 1
                    });
                    SessionHelper.SetObjectAsJson(HttpContext.Session, "Booking", booking);
                }
            }

            HotelRooms hotelRoom = context.HotelRooms.Where(x => x.RoomId == id).SingleOrDefault();

            ViewBag.Hotel = hotelRoom;
            int hId = ViewBag.Hotel.HotelId;

            return(RedirectToAction("HotelRoomsIndex", "Home", new { @id = hId }));
        }
コード例 #21
0
        private async Task <List <HotelRooms> > Json_Paring(string json)
        {
            total_checking_rooms = 0;

            JObject obj = JObject.Parse(json);

            // Console.WriteLine(obj.ToString());

            List <HotelRooms> hotelRomms = new List <HotelRooms>();

            if (int.Parse(obj["hotels"]["total"].ToString()) > 0)
            {
                JArray hotel_hotels = JArray.Parse(obj["hotels"]["hotels"].ToString());



                foreach (JObject itemObj in hotel_hotels)
                {
                    JArray hotel_rooms = JArray.Parse(itemObj["rooms"].ToString());


                    foreach (JObject itemObj2 in hotel_rooms)
                    {
                        JArray hotel_rates = JArray.Parse(itemObj2["rates"].ToString());

                        total_checking_rooms += hotel_rates.Count;

                        foreach (JObject itemObj3 in hotel_rates)
                        {
                            HotelRooms hotelRoom = new HotelRooms();

                            hotelRoom.checkIn               = obj["hotels"]["checkIn"].ToString();
                            hotelRoom.checkOut              = obj["hotels"]["checkOut"].ToString();
                            hotelRoom.hotel_code            = Convert.ToInt64(itemObj["code"].ToString());
                            hotelRoom.hotel_name            = itemObj["name"].ToString();
                            hotelRoom.hotel_destinationCode = itemObj["destinationCode"].ToString();
                            hotelRoom.hotel_destinationName = itemObj["destinationName"].ToString();
                            hotelRoom.hotel_zoneCode        = Convert.ToInt64(itemObj["zoneCode"].ToString());
                            hotelRoom.hotel_zoneName        = itemObj["zoneName"].ToString();
                            hotelRoom.room_code             = itemObj2["code"].ToString();
                            hotelRoom.room_name             = itemObj2["name"].ToString();
                            hotelRoom.rateKey               = itemObj3["rateKey"].ToString();
                            hotelRoom.rateType              = itemObj3["rateType"].ToString();
                            hotelRoom.rateClass             = itemObj3["rateClass"].ToString();
                            hotelRoom.boardName             = itemObj3["boardName"].ToString();



                            Console.WriteLine(testi);

                            //** Checek Actual Availability Rate:**//
                            if (RateCheck_YN.IsChecked == true)
                            {
                                hotelRoom.callBack = await hotelCheckRates(itemObj3["rateKey"].ToString());
                            }


                            Console.WriteLine(testi);

                            hotelRoom.net = itemObj3["net"].ToString();

                            if (itemObj3.ContainsKey("sellingRate") == true)
                            {
                                hotelRoom.sellingRate = itemObj3["sellingRate"].ToString();
                            }


                            if (itemObj.ContainsKey("exclusiveDeal") == true)
                            {
                                if (Convert.ToInt64(itemObj["exclusiveDeal"].ToString()) == 1)
                                {
                                    hotelRoom.GnD = "Y";
                                }
                                else
                                {
                                    hotelRoom.GnD = "N";
                                }
                            }

                            hotelRoom.packaging = bool.Parse(itemObj3["packaging"].ToString());



                            hotelRomms.Add(hotelRoom);

                            Console.WriteLine(" TOT :" + total_checking_rooms);
                            statusBar.Content = "Please waith for a Second.... We Start Checking the Health of System ... ->Cheked... :" + total_checking_rooms;

                            testi++;
                        }
                    }
                }
            }

            //var test2 = JsonConvert.SerializeObject(hotelRomms);
            //Console.WriteLine(test2);


            return(hotelRomms);
        }
コード例 #22
0
        public ActionResult Edit([Bind(Include = "UserId,EndDate,status,StratDate,HotelRoomId,VId,UserId,Title,Address,Location,PropertyTypeId,ClassTypeId,CheckIn,CheckOut,InternetTypeID,IsParking,IsBreakfast,IsEscalator,IsRoomService,IsRestaurant,IsBar,IsSpaMassage,IsSwimmingPool,Price,LandPhone,Mobile,Email,Website,Description,Image1,Image2,Image3,Date,Views,Status")] HotelRooms hotelRooms, HttpPostedFileBase file1, HttpPostedFileBase file2, HttpPostedFileBase file3)
        {
            ViewBag.HotelRoomPropertyType = db.HotelRoomPropertyType.ToList();
            ViewBag.HotelRoomClassType    = db.HotelRoomClassType.ToList();
            ViewBag.HotelRoomInternetType = db.HotelRoomInternetType.ToList();
            if (ModelState.IsValid)
            {
                if (file1 != null)
                {
                    //file1.SaveAs(HttpContext.Server.MapPath("~/Images/")+ file1.FileName);
                    //realEstate.Image1 = "/Images/"+file1.FileName;
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file1.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file1.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file1.FileName);
                                hotelRooms.Image1 = "/Images/" + file1.FileName;
                            }
                        }
                    }
                }
                else if (hotelRooms.Image1 != null)
                {
                }
                else
                {
                    hotelRooms.Image1 = "/Images/nullimage.jpg";
                }
                if (file2 != null)
                {
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file2.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file2.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file2.FileName);
                                hotelRooms.Image2 = "/Images/" + file2.FileName;
                            }
                        }
                    }
                }
                else if (hotelRooms.Image2 != null)
                {
                }
                else
                {
                    hotelRooms.Image2 = "/Images/nullimage.jpg";
                }
                if (file3 != null)
                {
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file3.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file3.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file3.FileName);
                                hotelRooms.Image3 = "/Images/" + file3.FileName;
                            }
                        }
                    }
                }
                else if (hotelRooms.Image3 != null)
                {
                }
                else
                {
                    hotelRooms.Image3 = "/Images/nullimage.jpg";
                }
                hotelRooms.Date            = DateTime.Now;
                db.Entry(hotelRooms).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "MyAccount"));
            }
            return(View(hotelRooms));
        }