Exemple #1
0
        public SuperService()
        {
            EmployeeService          = new EmployeeService();
            MaintenanceDetailService = new MaintenanceDetailService();
            MaintenanceService       = new MaintenanceService();
            PartService            = new PartService();
            PartUsageService       = new PartUsageService();
            ReportService          = new ReportService();
            ReservationFormService = new ReservationFormService();
            ReservationService     = new ReservationService();
            VehicleService         = new VehicleService();

            AdvisoryService          = new AdvisoryService();
            ContractService          = new ContractService();
            CourseService            = new CourseService();
            DepartmentService        = new DepartmentService();
            EnrollmentService        = new EnrollmentService();
            ProfessorContractService = new ProfessorContractService();
            ProfessorService         = new ProfessorService();
            ProfessorshipService     = new ProfessorshipService();
            ScheduleService          = new ScheduleService();
            SchoolService            = new SchoolService();
            SectionService           = new SectionService();
            StudentService           = new StudentService();
            TenureService            = new TenureService();
        }
Exemple #2
0
        private void Initialize(string url)
        {
            _serializerSettings = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                Converters        = new JsonConverter[]
                {
                    new Newtonsoft.Json.Converters.JavaScriptDateTimeConverter(),
                    new MaintenanceJsonConverter()
                }
            };

            Check.IsNotNullOrWhiteSpace(url, "ZabbixApi.url");

            _url        = url;
            _webClient  = new WebClient();
            _httpClient = new HttpClient();

            Actions            = new ActionService(this);
            Alerts             = new AlertService(this);
            ApiInfo            = new ApiInfoService(this);
            Applications       = new ApplicationService(this);
            Correlations       = new CorrelationService(this);
            DiscoveredHosts    = new DiscoveredHostService(this);
            DiscoveredServices = new DiscoveredServiceService(this);
            DiscoveryChecks    = new DiscoveryCheckService(this);
            DiscoveryRules     = new DiscoveryRuleService(this);
            Events             = new EventService(this);
            GraphItems         = new GraphItemService(this);
            GraphPrototypes    = new GraphPrototypeService(this);
            Graphs             = new GraphService(this);
            History            = new HistoryService(this);
            HostGroups         = new HostGroupService(this);
            HostInterfaces     = new HostInterfaceService(this);
            HostPrototypes     = new HostPrototypeService(this);
            Hosts               = new HostService(this);
            IconMaps            = new IconMapService(this);
            ServiceService      = new ServiceService(this);
            Images              = new ImageService(this);
            ItemPrototypes      = new ItemPrototypeService(this);
            Items               = new ItemService(this);
            LLDRules            = new LLDRuleService(this);
            Maintenance         = new MaintenanceService(this);
            Maps                = new MapService(this);
            MediaTypes          = new MediaTypeService(this);
            Proxies             = new ProxyService(this);
            ScreenItems         = new ScreenItemService(this);
            Screens             = new ScreenService(this);
            Scripts             = new ScriptService(this);
            TemplateScreenItems = new TemplateScreenItemService(this);
            TemplateScreens     = new TemplateScreenService(this);
            Templates           = new TemplateService(this);
            TriggerPrototypes   = new TriggerPrototypeService(this);
            Triggers            = new TriggerService(this);
            UserGroups          = new UserGroupService(this);
            GlobalMacros        = new GlobalMacroService(this);
            HostMacros          = new HostMacroService(this);
            Users               = new UserService(this);
            ValueMaps           = new ValueMapService(this);
        }
