Example #1
0
        public JsonResult GetHotelData(string HotelID)
        {
            HotelInformation hInfo     = new HotelInformation();
            Common           objCommon = new Common();

            return(Json(objCommon.DatasetToJson(hInfo.GetHotelData(HotelID)), JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public void HotelRooms()
        {
            if (!_dbContext.HotelInformations.Any())
            {
                var filePath = "Files/hotel_rooms.txt";
                var data     = File.ReadAllLines(filePath);

                foreach (var line in data)
                {
                    HotelInformation room = new HotelInformation();

                    dynamic[] lineData = line.Split(new char[] { '-' });

                    room.NumberOfRoom      = Int32.Parse(lineData[0]);
                    room.PriceForRoom      = Int32.Parse(lineData[1]);
                    room.ComfortableOfRoom = lineData[2];
                    room.HasToilet         = lineData[3] == "True";
                    room.HasTV             = lineData[4] == "True";
                    room.HasBigBed         = lineData[5] == "True";
                    room.IsFreeNow         = lineData[6] == "True";

                    _dbContext.HotelInformations.Add(room);
                }
                _dbContext.SaveChanges();
            }
        }
Example #3
0
        public int SaveInventory(RoomInventory RoomInventory)
        {
            HotelInformation Hinfo = new HotelInformation();
            int result             = Hinfo.SaveRoomInventory(RoomInventory);

            return(result);
        }
Example #4
0
        public JsonResult GetHotelName(string SearchKey)
        {
            HotelInformation Hinfo     = new HotelInformation();
            Common           objCommon = new Common();

            return(Json(Hinfo.GetHotelDetail(SearchKey), JsonRequestBehavior.AllowGet));
        }
Example #5
0
        public JsonResult GetHotelDetailData(string HotelId)
        {
            HotelInformation Hinfo     = new HotelInformation();
            Common           objCommon = new Common();

            return(Json(objCommon.DatasetToJson(Hinfo.GetIndividualHotelData(HotelId)), JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public JsonResult GetSearchData(SearchHotel Search)
        {
            HotelInformation Hinfo     = new HotelInformation();
            Common           objCommon = new Common();

            return(Json(objCommon.DatasetToJson(Hinfo.GetSearchData(Search)), JsonRequestBehavior.AllowGet));
        }
Example #7
0
        //private static DataTable HotelData = null;
        public static void LoadStaticCache()
        {
            HotelInformation Hinfo     = new HotelInformation();
            Common           objCommon = new Common();
            // Declare the File Information
            FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("~/Location Data/GlobalData.json"));

            // write the line using streamwriter
            using (StreamWriter sw = file.AppendText())
            {
                sw.WriteLine(objCommon.DatasetToJson(Hinfo.GetHotelsForCache()));
            }
            // Read the content using Streamreader from text file
            //using (StreamReader sr = file.OpenText())
            //{
            //    string s = "";
            //    while ((s = sr.ReadLine()) != null)
            //    {
            //        listBox1.Text = s; // Display the text file content to the list box
            //    }
            //    sr.Close();
            //}
            string jsondata = objCommon.DatasetToJson(Hinfo.GetHotelsForCache());
            string path     = HttpContext.Current.Server.MapPath("~/Location Data/");

            //File.Delete(path + "GlobalData.json");
            //File.Create(path + "GlobalData.json");
            File.WriteAllText(path + "GlobalData.json", jsondata);
        }
Example #8
0
        public JsonResult GetHotelList(string agentId)
        {
            HotelInformation   hotelObj = new HotelInformation();
            List <HotelBasics> list     = hotelObj.GetHotelList(agentId);

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Example #9
0
        //hotel information
        private void button6_Click(object sender, EventArgs e)
        {
            this.Hide();
            HotelInformation hi = new HotelInformation();

            hi.ShowDialog();
            this.Close();
        }
Example #10
0
 public int UploadHomeReport(string id, string hotelName, int hotelId)
 {
     try
     {
         string drive      = ConfigurationManager.AppSettings["PicDrive"];
         string folderName = ConfigurationManager.AppSettings["FolderName"];
         folderName = folderName + "/" + hotelName + "~" + hotelId;
         string           driveToSave = Path.Combine(drive, folderName);
         HotelInformation hInfo       = new HotelInformation();
         RoomImages       roomImg     = new RoomImages();
         int result = 0;
         if (CheckDirectory(driveToSave))
         {
             if (Request.Files.Count > 0)
             {
                 foreach (string file in Request.Files)
                 {
                     HttpPostedFileBase hpf = Request.Files[file] as HttpPostedFileBase;
                     hpf.SaveAs(Path.Combine(driveToSave, hpf.FileName));
                     roomImg.PicName  = hpf.FileName;
                     roomImg.RoomID   = id;
                     roomImg.HotelID  = hotelId;
                     roomImg.IsEnable = 0;
                     roomImg.Flag     = "A";
                     result           = hInfo.SaveRoomImages(roomImg);
                 }
             }
         }
         return(result);
     }
     catch (Exception ex)
     {
         ExceptionHandling.WriteException(ex);
         Response.StatusCode = (int)HttpStatusCode.BadRequest;
         return(0);
     }
 }
Example #11
0
        public JsonResult GetRoomInventory(string HotelID)
        {
            HotelInformation Hinfo = new HotelInformation();

            return(Json(Hinfo.GetRoomInventory(HotelID), JsonRequestBehavior.AllowGet));
        }
Example #12
0
        public int SaveHotelBasics(HotelBasics hotelBasics)
        {
            HotelInformation hotelInformation = new HotelInformation();

            return(hotelInformation.AddHotel(hotelBasics));
        }
Example #13
0
        public JsonResult GetRoomWisePLan(string RoomID)
        {
            HotelInformation hotelDetails = new HotelInformation();

            return(Json(hotelDetails.GetRoomWisePlan(RoomID), JsonRequestBehavior.AllowGet));
        }
Example #14
0
        public int SaveHotelContact(HotelContactInfo hotelContactInfo)
        {
            HotelInformation hotelInformation = new HotelInformation();

            return(hotelInformation.AddHotelContactDetail(hotelContactInfo));
        }
Example #15
0
        public int SaveRoomPlan(RoomPlan Details)
        {
            HotelInformation hotelInfo = new HotelInformation();

            return(hotelInfo.SaveRoomPlan(Details));
        }
Example #16
0
        public JsonResult GetRoomList(String HotelID)
        {
            HotelInformation hInfo = new HotelInformation();

            return(Json(hInfo.GetRoomList(HotelID), JsonRequestBehavior.AllowGet));
        }
Example #17
0
        public int RemoveImage(string ImageID)
        {
            HotelInformation Hinfo = new HotelInformation();

            return(Hinfo.RemoveImage(ImageID));
        }
Example #18
0
        public int EnableImage(string ImageID, string Status)
        {
            HotelInformation Hinfo = new HotelInformation();

            return(Hinfo.EnableImage(ImageID, Status));
        }
Example #19
0
        public int SaveHotelRoom(HotelRoom hotelRoom)
        {
            HotelInformation hotelInformation = new HotelInformation();

            return(hotelInformation.AddRoomDetails(hotelRoom));
        }
Example #20
0
        public int UpdateInventory(string inventDate, int RoomID, int Available)
        {
            HotelInformation Hinfo = new HotelInformation();

            return(Hinfo.UpdateInventory(inventDate, RoomID, Available));
        }
Example #21
0
        public int DeleteRoom(string RoomID)
        {
            HotelInformation hotelInformation = new HotelInformation();

            return(hotelInformation.DeleteRoom(RoomID));
        }
        private async Task Json_Paring(string target_parsing_Data, string json)
        {
            try
            {
                JObject obj = JObject.Parse(json);


                if (total_number == 0)
                {
                    //Console.WriteLine(obj["total"].ToString());
                    total_number = int.Parse(obj["total"].ToString());
                }

                JArray hotel_hotels = JArray.Parse(obj["hotels"].ToString());

                switch (target_parsing_Data)
                {
                case "HT":

                    foreach (JObject itemObj in hotel_hotels)
                    {
                        HotelInformation contents = new HotelInformation();

                        contents.code = Convert.ToInt64(itemObj["code"].ToString());
                        contents.name = itemObj["name"]["content"].ToString();


                        if (itemObj.ContainsKey("exclusiveDeal") == true)
                        {
                            if (Convert.ToInt64(itemObj["exclusiveDeal"].ToString()) == 1)
                            {
                                contents.isGnD = "Y";
                            }
                        }

                        if (itemObj.ContainsKey("countryCode") == true)
                        {
                            string countryCode_tmp = itemObj["countryCode"].ToString();
                            contents.countryCode = countryCode_tmp;
                            var linq = (from c in CountryDescMomoryDB where c.country_code == countryCode_tmp select new { c.country_description }).FirstOrDefault();
                            if (linq != null)
                            {
                                contents.countryName = linq.country_description.ToString();
                            }
                        }

                        if (itemObj.ContainsKey("destinationCode") == true)
                        {
                            string destinationCode_tmp = itemObj["destinationCode"].ToString();
                            contents.destinationCode = destinationCode_tmp;
                            var linq = (from d in DestinationDescMomoryDB where d.destinatin_code == destinationCode_tmp select new { d.destinatin_name }).FirstOrDefault();
                            if (linq != null)
                            {
                                contents.destinationName = linq.destinatin_name.ToString();
                            }
                        }

                        if (itemObj.ContainsKey("zoneCode") == true)
                        {
                            contents.zoneCode = itemObj["zoneCode"].ToString();
                        }

                        if (itemObj.ContainsKey("coordinates") == true)
                        {
                            contents.longitude = itemObj["coordinates"]["longitude"].ToString();
                            contents.latitude  = itemObj["coordinates"]["latitude"].ToString();
                        }

                        if (itemObj.ContainsKey("chainCode") == true)
                        {
                            contents.chainCode = itemObj["chainCode"].ToString();
                        }

                        if (itemObj.ContainsKey("accommodationTypeCode") == true)
                        {
                            contents.accommodationTypeCode = itemObj["accommodationTypeCode"].ToString();
                        }

                        if (itemObj.ContainsKey("address") == true)
                        {
                            contents.address = itemObj["address"]["content"].ToString();
                        }

                        if (itemObj.ContainsKey("postalCode") == true)
                        {
                            contents.postalCode = itemObj["postalCode"].ToString();
                        }

                        if (itemObj.ContainsKey("city") == true)
                        {
                            contents.city = itemObj["city"]["content"].ToString();
                        }

                        if (itemObj.ContainsKey("S2C") == true)
                        {
                            contents.S2C = itemObj["S2C"].ToString();
                        }

                        if (itemObj.ContainsKey("phones") == true)
                        {
                            JArray hotel_phones = JArray.Parse(itemObj["phones"].ToString());
                            foreach (JObject itemObj2 in hotel_phones)
                            {
                                if (itemObj2["phoneType"].ToString().Equals("PHONEBOOKING"))
                                {
                                    //Console.WriteLine("phones");
                                    contents.phoneNumber = itemObj2["phoneNumber"].ToString();
                                    //Console.WriteLine(itemObj2["phoneNumber"].ToString());
                                }
                                //        //else if(itemObj2["phoneType"].ToString() == "PHONEHOTEL")
                                //        //{
                                //        //    contents.phoneNumber = itemObj2["phoneNumber"].ToString();
                                //        //}
                            }
                        }
                        hotelContentsList.Add(contents);
                    }
                    break;

                case "IMG":
                    foreach (JObject itemObj in hotel_hotels)
                    {
                        if (itemObj.ContainsKey("images") == true)
                        {
                            JArray hotel_images = JArray.Parse(itemObj["images"].ToString());
                            foreach (JObject itemObj2 in hotel_images)
                            {
                                string room_only_yn = "";

                                for (int i = 0; i < option_wrapPanel.Children.Count; i++)
                                {
                                    CheckBox option_chbx = (CheckBox)option_wrapPanel.Children[i];
                                    if ((bool)option_chbx.IsChecked)
                                    {
                                        room_only_yn = option_chbx.Name;
                                    }
                                    Console.WriteLine(room_only_yn);
                                }

                                if (room_only_yn == "")
                                {
                                    RoomImage contents = new RoomImage();

                                    contents.hotel_code = Convert.ToInt64(itemObj["code"].ToString());
                                    contents.hotel_name = itemObj["name"]["content"].ToString();


                                    if (itemObj.ContainsKey("countryCode") == true)
                                    {
                                        string countryCode_tmp = itemObj["countryCode"].ToString();
                                        contents.hotel_countryCode = countryCode_tmp;
                                        var linq = (from c in CountryDescMomoryDB where c.country_code == countryCode_tmp select new { c.country_description }).FirstOrDefault();
                                        if (linq != null)
                                        {
                                            contents.hotel_countryName = linq.country_description.ToString();
                                        }
                                    }


                                    if (itemObj.ContainsKey("destinationCode") == true)
                                    {
                                        string destinationCode_tmp = itemObj["destinationCode"].ToString();
                                        contents.hotel_destinationCode = destinationCode_tmp;
                                        var linq = (from d in DestinationDescMomoryDB where d.destinatin_code == destinationCode_tmp select new { d.destinatin_name }).FirstOrDefault();
                                        if (linq != null)
                                        {
                                            contents.hotel_destinationName = linq.destinatin_name.ToString();
                                        }
                                    }

                                    contents.imageOrder    = Convert.ToInt64(itemObj2["order"].ToString());
                                    contents.imageTypeCode = itemObj2["imageTypeCode"].ToString();
                                    if (itemObj2.ContainsKey("roomCode") == true)
                                    {
                                        string imageroomCode_tmp = itemObj2["roomCode"].ToString();
                                        contents.imageroomCode = imageroomCode_tmp;
                                        var linq = (from r in RoomDescMomoryDB where r.room_code == imageroomCode_tmp select new { r.room_description }).FirstOrDefault();
                                        if (linq != null)
                                        {
                                            contents.room_typeDescription = linq.room_description.ToString();
                                        }
                                    }
                                    contents.imagePath = itemObj2["path"].ToString();

                                    HBRoomImageList.Add(contents);
                                }
                                else
                                {
                                    if (itemObj2["imageTypeCode"].ToString().Equals("HAB"))
                                    {
                                        if (itemObj2.ContainsKey("roomCode") == true)
                                        {
                                            RoomImage contents = new RoomImage();

                                            contents.hotel_code = Convert.ToInt64(itemObj["code"].ToString());
                                            contents.hotel_name = itemObj["name"]["content"].ToString();
                                            if (itemObj.ContainsKey("countryCode") == true)
                                            {
                                                string countryCode_tmp = itemObj["countryCode"].ToString();
                                                contents.hotel_countryCode = countryCode_tmp;
                                                var roonm_only_linq = (from c in CountryDescMomoryDB where c.country_code == countryCode_tmp select new { c.country_description }).FirstOrDefault();
                                                if (roonm_only_linq != null)
                                                {
                                                    contents.hotel_countryName = roonm_only_linq.country_description.ToString();
                                                }
                                            }


                                            if (itemObj.ContainsKey("destinationCode") == true)
                                            {
                                                string destinationCode_tmp = itemObj["destinationCode"].ToString();
                                                contents.hotel_destinationCode = destinationCode_tmp;
                                                var roonm_only_linq = (from d in DestinationDescMomoryDB where d.destinatin_code == destinationCode_tmp select new { d.destinatin_name }).FirstOrDefault();
                                                if (roonm_only_linq != null)
                                                {
                                                    contents.hotel_destinationName = roonm_only_linq.destinatin_name.ToString();
                                                }
                                            }
                                            contents.imageOrder    = Convert.ToInt64(itemObj2["order"].ToString());
                                            contents.imageTypeCode = itemObj2["imageTypeCode"].ToString();

                                            string imageroomCode_tmp = itemObj2["roomCode"].ToString();
                                            contents.imageroomCode = imageroomCode_tmp;
                                            var linq = (from r in RoomDescMomoryDB where r.room_code == imageroomCode_tmp select new { r.room_description }).FirstOrDefault();
                                            if (linq != null)
                                            {
                                                contents.room_typeDescription = linq.room_description.ToString();
                                            }


                                            contents.imagePath = itemObj2["path"].ToString();

                                            HBRoomImageList.Add(contents);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;

                case "WILD":
                    foreach (JObject itemObj in hotel_hotels)
                    {
                        Console.WriteLine("123");
                        if (itemObj.ContainsKey("wildcards") == true)
                        {
                            Console.WriteLine("1234");
                            JArray hotel_wildcards = JArray.Parse(itemObj["wildcards"].ToString());
                            foreach (JObject itemObj2 in hotel_wildcards)
                            {
                                HotelWildCards contents = new HotelWildCards();

                                contents.hotel_code = Convert.ToInt64(itemObj["code"].ToString());
                                contents.hotel_name = itemObj["name"]["content"].ToString();


                                if (itemObj.ContainsKey("countryCode") == true)
                                {
                                    string countryCode_tmp = itemObj["countryCode"].ToString();
                                    contents.hotel_countryCode = countryCode_tmp;
                                    var linq = (from c in CountryDescMomoryDB where c.country_code == countryCode_tmp select new { c.country_description }).FirstOrDefault();
                                    if (linq != null)
                                    {
                                        contents.hotel_countryName = linq.country_description.ToString();
                                    }
                                }


                                if (itemObj.ContainsKey("destinationCode") == true)
                                {
                                    string destinationCode_tmp = itemObj["destinationCode"].ToString();
                                    contents.hotel_destinationCode = destinationCode_tmp;
                                    var linq = (from d in DestinationDescMomoryDB where d.destinatin_code == destinationCode_tmp select new { d.destinatin_name }).FirstOrDefault();
                                    if (linq != null)
                                    {
                                        contents.hotel_destinationName = linq.destinatin_name.ToString();
                                    }
                                }


                                if (itemObj2.ContainsKey("roomType") == true)
                                {
                                    string wildcard_roomType_tmp = itemObj2["roomType"].ToString();
                                    contents.wildcard_roomType = wildcard_roomType_tmp;
                                    var linq = (from r in RoomDescMomoryDB where r.room_code == wildcard_roomType_tmp select new { r.room_description }).FirstOrDefault();
                                    if (linq != null)
                                    {
                                        contents.wildcard_roomTypeDescription = linq.room_description.ToString();
                                    }
                                }



                                if (itemObj2.ContainsKey("roomCode") == true)
                                {
                                    contents.wildcard_roomCode = itemObj2["roomCode"].ToString();
                                }
                                if (itemObj2.ContainsKey("characteristicCode") == true)
                                {
                                    contents.wildcard_characteristicCode = itemObj2["characteristicCode"].ToString();
                                }
                                if (itemObj2.ContainsKey("hotelRoomDescription") == true)
                                {
                                    contents.wildcard_hotelRoomDescription = itemObj2["hotelRoomDescription"]["content"].ToString();
                                }

                                HBWildCardsList.Add(contents);
                            }
                        }
                    }
                    break;

                case "HTROOM":
                    foreach (JObject itemObj in hotel_hotels)
                    {
                        //Console.WriteLine("123");
                        if (itemObj.ContainsKey("rooms") == true)
                        {
                            //Console.WriteLine("1234");
                            JArray hotel_roomtypes = JArray.Parse(itemObj["rooms"].ToString());
                            foreach (JObject itemObj2 in hotel_roomtypes)
                            {
                                HotelRoomTypeInfo contents = new HotelRoomTypeInfo();

                                contents.hotel_code = Convert.ToInt64(itemObj["code"].ToString());
                                contents.hotel_name = itemObj["name"]["content"].ToString();


                                if (itemObj.ContainsKey("countryCode") == true)
                                {
                                    string countryCode_tmp = itemObj["countryCode"].ToString();
                                    contents.hotel_countryCode = countryCode_tmp;
                                    var linq = (from c in CountryDescMomoryDB where c.country_code == countryCode_tmp select new { c.country_description }).FirstOrDefault();
                                    if (linq != null)
                                    {
                                        contents.hotel_countryName = linq.country_description.ToString();
                                    }
                                }


                                if (itemObj.ContainsKey("destinationCode") == true)
                                {
                                    string destinationCode_tmp = itemObj["destinationCode"].ToString();
                                    contents.hotel_destinationCode = destinationCode_tmp;
                                    var linq = (from d in DestinationDescMomoryDB where d.destinatin_code == destinationCode_tmp select new { d.destinatin_name }).FirstOrDefault();
                                    if (linq != null)
                                    {
                                        contents.hotel_destinationName = linq.destinatin_name.ToString();
                                    }
                                }


                                if (itemObj2.ContainsKey("roomCode") == true)
                                {
                                    string ht_roomCode_tmp = itemObj2["roomCode"].ToString();
                                    contents.roomCode = ht_roomCode_tmp;
                                    var linq = (from r in RoomDescMomoryDB where r.room_code == ht_roomCode_tmp select new { r.room_description }).FirstOrDefault();
                                    if (linq != null)
                                    {
                                        contents.roomCodeDescription = linq.room_description.ToString();
                                    }
                                }



                                if (itemObj2.ContainsKey("roomType") == true)
                                {
                                    contents.roomType = itemObj2["roomType"].ToString();
                                }
                                if (itemObj2.ContainsKey("characteristicCode") == true)
                                {
                                    contents.characteristicCode = itemObj2["characteristicCode"].ToString();
                                }

                                HBHTRoomTypeList.Add(contents);
                            }
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #23
0
        public JsonResult GetHotelDetails(string HotelID)
        {
            HotelInformation hotelDetails = new HotelInformation();

            return(Json("", JsonRequestBehavior.AllowGet));
        }