private Region getRegion() { int idRegion = 0; int.TryParse(_dgvEmployees.Rows[_dgvEmployees.SelectedCells[0].RowIndex].Cells[0].Value.ToString(), out idRegion); RegionList regionList = RegionList.getInstance(); return(regionList.getItem(idRegion)); }
private void fillFields(DataRow row) { int idRegion; int.TryParse(row.ItemArray[0].ToString(), out idRegion); RegionList regionList = RegionList.getInstance(); Region = regionList.getItem(idRegion); int.TryParse(row.ItemArray[1].ToString(), out idEmployeesName); int.TryParse(row.ItemArray[2].ToString(), out idDriver); }
/// <summary>Snippet for List</summary> public void List() { // Snippet: List(string, CallSettings) // Create client RegionsClient regionsClient = RegionsClient.Create(); // Initialize request argument(s) string project = ""; // Make the request RegionList response = regionsClient.List(project); // End snippet }
/// <summary> /// Get regions from list of WebRegions. /// </summary> /// <param name="userContext">User context.</param> /// <param name="webRegions">List of WebRegions.</param> /// <returns>RegionList.</returns> protected RegionList GetRegions(IUserContext userContext, List <WebRegion> webRegions) { RegionList regionList = new RegionList(); foreach (WebRegion webRegion in webRegions) { regionList.Add(GetRegion(userContext, webRegion)); } return(regionList); }
void Delete(Client player, string[] cmd, int iarg) { if (player.Admin() == false) { throw new ErrorException("Disabled"); } WorldRegion region = player.Session.CurrentRegion; if (region == null) { throw new ErrorException("No region here"); } if (cmd.Length <= iarg) { throw new ShowHelpException(); //Need more arguments } RegionList regions = player.Session.World.Regions; string subdel = cmd [iarg].ToLowerInvariant(); switch (subdel) { case "single": DeleteSingle(region, regions); player.TellSystem(Chat.Purple, region.Name + " removed"); player.Session.CurrentRegion = null; break; case "recursive": DeleteRecursive(region); player.TellSystem(Chat.Purple, region.Name + " and subregions removed"); region.Deleted = true; player.Session.CurrentRegion = null; break; case "subonly": DeleteSubregions(region); player.TellSystem(Chat.Purple, "Subregions of " + region.Name + " removed"); break; default: throw new ShowHelpException(); } RegionLoader.Save(regions); //Update all players regions foreach (var p in PlayerList.List) { RegionCrossing.SetRegion(p.Session); } ScoreboardRegionManager.UpdateAllPlayersRegion(); }
/// <summary> /// Gets all spatial filter regions. /// </summary> /// <returns></returns> public List <RegionViewModel> GetAllRegions() { List <int> regionIds = MySettings.Filter.Spatial.RegionIds.ToList(); if (regionIds.Count == 0) { return(new List <RegionViewModel>()); } RegionList regions = CoreData.RegionManager.GetRegionsByIds(UserContext, regionIds); return((from IRegion region in regions select RegionViewModel.CreateFromRegion(region)).ToList()); }
/// <summary>Snippet for ListAsync</summary> public async Task ListAsync() { // Snippet: ListAsync(string, CallSettings) // Additional: ListAsync(string, CancellationToken) // Create client RegionsClient regionsClient = await RegionsClient.CreateAsync(); // Initialize request argument(s) string project = ""; // Make the request RegionList response = await regionsClient.ListAsync(project); // End snippet }
public void RemoveRegionEventCall(object sender) { RegionEventArgs eventArgs = new RegionEventArgs() { Region = SelectedRegionItem }; RemoveRegionEventHandler?.Invoke(this, eventArgs); if (eventArgs.Success == true) { RegionList.Remove(eventArgs.Region); } }
public Driver(DataRow row) { int id; int.TryParse(row.ItemArray[0].ToString(), out id); Id = id; _fio = row.ItemArray[1].ToString(); int idRegion; int.TryParse(row.ItemArray[2].ToString(), out idRegion); Region = RegionList.getInstance().getItem(idRegion); DateTime.TryParse(row.ItemArray[3].ToString(), out _dateBirth); _mobile = row.ItemArray[4].ToString(); email = row.ItemArray[5].ToString(); int.TryParse(row.ItemArray[6].ToString(), out _fired); int.TryParse(row.ItemArray[7].ToString(), out _expSince); int idPosition; int.TryParse(row.ItemArray[8].ToString(), out idPosition); PositionID = idPosition; int idDept; int.TryParse(row.ItemArray[9].ToString(), out idDept); DeptID = idDept; Login = row.ItemArray[10].ToString(); int idOwner; int.TryParse(row.ItemArray[11].ToString(), out idOwner); OwnerID = idOwner; suppyAddress = row.ItemArray[12].ToString(); int idSex; int.TryParse(row.ItemArray[13].ToString(), out idSex); SexIndex = idSex; int.TryParse(row.ItemArray[14].ToString(), out _decret); DateTime.TryParse(row.ItemArray[15].ToString(), out _dateStopNotification); _number = row.ItemArray[16].ToString(); int.TryParse(row.ItemArray[17].ToString(), out _isDriver); int.TryParse(row.ItemArray[18].ToString(), out _from1C); }
public void GetRegionsByGUIDs() { IRegionCategory category = GetRegionManager(true).GetRegionCategory(GetUserContext(), 1); RegionList regions1 = GetRegionManager(true).GetRegionsByCategory(GetUserContext(), category); List <string> GUIDs = new List <string>(); foreach (Region region in regions1) { GUIDs.Add(region.GUID); } RegionList regions2 = GetRegionManager(true).GetRegionsByGUIDs(GetUserContext(), GUIDs); Assert.AreEqual(regions1[0].CategoryId, regions2[2].CategoryId); Assert.AreEqual(regions1.Count, regions2.Count); }
public void AddRegionEventCall(object sender) { RegionEventArgs eventArgs = new RegionEventArgs() { Region = new Region(Side, Region, Group, Root, End, ComObject, ComRegion, ComWeight) }; AddRegionEventHandler?.Invoke(this, eventArgs); if (eventArgs.Success == true) { RegionList.Add(eventArgs.Region); Root = ""; End = ""; } }
/// <summary> /// Gets all regions of a specific category type and returns it as an entry in a dictionary. /// </summary> /// <param name="regionCategories">The region categories.</param> /// <returns></returns> private Dictionary <int, List <IRegion> > GetRegionsDictionary(RegionCategoryList regionCategories) { RegionList regions = CoreData.RegionManager.GetRegionsByCategories(UserContext, regionCategories); var dicRegions = new Dictionary <int, List <IRegion> >(); foreach (IRegion region in regions) { if (!dicRegions.ContainsKey(region.CategoryId)) { dicRegions.Add(region.CategoryId, new List <IRegion>()); } dicRegions[region.CategoryId].Add(region); } return(dicRegions); }
public bool InsertRegionList() { bool result = true; try { RegionList ls = new RegionList(); ls.DDNAME = ""; db.RegionLists.InsertOnSubmit(ls); db.SubmitChanges(); } catch (Exception ex) { result = false; } return(result); }
private void OnLoaded(object sender, RoutedEventArgs e) { vectorLayer = new C1VectorLayer(); Map.Source = new VirtualEarthRoadSource(); Map.Layers.Add(vectorLayer); if (!MainPage.IsWindowsPhoneDevice()) { scaleLayer = new C1VectorLayer(); ScaleMap.Source = new VirtualEarthRoadSource(); ScaleMap.Layers.Add(scaleLayer); } collectionView = DataService.GetService().ProductWiseSaleCollection; ProductList.ItemsSource = DataService.GetService().ProductList; RegionList.ItemsSource = DataService.GetService().RegionList; ProductList.SelectAll(); RegionList.SelectAll(); }
private async void GetRegionList() { RegionList list = null; loadingUI.ShowLoading("Getting region list..."); try { list = await loginApi.ListRegions(); } catch (System.Exception e) { Debug.LogWarning("Exception! " + e); } OnRegionDownload(list); }
/// <summary>Snippet for List</summary> public void ListRequestObject() { // Snippet: List(ListRegionsRequest, CallSettings) // Create client RegionsClient regionsClient = RegionsClient.Create(); // Initialize request argument(s) ListRegionsRequest request = new ListRegionsRequest { PageToken = "", MaxResults = 0U, OrderBy = "", Project = "", Filter = "", ReturnPartialSuccess = false, }; // Make the request RegionList response = regionsClient.List(request); // End snippet }
protected void BindRegionList() { try { RegionController sysmgr = new RegionController(); List <Region> info = sysmgr.Region_List(); info.Sort((x, y) => x.RegionDescription.CompareTo(y.RegionDescription)); RegionList.DataSource = info; RegionList.DataTextField = nameof(Region.RegionDescription); RegionList.DataValueField = nameof(Region.RegionID); RegionList.DataBind(); RegionList.Items.Insert(0, "select..."); } catch (Exception ex) { errormsgs.Add(GetInnerException(ex).ToString()); LoadMessageDisplay(errormsgs, "alert alert-danger"); } }
protected void btnAdd_Click(object sender, EventArgs e) { decimal regionPrice = 0m; decimal addRegionPrice = 0m; if (ValidateValues(out regionPrice, out addRegionPrice)) { Region item = new Region(); item.RegionsId = txtRegion_Id.Text; item.Regions = txtRegion.Value; item.RegionPrice = regionPrice; item.RegionAddPrice = addRegionPrice; RegionList.Add(item); BindRegion(); txtRegion_Id.Text = string.Empty; txtRegion.Value = string.Empty; txtRegionPrice.Text = "0"; txtAddRegionPrice.Text = "0"; } }
private void btnSave_Click(object sender, EventArgs e) { if (_workWithForm.IsEditMode()) { RegionList regionList = RegionList.getInstance(); int idRegion; int.TryParse(cbRegion.SelectedValue.ToString(), out idRegion); _employees.Region = regionList.getItem(idRegion); _employees.IdEmployeesName = cbEmployeesName.SelectedValue.ToString(); _employees.IdDriver = cbDriver.SelectedValue.ToString(); _employees.Save(); DialogResult = System.Windows.Forms.DialogResult.OK; } else { _workWithForm.SetEditMode(true); } }
private void btnAdd_Click(object sender, EventArgs e) { decimal num; decimal num2; if (ValidateValues(out num, out num2)) { Region region2 = new Region(); region2.RegionsId = txtRegion_Id.Text; region2.Regions = txtRegion.Value; region2.RegionPrice = num; region2.RegionAddPrice = num2; Region item = region2; RegionList.Add(item); BindRegion(); txtRegion_Id.Text = string.Empty; txtRegion.Value = string.Empty; txtRegionPrice.Text = "0"; txtAddRegionPrice.Text = "0"; } }
public void MirrorFilteredRegionCall(object sender) { List <Region> NewRegionList = new List <Region>(); foreach (Region region in RegionListViewSource.View) { if (region.Side.Contains(MirrorReplaceText) || region.Side.Contains(MirrorReplaceWithText)) { MirrorRegionEventArgs eventArgs = new MirrorRegionEventArgs(); if (region.Side.Contains(MirrorReplaceText)) { eventArgs.Region = region; eventArgs.Replace = MirrorReplaceText; eventArgs.ReplaceWith = MirrorReplaceWithText; eventArgs.JointReplace = JointReplaceText; eventArgs.JointReplaceWith = JointReplaceWithText; } else { eventArgs.Region = region; eventArgs.Replace = MirrorReplaceWithText; eventArgs.ReplaceWith = MirrorReplaceText; eventArgs.JointReplace = JointReplaceWithText; eventArgs.JointReplaceWith = JointReplaceText; } MirrorFilteredRegionsHandler?.Invoke(this, eventArgs); if (eventArgs.NewRegion != null) { NewRegionList.Add(eventArgs.NewRegion); } } } foreach (Region newRegion in NewRegionList) { RegionList.Add(newRegion); } }
public RegionStartStop(GuiApplication app) { InitializeComponent(); m_App = app; RegionList.View = View.Details; var regionData = (Dictionary <string, string>)m_App.m_GetData?.Invoke("region-id-name-pairs"); var regionEnabled = (string[])m_App.m_GetData?.Invoke("region-ids/enabled"); var regionOnline = (string[])m_App.m_GetData?.Invoke("region-ids/online"); foreach (KeyValuePair <string, string> kvp in regionData) { ListViewItem item = new ListViewItem { Text = kvp.Key }; item.SubItems.Add(new ListViewItem.ListViewSubItem(item, kvp.Value)); item.SubItems.Add(new ListViewItem.ListViewSubItem(item, regionOnline.Contains(kvp.Key) ? "Yes" : "No")); item.SubItems.Add(new ListViewItem.ListViewSubItem(item, regionEnabled.Contains(kvp.Key) ? "Yes" : "No")); RegionList.Items.Add(item); } RegionList.Refresh(); }
/// <summary>Snippet for ListAsync</summary> public async Task ListRequestObjectAsync() { // Snippet: ListAsync(ListRegionsRequest, CallSettings) // Additional: ListAsync(ListRegionsRequest, CancellationToken) // Create client RegionsClient regionsClient = await RegionsClient.CreateAsync(); // Initialize request argument(s) ListRegionsRequest request = new ListRegionsRequest { PageToken = "", MaxResults = 0U, OrderBy = "", Project = "", Filter = "", ReturnPartialSuccess = false, }; // Make the request RegionList response = await regionsClient.ListAsync(request); // End snippet }
private void BindControl(ShippingModeInfo modeItem) { txtModeName.Text = Globals.HtmlDecode(modeItem.Name); txtWeight.Text = modeItem.Weight.ToString(); txtAddWeight.Text = modeItem.AddWeight.ToString(); if (modeItem.AddPrice.HasValue) { txtAddPrice.Text = modeItem.AddPrice.Value.ToString("F2"); } txtPrice.Text = modeItem.Price.ToString("F2"); RegionList.Clear(); if ((modeItem.ModeGroup != null) && (modeItem.ModeGroup.Count > 0)) { foreach (ShippingModeGroupInfo info in modeItem.ModeGroup) { Region region2 = new Region(); region2.RegionPrice = decimal.Parse(info.Price.ToString("F2")); region2.RegionAddPrice = decimal.Parse(info.AddPrice.ToString("F2")); Region item = region2; StringBuilder builder = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); foreach (ShippingRegionInfo info2 in info.ModeRegions) { builder.Append(info2.RegionId + ","); builder2.Append(RegionHelper.GetFullRegion(info2.RegionId, ",") + ","); } if (!string.IsNullOrEmpty(builder.ToString())) { item.RegionsId = builder.ToString().Substring(0, builder.ToString().Length - 1); } if (!string.IsNullOrEmpty(builder2.ToString())) { item.Regions = builder2.ToString().Substring(0, builder2.ToString().Length - 1); } RegionList.Add(item); } } }
/// <summary> /// Return true if region was created /// </summary> void CreateRegion(Client player, CoordDouble start, CoordDouble end) { RegionList regions = player.Session.World.Regions; try { WorldRegion wr = Create(player.Session.Dimension, start, end, player.Name + "'s place", player, player.MinecraftUsername, regions); if (wr == null) { return; } regionStart.Remove(player.MinecraftUsername); Log.WritePlayer(player, "Region Created: " + wr); player.TellSystem(Chat.Aqua, "Region created"); return; } catch (InvalidOperationException ioe) { player.TellSystem(Chat.Red, ioe.Message); return; } }
public SimpleExaminationViewModel(BaseScene scene, String json) : base(scene, json) { CanAnalysis = true; init(); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); var response = javaScriptSerializer.Deserialize <SimpleExaminationScene>(json); examination = response.Convert(); if (examination.ExaminationQuestions != null) { foreach (var v in examination.ExaminationQuestions) { QuestionVM vm = new QuestionVM(); vm.Set(v); QuestionList.Add(vm); TotalScore += v.Score; } } if (examination.Voters != null) { foreach (var v in examination.Voters) { StudentVM studentNM = new StudentVM(); studentNM.Set(v); StudentList.Add(studentNM); } } if (response.RegionScenes != null) { RegionList.Clear(); foreach (var v in response.RegionScenes) { RegionList.Add(v.convert()); } } }
public void GetRegions() { using (ShimsContext.Create()) { //Login user LoginTestUserAnalyser(); IUserContext userContext = SessionHandler.UserContext; int defaultCountryIsoCode = 752; RegionCategoryList regionCategories = CoreData.RegionManager.GetRegionCategories(userContext, defaultCountryIsoCode); RegionTypeList regionTypes = CoreData.RegionManager.GetRegionTypes(userContext); IRegionCategory regionCategory = CoreData.RegionManager.GetRegionCategory(userContext, 21); //21=län RegionList regions = CoreData.RegionManager.GetRegionsByCategory(userContext, regionCategory); Region dalarna = regions[1] as Region; //var controller = new CultureController(); //// Mock Controller //Builder.InitializeController(controller); //Builder.HttpContext.Response.Expect(x => x.Cookies).Return(new HttpCookieCollection()); //RedirectResult result = controller.SetCulture("en", "home/index"); //Assert.AreEqual("home/index", result.Url); } }
static void DeleteSingle(WorldRegion r, RegionList regions) { lock (regions) { var parent = WorldRegion.GetParentList(regions, r); if (parent == null) { return; } //Move all subregions to parent list if (r.SubRegions != null) { foreach (var s in r.SubRegions) { parent.Add(s); } } r.Residents.Clear(); r.SubRegions.Clear(); } RegionLoader.Save(regions); }
public void List() { moq::Mock <Regions.RegionsClient> mockGrpcClient = new moq::Mock <Regions.RegionsClient>(moq::MockBehavior.Strict); ListRegionsRequest request = new ListRegionsRequest { Project = "projectaa6ff846", }; RegionList expectedResponse = new RegionList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { new Region(), }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RegionsClient client = new RegionsClientImpl(mockGrpcClient.Object, null); RegionList response = client.List(request.Project); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// 区域层级 /// </summary> public string GetRegionLeveStr() { return(string.Join(",", RegionList.Select(x => "'" + x + "'"))); }
public void ClearRegions() { m_Regions = null; }
public void AddRegion(int id, float l, float t, float r, float b) { if (m_Regions == null) { m_Regions = new RegionList(); } m_Regions.AddRegion(id, l, t, r, b); }
internal static WorldRegion Create(Dimensions dimension, CoordDouble start, CoordDouble end, string regionName, Client player, string resident, RegionList regions) { if (regions == null) throw new ErrorException("No regions in this world"); WorldRegion w = new WorldRegion(dimension, start, end, regionName); w.Residents.Add(resident); w.Type = "protected"; lock (regions) { //Test for overlapping regions WorldRegion existing = RegionCrossing.GetBaseRegion(regions.List, w, dimension); if (existing == null) { //New Top level region regions.List.Add(w); RegionLoader.Save(regions); return w; } //Make sure you already are a part of the region if (existing.ResidentPermissions(player) == false) throw new ErrorException("You can't set a subregion unless you are a resident in the parent region."); //All inside, make subregion if (existing.Cover(w)) { if (existing.SubRegions == null) existing.SubRegions = new List<WorldRegion>(); existing.SubRegions.Add(w); RegionLoader.Save(regions); return w; } //Need to make a wrapping region //Only admins may create wrapping regions if (player != null && player.Admin() == false) throw new ErrorException("New region must be fully inside " + existing); //New region covering several old ones? var parentList = WorldRegion.GetParentList(regions, existing); if (parentList == null) throw new ErrorException("Parent list not found for " + existing); //regions to move inside the new one var moving = new List<WorldRegion>(); //Determine if we are breaking any boundaries bool breaking = false; foreach (var s in parentList) { if (w.Cover(s)) { moving.Add(s); } else if (w.Overlap(s)) //Overlap but not cover completely { player.TellSystem(Chat.Red, "Breaking boundaries: " + s); breaking = true; } } if (breaking) { player.TellSystem(Chat.Red, "Failed creating: " + w); player.TellSystem(Chat.Red, "Aborting: Broke region boundaries"); return null; } //Move subregions into new region and remove from parentlist w.SubRegions = moving; foreach (var s in moving) { player.TellSystem(Chat.Aqua, "New subregion: " + s); parentList.Remove(s); } parentList.Add(w); RegionLoader.Save(regions); return w; } }
static void DeleteSingle(WorldRegion r, RegionList regions) { lock (regions) { var parent = WorldRegion.GetParentList(regions, r); if (parent == null) return; //Move all subregions to parent list if (r.SubRegions != null) { foreach (var s in r.SubRegions) parent.Add(s); } r.Residents.Clear(); r.SubRegions.Clear(); } RegionLoader.Save(regions); }