public IVacationPart MakeBooking(HotelInfo hotel, DateTime checkin, DateTime checkout) { Console.WriteLine("Waiting for remote hotel booking service to respond..."); System.Threading.Thread.Sleep(300); // Waiting for remote service Console.WriteLine("Booking hotel {0} {1:dd-MMM-yyyy} - {2:dd-MMMM-yyyy}\n", hotel, checkin, checkout); return(new DummyVacationPart("Hotel " + hotel.ToString())); }
public ActionResult Index() { HotelInfo model = new HotelInfo() { Price = 3.5M }; return(View(model)); }
/// <summary> /// Проверка на существование /// </summary> /// <param name="value">Отель</param> /// <returns>true-существует, false-нет</returns> public static bool IsContains(HotelInfo value) { if (EntityConnection.HotelInfoes.Where(x => x.Name.Equals(value.Name)).Count() > 0) { return(true); } return(false); }
public HotelViewModel(HotelInfo info, HotelMain main) { IsCitizen = SessionHelper.CurrentEntity.Is(EntityTypeEnum.Citizen); Info = new HotelInfoViewModel(info); CurrencySymbol = main.CurrencySymbol; Rooms = main.Rooms.Select(r => new HotelRoomMainViewModel(r)) .OrderBy(r => r.Quality).ToList(); }
public HotelInfo GetHotelValues(DataRow dr) { HotelInfo retVal = new HotelInfo(); retVal.HotelId = Convert.ToInt32(dr["HotelId"]); retVal.HotelName = Convert.ToString(dr["HotelName"]); return(retVal); }
public HotelRoomsViewModel(HotelInfo info, IEnumerable <HotelRoomModel> hotelRooms) { Info = new HotelInfoViewModel(info); Rooms = hotelRooms .Select(r => new HotelRoomViewModel(r)) .GroupBy(r => r.Quality) .OrderBy(r => r.Key) .ToDictionary(r => r.Key, r => r.ToList()); }
public async Task <IHttpActionResult> getHotelInformation(HotelInfo hotelInfo) { BaseDL bdl = new BaseDL(); NpgsqlParameter[] Sqlprms = new NpgsqlParameter[1]; Sqlprms[0] = new NpgsqlParameter("@hotel_code", hotelInfo.HotelNo); string cmdText = "Select hotel_name,logo_data from mst_hotel where hotel_code=@hotel_code"; DataTable dt = await bdl.SelectDataTable(cmdText, Sqlprms); return(Ok(dt)); }
/// <summary> /// Настройки отеля /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void HotelToolStripMenuItem_Click(object sender, EventArgs e) { Form_HotelInfo form = new Form_HotelInfo(this.hotelInfo); if (form.ShowDialog() == DialogResult.OK) { this.hotelInfo = form.Hotel; //Обновление всех данных UpdateDictionary(this.hotelInfo); UpdateListViewHotel(this.dictFloors); } }
public ActionResult InsertCost(HotelInfo hotel) { try { repository.InsertHotel(hotel); return(Ok("Data is Inserted Successfully")); } catch (Exception e) { return(BadRequest(e)); } }
public ActionResult UpdateCost(int HotelId, HotelInfo hotel) { try { repository.UpdateHotel(HotelId, hotel); return(Ok("Data is Updated Successfully")); } catch (Exception e) { return(BadRequest(e)); } }
public ActionResult AddHotel(HotelInfo hotelInfo) { try { mgmt.AddNewHotel(hotelInfo.HotelName, hotelInfo.Address); return(RedirectToAction("Index")); } catch (Exception e) { ModelState.AddModelError(String.Empty, e.Message); return(View()); } }
protected void btEdit_Click(object sender, EventArgs e) { HotelInfoBLL _HotelInfoBLL = new HotelInfoBLL(); HotelInfo _HotelInfo = new HotelInfo(); _HotelInfo.CityID = int.Parse(Request.QueryString["CityID"].ToString()); _HotelInfo.HotelName = txtHotelName.Text.Trim(); _HotelInfo.Local = TxtHotelLoc.Text.Trim(); _HotelInfo.PhoneNum = TxtHotelNum.Text.Trim(); _HotelInfo.HotelService = TxtHtlService.Text.Trim(); _HotelInfo.HotelIntroduction = TxtHotelIntroduce.Text.Trim(); _HotelInfo.RestaurantDevice = TxtResScrvice.Text.Trim(); _HotelInfo.IndoorService = txtIdrService.Text.Trim(); if (txtHotelLgt.Text.Trim() != "") { _HotelInfo.SLongitude = float.Parse(txtHotelLgt.Text.Trim().ToString()); } else { _HotelInfo.SLongitude = 0.0f; } if (txtHotelLat.Text.Trim() != "") { _HotelInfo.Slatitude = float.Parse(txtHotelLat.Text.Trim().ToString()); } else { _HotelInfo.Slatitude = 0.0f; } if (txtHotelStar.Text != "") { _HotelInfo.Star = int.Parse(txtHotelStar.Text.Trim()); } else { _HotelInfo.Star = 0; } int PageStart = int.Parse(Request.QueryString["PageStart"].ToString()); int CityID = int.Parse(Request.QueryString["CityID"].ToString()); if (_HotelInfoBLL.UpdHotelInfo(CityID, _HotelInfo)) { Response.Write("<script language='javascript'>"); Response.Write("alert('更改成功');"); Response.Write("document.location.href='HotelInfoList.aspx?PageStart=" + PageStart.ToString() + "&CityID=" + CityID.ToString() + "';"); Response.Write("</script>"); } }
//we can simply add new FileManagers which supports different formats(different than CSV) //by overriding "ParseHotelInfoToList" and implementing format specific logic public override HotelInfo[] ParseHotelInfoToList(IFormCollection form) { //check file is exists this.ValidateForm(form); IFormFile inputFile = form.Files[0]; List <HotelInfo> hotelInfo = new List <HotelInfo>(); //read file using (var reader = new StreamReader(inputFile.OpenReadStream())) { var headers = reader.ReadLine(); while (!reader.EndOfStream) { var line = reader.ReadLine(); var adrr = ""; //extract address in to variable Match match = Regex.Match(line, cnstAddrRegExpPattern); if (match.Success) { adrr = match.Groups[1].Value; } //remove address parts from line line = Regex.Replace(line, cnstAddrRegExpPattern, ""); //split line by comma into vaues var values = line.Split(','); if (values.Length == 6) { //initialize model var item = new HotelInfo(values[0], adrr, Int32.Parse(values[2]), values[3], values[4], values[5]); //validate model by validation rules which loading by appsettings.json this.ValidateModel(item); //add to list hotelInfo.Add(item); } else { throw new Exception("CSV Format Error!"); } } } //get sort field and sort direction from request object OutputProperties outProps = MapFormCollectionToOutputProperties(form); HotelInfo[] hotelInfoArray = hotelInfo.ToArray(); //sort model list according to output properties hotelInfoArray = this.SortHotelInfos(hotelInfoArray, outProps); return(hotelInfoArray); }
private static void pollingHotel(String connString) { WebDriverSettingInfo webDriverSetting = new WebDriverSettingInfo(hideCommand: true, hideBrowser: false); Boolean success = false; String baseUrl = "https://ca.hotels.com/search.do?resolved-location=CITY:{id}:UNKNOWN:UNKNOWN&f-star-rating=3,2&destination-id={id}&q-destination={region}&q-check-in={checkin}&q-check-out={checkout}&q-rooms=1&q-room-0-adults=2&q-room-0-children=0"; baseUrl = baseUrl.Replace("{checkin}", "2018-09-25"); baseUrl = baseUrl.Replace("{checkout}", "2018-09-26"); Dictionary <String, String> cities = new Dictionary <string, string>() { { "170961", "Kitchener, Ontario, Canada" }, { "1633548", "Hamilton, Ontario" }, { "169995", "Quebec, Quebec, Canada" }, { "169714", "Ottawa, Ontario, Canada" }, { "167228", "Edmonton, Alberta, Canada" }, { "169003", "Calgary, Alberta, Canada" }, { "169712", "Vancouver, British Columbia, Canada" }, { "169716", "Montreal, Quebec, Canada" }, { "1636865", "Toronto, Ontario, Canada" }, { "170165", "Winnipeg, Manitoba, Canada" } }; ChromeDriver driver = Utilities.WebDriverExtension.GetChromeDriver(hideBrowser: webDriverSetting.HideBrowser, hideCommand: webDriverSetting.HideCommand, isMaximized: true); foreach (String key in cities.Keys) { display($"{cities[key]} -> ", isWriteLine: false, addTime: true); String url = baseUrl.Replace("{id}", key); url = url.Replace("{region}", cities[key]); driver.Navigate().GoToUrl(url); Int32 count = scrollToBottom(driver, "info unavailable-info", 2, true); IReadOnlyCollection <IWebElement> elements = driver.FindElementsByXPath("//ol/li"); display($" pages: [{count}] -> [{elements.Count}]", isWriteLine: false); count = 0; foreach (IWebElement element in elements) { HotelInfo hotel = new HotelInfo(driver, element, cities[key]); if (!String.IsNullOrEmpty(hotel.Name)) { success = DataOperation.AddHotel(connString, hotel); ++count; if (count % 10 == 0) { display($".", isWriteLine: false); } } } display($" Done[{count}]", isWriteLine: true); } driver.Quit(); }
public async Task <IEnumerable <Hotel> > AddHotel([FromBody][Required] HotelBindingModel hotel) { HotelInfo hotelInfo = new HotelInfo() { Name = hotel.Name, Phone = hotel.Phone, Address = hotel.Address, City = hotel.City, State = hotel.State, Zip = hotel.Zip, }; return(await hotelDAO.AddHotelAsync(hotelInfo)); }
/// <summary> /// Добавить гостя в отель по определенному номеру /// </summary> /// <param name="hotel"></param> /// <param name="number"></param> /// <param name="guest"></param> public static void AddGuestToHotel(HotelInfo hotel, HotelNumber number, Guest guest) { if (hotel == null || guest == null) { throw new NullReferenceException("hotel or guest is null"); } number.IsEmpty = false; number.Guest = guest; if (!IsContains(guest)) { hotel.Guests.Add(guest); } EntityConnection.SaveChanges(); }
public async Task <IEnumerable <Hotel> > AddHotelAsync(HotelInfo hotelInfo) { IEnumerable <Hotel> result = await GetHotelByCityAsync(hotelInfo.City); List <Hotel> hotels = result.ToList(); if (hotels.Any(h => h.Name == hotelInfo.Name)) { return(hotels.Where(h => h.Name == hotelInfo.Name)); } Hotel newHotel = new Hotel(hotelInfo); Task.WaitAll(mapper.InsertAsync(newHotel), mapper.InsertAsync(new HotelByCity(newHotel))); return(hotels); }
public async Task <ActionResult <HotelInfo> > AddHotelAsync(HotelInfo model) { TryValidateModel(model); if (ModelState.IsValid) { var result = await db.Hotels.AddAsync(model); await db.SaveChangesAsync(); return(CreatedAtRoute("GetHotelBycity", new { city = result.Entity.City }, result.Entity)); } else { return(BadRequest(ModelState)); } }
/// <summary> /// Gets the hotel around hotel by id. /// </summary> /// <returns></returns> public static List <Models.HotelInfoModel> GetHotelAroundHotelById(string id) { List <Models.HotelInfoModel> hi = new List <Models.HotelInfoModel>(); Models.HotelInfoModel sin = null; var temp = GetHotelAroundHotelListById(id); foreach (var item in temp) { sin = HotelInfo.GetHotelInfoById(item.id.ToString()); if (sin != null && sin.id > 0) { hi.Add(sin); } } return(hi); }
public HotelManagersViewModel(HotelInfo info, IEnumerable <HotelManagerModel> managers) { Info = new HotelInfoViewModel(info); Managers.Add(new HotelManagerViewModel() { Avatar = new SmallEntityAvatarViewModel(info.OwnerID, info.OwnerName, info.OwnerImgUrl), CitizenID = info.OwnerID, ReadOnly = true, Rights = HotelRights.FullRights, Title = "Owner", HotelID = info.HotelID }); Managers.AddRange(managers.Select(m => new HotelManagerViewModel(info.HotelID, m, Rights)).OrderByDescending(m => m.Rights.Priority).ToList()); ManagerSelector = Select2AjaxViewModel.Create <CitizenController>(x => x.GetCitizens(null), "citizenID", null, ""); }
public InsertData(string etat, HotelInfo ele, HotelInfoViewModel view) { InitializeComponent(); this.DataContext = viewVM = view; Etat = etat; if (etat == "AJOUT") { this.Title = "Enregistrement d'un Quartier"; } else { this.Title = "Modification d'un Quartier"; } }
public void UpdateHotel(int HotelId, HotelInfo hotel) { var data = context.HotelInfos.SingleOrDefault(s => s.HotelId == HotelId); data.HotelName = hotel.HotelName; data.HotelState = hotel.HotelState; data.HotelCity = hotel.HotelCity; data.HotelAddress = hotel.HotelAddress; data.PinNumber = hotel.PinNumber; data.Rating = hotel.Rating; data.StartingTime = hotel.StartingTime; data.ClosingTime = hotel.ClosingTime; data.NoOfRoomAvailable = hotel.NoOfRoomAvailable; data.ContectId = hotel.ContectId; data.CostId = hotel.CostId; context.SaveChanges(); }
private void btnValider_Click(object sender, RoutedEventArgs e) { try { HotelInfoViewModel vm = this.DataContext as HotelInfoViewModel; HotelInfo ent = vm.SelectedData; if (Etat == "AJOUT") { try { ent.Etat = "ACTIF"; ent.idHotel = 1; viewVM.model.HotelInfo.Add(ent); viewVM.model.SaveChanges(); Msg = "OK"; this.Close(); } catch (Exception ex) { Msg = "Error"; ErrorMsg = ex.Message; } } else { try { viewVM.model.SaveChanges(); Msg = "OK"; this.Close(); } catch (Exception ex) { Msg = "Error"; ErrorMsg = ex.Message; } } } catch (Exception) { } }
/// <summary> /// Обновить словарь по данным из отеля /// </summary> /// <param name="hotel"></param> private void UpdateDictionary(HotelInfo hotel) { this.dictFloors.Clear(); // Очищаем словарь // Заполняем словарь foreach (var number in hotel.HotelNumbers) { if (dictFloors.ContainsKey(number.FloorIndex)) { dictFloors[number.FloorIndex].Add(number); } else { dictFloors.Add(number.FloorIndex, new List <HotelNumber> { number }); } } }
public HotelMakeDeliveryViewModel(HotelInfo info, Hotel hotel, HotelRights rights, IQueryable <MarketOfferModel> offers, PagingParam pp, int quality, int productID) { Info = new HotelInfoViewModel(info); WalletIDs.Add(SessionHelper.CurrentEntity.WalletID, "Your wallet"); if (rights.CanUseWallet) { WalletIDs.Add(hotel.Entity.WalletID, "Hotel's wallet"); } Market = new CountryMarketOffersListViewModel(hotel.Entity, hotel.Region.Country, offers.ToList(), Persistent.Countries.GetAll().ToList(), new List <int>() { (int)ProductTypeEnum.Fuel, (int)ProductTypeEnum.ConstructionMaterials }, pp, quality, productID); }
/// <summary> /// 取得当前微信帐号信息 /// </summary> public WX_UserWeixinInfo GetWeiXinCode() { if (IsWeiXinCode()) { var model = Session["nowweixin"] as WX_UserWeixinInfo; if (model != null) { return(model); } } else { //int shopid = GetShopId(); //if (shopid != 0) //{ // BLL.wx_diancai_shopinfo shopBll = new BLL.wx_diancai_shopinfo(); // Model.wx_diancai_shopinfo shop = shopBll.GetModel(shopid); // return new BLL.wx_userweixin().GetModel(shop.wid.Value); //} int hotelid = GetHotelId(); if (hotelid != 0) { HotelInfo hotel = null; using (var dbContext = new HotelDbContext()) { hotel = new HotelService(new HotelRepository()).GetModel(hotelid); } if (hotel != null) { return(new WXUserService(new WXUserRepository()).GetModel(hotel.wid.Value)); } } Response.Write("<script>parent.location.href='http://" + HttpContext.Current.Request.Url.Authority + "/admin/weixin/myweixinlist.aspx'</script>"); Response.End(); } return(null); }
public async Task <IHttpActionResult> CheckRoomNo(HotelInfo hotelInfo) { BaseDL bdl = new BaseDL(); int roomno_count = 0; string filltext = string.Empty; string result = hotelInfo.RoomNo; NpgsqlParameter[] Sqlprms = new NpgsqlParameter[1]; Sqlprms[0] = new NpgsqlParameter("@hotel_code", hotelInfo.HotelNo); string cmdText = "Select hotel_code,hotel_roomno_count,roomno_fill_text from mst_hotel where hotel_code=@hotel_code"; DataTable dt = await bdl.SelectDataTable(cmdText, Sqlprms); if (dt.Rows.Count > 0) { if (!String.IsNullOrWhiteSpace(dt.Rows[0]["hotel_roomno_count"].ToString())) { roomno_count = Convert.ToInt32(dt.Rows[0]["hotel_roomno_count"].ToString()); if (result.Length <= roomno_count) { if (!string.IsNullOrEmpty(dt.Rows[0]["roomno_fill_text"].ToString())) { filltext = dt.Rows[0]["roomno_fill_text"].ToString(); result = result.PadLeft(Convert.ToInt32(roomno_count), Convert.ToChar(filltext)); } else { result = hotelInfo.RoomNo; } } else { result = "Error"; } } } else { result = hotelInfo.RoomNo; } return(Ok(result)); }
/// <summary> /// Метод для инициализации нового пользователя /// </summary> private void InitialLogin() { //Форма для заполнения данных для входа Form_Login form = new Form_Login(); if (form.ShowDialog() == DialogResult.OK) // Если вход успешен, значит регистрация прошла и отель существует; { hotelInfo = form.Director.HotelInfo; // Получаем заполненные данные из формы this.Text += hotelInfo.Name; dictFloors = new Dictionary <short, List <HotelNumber> >(); // Инициализация переменной ComboBox_Comfortable.Items.Clear(); ComboBox_Comfortable.Items.AddRange(HotelCreator.GetComfortData()); ComboBox_Comfortable.SelectedIndex = 0; UpdateDictionary(hotelInfo); UpdateListViewHotel(this.dictFloors); } else // В случае если нажата кнопка выйти { this.Close(); } }
private void TestHotelInfo(HotelInfo hotel) { Assert.AreEqual(hotel.ID, 123); Assert.AreEqual(hotel.Longitude, -12.5555); Assert.AreEqual(hotel.Latitude, 138383839.193939393923); Assert.AreEqual(hotel.DestinationRegionID, 2321); Assert.AreEqual(hotel.StarRating, 4.5); Assert.AreEqual(hotel.GuestReviewRating, 5.0); Assert.AreEqual(hotel.ReviewTotal, 4.3); Assert.AreEqual(hotel.VipAccess, true); Assert.AreEqual(hotel.IsOfficialRating, true); Assert.AreEqual(hotel.Name, "Hotel Name"); Assert.AreEqual(hotel.LocalizedName, "اسم الفندق"); Assert.AreEqual(hotel.Destination, "Hotel Destination"); Assert.AreEqual(hotel.LongDestination, "Hotel Long Destination"); Assert.AreEqual(hotel.StreetAddress, "Street Address 123"); Assert.AreEqual(hotel.City, "Hotel City"); Assert.AreEqual(hotel.Province, "Province"); Assert.AreEqual(hotel.CountryCode, "ABC"); Assert.AreEqual(hotel.ImageUrl, "https://www.one.com/two.jpg"); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(HotelInfo model) { StringBuilder query = new StringBuilder(); query.Append("Insert Into[dbo].[wx_hotels_info]"); query.Append(" ([wid],[hotelName],[hotelAddress],[hotelPhone],[mobilPhone],[noticeEmail],[emailPws],[smtp],[coverPic],[topPic],[orderLimit],[listMode],[messageNotice],[pwd],[hotelIntroduct],[orderRemark],[createDate],[sortid],[xplace],[yplace],[HotelCode],[Operator],[HotelLevel],[Recommend])"); query.Append(" Values"); query.Append(" (@wid, @hotelName, @hotelAddress, @hotelPhone, @mobilPhone, @noticeEmail, @emailPws, @smtp, @coverPic, @topPic, @orderLimit, @listMode, @messageNotice, @pwd, @hotelIntroduct, @orderRemark, @createDate, @sortid, @xplace, @yplace, @HotelCode, @Operator, @HotelLevel,@Recommend);"); query.Append("Select @Id = Scope_Identity();"); query.Append("Update dbo.wx_hotels_info Set HotelCode=Right('0000'+Cast(@Id As Varchar(10)),4) Where Id=@Id"); using (IDbConnection db = DbFactory.GetOpenedConnection()) { DynamicParameters dynamicParameters = new DynamicParameters(); dynamicParameters.AddDynamicParams(model); dynamicParameters.Add("@Id", dbType: DbType.Int32, direction: ParameterDirection.Output); db.Execute(query.ToString(), dynamicParameters); return(dynamicParameters.Get <int>("@Id")); } }