/// <summary> /// Executes the plug-in. /// </summary> /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the /// <see cref="IPluginExecutionContext"/>, /// <see cref="IOrganizationService"/> /// and <see cref="ITracingService"/> /// </param> /// <remarks> /// For improved performance, Microsoft Dynamics CRM caches plug-in instances. /// The plug-in's Execute method should be written to be stateless as the constructor /// is not called for every invocation of the plug-in. Also, multiple system threads /// could execute the plug-in at the same time. All per invocation state information /// is stored in the context. This means that you should not use global variables in plug-ins. /// </remarks> protected void ExecutePostSiteWarehouseCreate(LocalPluginContext localContext) { if (localContext == null) { throw new ArgumentNullException("localContext"); } IPluginExecutionContext context = localContext.PluginExecutionContext; IOrganizationService service = localContext.OrganizationService; ITracingService trace = localContext.TracingService; Entity siteEntity = (Entity)context.InputParameters["Target"]; string message = context.MessageName; string error = ""; Entity postImageEntity = (context.PostEntityImages != null && context.PostEntityImages.Contains(this.postImageAlias)) ? context.PostEntityImages[this.postImageAlias] : null; try { CityHandler cityHandler = new CityHandler(service, trace); cityHandler.SetCity(siteEntity); } catch (Exception ex) { throw new InvalidPluginExecutionException(String.Concat("(Exception)\n", ex.Message, Environment.NewLine, ex.StackTrace, Environment.NewLine, error)); } }
public void CheckDestroyed() { AICities aic = AICities.instance; CityHandler cH = CityHandler.instance; if (!destroyed) { switch (size) { case 3: if (cityTiles.Count != 3) { Debug.Log("City Destroyed!"); destroyed = true; if (owner == 0) { cH.DestroyCity(this); } else { aic.DestroyCity(this); } } break; case 4: if (cityTiles.Count <= 2) { Debug.Log("City Destroyed!"); destroyed = true; if (owner == 0) { cH.DestroyCity(this); } else { aic.DestroyCity(this); } } break; case 7: if (cityTiles.Count <= 5) { Debug.Log(cityTiles.Count); Debug.Log("City Destroyed!"); destroyed = true; if (owner == 0) { cH.DestroyCity(this); } else { aic.DestroyCity(this); } } break; } } }
public void Init() { cH = GameObject.Find("ClientMaster").GetComponent <CityHandler>(); //If there is no target, create a temporary target at 'distance' from the cameras current viewpoint if (!target) { GameObject go = new GameObject("Cam Target"); go.transform.position = camTargetInit.transform.position; //transform.position + (transform.forward * distance); target = go.transform; } distance = Vector3.Distance(transform.position, target.position); //desiredDistance = distance; //be sure to grab the current rotations as starting points. position = transform.position; rotation = transform.rotation; currentRotation = transform.rotation; desiredRotation = transform.rotation; xDeg = Vector3.Angle(Vector3.right, transform.right); yDeg = yMaxLimit; Rotate(); yDeg = Vector3.Angle(Vector3.up, transform.up); }
private void Awake() { if (instance != null) { Debug.Log("Too many city handlers!"); return; } instance = this; }
} //Singleton loop private void Start() { msgD = MsgDisplay.instance; cH = GetComponent <CityHandler>(); decks = GetComponent <Decks>(); deckHandUI = GameObject.Find("UIScripts").GetComponent <DeckHandUI>(); rP = GetComponent <ResolutionPhase>(); aiI = GetComponent <AIInfo>(); aiC = GetComponent <AICities>(); }
public IActionResult Update(int id) { List <SelectListItem> items = new List <SelectListItem> { new SelectListItem { Text = "- City -", Value = "0" } }; items.AddRange(new ProvinceHandler().GetProvinces().ToSelectListItemList()); ViewBag.Province = items; CityModel model = new CityHandler().GetCityById(id).ToCityModel(); return(PartialView("~/Views/Cities/_Update.cshtml", model)); }
public void Start() { tS = TemplateSelection.instance; cH = GetComponent <CityHandler>(); for (int i = 0; i < cityPlaceObjects.Count; i++) { GameObject newObject = Instantiate(cityPlaceObjects[i]); cityPlaceObjects[i] = newObject; if (target) { cityPlaceObjects[i].transform.position = target.transform.position; } cityPlaceObjects[i].SetActive(false); } }
public Entity SetCity(Entity accountEntity) { CityHandler cityHandler = new CityHandler(_organizationService, _tracingService); return(cityHandler.SetCity(accountEntity)); }
public Entity SetCity(Entity prospectInquiryEntity) { CityHandler cityHandler = new CityHandler(_organizationService, _tracingService); return(cityHandler.SetCity(prospectInquiryEntity)); }
public async Task GetCityData() { // Arrange var city1Node = HtmlNode.CreateNode(_htmlCity1Literal); var city2Node = HtmlNode.CreateNode(_htmlCity2Literal); var expectedResult = new List <CityData> { new CityData() { Name = "Київ", Url = "https://lun.ua/?q=kyiv" }, new CityData() { Name = "Київська обл.", Url = "https://lun.ua/?q=kyiv_region" } }; var cityHRefs = new List <string> { "/?q=kyiv", "/?q=kyiv_region" }; var htmlWebMock = new Mock <HtmlWeb>(); var htmlParserMock = new Mock <HtmlParser>(htmlWebMock.Object); htmlParserMock .Setup(htmlParser => htmlParser.ParseText(city1Node)) .Returns(expectedResult[0].Name); htmlParserMock .Setup(htmlParser => htmlParser.ParseText(city2Node)) .Returns(expectedResult[1].Name); htmlParserMock .Setup(htmlParser => htmlParser.ParseHref(city1Node)) .Returns(cityHRefs[0]); htmlParserMock .Setup(htmlParser => htmlParser.ParseHref(city2Node)) .Returns(cityHRefs[1]); var pageHandlerMock = new Mock <PageHandler>(htmlParserMock.Object); pageHandlerMock .Setup(pageHandler => pageHandler.LoadCityHtml()) .ReturnsAsync(new HtmlNodeCollection(null) { city1Node, city2Node }); pageHandlerMock .Setup(pageHandler => pageHandler.CreateLunUaUrl(cityHRefs[0])) .Returns(expectedResult[0].Url); pageHandlerMock .Setup(pageHandler => pageHandler.CreateLunUaUrl(cityHRefs[1])) .Returns(expectedResult[1].Url); var cityHandler = new CityHandler(pageHandlerMock.Object, htmlParserMock.Object); // Act var actualResult = await cityHandler.GetCityData(); // Assert Assert.Equal(expectedResult.ToList(), actualResult.ToList()); }
public IActionResult Delete(int id) { CityModel model = new CityHandler().GetCityById(id).ToCityModel(); return(PartialView("~/Views/Cities/_Delete.cshtml", model)); }
public IActionResult Manage() { List <CityModel> schemes = new CityHandler().GetCitys().ToCityList(); return(View(schemes)); }
/// <summary> /// Obtiene las ciudades por departamento /// </summary> /// <param name="id"></param> /// <returns></returns> public HttpResponseMessage GetCityByDepartament(int id) { CityHandler cityHandler = new CityHandler(); return(Request.CreateResponse(HttpStatusCode.OK, cityHandler.GetCityByDepartamentId(id))); }
private void Start() { rP = ResolutionPhase.instance; dHUI = DeckHandUI.instance; cH = GetComponent <CityHandler>(); }
public LunUaAggregator(CityHandler cityHandler, ApartComplexHandler apartComplexHandler, ApartmentHandler apartmentHandler) { _cityHandler = cityHandler; _apartComplexHandler = apartComplexHandler; _apartmentHandler = apartmentHandler; }