Exemple #3
0
 public VehiclesController(GIBDDContext context,
                           MaintenanceService maintenanceService, ILogger <VehiclesController> logger)
 {
     _context            = context;
     _maintenanceService = maintenanceService;
     _logger             = logger;
 }
        public void ServiceMustGet()
        {
            var service = new MaintenanceService(this.context);
            var result  = service.Get();

            Assert.NotNull(result);
        }
        // GET: Maintenance
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new MaintenanceService(userId);
            var model   = service.GetMaintenances();

            return(View(model));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationGroundService"/> class.
        /// </summary>
        public NotificationGroundService()
        {
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "Maint.NotificationGroundService";
            }

            MaintenanceService.Initialize();
        }
        private void initFertData(int produceId)
        {
            //1.施肥
            MaintenanceService mtser = new MaintenanceService();
            List <dynamic>     data  = mtser.queryFertilization(PubData.PRODUCT_ACTION_TYPE_P02, produceId);

            if (data.Count > 0)
            {
                dataGridFert.ItemsSource = data;
            }
        }
        private void initPestData(int produceId)
        {
            //施药
            MaintenanceService mtser = new MaintenanceService();
            List <dynamic>     datap = mtser.queryPestRecord(PubData.PRODUCT_ACTION_TYPE_P01, produceId);

            if (datap.Count > 0)
            {
                dataGridPest.ItemsSource = datap;
            }
        }
 public MaintenanceServiceTests()
 {
     MessageList            = MessageListStub.Get();
     _messageRepositoryMock = Substitute.For <IMessageRepository>();
     _messageRepositoryMock.AddMessage(Arg.Any <IRceMessage>())
     .Returns(Task.CompletedTask)
     .AndDoes(e => MessageList.AddRange(e.Args().Cast <IRceMessage>()));
     _messageRepositoryMock.RemoveMessages(Arg.Any <IEnumerable <Guid> >())
     .Returns(Task.CompletedTask)
     .AndDoes(e => MessageList.RemoveAll(f => ((IEnumerable <Guid>)e.Args().First()).Contains(f.MessageId)));
     _maintenanceService = new MaintenanceService(_messageRepositoryMock);
 }
Exemple #10
0
        public void MaintenanceService_GetAllAircraftDueForTireChange()
        {
            // Arrange
            var mtxSvc   = new MaintenanceService();
            var expected = new[] { 1, 3, 5 };

            // Act
            var actual = mtxSvc.GetAllAircraftDueForTireChange().Select(x => x.Id).ToArray();

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
Exemple #11
0
        public ApplicationViewModel()
        {
            db    = new GIBDDContext();
            repos = new DBReposSQL();
            //Vehicles = new ObservableCollection<Vehicle>
            //{
            //    new Vehicle { RegistrationNumber="А707ХХ" }
            //};
            LoadData();

            this.maintenanceService = new MaintenanceService(db);
        }
Exemple #12
0
        public async Task CreateAsync(CreateMaintenanceServiceViewModel input)
        {
            var maintenanceService = new MaintenanceService()
            {
                Name        = input.Name,
                ServiceDate = input.ServiceDate,
                PropertyId  = input.PropertyId,
                VendorId    = input.VendorId,
            };

            await this.maintenanceServicesRepository.AddAsync(maintenanceService);

            await this.maintenanceServicesRepository.SaveChangesAsync();
        }
        public ActionResult Create(MaintenanceCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new MaintenanceService(userId);

            service.CreateMaintenance(model);

            return(RedirectToAction("Index"));
        }
Exemple #14
0
        private void Initialize(string url)
        {
            Check.IsNotNullOrWhiteSpace(url, "ZabbixApi.url");

            _url        = url;
            _webClient  = new WebClient();
            _httpClient = new HttpClient();

            Actions            = new ActionService(this);
            Alerts             = new AlertService(this);
            ApiInfo            = new ApiInfoService(this);
            Applications       = new ApplicationService(this);
            DiscoveredHosts    = new DiscoveredHostService(this);
            DiscoveredServices = new DiscoveredServiceService(this);
            DiscoveryChecks    = new DiscoveryCheckService(this);
            DiscoveryRules     = new DiscoveryRuleService(this);
            Events             = new EventService(this);
            GraphItems         = new GraphItemService(this);
            GraphPrototypes    = new GraphPrototypeService(this);
            Graphs             = new GraphService(this);
            History            = new HistoryService(this);
            HostGroups         = new HostGroupService(this);
            HostInterfaces     = new HostInterfaceService(this);
            HostPrototypes     = new HostPrototypeService(this);
            Hosts               = new HostService(this);
            IconMaps            = new IconMapService(this);
            ITServiceService    = new ITServiceService(this);
            Images              = new ImageService(this);
            ItemPrototypes      = new ItemPrototypeService(this);
            Items               = new ItemService(this);
            LLDRules            = new LLDRuleService(this);
            Maintenance         = new MaintenanceService(this);
            Maps                = new MapService(this);
            Medias              = new MediaService(this);
            MediaTypes          = new MediaTypeService(this);
            Proxies             = new ProxyService(this);
            ScreenItems         = new ScreenItemService(this);
            Screens             = new ScreenService(this);
            Scripts             = new ScriptService(this);
            TemplateScreenItems = new TemplateScreenItemService(this);
            TemplateScreens     = new TemplateScreenService(this);
            Templates           = new TemplateService(this);
            TriggerPrototypes   = new TriggerPrototypeService(this);
            Triggers            = new TriggerService(this);
            UserGroups          = new UserGroupService(this);
            GlobalMacros        = new GlobalMacroService(this);
            HostMacros          = new HostMacroService(this);
            Users               = new UserService(this);
        }
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            MaintenanceService = await _context.MaintenanceServices.FirstOrDefaultAsync(m => m.Id == id);

            if (MaintenanceService == null)
            {
                return(NotFound());
            }

            ViewData["CurrencyTypeId"] = new SelectList(_context.CurrencyTypes.AsNoTracking(), "Id", "Name");
            return(Page());
        }
