예제 #1
0
        public ActionResult Info(string id)
        {
            string weixinid     = HotelCloud.Common.HCRequest.GetString("weixinID");
            string userWeiXinID = HotelCloud.Common.HCRequest.GetString("key");

            if (!userWeiXinID.Equals(""))
            {
                weixinid = userWeiXinID.Split('@')[0];
                hotel3g.Models.Cookies.SetCookies("userWeixinNO", userWeiXinID.Split('@')[1], 30, weixinid);
            }
            Hotel hotel = Cache.GetHotel(Convert.ToInt32(id));

            ViewData["userWeiXinID"] = hotel3g.Models.Cookies.GetCookies("userWeixinNO", weixinid);
            ViewData["hotel"]        = hotel;
            ViewData["image"]        = Img.GetHotelImage(3, hotel.ID);

            //[{name:"广州火车站",juli:8},{name:"白云国际机场28",juli:25},{name:"北京路238",juli:2}]
            string fujin = string.Empty;
            string round = hotel.RoundValue;

            round = "{\"RoundValue\":" + round + "}";
            round = round.Replace("name", "\"name\"").Replace("juli", "\"juli\"");

            //var json =JObject.Parse(round);
            //foreach (var item in json["RoundValue"])
            //{
            //    string name = ((item as JContainer)["name"] as JValue).Value.ToString();
            //    string juli = (item as JContainer)["juli"].ToString();
            //    fujin += string.Format("{0}({1}公里);", name, juli);
            //}
            ViewData["fujin"]         = fujin;
            ViewData["HotelPictures"] = hotel3g.Common.HotelImage.Assembly(HotelHelper.GetHotelRoomImages(WeiXinPublic.ConvertHelper.ToInt(id)));
            return(View());
        }
예제 #2
0
        public ActionResult <string> AddRoomCommand([FromBody] Room room)
        {
            var result = HotelHelper.AddRoom(room).ToString();

            ProjectionHelper.ProjectRooms();
            return(result);
        }
예제 #3
0
        public ActionResult <string> AddHotelCommand([FromBody] Hotel hotel)
        {
            var result = HotelHelper.AddHotel(hotel).ToString();

            ProjectionHelper.ProjectRooms();
            return(result);
        }
예제 #4
0
        public ActionResult <string> RemoveHotelCommand(string hotelId)
        {
            var result = HotelHelper.RemoveHotel(hotelId).ToString();

            ProjectionHelper.TruncateAndProjectRooms();
            return(result);
        }
예제 #5
0
        //酒店详细新闻
        public ActionResult Newsinfo(string id)
        {
            string weixinid = HotelCloud.Common.HCRequest.GetString("weixinID");

            int    error = 0;
            string nid   = HCRequest.GetString("nid");

            string userWeiXinID = HotelCloud.Common.HCRequest.GetString("key");

            if (!userWeiXinID.Equals(""))
            {
                weixinid = userWeiXinID.Split('@')[0];
                hotel3g.Models.Cookies.SetCookies("userWeixinNO", userWeiXinID.Split('@')[1], 30, userWeiXinID.Split('@')[0]);
            }
            if (string.IsNullOrEmpty(nid) || !int.TryParse(nid, out error))
            {
                return(base.RedirectToAction("NewsinfoList", "Hotel", new { id = id, key = userWeiXinID }));
            }
            int preid, nextid;

            ViewData["HotelNewsinfo"] = HotelHelper.GetNewsDetails(nid, out preid, out nextid, id);
            ViewData["HotelNewsID"]   = nid;
            ViewData["preid"]         = nextid;
            ViewData["nextid"]        = preid;
            Hotel hotel = Cache.GetHotel(Convert.ToInt32(id));

            ViewData["hotel"] = hotel;

            ViewData["userWeiXinID"] = hotel3g.Models.Cookies.GetCookies("userWeixinNO", weixinid);
            string s = hotel3g.Models.HotelHelper.getTemp(weixinid);

            return(View());
        }
