/// <summary> /// 触发 获取pdf文件地址 操作 /// </summary> /// <param name="ErpVoucherNo"></param> /// <param name="ipAddress"></param> /// <returns></returns> public ActionResult PdfInit(string ErpVoucherNo, string ipAddress) { SuccessResult successResult = new SuccessResult(); successResult.Success = false; try { var productOrder = new View_ProductService().GetProduct(ErpVoucherNo); if (productOrder == null) { successResult.Msg = "没有该生产订单!"; return(Json(successResult, JsonRequestBehavior.AllowGet)); } //根据生产订单获取SOP地址 var moReport = new T_Material_Batch_DB().GetSopList(ErpVoucherNo).FirstOrDefault(); if (moReport == null) { successResult.Msg = "该erp单号没有pdf地址数据,请核实!"; return(Json(successResult, JsonRequestBehavior.AllowGet)); } View_CompterService compterService = new View_CompterService(); var compter = compterService.GetCompter(ipAddress); if (compter == null) { successResult.Msg = "该电脑不能使用该功能,请联系管理员添加!"; return(Json(successResult, JsonRequestBehavior.AllowGet)); } var stations = new View_StationService().GetList(x => x.LineId == compter.LineId); var objStation = stations .Find(x => x.Id == compter.StationId && x.OrderNo == ErpVoucherNo); string pdfAddress = ""; //该工位&&该订单号&&pdf地址 不为空=>不做更新 if (objStation != null && !string.IsNullOrEmpty(objStation.PdfAddress)) { pdfAddress = objStation.PdfAddress; } else//做更新 { var count = stations.FindAll(x => x.OrderNo == ErpVoucherNo && !string.IsNullOrEmpty(x.PdfAddress) && x.Id != compter.StationId).Count(); pdfAddress = count == 0 ? moReport.Sop1 : count == 1 ? moReport.Sop2 : count == 2 ? moReport.Sop3 : count == 3 ? moReport.Sop4 : count == 4 ? moReport.Sop5 : moReport.Sop6; var station = new StationService() .GetList(x => x.Id == compter.StationId).FirstOrDefault(); station.OrderNo = ErpVoucherNo; station.PdfAddress = pdfAddress; new StationService().Update(station); } successResult.Data = new { productOrder = productOrder, pdfAddress = pdfAddress }; successResult.Success = true; } catch (Exception ex) { successResult.Msg = ex.Message; } return(Json(successResult, JsonRequestBehavior.AllowGet)); }
protected async override Task OnInitializedAsync() { var authenticationState = await AuthenticationStateTask; #region Must test this function //if (authenticationState.User.IsInRole("Admin")) //{ //} #endregion if (!authenticationState.User.Identity.IsAuthenticated) { string returnUrl = WebUtility.UrlEncode($"/master/station/edit/{Id}"); NavigationManager.NavigateTo($"/identity/account/login?returnUrl={returnUrl}"); } int.TryParse(Id, out int objId); if (objId != 0) { PageHeaderText = "Edit Station"; Station = await StationService.GetStation(int.Parse(Id)); } else { PageHeaderText = "Add Station"; Station = new Station { //AreaCode = "00", //NameStation = "XXX" }; } Areas = (await AreaService.GetAreas()).ToList(); }
public RealTimeMoisture(soildata raw) { Station station = StationService.GetStationByRawId(raw.StationID); stationId = station.id; stationName = station.stationName; stationType = station.stationType; subcenterName = station.subcenterName; longtitude = station.longtitude; latitude = station.latitude; datatime = raw.DataTime; voltage = raw.Voltage; if (!raw.Moisture10.HasValue) { errorCode = -1; moisture10 = -1; } else if (!raw.Moisture20.HasValue) { errorCode = -1; moisture20 = -1; } else if (!raw.Moistrue40.HasValue) { errorCode = -1; moisture40 = -1; } else { errorCode = 0; moisture10 = raw.Moisture10; moisture20 = raw.Moisture20; moisture40 = raw.Moistrue40; } }
/// <summary> /// gis所需墒情数据 /// </summary> /// <param name="subcenter"></param> /// <returns></returns> public static List <RealTimeMoisture> RealTimeMoisture(int subcenter) { LNRRDB ln = new LNRRDB(); Maintain mt = new Maintain(); DateTime now = DateTime.Now; List <RealTimeMoisture> ret = new List <RealTimeMoisture>(); List <string> stations = StationService.ListAllRawIDByTypes(new List <StationTypes> { StationTypes.soilStation }, subcenter); IEnumerable <soildata> records = CurrentService.ListRealSoil(ln, stations); // TODO 此处总是报错 //foreach (string id in stations) //{ // if (records.Any(i => (i.StationID) == id)) // { // soildata s = records.Where(i => (i.StationID) == id).OrderByDescending(r => r.DataTime).First(); // RealTimeMoisture temp = new Models.RealTimeMoisture(s); // if (temp != null) // ret.Add(temp); // } //} return(ret); }
public async Task Stations_Change() { // Arrange var service = new StationService(); var controller = new StationsController(service); var nowObject = new Station { CallSign = "2DayFM", Code = "2DayFM", City = "Sydney", State = "NSW" }; // Act var result = await controller.Put(20, nowObject); // Assert var okResult = result.Should().BeOfType <NoContentResult>().Subject; var station = service.Get(20); station.Id.Should().Be(20); station.CallSign.Should().Be("2DayFM"); station.Code.Should().Be("2DayFM"); station.City.Should().Be("Sydney"); station.State.Should().Be("NSW"); }
/// <summary> /// 实时墒情显示 /// </summary> /// <param name="nowTime"></param> /// <returns></returns> public static List <RealTimeSoil> RealTimeSoil(int subcenter) { using (LNRRDB ln = new LNRRDB()) { DateTime now = DateTime.Now; List <RealTimeSoil> ret = new List <RealTimeSoil>(); List <string> stations = StationService.ListAllRawIDByTypes(new List <StationTypes> { StationTypes.soilStation }, subcenter); IQueryable <soildata> records = CurrentService.ListRealSoil(ln, stations); foreach (string id in stations) { soildata s; if (records.Any(i => (i.StationID) == id)) { s = records.Where(i => (i.StationID) == id).OrderByDescending(r => r.DataTime).First(); } else { continue; } RealTimeSoil temp = new Models.RealTimeSoil(s); if (temp != null) { ret.Add(temp); } } return(ret); } }
private void SetDropdownsInViewBags() { var operationalIntervalService = new OperationalIntervalService(); var stationService = new StationService(); var lineService = new LineService(); ViewBag.Stations = stationService.GetStations() .OrderBy(a => a.StationName) .ToList(); ViewBag.Ois = operationalIntervalService.GetOperationalIntervals() .OrderBy(a => a.Name) .Select(a => new SelectListItem { Text = a.Name, Value = a.Id.ToString() }) .ToList(); ViewBag.Lines = lineService.getLines() .OrderBy(a => a.LineName) .Select(a => new SelectListItem { Text = a.LineName, Value = a.Id.ToString() }) .ToList(); }
/// <summary> /// 墒情数据查询,结构为(时间) /// </summary> /// <param name="fromTime"></param> /// <param name="toTime"></param> /// <param name="stationIds"></param> /// <returns></returns> public static QueryResult ListHourSoil_Standard(DateTime fromTime, DateTime toTime, string stationId) { //查询为空 if (stationId == null) { return(new QueryResult()); } //创建数据库对象 using (RWDB rw = new RWDB()) { using (Maintain mt = new Maintain()) { //获取数据 IQueryable <ST_SOIL_R> rainRecord = ListHourSoil_Standard(rw, fromTime, toTime, stationId); QueryResult result = new QueryResult(); List <ST_SOIL_R> singleStationRecord = new List <ST_SOIL_R>(); singleStationRecord = rainRecord.Where(r => r.STCD.Equals(stationId)).OrderByDescending(r => r.TM).ToList(); Station station = StationService.GetStationById(stationId); TimeRecord record = new TimeRecord { stationId = station.stationId, stationName = station.stationName, stationType = station.stationType }; foreach (var r in singleStationRecord) { //gm 20190221 TimeSoil ts = new TimeSoil(r.TM, null, r.SLM10, r.SLM20, r.SLM40); record.tsoils.Add(ts); } result.records.Add(record); return(result); } } }
public async Task GetFavoriteStation_GivenInvalidDefaultStationName_ThrowsArgumentException() { _stationOptions.Value.StationName = "InvalidStation"; var cut = new StationService(_bikeshareClientStub, _stationOptions, _logger); await Assert.ThrowsAsync <ArgumentException>(() => cut.GetFavoriteStation()); }
//Инъекция зависимостей в конструктор public AdminController(UnitOfWork unit) { rs = new RouteService(unit); ss = new StationService(unit); us = new UserService(unit); Unit = unit; }
/// <summary> /// contructor of RentBikeController /// </summary> public RentBikeController() { bikeService = new BaseBikeService(SQLConnecter.GetInstance()); stationService = new StationService(SQLConnecter.GetInstance()); cardService = new CardService(SQLConnecter.GetInstance()); transactionService = new TransactionService(SQLConnecter.GetInstance()); }
static void Main() { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //connect to database connecter = SQLConnecter.GetInstance(); //init services bikeService = new BikeService(connecter); cardService = new CardService(connecter); electricBikeService = new ElectricBikeService(connecter); stationService = new StationService(connecter); tandemService = new TandemService(connecter); transactionService = new TransactionService(connecter); userService = new UserService(connecter); //init controllers rentBikeController = new RentBikeController(); bikeStationController = new BikeStationController(); returnBikeController = new ReturnBikeController(); //init the presentation homePageForm = new HomePageForm(); stationDetailForm = new StationDetailForm(); bikeDetailForm = new BikeDetailForm(); cardInformationForm = new CardInformationForm(); listBikeForm = new ListBikeForm(); rentBikeForm = new RentBikeForm(); returnBikeForm = new ReturnBikeForm(); transactionInformationForm = new TransactionInformationForm(); Application.Run(homePageForm); }
/// <summary> /// gis所需雨水情数据 /// </summary> /// <param name="subcnter"></param> /// <returns></returns> public static List <RealTimeRainWater> RealTimeRainWater(int subcnter) { try { List <RealTimeRainWater> ret = new List <RealTimeRainWater>(); List <string> stations = StationService.ListStationRawIDAll(subcnter); List <CurrentData> records = ListRealHydro(stations); foreach (var c in records) { RealTimeRainWater temp = new Models.RealTimeRainWater(c); if (temp.datatime != null) { ret.Add(temp); } } return(ret); } catch (Exception e) { Console.WriteLine(e + ""); return(null); } }
public RealTimeHydro(CurrentData w) { using (Maintain mt = new Maintain()) { stationInfo = StationService.GetStationByRawId(w.StationID); waterInfo = w; string currentState = w.CurrentState; DateTime time = w.DataTime; DateTime now = DateTime.Now; switch (currentState) { case "EWarning": state = RealTimeState.Warning; break; case "EError": state = RealTimeState.Error; break; case "ENormal": if (time.AddHours(1.5) > now) { state = RealTimeState.Normal; } else if (time.AddHours(2.5) < now) { state = RealTimeState.TwoHalfHour; } else { state = RealTimeState.OneHalfHour; } break; } } }
public async Task GetAvailableStations_ReturnsAllAvialableStation() { var cut = new StationService(_bikeshareClientStub, _stationOptions, _logger); var stations = await cut.GetAllAvailableStations(); Assert.Equal(50, stations.Count()); }
public async Task GetFavoriteStation_GivenValidDefaultStationName_ReturnFavoriteStation() { var cut = new StationService(_bikeshareClientStub, _stationOptions, _logger); var station = await cut.GetFavoriteStation(); Assert.Equal(_defaultFavoriteStation, station.Name); }
//Инъекция зависимостей в конструктор public CashierController(UnitOfWork _unit) { unit = _unit; ts = new TicketService(_unit); rs = new RouteService(_unit); us = new UserService(_unit); ss = new StationService(_unit); }
public async Task <IActionResult> StationsAsync() { var Stations = await StationService.FindStations(); ViewBag.AllStation = Stations; return(View()); }
public void InitBindingLists() { SelectedStations = new BindingList <Station>(NewRoad.Stations.ToList()); AllStations = new BindingList <Station>(StationService.GetAllStations()); foreach (Station station in SelectedStations) { AllStations.Remove(AllStations.Where(s => s.Id == station.Id).SingleOrDefault()); } }
/// <summary> /// 河道水情数据查询 /// </summary> /// <param name="fromTime"></param> /// <param name="toTime"></param> /// <param name="stationIds"></param> /// <returns></returns> public static QueryResult ListHourWater_Standard(DateTime fromTime, DateTime toTime, string stationId) { //查询为空 if (stationId == null) { return(new QueryResult()); } //创建数据库对象 using (RWDB rw = new RWDB()) { QueryResult result = new QueryResult(); //获取数据 IQueryable <ST_RIVER_R> riverRecord = ListHourRiver_Standard(rw, fromTime, toTime, stationId); IQueryable <ST_RSVR_R> rsvrRecord = ListHourReservoir_Standard(rw, fromTime, toTime, stationId); if (riverRecord.Count() != 0) { //是河道水情站 List <ST_RIVER_R> singleStationRecord = new List <ST_RIVER_R>(); singleStationRecord = riverRecord.Where(r => r.STCD.Equals(stationId)).OrderByDescending(r => r.TM).ToList(); Station station = StationService.GetStationById(stationId); TimeRecord record = new TimeRecord { stationId = station.stationId, stationName = station.stationName, stationType = station.stationType }; foreach (var r in singleStationRecord) { TimeRiver tr = new TimeRiver(r.TM, r.Z, r.Q); record.trivers.Add(tr); } result.records.Add(record); } else if (rsvrRecord.Count() != 0) { //是水库水情站 //是河道水情站 List <ST_RSVR_R> singleStationRecord = new List <ST_RSVR_R>(); singleStationRecord = rsvrRecord.Where(r => r.STCD.Equals(stationId)).OrderByDescending(r => r.TM).ToList(); Station station = StationService.GetStationById(stationId); TimeRecord record = new TimeRecord { stationId = station.stationId, stationName = station.stationName, stationType = station.stationType }; foreach (var r in singleStationRecord) { TimeReservoir tr = new TimeReservoir(r.TM, r.RZ, r.W); record.treserviors.Add(tr); } result.records.Add(record); } else { //两个表都没有这个站点的数据 } return(result); } }
protected async Task Confirmation_Click(bool deleteConfirmed) { if (deleteConfirmed) { await StationService.DeleteStation(Station.Id); await OnObjDeleted.InvokeAsync(Station.Id); } }
public async Task GetFavoriteStation_GivenValidStationNameParameter_ReturnsFavoriteStation() { var cut = new StationService(_bikeshareClientStub, _stationOptions, _logger); var expectedStation = "Strandveikaia"; var station = await cut.GetFavoriteStation(expectedStation); Assert.Equal(expectedStation, station.Name); }
public async Task GetFavoriteStation_GivenInvalidStationNameParameter_ReturnsDefaultFavoriteStation() { var cut = new StationService(_bikeshareClientStub, _stationOptions, _logger); var expectedStation = _defaultFavoriteStation; var station = await cut.GetFavoriteStation("InvalidStation"); Assert.Equal(expectedStation, station.Name); }
protected void btnGetAccounts_DirectClick(object sender, Ext.Net.DirectEventArgs e) { Station station = new Station(); StationService service = new StationService(); Store str = grdStation.GetStore(); str.DataSource = Database.Session.QueryOver <Station>().Where(x => x.state == true).List(); str.DataBind(); }
static void Main(string[] args) { string configurationFile = "StationMatrix.csv"; string startStationName = "A"; string endStationName = "F"; string trainColor = string.Empty; for (int i = 0; i < args.Length; i++) { if (!args[i].StartsWith('-')) { continue; } switch (args[i].ToLower()) { case "-p": case "--path": configurationFile = args[i + 1]; break; case "-s": case "--start": startStationName = args[i + 1]; break; case "-e": case "--end": endStationName = args[i + 1]; break; case "-c": case "--color": trainColor = args[i + 1]; break; } } IStationConfigurationProvider stationConfigurationProvider = new StationConfigurationProvider(configurationFile); IStationService stationService = new StationService(stationConfigurationProvider); IOptimizationService optimizationService = new OptimizationService(stationService); List <Station> stations = optimizationService.OptimizeRoute(trainColor, startStationName, endStationName); if (stations == null) { Console.WriteLine($"No optimal route found"); } else { Console.WriteLine($"Optimal route found: {string.Join('>', stations.Select(s => s.Name).ToArray())}"); } Console.WriteLine("Press a key to finish"); Console.ReadLine(); }
public void StationServiceISFTest() { StationService journal = StationService.FromEDName("Facilitator"); StationService edsm = StationService.FromName("Interstellar Factors Contact"); Assert.AreEqual("Facilitator", edsm.edname); Assert.AreEqual("Interstellar Factors Contact", journal.invariantName); Assert.AreEqual(journal.edname, edsm.edname); Assert.AreEqual(journal.invariantName, edsm.invariantName); }
public ShoppingCartController() { boekingService = new BoekingService(); hotelService = new HotelService(); ritService = new RitService(); stationService = new StationService(); trajectService = new TrajectService(); treinTypeService = new TreinTypeService(); vakantieDagenService = new VakantieDagenService(); }
public HomeController() { this._alarmService = new AlarmService(); this._areaService = new AreaService(); this._stationService = new StationService(); this._deviceService = new DeviceService(); this._pointService = new PointService(); this._orderService = new OrderService(); this._valueService = new ValueService(); this._excelManager = new ExcelManager(); }
public void GetStationByName_IsNullStation_ShouldBeNullStation(string stationName) { //Arrange _stationConfigurationProviderMock.GetStations().Returns(_stationsRepository.Values.ToList()); IStationService stationService = new StationService(_stationConfigurationProviderMock); //Act Station station = stationService.GetStationByName(stationName); //Assert Assert.Null(station); }
private void SetStationsViewBag() { var stationService = new StationService(); ViewBag.Stations = stationService.GetStations().OrderBy(a => a.StationName) .Select(a => new SelectListItem { Value = a.StationId.ToString(), Text = a.StationName }).ToList(); }