public async Task <ApiResponse> Get(string type) { return(await Execute(() => { using (SqliteConnection) { var model = new StationModel(SqliteConnection); Result.Result = true; Result.Data = model.Get(type); } })); }
public bool Update(StationModel model) { if (model == null) { throw new System.ArgumentNullException(nameof(model)); } return(this.Invoke((c) => { return c.Update(model); })); }
public void loadstation(string Name, string label, string Type, Point pos, string stationID, string stationIP, string stationPORT, string stationAREA) { StationModel pstation = new StationModel(pif.content, Type); pstation.SetPosition(pos.X, pos.Y); pstation.SetKeyAndLabel(label); pstation.SetLabel(label); pstation.SetNameID(Name); //pstation.SetCamParam(stationID, stationIP, stationPORT, stationAREA); RegistrationAgent.stationRegistrationList.Add(pstation); pif.updateTreeviewStations(pstation.properties.stationNameID); }
public List <StationModel> GetTubeLineEnd(List <TubeLine> tsE) { List <StationModel> smlE = new List <StationModel>(); for (int e = 0; e < tsE.Count; e++) { StationModel smE = new StationModel(); smE.FromStation = tsE[e].FromStation; smE.ToStation = tsE[e].ToStation; smlE.Add(smE); } return(smlE); }
private void AddStation() { // If AddStationButton is clicked when entry is empty, nothing happens if (NewStation != null && NewStation.Length == 0) { return; } var nStation = new StationModel(NewStation); DataService.AddStation(nStation); Stations.Add(new SelectableItemWrapper <StationModel>(nStation)); NewStation = ""; //Clear entry after saving }
public IHttpActionResult SubmitStation(StationModel model) { try { var res = _routemanager.SubmitStation(int.Parse(User.Identity.GetUserId()), model.Name, model.StLat, model.StLng, model.MainStationId); return(Json(_responseProvider.GenerateRouteResponse(res, "SubmitStation"))); } catch (Exception e) { _logmanager.Log(Tag, "SubmitStation", e.Message); } return(Json(_responseProvider.GenerateUnknownErrorResponse())); }
public IHttpActionResult GetSubStations(StationModel model) { try { var res = _routemanager.GetSubStations(model.MainStationId); return(Json(_responseProvider.GenerateRouteResponse(res))); } catch (Exception e) { _logmanager.Log(Tag, "GetSubStations", e.Message); } return(Json(_responseProvider.GenerateUnknownErrorResponse())); }
private void LoadSelectedStation(decimal lat, decimal lng) { foreach (var station in Stations) { if (station.Model.Latitude == Convert.ToDecimal(lat) && station.Model.Longitude == Convert.ToDecimal(lng)) { SelectedStationMap = station; } } timer.Stop(); timer.Start(); }
// GET: Admin/Station/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StationModel stationModel = db.StationModels.Find(id); if (stationModel == null) { return(HttpNotFound()); } return(View(stationModel)); }
public async Task Insert_Fails_Missing_Region() { var repo = new StationRepository(Context); var newStation = new StationModel { Name = "My Custom Station", }; var inserted = await repo.InsertAsync(newStation); Assert.IsNull(inserted); Assert.AreEqual(0, Context.Stations.Count()); }
private Task MakeMoveFromLastBase(FlightModel flight, int?stationId) { StationModel flightOldStation = StationsList.FirstOrDefault(s => { { return(s.Flight != null && s.Flight.ID == flight.ID); } }); FlightModel flightToMove = flightOldStation.Flight; Image plainToFly = GetPlainImage(flightOldStation); RemoveFlightFromStation(flightToMove, flightOldStation); return(MoveOutFromStations(plainToFly, flightOldStation)); }
public async Task PUT_Is_Bad_Request_Missing_Id() { var controller = new StationsController(Context); ConfigureRequest(controller); var model = new StationModel { Name = "Test No Id" }; var result = await GetResponse(controller.Put(model)); Assert.AreEqual(HttpStatusCode.BadRequest, result.StatusCode); }
public bool CreateCameraAgentM(String AreaID, StationModel cameraAgent) { //if (RegistrationAgent.areaList.ContainsKey(AreaID) == false) //{ // RegistrationAgent.areaList.Add(AreaID, new Area(AreaID)); // return RegistrationAgent.areaList[AreaID].AddMixed(cameraAgent); //} //else //{ // return RegistrationAgent.areaList[AreaID].AddMixed(cameraAgent); //} //cameraAgent.dataHandle += dataHandleM; return(false); }
public IActionResult StationFormPartial([FromBody] StationModel station) { UserDetailModel user = HttpContext.Session.SessionGet <UserDetailModel>("user"); if (user == null) { return(PartialView("_ErrorPartial", new ErrorViewModel { ErrorMessage = "Session expired. Please login to continue.", ErrorCode = 1 })); } return(PartialView(station)); }
public IActionResult Get() { using var channel = GrpcChannel.ForAddress(GrpcServiceUrl); var client = new Greeter.GreeterClient(channel); // 获取PLC信息 var reply = client.SayHello(new HelloRequest { Name = "LineZero" }); var plcModel = JsonConvert.DeserializeObject <ST_PLCData>(reply.Message); // 将PLC模型转换为站点模型 var stationModel = new StationModel(plcModel); return(new OkObjectResult(stationModel)); }
public BingEvent(APPConfiguration appconfig, StationModel stnmodel, BaseProtocol basepro) { // MyServer = new Server(); MyAppConfig = appconfig; MyStationModel = stnmodel; MyStnBaseProtocol = basepro; // InitOpc(); // DataChangeBing(); //opchelper = new OpcHelper(MyStnBaseProtocol, MyStationModel, _serverNamespaceIndex); //opchelper.MyServer = MyServer; //opcbll = new OpcBll(); //opcbll.StnModel = stnmodel; // opcbll.myopcHelper = opchelper; }
public void ExitAirport_ThereIsNoNextStation_PlaneIsExitingAirport() { //arrange var plane = new Plane(100, StatusFly.Fly); var station4 = new StationModel { StationId = 4, Plane = plane }; var stationManager = new StationManager(); //act stationManager.Movment(station4); stationManager.GetArr(); //assert }
public void AddPlaneIfLand_PlaneIsLanding_AddingPlaneToStation() { //arrange var plane = new Plane(100, StatusFly.Land); var station1 = new StationModel { StationId = 1 }; var stationmanager = new StationManager(); //act stationmanager.AddingNewPlane(plane); //assert Assert.IsTrue(station1.Plane == plane); }
public void AddPlaneIfLand_PlaneIsLanding_PlaneDosentAddToTheFirstStation() { //arrange var plane = new Plane(100, StatusFly.Land); var plane2 = new Plane(101, StatusFly.Land); var station1 = new StationModel { StationId = 1, Plane = plane }; var stationmanager = new StationManager(); //act stationmanager.AddingNewPlane(plane2); //assert Assert.IsNotNull(station1.Plane); }
private void button1_Click(object sender, EventArgs e) { NovaStanica ft = new NovaStanica(); ft.ShowDialog(); if (ft.st != null) { station = ft.st; station = StationModel.InsertStation(ft.st); var sta = StationModel.NotInRouteStations(route != null ? route.Id.ToString() : null); listBox1.Items.Clear(); listBox1.Items.AddRange(sta.ToArray()); } }
public StationModel GetStation(Guid id) { var dbStation = _dbContext.Stations.First(e => e.Id == id); var station = new StationModel() { City = dbStation.City, Name = dbStation.Name, Id = dbStation.Id, Employes = dbStation.Employes, DirectionId = dbStation.DirectionId }; return(station); }
public static JObject addAPutAway(StationModel pstation) { dynamic product = new JObject(); dynamic putaway = new JObject(); dynamic checkin = new JObject(); dynamic checkout = new JObject(); putaway.key = pstation.props.NameID; checkin.key = pstation.checkInPoint.properties.key; checkout.key = pstation.checkOutPoint.properties.key; putaway.checkin = checkin; putaway.checkout = checkout; product.putaway = putaway; return(product.ToString()); }
public static JObject addADocking(StationModel pstation) { dynamic product = new JObject(); dynamic docking = new JObject(); dynamic checkin = new JObject(); dynamic checkout = new JObject(); docking.key = pstation.props.NameID; checkin.key = pstation.checkInPoint.properties.key; checkout.key = pstation.checkOutPoint.properties.key; docking.checkin = checkin; docking.checkout = checkout; product.docking = docking; return(product.ToString()); }
/// <summary> /// Get the station model with the shortest waiting list. /// </summary> /// <param name="stationList">The list from which the base station is picked</param> /// <returns></returns> private StationModel GetShorterWatingListStation(List <StationModel> stationList) { StationModel stationToReturn = null; int min = int.MaxValue; foreach (var station in stationList) { if (station.WaitingStationsList.Count < min) { stationToReturn = station; min = station.WaitingStationsList.Count; } } return(stationToReturn); }
public EventFireMockup(IEventAggregator eventAggregator) { this.eventAggregator = eventAggregator; StationModel = new StationModel() { StationNumber = 1, StationServiceType = Common.ServiceType.Nurse, EmployeeFirstName = "Daniel", EmployeeLastName = "Szuster", EmployeeId = 1, Password = "******", UserName = "******" }; }
public IActionResult AddStation([FromBody] StationModel stm) { Station st = new Station { District = stm.District, Type = "station", Point = new Point { X = (float)stm.X, Y = (float)stm.Y } }; appCtx.Stations.Add(st); appCtx.SaveChanges(); return(Ok()); }
public StorageService() { eventService = ServiceController.GetService <JournalEventService>(); eventService.PreEventCall += EventService_PreEventCall; eventService.Subscribe <StatusEvent>(GameStatusCallback); Game = new GameModel(eventService); Commander = new CommanderModel(eventService); Navigation = new NavigationModel(eventService); StarSystem = new StarSystemModel(eventService); Ship = new ShipModel(eventService); Station = new StationModel(eventService); //Missions = new MissionsModel(eventService); }
public string GetStations() { StationModel model = new StationModel(); var stationsToMap = model.Stations.ToArray().Select(x => new { id = x.StationId, text = x.Name, latitude = x.Latitude, longitude = x.Longitude, state = (new Random().Next() % 2 == 0) ? "STOPPED" : "STARTED" //TODO: убрать иммитацию }).ToArray(); var jsonStations = JsonConvert.SerializeObject(stationsToMap); return(jsonStations); }
public EmbarkEvent(DateTime timestamp, bool toSRV, bool toTransport, bool toMultiCrew, int?toLocalId, string system, long systemAddress, string body, int?bodyId, bool?onStation, bool?onPlanet, string station, long?marketId, StationModel stationModel) : base(timestamp, NAME) { this.tosrv = toSRV; this.totransport = toTransport; this.tomulticrew = toMultiCrew; this.toLocalId = toLocalId; this.systemname = system; this.systemAddress = systemAddress; this.bodyname = body; this.bodyId = bodyId; this.onstation = onStation; this.onplanet = onPlanet; this.station = station; this.marketId = marketId; this.stationModel = stationModel; }
// GET: Stations public ActionResult Index() { StationModel model = new StationModel(); var stations = model.Stations.ToList().Select(x => new { Primarykey = x.StationId.ToString("D"), Name = x.Name, Coordinates = $"{Math.Round(x.Longitude, 2)}°, {Math.Round(x.Latitude, 2)}°", }).ToArray(); var jsonString = JsonConvert.SerializeObject(stations); View("StationList").ViewData["Stations"] = jsonString; return(View("StationList")); }
//静态的创建StationModel的方法 ,这个方法在后面的显示脚本中会用到 public static StationModel CreateModel(StationModel model) { return new StationModel(model.stationID, model.stationName, model.stationArrivedTime, model.stationLeaveTime, model.stationMileage, model.stationFsoftSeat, model.stationSsoftSeat, model.stationHardSeat, model.stationSoftSeat, model.stationHardSleep, model.stationSoftSleep, model.stationWuZuo, model.stationSWZ, model.stationTDZ, model.stationGJRW, model.stationStay); }