Exemple #16
0
        public async System.Threading.Tasks.Task Test8Async()
        {
            List <Log> cloudLog = new List <Log>();

            for (int i = 0; i < 10; i++)
            {
                Log log = new Log();
                log.FoodName = i.ToString();
                log.Date     = DateTime.Now;
                int[] w = { 1, 1 };
                log.WeatherList = new List <int>(w);
                cloudLog.Add(log);
            }
            List <Log> logs = new MaintenanceService(null, null, null, null, null, null, null).DeleteRecord(cloudLog, "1", DateTime.MinValue, 4);

            Assert.AreEqual(logs.Count, 9);
        }
Exemple #17
0
        public async System.Threading.Tasks.Task Test10Async()
        {
            List <Log> cloudLog = new List <Log>();
            List <Log> localLog = new List <Log>();

            for (int i = 0; i < 10; i++)
            {
                Log log = new Log();
                log.FoodName = i.ToString();
                log.Date     = DateTime.Now;
                cloudLog.Add(log);
                Log log1 = new Log();
                log.FoodName = "1";
                log.Date     = DateTime.Now;
                localLog.Add(log);
            }
            List <Log> logs = new MaintenanceService(null, null, null, null, null, null, null).InsertRecord(cloudLog, localLog, "1", DateTime.MaxValue, 4);

            Assert.AreEqual(logs.Count, 10);
        }
        public SendNotificationResponse SendNotification(SendNotificationRequest request)
        {
            try
            {
                Guid lRequestId = Guid.Empty;

                if (request.RequestId != "")
                {
                    lRequestId = new Guid(request.RequestId);
                }

                MaintenanceService.OnTrainNotification(
                    lRequestId,
                    request.NotificationId,
                    request.ElementId,
                    request.Parameter);
            }
            catch (System.Exception e)
            {
                LogManager.WriteLog(TraceType.EXCEPTION, e.Message, "PIS.Ground.Maintenance.NotificationGroundService.SendNotification", e, EventIdEnum.Maintenance);
            }

            return(new SendNotificationResponse());  //always empty response
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            DynamicParameters d    = new DynamicParameters();
            TabItem           item = tabControl.SelectedItem as TabItem;

            if ("ProductInfo".Equals(item.Header))//产品信息
            {
                //MessageBox.Show("产品信息");
                d.Add("produceId", produceId.SelectedValue);
                d.Add("productName", productName.Text.Trim());
                d.Add("orginDesc", orginDesc.Text.Trim());
                d.Add("remark", txtRemark.Text.Trim());
                d.Add("corpProductId", this.hproId.Text.Trim());

                ArchivesService aser = new ArchivesService();
                aser.doModify(d, hproId.Text);
                this.Close();
            }
            if ("GrowPeriod".Equals(item.Header))//生长期图片
            {
                MessageBox.Show("生长期图片");
            }
            if ("FertRecord".Equals(item.Header))//施肥记录
            {
                //MessageBox.Show("施肥记录");

                DynamicParameters df = new DynamicParameters();
                df.Add("productId", hproId.Text);
                df.Add("actionValue", actionValue.Text.Trim());
                df.Add("amount", amount.Text.Trim());
                df.Add("actionId", produceId.SelectedValue);
                df.Add("actionType", PubData.PRODUCT_ACTION_TYPE_P02);
                ComboBoxItem itm = harvestAmountUnit.SelectedItem as ComboBoxItem;
                df.Add("amountUnit", itm.Tag);
                df.Add("area", area.Text.Trim());
                df.Add("actionDate", Convert.ToDateTime(actionDate.Text).ToString("yyyy-MM-dd"));
                df.Add("actionPerson", actionPerson.Text.Trim());

                MaintenanceService mtaService = new MaintenanceService();
                mtaService.doAdd(df);

                initFertData(Convert.ToInt32(produceId.SelectedValue));
                //MessageBox.Show("保存成功!");
                //this.Close();
            }
            if ("PestRecord".Equals(item.Header))//施药记录
            {
                //MessageBox.Show("施药记录");

                DynamicParameters dy = new DynamicParameters();
                dy.Add("productId", hproId.Text);
                dy.Add("actionValue", actionValue2.Text.Trim());
                dy.Add("thinckNess", thinckNess.Text.Trim());
                dy.Add("amount", amount2.Text.Trim());
                dy.Add("actionId", produceId.SelectedValue);
                dy.Add("actionType", PubData.PRODUCT_ACTION_TYPE_P01);
                ComboBoxItem itm2 = amountUnit2.SelectedItem as ComboBoxItem;
                dy.Add("amountUnit", itm2.Tag);
                dy.Add("area", area2.Text.Trim());
                dy.Add("actionDate", Convert.ToDateTime(actionDate2.Text).ToString("yyyy-MM-dd"));
                dy.Add("actionPerson", actionPerson2.Text.Trim());

                MaintenanceService mtaService = new MaintenanceService();
                mtaService.doAddApplying(dy);

                initPestData(Convert.ToInt32(produceId.SelectedValue));
            }
            if ("EnvData".Equals(item.Header))//环境数据
            {
                MessageBox.Show("环境数据");
            }
            if ("ProductCert".Equals(item.Header))//产品认证
            {
                MessageBox.Show("产品认证");
            }
        }
 public MaintenancesController(MaintenanceService maintenanceService)
 {
     _maintenanceService = maintenanceService;
 }