예제 #6
0
        public ActionResult Detail()
        {
            string key           = HotelCloud.Common.HCRequest.GetString("key");
            string hotelweixinId = key.Split('@')[0];
            string userweixinId  = key.Split('@')[1];

            int hid       = Convert.ToInt32(RouteData.Values["Id"]);
            int meetingId = Convert.ToInt32(HCRequest.GetString("meetingId"));


            var dbMeeting = Meeting.GeteMeeting(hid, meetingId);
            var meeting   = DataTableToEntity.GetEntity <Meeting>(dbMeeting);

            meeting.listMeetingTypeCapacity = new List <MeetingTypeCapacity>();
            if (!string.IsNullOrEmpty(meeting.TypeAndHoldInfo) && meeting.TypeAndHoldInfo.Contains("{"))
            {
                meeting.listMeetingTypeCapacity = Newtonsoft.Json.JsonConvert.DeserializeObject <List <MeetingTypeCapacity> >(meeting.TypeAndHoldInfo);
            }


            ViewData["meeting"] = meeting;


            var date = Convert.ToDateTime(Request.QueryString["date"]);
            List <MeetingRates> rateList = new List <MeetingRates>();

            if (meeting.PayType == 0)
            {
                DataTable dbRates = MeetingRates.GeteMeetingRatesList(hid, meetingId, date);
                rateList = DataTableToEntity.GetEntities <MeetingRates>(dbRates).ToList();
            }
            ViewData["rateList"] = rateList;

            DataTable db_pics = Meeting.GetMeetingPics(hid);
            var       picList = DataTableToEntity.GetEntities <RoomTypeImgEntity>(db_pics);

            picList             = picList.Where(c => c.RoomId == meetingId).ToList();
            ViewData["picList"] = picList;



            string MemberCardRuleJson = ActionController.getMemberCardIntegralRule(userweixinId, hotelweixinId);

            ViewData["MemberCardRuleJson"] = MemberCardRuleJson;
            Hashtable MemberCardRuleJsonobj = Newtonsoft.Json.JsonConvert.DeserializeObject <Hashtable>(MemberCardRuleJson);
            Hashtable ruletable             = Newtonsoft.Json.JsonConvert.DeserializeObject <Hashtable>(MemberCardRuleJsonobj["rule"].ToString());
            double    graderate             = WeiXinPublic.ConvertHelper.ToDouble(ruletable["GradeRate"]);

            ViewData["graderate"] = graderate;

            Hotel hotel = HotelHelper.GetMainIndexHotel(hid);

            ViewData["hotelName"] = hotel.SubName;

            return(View());
        }
        // DELETE api/values/5
        public void Delete(int hotelId, int reviewId)
        {
            var reviews = HotelHelper.GetReviews(hotelId);
            var review  = reviews.FirstOrDefault(r => r.ReviewId == reviewId);

            if (review != null)
            {
                reviews.Remove(review);
            }
        }
예제 #8
0
        public ActionResult PicInfo(string id)
        {
            ViewData["HotelPictures"] = HotelHelper.GetHotelPictures(id);
            string url      = HCRequest.GetString("surl").Split('@')[0];
            string weixinid = HCRequest.GetString("surl").Split('@')[1];
            Hotel  hotel    = Cache.GetHotel(Convert.ToInt32(id));

            ViewData["hotel"]    = hotel;
            ViewData["url"]      = url;
            ViewData["weixinid"] = weixinid;
            return(View());
        }
        // PUT api/values/5
        public void Put([FromBody] TypeScriptDemo.Domain.HotelReview review)
        {
            var reviews       = HotelHelper.GetReviews(review.HotelId);
            var currentReview = reviews.FirstOrDefault(r => r.ReviewId == review.ReviewId);

            if (currentReview != null)
            {
                currentReview.Rating       = review.Rating;
                currentReview.ReviewDate   = DateTime.Now;
                currentReview.ReviewerName = review.ReviewerName;
                currentReview.Comments     = review.Comments;
            }
        }
