public async Task ChangeCity(Location location, CityId cityId) { var modLocation = await _context.Locations.FindAsync(location.Id); modLocation.UpdateCity(await GetCityAsync(cityId)); await _context.SaveChangesAsync(); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { try { this.SetCityIdFromUrl(); if (CityAliasFromUrl.Equals(Const.URL_REGION_RESET)) { filterContext.Result = GetRedirectToRouteResult(Const.ALL_CITIES); } if (CityId == 0 && GetCityIdFromCookie() > 0 && !CityAliasFromUrl.Equals(Const.URL_REGION_RESET)) { filterContext.Result = GetRedirectToRouteResult(GetCityById(GetCityIdFromCookie())?.Alias); } //Set region cookies Response.Cookies.Add(new HttpCookie(Const.COOKIE_NAME_CURRENTCITYID, CityId.ToString())); // Set culture globally _SetInitialCurrentCultureFromUrl(); } catch (Exception) { throw; } }
public static async Task <bool> CheckIfCityExists(CityId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new SplurgeStopDbContext(connectionString); var repository = new CityRepository(context); return(await repository.ExistsAsync(id)); }
public void City_created() { var cityId = new CityId(SequentialGuid.NewSequentialGuid()); var sut = City.Create(cityId, "Rapture"); Assert.NotNull(sut); Assert.Contains("Rapture", sut.Name); }
protected ACity(Empire empire, CityId id) { TheEmpire = empire; Id = id; Data = empire.Data->CitiesData[id]; CachedPersistentId = PersistentId; TheEmpire.OnStartOfTurnOrResume += () => _maintenance = -1; }
private void OnAddCity(City city) { var rnd = new Random(); CityId i = CityId.NewCityId(rnd.Next()); var amsterdam = new City(id: i, name: "Amsterdam " + i.Item); //let amsterdam = { City.Id = CityId(020); Name = "Amsterdam"}; Store.Dispatch(StoreAction.NewCityAdded(amsterdam)); }
private void SaveAction(object obj) { try { SettingConfiguration.UpdateKey("Company", Company); SettingConfiguration.UpdateKey("PortId", PortId.ToString()); SettingConfiguration.UpdateKey("CityId", CityId.ToString()); WindowClose(); } catch (Exception ex) { Helpers.ShowMessage(ex.Message); } }
public static async Task UpdateCityName(CityId id, string name) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new SplurgeStopDbContext(connectionString); var repository = new CityRepository(context); var unitOfWork = new EfCoreUnitOfWork(context); var service = new CityService(repository, unitOfWork); var cityController = new CityController(service); var updateCommand = new Commands.SetCityName { Id = id, Name = name }; await cityController.Put(updateCommand); }
public static async Task RemoveCity(CityId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new SplurgeStopDbContext(connectionString); var repository = new CityRepository(context); var unitOfWork = new EfCoreUnitOfWork(context); var service = new CityService(repository, unitOfWork); var cityController = new CityController(service); var updateCommand = new Commands.DeleteCity { Id = id }; await cityController.DeleteCity(updateCommand); }
protected override void GetAttributes() { attrs.Clear(); attrs.Add("CityId", CityId.ToString()); attrs.Add("ProvinceId", ProvinceId.ToString()); attrs.Add("IndoorTemperature", IndoorTemperature.ToString()); attrs.Add("GraphScale", GraphScale.ToString()); attrs.Add("ActiveTab", ActiveTab.ToString()); attrs.Add("buildingwidth", BuildingOutlineWidth.ToString()); attrs.Add("blockscale", BlockScale.ToString()); attrs.Add("pipeLineScale", PipeLineScale.ToString()); attrs.Add("elecprice", ElecPrice.ToString()); attrs.Add("gasprice", GasPrice.ToString()); if (rasterImageID.IsNull == false) { attrs.Add("rasterImage", rasterImageID.Handle.ToString()); } }
/// <summary> /// Assigns a key to the composeykey, to avoid duplicity. /// </summary> private void GenerateComposeKey() { string baseKey = CountryId.ToString(); if (StateId.HasValue) { baseKey += StateId.Value.ToString(); } if (CityId.HasValue()) { baseKey += CityId; } baseKey += HolidayDate.Year.ToString(); baseKey += HolidayDate.Month.ToString(); baseKey += HolidayDate.Day.ToString(); baseKey += HolidayType.Key.ToString(); baseKey += NativeDescription; ComposeKey = baseKey.ToMD5HashString(); }
public override string ToString() { return(CityId.ToString().PadRight(6) + Name.PadRight(30) + District.PadRight(30) + Population.ToString("N0").PadRight(10)); }
public void City_not_created(CityId id, string name) { Action sut = () => City.Create(id, name); Assert.Throws <ArgumentNullException>(sut.Invoke); }
public City(Empire empire, CityId id) : base(empire, id) { }
public async Task <JsonResult> citypod([FromBody] CityId c) { IEnumerable <PodCity> podcities = await db.PodCities.Where(p => p.CityId == c.Id).ToListAsync(); return(Json(podcities)); }
private readonly short padding; // 2 bytes, 16 total public TileInfo(CityId hypotheticalCity) { Resources = new BaseResourceSet(); ExploitingCity = hypotheticalCity; padding = 0; }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); imageServerUrl = ImageManage.GetImagerServerUrl(1); //初始化当前MQ用户 _MQLoginId = Utils.GetInt(Request.QueryString[Utils.MQLoginIdKey]); _password = Utils.GetQueryStringValue(Utils.MQPwKey); if (_MQLoginId > 0 && !String.IsNullOrEmpty(_password)) { _userInfo = new UserProvider().MQLogin(_MQLoginId, _password); UserProvider.GenerateIMFrameUserLoginCookies(UserProvider.GenerateSSOToken(_MQLoginId.ToString()), _MQLoginId.ToString()); } else { _userInfo = new UserProvider().GetMQUser(); } isLogin = _userInfo != null ? true : false; if (!isLogin) { Response.Clear(); Response.Write("用户名或者密码失效,请重新点击右边的菜单按钮!"); Response.End(); } _MQLoginId = Convert.ToInt32(_userInfo.ContactInfo.MQ); _password = _userInfo.PassWordInfo.MD5Password; _IsCompanyCheck = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetCompanyState(_userInfo.CompanyID).IsCheck; //_password = "******"; //_MQLoginId = 6709; //UserInfo userInfo = null; ////isLogin = EyouSoft.Security.Membership.UserProvider.IsUserLogin(out userInfo); //isLogin = true; ///* UserId:tongye114 */ //string UserId = "751ae431-8117-4fc3-b9c9-6c4977b57d45"; ///* UserId :liuyl_test */ /////UserId = "3f11ad31-4596-403b-b4a8-05f8fdd9dd31"; ///*test */ ////UserId = "BC2BAF09-694D-45E0-A5E3-3DDF1E4E2398"; //Model.CompanyStructure.CompanyUser user = EyouSoft.BLL.CompanyStructure.CompanyUser.CreateInstance().GetModel(UserId); //_userInfo = new UserInfo() //{ // CityId = 1, // CompanyID = user.CompanyID, // UserName = user.UserName, // DepartId = "1", // ProvinceId = 1, // DepartName = "432fds", // IsAdmin = true, // ID = UserId, //}; ////_userInfo.ContactInfo = user.ContactInfo; //_userInfo.ContactInfo.ContactName = user.ContactInfo.ContactName; //_userInfo.ContactInfo.Email = user.ContactInfo.Email; //_userInfo.ContactInfo.MQ = user.ContactInfo.MQ; //_userInfo.ContactInfo.QQ = user.ContactInfo.QQ; //_IsCompanyCheck = true; ////if (userInfo != null) ////{ //// _userInfo = userInfo; //// _IsCompanyCheck = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetCompanyState(_userInfo.CompanyID).IsCheck; //// if (userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.车队) //// || userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.购物店) //// || userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.景区) //// || userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.酒店) //// || userInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.旅游用品店)) //// { //// _IsSupplyUser = true; //// } //// else //// { //// _IsSupplyUser = false; //// } ////} ////Model.CompanyStructure.CompanyRole r = new EyouSoft.Model.CompanyStructure.CompanyRole(); ////r.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.专线); ////r.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.组团); //_userInfo.CompanyRole.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.专线); //_userInfo.CompanyRole.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.组团); //_userInfo.CompanyRole.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.地接); //_userInfo.AreaId = new int[6] { 1, 2, 3,4,5,241 }; ////,7,8,9,1,2,3,4,5,6,10,11,12,13,14,15,16,17,18,19,20,21,22,23,2 //_userInfo.PermissionList = new int[24] { 7, 8, 9, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 }; ////_userInfo.AreaId = new int[user.Area.Count] { }; ////string[] arr = user.are.Split(','); ////for (int i = 0; i < user.Area.Count; i++) ////{ //// _userInfo.AreaId[i] = user.Area[i].AreaId; ////} #region 更新cookie 修改人: 杜桂云 CityId = Utils.GetInt(Request.QueryString["CityId"]); if (CityId > 0 && !string.IsNullOrEmpty(Request.QueryString["isCut"])) { //存cookie if (Response.Cookies["MQCityId"] == null) { System.Web.HttpCookie cookie = new System.Web.HttpCookie("MQCityId"); cookie.Value = CityId.ToString(); cookie.Expires = DateTime.Now.AddDays(10); Response.Cookies.Add(cookie); } else //修改 { Response.Cookies["MQCityId"].Value = CityId.ToString(); Response.Cookies["MQCityId"].Expires = DateTime.Now.AddDays(10); } } else { if (CityId <= 0) { //取cookie if (Utils.GetInt(Response.Cookies["MQCityId"].Value) > 0) { CityId = Utils.GetInt(Response.Cookies["MQCityId"].Value); } else // { if (SiteUserInfo.CityId > 0) { CityId = SiteUserInfo.CityId; } else//默认值(杭州) { CityId = 362; } } } } #endregion #region 城市Model EyouSoft.Model.SystemStructure.SysCity thisCityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(CityId); if (thisCityModel != null) { CityModel = new EyouSoft.Model.SystemStructure.SysCity(); CityModel.CityId = CityId; CityModel.CityName = thisCityModel.CityName; CityModel.ProvinceId = thisCityModel.ProvinceId; CityModel.ProvinceName = thisCityModel.ProvinceName; } else { CityId = 362; EyouSoft.Model.SystemStructure.SysCity hzCityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(CityId); CityModel = new EyouSoft.Model.SystemStructure.SysCity(); CityModel.CityId = CityId; CityModel.CityName = hzCityModel.CityName; CityModel.ProvinceId = hzCityModel.ProvinceId; CityModel.ProvinceName = hzCityModel.ProvinceName; hzCityModel = null; } thisCityModel = null; #endregion }
public async Task <City> GetCityAsync(CityId id) { return(await _context.Cities.FindAsync(id)); }