Exemple #21
0
 public MaintenanceManager(RabbitMQMessageHandler messageHandler, MaintenanceService maintenanceService)
 {
     _messageHandler     = messageHandler;
     _maintenanceService = maintenanceService;
 }
Exemple #22
0
 public MaintenanceController(RabbitMQMessagePublisher messagePublisher, MaintenanceService maintenanceService)
 {
     _messagePublisher   = messagePublisher;
     _maintenanceService = maintenanceService;
 }
 public MaintenanceController(AppContextModel context)
 {
     _context           = context;
     maintenanceService = new MaintenanceService(_context);
 }
Exemple #24
0
        public async System.Threading.Tasks.Task Test13Async()
        {
            //weatherservice
            var weatherRootToReturn = new WeatherRoot();

            weatherRootToReturn.main          = new Main();
            weatherRootToReturn.main.temp     = "29";
            weatherRootToReturn.main.humidity = "30";
            var weatherServiceMock = new Mock <IWeatherService>();

            weatherServiceMock.Setup(w => w.GetWeatherAsync()).ReturnsAsync(weatherRootToReturn);
            var mockWeatherService = weatherServiceMock.Object;

            // loadjsonservice

            List <FoodInformation> fi = new List <FoodInformation>();

            for (int i = 0; i <= 40; i++)
            {
                FoodInformation food = new FoodInformation();
                food.Name   = i.ToString();
                food.Weight = new List <int>();
                for (int j = 0; j < 6; j++)
                {
                    food.Weight.Add(i);
                }
                fi.Add(food);
            }

            var loadJsonServiceMock = new Mock <ILoadJsonService>();

            loadJsonServiceMock.Setup(w => w.ReadJsonAsync()).ReturnsAsync(fi);
            var mockLoadJsonServiceMock = loadJsonServiceMock.Object;

            //userchoiceservice
            var userChoiceServiceMock = new Mock <IUserChoiceService>();

            userChoiceServiceMock.Setup(w => w.ReadJsonAsync()).ReturnsAsync(new List <Log>());
            var mockUserChoiceService = userChoiceServiceMock.Object;

            //userfacorservice
            var userFavorServiceMock = new Mock <IUserFavorService>();

            userFavorServiceMock.Setup(w => w.ReadJsonAsync()).ReturnsAsync(new List <FoodWeightChange>());
            var mockUserFavorService = userFavorServiceMock.Object;
            //log
            var        logServiceMock = new Mock <ILogService>();
            List <Log> localLog       = new List <Log>();

            for (int i = 0; i < 9; i++)
            {
                Log log = new Log();
                log.FoodName = i.ToString();
                log.Date     = new DateTime(2016, 6, 1);
                int[] t = { 1, 1 };
                log.WeatherList = new List <int>(t);
                int[] t1 = { -1, -1, 2, 2, 2, 2 };
                log.WeightChangeList = new List <int>(t1);
                localLog.Add(log);
            }
            logServiceMock.Setup(w => w.GetLogs()).Returns(localLog);
            var mockLogSerivce = logServiceMock.Object;

            //foodFavorSerivce
            var foodFavorSerivce     = new Mock <IFoodFavorService>();
            var mockFoodFavorService = foodFavorSerivce.Object;

            IRecommendationService ir = new RecommendationService(mockWeatherService, mockLoadJsonServiceMock,
                                                                  mockUserFavorService, mockLogSerivce, mockFoodFavorService);

            ir.InitRecommendationAsync();
            // mockOneDriveService
            var        oneDriveService = new Mock <IOneDriveService>();
            List <Log> k = new List <Log>();

            for (int i = 0; i <= 10; i++)
            {
                Log log = new Log();
                log.FoodName = i.ToString();
                log.Date     = new DateTime(2016, 6, 2);
                int[] t = { 1, 1 };
                log.WeatherList = new List <int>(t);
                int[] t2 = { 1, 1, 1, 1, 1, 1 };
                log.WeightChangeList = new List <int>(t2);
                k.Add(log);
            }
            oneDriveService.Setup(w => w.LoadLogAsync()).ReturnsAsync(k);
            oneDriveService.Setup(w => w.LoadFoodWeightAsync()).ReturnsAsync(new List <FoodWeightChange>());
            var mockOneDriveService = oneDriveService.Object;
            //mockLastTimeCommitService
            var      lastTimeCommitService = new Mock <ILastTimeCommitService>();
            DateTime dt = new DateTime(2016, 4, 1);

            lastTimeCommitService.Setup(w => w.ReadJsonAsync()).ReturnsAsync(dt);
            var mockLastTimeCommitService         = lastTimeCommitService.Object;
            MaintenanceService maintenanceService = new MaintenanceService(ir, mockUserChoiceService,
                                                                           mockUserFavorService, mockOneDriveService, mockLastTimeCommitService, mockLogSerivce,
                                                                           mockFoodFavorService);
            await maintenanceService.MaintenanceAsync();
        }