예제 #10
0
        public ActionResult HotelService(string id)
        {
            string userWeiXinID = HotelCloud.Common.HCRequest.GetString("key");
            string weixinid     = HotelCloud.Common.HCRequest.GetString("weixinID");

            if (!userWeiXinID.Equals(""))
            {
                weixinid = userWeiXinID.Split('@')[0];
                hotel3g.Models.Cookies.SetCookies("userWeixinNO", userWeiXinID.Split('@')[1], 30, weixinid);
            }
            ViewData["weixinID"]     = weixinid;
            ViewData["hId"]          = id;
            ViewData["userWeiXinID"] = hotel3g.Models.Cookies.GetCookies("userWeixinNO", weixinid);

            ViewData["hotel"]     = hotel3g.Common.FacilityImages.GetHotel(HotelHelper.GetHotelService(WeiXinPublic.ConvertHelper.ToInt(id)));
            ViewData["facImagfe"] = hotel3g.Common.FacilityImages.Assembly(HotelHelper.GetHotelFacilityImages(WeiXinPublic.ConvertHelper.ToInt(id)));
            return(View());
        }
예제 #11
0
        public ActionResult FeedbackService(string id)
        {
            Hotel  hotel           = new Hotel();
            string cache_hotelName = string.Format("{0}_{1}", id, "mainindex");

            if (cache[cache_hotelName] != null)
            {
                hotel = (Hotel)cache[cache_hotelName];
            }
            else
            {
                hotel = HotelHelper.GetMainIndexHotel(Convert.ToInt32(id));
                cache.Insert(cache_hotelName, hotel, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
            }

            ViewData["hotel"] = hotel.SubName;
            return(View());
        }
예제 #12
0
        public IEnumerable <ReviewViewModel> GetReviewsForHotel(int id)
        {
            var rev = HotelHelper.GetReviewsForHotel(id);
            var vms = new List <ReviewViewModel>();

            foreach (var item in rev)
            {
                var vm = new ReviewViewModel
                {
                    Header      = item.ReviewHeader,
                    CurrentDate = item.ReviewDate,
                    Description = item.ReviewDescription,
                    Rating      = int.Parse(item.ReviewScore),
                    User        = unit.GetById(item.UserId)
                };
                vms.Add(vm);
            }
            return(vms);
        }
예제 #13
0
        //酒店图集显示
        public ActionResult Images(string id)
        {
            string weixinid     = HotelCloud.Common.HCRequest.GetString("weixinID");
            string userWeiXinID = HotelCloud.Common.HCRequest.GetString("key");

            if (!userWeiXinID.Equals(""))
            {
                weixinid = userWeiXinID.Split('@')[0];
                hotel3g.Models.Cookies.SetCookies("userWeixinNO", userWeiXinID.Split('@')[1], 30, weixinid);
            }
            Hotel hotel = Cache.GetHotel(Convert.ToInt32(id));

            ViewData["hotel"]        = hotel;
            ViewData["weixinID"]     = weixinid;
            ViewData["hId"]          = id;
            ViewData["userWeiXinID"] = hotel3g.Models.Cookies.GetCookies("userWeixinNO", weixinid);

            ViewData["HotelPictures"] = hotel3g.Common.HotelImage.Assembly(HotelHelper.GetHotelRoomImages(WeiXinPublic.ConvertHelper.ToInt(id)));
            return(View());
        }
예제 #14
0
        public void AddHotel()
        {
            try
            {
                //Arranage
                string    Email    = ConfigurationManager.AppSettings["Email"].ToString().Trim();
                string    Password = ConfigurationManager.AppSettings["Password"].ToString().Trim();
                DataTable TestData = ExcelUtilityHelper.ReadExcel("Insert");

                //Act
                //Login to the Application
                LoginHelper.Login(Email, Password);
                //Navigae to the Dashboard Page
                NavigationHelper.Navigate();
                //Click on Add Button to add Hotel
                HotelHelper.ClickAddButton();
                //Perform actions on Genral Tab
                HotelHelper.PerformGeneralTabActions(TestData);
                //Perform actions on Facilities Tab
                HotelHelper.PerformFacilitiesTabActions();
                //Perform actions on Meta Info Tab
                HotelHelper.PerformMetaInfoTabActions();
                //Perform actions on Policy Tab
                HotelHelper.PerformPolicyTabActions();
                //Perform actions on Contact Tab
                HotelHelper.PerformContactTabActions();
                //Perform actions on Translate Tab
                HotelHelper.PerformTranslateTabActions();
                //Perform actions on Submit
                HotelHelper.ClickSubmit();

                //Assert
                //Verify if
                Assert.IsTrue(HotelHelper.VerifyHotelName(TestData));
            }
            catch
            {
                Assert.Fail();
            }
        }
예제 #15
0
        public void UpdateHotel()
        {
            try
            {
                //Arranage
                string    Email    = ConfigurationManager.AppSettings["Email"].ToString().Trim();
                string    Password = ConfigurationManager.AppSettings["Password"].ToString().Trim();
                DataTable TestData = ExcelUtilityHelper.ReadExcel("Update");

                //Login to the Application
                LoginHelper.Login(Email, Password);
                //Navigate to Dashboard Page
                NavigationHelper.Navigate();
                //Verify if Hotel Name exists in the Tablenif not return
                if (!HotelHelper.VerifyHotelNameAndClickEditButton(TestData))
                {
                    return;
                }
                //Perform General Tab actions
                HotelHelper.PerformGeneralTabActions(TestData);
                //Perform Facilities Tab actions
                HotelHelper.PerformFacilitiesTabActions();
                //Perform Meta Info Tab Actions
                HotelHelper.PerformMetaInfoTabActions();
                //Perform Policy Tab Actions
                HotelHelper.PerformPolicyTabActions();
                //Perform Contact tab Actions
                HotelHelper.PerformContactTabActions();
                //Perform Translate Tab actions
                HotelHelper.PerformTranslateTabActions();
                //Click on Update
                HotelHelper.ClickUpdate();
                //Verify if Hotel Name is updated in the Grid / Table
                Assert.IsTrue(HotelHelper.VerifyHotelName(TestData));
            }
            catch
            {
                Assert.Fail();
            }
        }
예제 #16
0
        public void SearchHotel()
        {
            try
            {
                //Arranage
                string    Email    = ConfigurationManager.AppSettings["Email"].ToString().Trim();
                string    Password = ConfigurationManager.AppSettings["Password"].ToString().Trim();
                DataTable TestData = ExcelUtilityHelper.ReadExcel("Delete");

                //Login into the Application
                LoginHelper.Login(Email, Password);
                //Navigate to Dahsboard Page
                NavigationHelper.Navigate();

                //Assert
                //Verify Hotel Name in the Grid
                Assert.IsTrue(HotelHelper.VerifyHotelName(ExcelUtilityHelper.ReadExcel("Search")));
            }
            catch
            {
                Assert.Fail();
            }
        }
예제 #17
0
        public void DeleteHotel()
        {
            try
            {
                //Arranage
                string    Email    = ConfigurationManager.AppSettings["Email"].ToString().Trim();
                string    Password = ConfigurationManager.AppSettings["Password"].ToString().Trim();
                DataTable TestData = ExcelUtilityHelper.ReadExcel("Delete");

                //Login to the Applciation
                LoginHelper.Login(Email, Password);
                //Navigate to Dahsboard Page
                NavigationHelper.Navigate();
                //Delete a Hotel in the Grid
                HotelHelper.VerifyHotelNameAndDeleteHotel(TestData);

                //Verify if hotel name in the Grid / Table
                Assert.IsTrue(!HotelHelper.VerifyHotelName(TestData));
            }
            catch
            {
                Assert.Fail();
            }
        }
        // GET api/values

        // GET api/values/5
        public IEnumerable <TypeScriptDemo.Domain.HotelReview> Get(int hotelId)
        {
            return(HotelHelper.GetReviews(hotelId));
        }
        // POST api/values
        public void Post([FromBody] TypeScriptDemo.Domain.HotelReview review)
        {
            var reviews = HotelHelper.GetReviews(review.HotelId);

            reviews.Add(review);
        }
예제 #20
0
        public ActionResult MainTravel(string id)
        {
            string userWeiXinID = HotelCloud.Common.HCRequest.GetString("key");

            if (!userWeiXinID.Equals(""))
            {
                hotel3g.Models.Cookies.SetCookies("userWeixinNO", userWeiXinID.Split('@')[1], 30, userWeiXinID.Split('@')[0]);
            }
            string weixinID = HotelCloud.Common.HCRequest.GetString("weixinID");

            if (weixinID.Equals(""))
            {
                weixinID = userWeiXinID.Split('@')[0];
            }
            //int hotelId=HotelCloud.Common.HCRequest.getInt("hId");

            IList <Advertisement> list = new List <Advertisement>();

            string cacheName = string.Format("{0}_{1}", weixinID, "mainindex");

            if (cache[cacheName] != null)
            {
                list = (List <Advertisement>)cache[cacheName];
            }

            else
            {
                list = Advertisement.GetAdvertisementBySort(weixinID, 0);
                cache.Insert(cacheName, list, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
            }


            if (list != null && list.Count == 0)
            {
                //创建虚拟
                string[] imgs       = { "/img/ad_01.jpg", "/img/ad_02.jpg", "/img/ad_03.jpg", "/img/ad_04.jpg", "/img/ad_05.jpg" };
                string   imgwebsite = System.Configuration.ConfigurationManager.AppSettings["imgwebsite"] == null ? "http://admin.weikeniu.com" : System.Configuration.ConfigurationManager.AppSettings["imgwebsite"].ToString();
                foreach (string str in imgs)
                {
                    Advertisement ad = new Advertisement();
                    ad.ImageUrl = imgwebsite + str;
                    list.Add(ad);
                }
            }
            ViewData["ad"]           = list;
            ViewData["hId"]          = id;
            ViewData["weixinID"]     = weixinID;
            ViewData["userWeiXinID"] = hotel3g.Models.Cookies.GetCookies("userWeixinNO", weixinID);

            Hotel  hotel           = new Hotel();
            string cache_hotelName = string.Format("{0}_{1}", id, "mainindex");

            if (cache[cache_hotelName] != null)
            {
                hotel = (Hotel)cache[cache_hotelName];
            }
            else
            {
                hotel = HotelHelper.GetMainIndexHotel(Convert.ToInt32(id));
                cache.Insert(cache_hotelName, hotel, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
            }

            ViewData["hotel"]    = hotel.SubName;
            ViewData["quanjing"] = hotel.Quanjing;


            bool IsBranch = hotel3g.Models.DAL.BranchHelper.IsBranch(weixinID);

            ViewData["IsBranch"] = IsBranch;



            string sql = "select weixinName from WeiXinNO with (nolock) where weixinId=@weixinId  ";

            ViewData["weixinname"] = SQLHelper.Get_Value(sql, SQLHelper.GetCon(), new Dictionary <string, DBParam>()
            {
                { "weixinId", new DBParam()
                  {
                      ParamValue = weixinID
                  } },
            });


            //读取模板style 0:默认 1:简约(Simple) 2:多彩(Colourful)
            //  hotel3g.Repository.WeiXinAppConfig Config = hotel3g.Repository.MemberHelper.GetHotelAppConfig(weixinID);


            //if (Config.style > 0)
            //{
            //    //菜单栏
            //    List<MenuDictionaryResponse> MenuBarList = hotel3g.Models.MenuBarHelper.MenuBarList(Config.style, weixinID, hotel.Quanjing);

            //    ViewData["MenuBarList"] = MenuBarList;

            //    hotel = HotelHelper.GetMainIndexHotel(Convert.ToInt32(id));
            //    ViewData["HotelInfo"] = hotel;
            //}


            //if (!string.IsNullOrEmpty(hotel.MainPic))
            //{
            //    switch (Config.style)
            //    {
            //        case 0: return View();
            //        case 1: return View("Simple");
            //        case 2: return View("Colourful");
            //        case 3: return View("MiniSimple");
            //        case 4: return View("MiniColourful");
            //        case 5: return View("Dynamic");
            //        default: return View();
            //    }
            //}


            //int count = 0;
            //ProductEntityList list_products = new ProductEntityList();
            //var dt = CommodityService.GetSaleProductsListIndex(weixinID, out count, 1, 99, "", "");
            //list_products.ProductEntity_List = ProductEntity.ConvertProductEntityIndexListMall(dt);
            //list_products.Count = count;
            //ViewData["products"] = list_products.ProductEntity_List;


            //string traveledition = string.Empty;
            //string sql = "select traveledition  from WeiXinNO with (nolock) where weixinId=@weixinId  ";
            //DataTable db_open = SQLHelper.Get_DataTable(sql, SQLHelper.GetCon(), new Dictionary<string, DBParam>()
            //        {{"weixinId",new DBParam(){ParamValue=weixinID}},

            //    });

            //if (db_open.Rows.Count > 0)
            //{
            //    traveledition = db_open.Rows[0]["traveledition"].ToString();
            //}
            //ViewData["traveledition"] = traveledition;


            ViewData["CommodityTypeTable"] = CommodityService.GetCommodityTypeByWeixinId(weixinID, "", "");

            DataTable commodityDataTable = CommodityService.GetCommodityList("", "", "", "", "", "", "", 1, weixinID, id, false);

            ViewData["commodityDataTable"] = commodityDataTable;

            return(View());
        }
예제 #21
0
        public ActionResult Main(string id)
        {
            string userWeiXinID = HotelCloud.Common.HCRequest.GetString("key");

            if (!userWeiXinID.Equals(""))
            {
                hotel3g.Models.Cookies.SetCookies("userWeixinNO", userWeiXinID.Split('@')[1], 30, userWeiXinID.Split('@')[0]);
            }
            string weixinID = HotelCloud.Common.HCRequest.GetString("weixinID");

            if (weixinID.Equals(""))
            {
                weixinID = userWeiXinID.Split('@')[0];
            }
            //int hotelId=HotelCloud.Common.HCRequest.getInt("hId");

            IList <Advertisement> list = new List <Advertisement>();

            string cacheName = string.Format("{0}_{1}", weixinID, "mainindex");

            if (cache[cacheName] != null)
            {
                list = (List <Advertisement>)cache[cacheName];
            }

            else
            {
                list = Advertisement.GetAdvertisementBySort(weixinID);
                cache.Insert(cacheName, list, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
            }


            if (list != null && list.Count == 0)
            {
                //创建虚拟
                string[] imgs       = { "/img/ad_01.jpg", "/img/ad_02.jpg", "/img/ad_03.jpg", "/img/ad_04.jpg", "/img/ad_05.jpg" };
                string   imgwebsite = System.Configuration.ConfigurationManager.AppSettings["imgwebsite"] == null ? "http://admin.weikeniu.com" : System.Configuration.ConfigurationManager.AppSettings["imgwebsite"].ToString();
                foreach (string str in imgs)
                {
                    Advertisement ad = new Advertisement();
                    ad.ImageUrl = imgwebsite + str;
                    list.Add(ad);
                }
            }
            ViewData["ad"]           = list;
            ViewData["hId"]          = id;
            ViewData["weixinID"]     = weixinID;
            ViewData["userWeiXinID"] = hotel3g.Models.Cookies.GetCookies("userWeixinNO", weixinID);

            Hotel  hotel           = new Hotel();
            string cache_hotelName = string.Format("{0}_{1}", id, "mainindex");

            if (cache[cache_hotelName] != null)
            {
                hotel = (Hotel)cache[cache_hotelName];
            }
            else
            {
                hotel = HotelHelper.GetMainIndexHotel(Convert.ToInt32(id));
                cache.Insert(cache_hotelName, hotel, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
            }

            ViewData["hotel"]    = hotel.SubName;
            ViewData["quanjing"] = hotel.Quanjing;


            bool IsBranch = hotel3g.Models.DAL.BranchHelper.IsBranch(weixinID);

            ViewData["IsBranch"] = IsBranch;



            //读取模板style 0:默认 1:简约(Simple) 2:多彩(Colourful)
            hotel3g.Repository.WeiXinAppConfig Config = hotel3g.Repository.MemberHelper.GetHotelAppConfig(weixinID);


            if (Config.style > 0)
            {
                //菜单栏
                List <MenuDictionaryResponse> MenuBarList = hotel3g.Models.MenuBarHelper.MenuBarList(Config.style, weixinID, hotel.Quanjing, userWeiXinID);

                ViewData["MenuBarList"] = MenuBarList;

                hotel = HotelHelper.GetMainIndexHotel(Convert.ToInt32(id));
                ViewData["HotelInfo"] = hotel;
            }
            if (!string.IsNullOrEmpty(hotel.MainPic))
            {
                switch (Config.style)
                {
                case 0: return(View());

                case 1: return(View("Simple"));

                case 2: return(View("Colourful"));

                case 3: return(View("MiniSimple"));

                case 4: return(View("MiniColourful"));

                case 5: return(View("Dynamic"));

                default: return(View());
                }
            }
            return(View());
        }
예제 #22
0
        // GET api/<controller>/5
        public Hotel Get(int id)
        {
            var hotels = HotelHelper.GetHotels();

            return(hotels.FirstOrDefault(r => r.HotelId == id));
        }
예제 #23
0
 // GET api/<controller>
 public IEnumerable <Hotel> Get()
 {
     return(HotelHelper.GetHotels());
 }
예제 #24
0
파일: Floor.cs 프로젝트: step4u/CallService
        public Floors()
        {
            DataTable dt = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_FLOOR");
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException ex)
                {
                    util.WriteLog(string.Format("DB Error ({0}) : {1}", this.GetType(), ex.Message));
                }
            }

            foreach (DataRow row in dt.Rows)
            {
                DataTable dt1 = null;
                using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
                {
                    DataTable _input = util.CreateDT2SP();
                    _input.Rows.Add("@I_ROOM", row[0].ToString());

                    try
                    {
                        dt1 = db.GetDataTableSP("GET_ROOM_BY_FLOOR", _input);
                    }
                    catch (FirebirdSql.Data.FirebirdClient.FbException ex)
                    {
                        util.WriteLog(string.Format("DB Error ({0}) : {1}", this.GetType(), ex.Message));
                    }
                }

                ObservableCollection <RoomItem> _list = new ObservableCollection <RoomItem>();
                foreach (DataRow _row in dt1.Rows)
                {
                    int      err_count = 0;
                    RoomItem txtroom   = new RoomItem()
                    {
                        RoomNum         = _row[0].ToString(),
                        States          = string.IsNullOrEmpty(_row[1].ToString()) == true || _row[1].ToString().Equals("0") ? "0" : "1",
                        States_Clean    = _row[4].ToString(),
                        States_Laundary = _row[5].ToString(),
                        States_Parcel   = _row[6].ToString(),
                        IsChecked       = false,
                        Height          = 130,
                        Width           = 130,
                        CWidth          = 70,
                        CHeight         = 70,
                        Margin          = new Thickness(10, 10, 10, 10),
                        HAlignment      = System.Windows.HorizontalAlignment.Left,
                        VAlignment      = System.Windows.VerticalAlignment.Top
                    };

                    _cgi_pms_data_type pms_data_type;
                    using (HotelHelper hh = new HotelHelper(util.PBXIP))
                    {
                        pms_data_type = hh.GetPolicy(_row[2].ToString());
                        if (pms_data_type.status == STRUCTS.ERR_SOCKET_TIMEOUT)
                        {
                            _list.Add(txtroom);
                            continue;
                        }
                    }
                    txtroom.Hour    = pms_data_type.hour;
                    txtroom.Minutes = pms_data_type.minutes;
                    if (txtroom.States.Equals("0"))
                    {
                        pms_data_type.language = 0;
                    }
                    txtroom.Languages = pms_data_type.language.ToString();
                    txtroom.PMSDATA   = pms_data_type;

                    _list.Add(txtroom);
                }

                var lastitem = _list.Where(x => x.PMSDATA.status == STRUCTS.ERR_SOCKET_TIMEOUT);
                if (lastitem.Count() > 1)
                {
                    break;
                }
                this.Add(new Floor()
                {
                    txtFloor = string.Format("{0}F", row[0].ToString()), list = _list
                });
            }
        }
        public IHttpActionResult GetHotel(int id)
        {
            var hotel = HotelHelper.GetHotelViewModel(id);

            return(Ok(hotel));
        }
        public IEnumerable <Hotel> GetAll(int amount)
        {
            var hotels = HotelHelper.GetTopHotels(amount).ToList();

            return(hotels);
        }
예제 #27
0
        public ActionResult Index(string id)
        {
            string userWeiXinID = HotelCloud.Common.HCRequest.GetString("key");

            if (!userWeiXinID.Equals(""))
            {
                hotel3g.Models.Cookies.SetCookies("userWeixinNO", userWeiXinID.Split('@')[1], 30, userWeiXinID.Split('@')[0]);
            }
            string weixinID = HotelCloud.Common.HCRequest.GetString("weixinID");

            if (weixinID.Equals(""))
            {
                weixinID = userWeiXinID.Split('@')[0];
            }
            //int hotelId=HotelCloud.Common.HCRequest.getInt("hId");

            IList <Advertisement> list = new List <Advertisement>();

            string cacheName = string.Format("{0}_{1}", weixinID, "mainindex");

            if (cache[cacheName] != null)
            {
                list = (List <Advertisement>)cache[cacheName];
            }

            else
            {
                list = Advertisement.GetAdvertisementBySort(weixinID);
                cache.Insert(cacheName, list, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
            }


            if (list != null && list.Count == 0)
            {
                //创建虚拟
                string[] imgs       = { "/img/ad_01.jpg", "/img/ad_02.jpg", "/img/ad_03.jpg", "/img/ad_04.jpg", "/img/ad_05.jpg" };
                string   imgwebsite = System.Configuration.ConfigurationManager.AppSettings["imgwebsite"] == null ? "http://admin.weikeniu.com" : System.Configuration.ConfigurationManager.AppSettings["imgwebsite"].ToString();
                foreach (string str in imgs)
                {
                    Advertisement ad = new Advertisement();
                    ad.ImageUrl = imgwebsite + str;
                    list.Add(ad);
                }
            }
            ViewData["ad"]           = list;
            ViewData["hId"]          = id;
            ViewData["weixinID"]     = weixinID;
            ViewData["userWeiXinID"] = hotel3g.Models.Cookies.GetCookies("userWeixinNO", weixinID);

            Hotel  hotel           = new Hotel();
            string cache_hotelName = string.Format("{0}_{1}", id, "mainindex");

            if (cache[cache_hotelName] != null)
            {
                hotel = (Hotel)cache[cache_hotelName];
            }
            else
            {
                hotel = HotelHelper.GetMainIndexHotel(Convert.ToInt32(id));
                cache.Insert(cache_hotelName, hotel, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
            }

            ViewData["hotel"]    = hotel.SubName;
            ViewData["quanjing"] = hotel.Quanjing;
            ViewData["tel"]      = hotel.Tel;


            string sql    = @"select  userid   from  WeiXinNO with(nolock)  where weixinid=@weixinid ";
            string userId = HotelCloud.SqlServer.SQLHelper.Get_Value(sql, HotelCloud.SqlServer.SQLHelper.GetCon(), new Dictionary <string, HotelCloud.SqlServer.DBParam> {
                { "weixinid", new HotelCloud.SqlServer.DBParam {
                      ParamValue = weixinID
                  } }
            });

            ViewData["userId"] = userId;



            return(View());
        }
        public IHttpActionResult GetHotels()
        {
            var hotels = HotelHelper.GetAllHotels();

            return(Ok(hotels));
        }