Exemple #25
0
        public void Execute()
        {
            var uow     = new UnitOfWork();
            var service = new MaintenanceService(null, uow);
            var text    = System.IO.File.ReadAllText(_filename, Encoding.Default);

            var maintenances = service.GetAll();

            var lines = text.Split(new[] { "\r\n" }, StringSplitOptions.None);

            foreach (var line in lines)
            {
                var columns = line.Split(';');

                if (columns.Length == 20)
                {
                    var titleNo = columns[0].Trim();
                    var descNo  = columns[1].Trim();
                    var titleSe = columns[3].Trim();
                    var descSe  = columns[4].Trim();

                    var daily    = columns[7].Trim() == "X";
                    var weekly   = columns[8].Trim() == "X";
                    var weekly2  = columns[9].Trim() == "X";
                    var monthly  = columns[10].Trim() == "X";
                    var monthly3 = columns[11].Trim() == "X";
                    var monthly6 = columns[12].Trim() == "X";
                    var yearly   = columns[13].Trim() == "X";
                    var rarely   = columns[14].Trim() == "X";

                    var vendor = columns[19];

                    Maintenance maintenanceNo = null;

                    if (titleNo.Length > 0)
                    {
                        maintenanceNo = maintenances.SingleOrDefault(m => m.Name.StartsWith(titleNo)) ?? new Maintenance();

                        maintenanceNo.Name               = titleNo;
                        maintenanceNo.Description        = descNo;
                        maintenanceNo.IntervalDaily      = daily;
                        maintenanceNo.IntervalWeekly     = weekly;
                        maintenanceNo.IntervalWeekly2    = weekly2;
                        maintenanceNo.IntervalMonthly    = monthly;
                        maintenanceNo.IntervalMonthly3   = monthly3;
                        maintenanceNo.IntervalHalfYearly = monthly6;
                        maintenanceNo.IntervalYearly     = yearly;
                        maintenanceNo.IntervalRarely     = rarely;
                        maintenanceNo.LanguageId         = 1;
                        maintenanceNo.Vendor             = FindOrCreateVendor(vendor, uow);

                        service.Create(maintenanceNo);
                    }

                    if (titleSe.Length > 0)
                    {
                        var maintenanceSe = new Maintenance
                        {
                            Name               = titleSe,
                            Description        = descSe,
                            IntervalDaily      = daily,
                            IntervalWeekly     = weekly,
                            IntervalWeekly2    = weekly2,
                            IntervalMonthly    = monthly,
                            IntervalMonthly3   = monthly3,
                            IntervalHalfYearly = monthly6,
                            IntervalYearly     = yearly,
                            IntervalRarely     = rarely,
                            TranslatedFrom     = maintenanceNo,
                            LanguageId         = 2,
                            Vendor             = FindOrCreateVendor(vendor, uow)
                        };

                        service.Create(maintenanceSe);

                        if (maintenanceNo != null)
                        {
                            maintenanceNo.Translations.Add(maintenanceSe);
                        }
                    }
                }
            }

            try
            {
                uow.Commit();
            }
            catch (DbEntityValidationException e)
            {
            }
            Console.ReadKey();
        }
 private MaintenanceService EstablishMaintenanceService()
 {
     var userId = Guid.Parse(User.Identity.GetUserId());
     var service = new MaintenanceService(userId);
     return service;
 }