public JobCall(IStructure originStructure, IStructure targetStructure, Item item, JobController jobController) { this.jobController = jobController; setOriginStructure(originStructure); setTargetStructure(targetStructure); setItem(item); }
private async Task UpdateJobsAsync() { timer.Stop(); foreach (var job in currentJobs.Values) { try { var idrac = new JobController(job.Server); var updatedJob = await idrac.GetJobAsync(job.Job.Id); currentJobs.AddOrUpdate(job.Job.Id, new ServerJob() { Server = job.Server, Job = updatedJob, SerialNumber = job.SerialNumber }, (key, existingVal) => { existingVal.Job.Message = updatedJob.Message; existingVal.Job.PercentComplete = updatedJob.PercentComplete; existingVal.Job.JobState = updatedJob.JobState; return(existingVal); }); } catch (Exception ex) { OutputTextBox.AppendText(string.Format("Falha ao obter dados de {0} {1}\n", job.Server, ex.Message)); timer.Start(); return; } } JobsDataGrid.ItemsSource = currentJobs.Values; timer.Start(); }
public void DeleteCorrectIdTest() { var mockRepository = new Mock <IJobService>(); var mockIMapper = new Mock <IMapper>(); var categoryServiceRepository = new Mock <ICategoryService>(); var cityServiceCategory = new Mock <ICityService>(); var ITypeJobService = new Mock <ITypeJobService>(); var IRepositoryService = new Mock <IRepositoryImage>(); var controller = new JobController(mockRepository.Object, categoryServiceRepository.Object, cityServiceCategory.Object, ITypeJobService.Object, mockIMapper.Object, IRepositoryService.Object); int id = 10000; Task <IActionResult> ActionResult = controller.Delete(id); try { NotFoundResult contentResult = (NotFoundResult)ActionResult.Result; mockRepository.Setup(x => x.Remove(id)).Returns(Task.CompletedTask); Assert.NotNull(contentResult); Assert.Equal(404, contentResult.StatusCode); } catch (Exception ex) { OkObjectResult contentResult = (OkObjectResult)ActionResult.Result; mockRepository.Setup(x => x.Remove(id)).Returns(Task.CompletedTask); Assert.NotNull(contentResult); Assert.Equal(200, contentResult.StatusCode); } }
public static void Init() { GroupController.LoadGroups(); VehicleController.LoadVehicles(); PropertyController.LoadProperties(); JobController.LoadJobs(); }
protected void JobGridView_RowCommand(Object sender, GridViewCommandEventArgs e) { JobController control = new JobController(); GridViewRow row = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow; currentJobListForm.Visible = false; NewJobButton.Visible = false; jobInfo.Visible = true; JobNumberLabel.Text = row.Cells[0].Text; CustomerLabel.Text = row.Cells[4].Text; ContactLabel.Text = row.Cells[5].Text; List <ServiceDetailPoco> serviceDetail = control.ListServiceDetails(int.Parse(JobNumberLabel.Text)); if (e.CommandName == "CurrentJob") { pageTitle.InnerHtml = "Current Job"; currentJobForm.Visible = true; CurrentJobGridView.DataSource = serviceDetail; CurrentJobGridView.DataBind(); } else if (e.CommandName == "CurrentJobService") { pageTitle.InnerHtml = "Current Job Service Details"; currentJobService.Visible = true; ServicesGridView.DataSource = serviceDetail; ServicesGridView.DataBind(); } }
public void Createjob(Client player, int characterId, int level, int cost, JobType type) { if (!AdminController.AdminRankCheck(player, "createjob")) { return; } CharacterController characterController = player.getData("CHARACTER"); var jobData = new Data.Job { CharacterId = characterId, Level = level, Cost = cost, Type = type, PosX = player.position.X, PosY = player.position.Y, PosZ = player.position.Z, OwnerName = characterController.Character.Name }; var jobController = new JobController(jobData); ContextFactory.Instance.Job.Add(jobData); ContextFactory.Instance.SaveChanges(); jobController.CreateWorldEntity(); player.sendChatMessage("~g~[СЕРВЕР]: ~w~ Добавлена работа: " + jobController.Type()); }
protected void Page_Load(object sender, EventArgs e) { var newjob = Request.QueryString["job"]; if (!Request.IsAuthenticated) { Response.Redirect("~/Account/Login.aspx"); } else if (newjob == "0") { UserFullName.Text = User.Identity.Name.ToString(); } else { CustomerDDL.Visible = false; UserFullName.Text = User.Identity.Name.ToString(); JobID.Text = Request.QueryString["id"]; CustomerName.Text = Request.QueryString["name"]; ContactNumber.Text = Request.QueryString["contact"]; JobController sysmgr = new JobController(); int jobId = int.Parse(JobID.Text); JobServiceGridView.DataSource = sysmgr.CurrentJobDetail(jobId); JobServiceGridView.DataBind(); } }
protected void CurrentJobGridView_RowCommand(Object sender, GridViewCommandEventArgs e) { JobController control = new JobController(); GridViewRow row = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow; List <ServiceDetailPoco> serviceDetail = control.ListServiceDetails(int.Parse(JobNumberLabel.Text)); int serviceDetailID = int.Parse(CurrentJobGridView.DataKeys[row.RowIndex].Value.ToString()); if (serviceDetail.Count > 1) { MessageUserControl.TryRun(() => { control.DeleteServiceDetail(serviceDetailID); }, "Service Deleted", "Service was successfully removed"); serviceDetail = control.ListServiceDetails(int.Parse(JobNumberLabel.Text)); CurrentJobGridView.DataSource = serviceDetail; CurrentJobGridView.DataBind(); } else { MessageUserControl.TryRun(() => { int jobId = int.Parse(JobNumberLabel.Text); control.DeleteJob(jobId, serviceDetailID); currentJobListForm.Visible = true; currentJobForm.Visible = false; NewJobButton.Visible = true; jobInfo.Visible = false; JobGridView.DataSource = control.ListCurrentJobs(); JobGridView.DataBind(); }, "Job Deleted", "All services removed job has been deleted"); } }
protected override void OnStart(string[] args) { // Busca os parâmetros de execução NameValueCollection taskParams = PrintLogContext.GetTaskParams(); // Caso não consiga recuperar os parâmetros de execução, avisa que o XML // é inválido e para o serviço if (taskParams == null) { String stopReason = "XML inválido. Verifique se a instalação foi executada corretamente."; if (EventLog.SourceExists("Print Log Router")) { EventLog.WriteEntry("Print Log Router", "Parando o serviço... " + stopReason); } this.Stop(); return; } // Inicia a execução double interval = double.Parse(taskParams["interval"]); List <IPeriodicTask> taskList = new List <IPeriodicTask>(); taskList.Add(new DeviceDiscoverer()); taskList.Add(new PrintLogRoutingTask()); jobController = new JobController(taskList, taskParams, null, interval); jobController.Start(); // Agenda o mecanismo de reinicio do serviço para daqui a 5 horas Timer timeToLive = new Timer(17999000); timeToLive.Elapsed += new ElapsedEventHandler(KickService); timeToLive.Start(); }
public void Setup() { _mockRepository = new Mock <IJobRepository>(); var config = new MapperConfiguration(opts => { opts.AddProfile(new JobProfile()); }); var mapper = config.CreateMapper(); _jobController = new JobController(_mockRepository.Object, mapper); var testJobsList = new List <Job>() { new Job { Priority = 1, Name = "Write high-quality code!" }, new Job { Priority = 2, Name = "Read book about Angular" } }; _mockRepository.Setup(j => j.GetJobs()).Returns(testJobsList); }
public void AdminApplies_ShouldRenderAdminAppliesViewModel() { // Arrange Mapper.Initialize(cfg => { cfg.CreateMap <Applies, ApplyViewModel>(); cfg.CreateMap <ApplyViewModel, Applies>(); }); var mockedMapper = new Mock <IMapper>(); var mockedUsersService = new Mock <IUsersService>(); var mockedAppliesService = new Mock <IAppliesService>(); var controller = new JobController(mockedAppliesService.Object, mockedMapper.Object, mockedUsersService.Object); var apply = new Applies { Id = Guid.NewGuid() }; var appliesCollection = new List <Applies>() { apply }; mockedAppliesService.Setup(c => c.GetAll()).Returns(appliesCollection.AsQueryable()); //Act and Assert controller .WithCallTo(c => c.AdminApplies()) .ShouldRenderView("AdminApplies"); }
public void TryApplyPendingEdits() { if (dying) { return; } Assert.IsTrue(loaded); if (pendingEdits.Count > 0 && blockReaders == 0 && !blockWriter) { int c = pendingEdits.Count; while (c-- > 0) // just incase setblock fails, prob wont happen tho { BlockEdit e = pendingEdits.Dequeue(); SetBlock(e.x, e.y, e.z, e.block); } if (!NeighborsLoaded() || !IsLocalGroupFreeForMeshing()) { update = true; } else // slam out job right away if you can { update = false; lightUpdate = false; JobController.StartMeshJob(this); } } }
public void ManageEmployees_ShouldRenderManageEmployeesViewModel() { // Arrange Mapper.Initialize(cfg => { cfg.CreateMap <User, UserViewModel>(); cfg.CreateMap <UserViewModel, User>(); }); var mockedMapper = new Mock <IMapper>(); var mockedUsersService = new Mock <IUsersService>(); var mockedAppliesService = new Mock <IAppliesService>(); var controller = new JobController(mockedAppliesService.Object, mockedMapper.Object, mockedUsersService.Object); var user = new User { }; var usersCollection = new List <User>() { }; mockedUsersService.Setup(c => c.GetAll()).Returns(usersCollection.AsQueryable()); //Act and Assert controller .WithCallTo(c => c.ManageEmployees()) .ShouldRenderView("ManageEmployees"); }
public void Reject_ShouldRedirectToIndexHome() { // Arrange var mockedMapper = new Mock <IMapper>(); var mockedUsersService = new Mock <IUsersService>(); var mockedAppliesService = new Mock <IAppliesService>(); var controller = new JobController(mockedAppliesService.Object, mockedMapper.Object, mockedUsersService.Object); Guid id = Guid.NewGuid(); var apply = new Applies { Id = id }; var appliesCollection = new List <Applies>() { apply }; mockedAppliesService.Setup(c => c.GetAll()).Returns(appliesCollection.AsQueryable()); mockedAppliesService.Setup(c => c.Delete(apply)); //Act and Assert controller .WithCallTo(c => c.Reject(id)) .ShouldRedirectTo((HomeController c) => c.Index()); }
protected void AddServiceButton_Click(object sender, EventArgs e) { try { Job item = new Job(); item.CustomerID = int.Parse(CustomerDDL.SelectedValue); item.JobDateIn = DateTime.Now; item.JobDateStarted = DateTime.Now; item.EmployeeID = int.Parse("3"); item.ShopRate = int.Parse("55"); item.StatusCode = "I"; item.VehicleIdentification = "vinaladlfmsdfm1234"; JobController sysmgr = new JobController(); int newjob = sysmgr.Job_Add(item); JobServiceGridView.DataBind(); } catch (Exception ex) { } }
private void InitializeJob(Object sender, ElapsedEventArgs e) { // Verifica se o job já foi iniciado if (jobController != null) { startupTrigger.Stop(); return; } // Abre a conexão com o banco DataAccess dataAccess = DataAccess.Instance; dataAccess.MountConnection(FileResource.MapDesktopResource("DataAccess.xml"), DatabaseEnum.PrintAccounting); dataAccess.OpenConnection(); // Busca os parâmetros de execução no banco ApplicationParamDAO applicationParamDAO = new ApplicationParamDAO(dataAccess.GetConnection()); Dictionary <String, NameValueCollection> appParams = applicationParamDAO.GetParamsGroupByTask(); double interval = Double.Parse(appParams["reportMailing"]["interval"]); // Fecha a conexão com o banco dataAccess.CloseConnection(); // Cria a lista sem nenhum parâmetro ( a classe reportMailingTask não necessita parâmetros por enquanto) NameValueCollection taskParams = new NameValueCollection(); IPeriodicTask reportMailingTask = new ReportMailingTask(); jobController = new JobController(reportMailingTask, taskParams, dataAccess, interval); jobController.Start(); }
public void RenderDefaultViewWithExpectedJobViewModel() { // Arrange var mappingService = new Mock <IMappingService>(); var jobService = new Mock <IJobService>(); var userService = new Mock <IUserService>(); var jobController = new JobController(mappingService.Object, jobService.Object, userService.Object); int?jobId = 10; var job = new Job(); jobService.Setup(j => j.GetJobById(It.IsAny <int>())).Returns(job); var jobViewModelId = 10; var jobViewModel = new JobViewModel() { Id = jobViewModelId }; mappingService.Setup(m => m.Map <JobViewModel>(job)).Returns(jobViewModel); // Act & Assert jobController .WithCallTo(h => h.Details(jobId)) .ShouldRenderDefaultView() .WithModel <JobViewModel>(viewModel => { Assert.AreEqual(jobViewModel, viewModel); Assert.AreEqual(jobViewModelId, viewModel.Id); }); }
private void InitializeJob(Object sender, ElapsedEventArgs e) { // Verifica se o job já foi iniciado if (jobController != null) { startupTrigger.Stop(); return; } // Abre a conexão com o banco DataAccess dataAccess = DataAccess.Instance; dataAccess.MountConnection(FileResource.MapDesktopResource("DataAccess.xml"), DatabaseEnum.PrintAccounting); dataAccess.OpenConnection(); // Busca os parâmetros de execução no banco ApplicationParamDAO applicationParamDAO = new ApplicationParamDAO(dataAccess.GetConnection()); NameValueCollection taskParams = applicationParamDAO.GetTaskParams("printLogImport"); double interval = double.Parse(taskParams["interval"]); // Fecha a conexão com o banco dataAccess.CloseConnection(); IPeriodicTask printLogImportTask = new PrintLogImportTask(); jobController = new JobController(printLogImportTask, taskParams, dataAccess, interval); jobController.Start(); }
public void Can_Save_Valid_Changes() { // Arrange - create mock repository Mock <IJobRepository> mock = new Mock <IJobRepository>(); Mock <IItemRepository> mockitems = new Mock <IItemRepository>(); List <AppUser> _users = new List <AppUser> { new AppUser { EngID = 1 }, new AppUser { EngID = 2 } }; Mock <UserManager <AppUser> > mockusers = MockUserManager <AppUser>(_users); // Arrange - create mock temp data Mock <ITempDataDictionary> tempData = new Mock <ITempDataDictionary>(); // Arrange - create the controller JobController target = new JobController(mock.Object, mockusers.Object) { TempData = tempData.Object }; // Arrange - create a Job Job Job = new Job { Name = "Test" }; // Act - try to save the Job IActionResult result = target.Edit(Job.JobID); }
public void Setup() { this.jobsService = MockRepository.GenerateMock <IJobsService>(); this.jobController = new JobController(this.jobsService); this.jobViewModel = new JobsViewModel { Page = 1, Jobs = null, Location = "testLocation", Description = "testDescription", FullTime = "true" }; jobList = new List <Job>(); jobViewModel = new JobsViewModel { Jobs = jobList, Description = "testDescription", Location = "testLocation", FullTime = "true", Page = 1 }; jobTask = Task <IJobsViewModel> .Factory.StartNew(() => new JobsViewModel { Page = 1, Jobs = null, Location = "model", Description = "testDescription", FullTime = "true" }); }
private async Task UpdateJobsAsync() { timer.Stop(); foreach (ServerJob job in currentJobs.Values) { try { var idrac = new JobController(job.Server); var updatedJob = await idrac.GetJobAsync(job.Job.Id); currentJobs.AddOrUpdate(job.Job.Id, new ServerJob() { Server = job.Server, Job = updatedJob, SerialNumber = job.SerialNumber }, (key, existingVal) => { existingVal.Job.Message = updatedJob.Message; existingVal.Job.PercentComplete = updatedJob.PercentComplete; existingVal.Job.JobState = updatedJob.JobState; return(existingVal); }); } catch { OutputTextBox.AppendText("Falha ao atualizar status dos Jobs\n"); timer.Start(); return; } } JobsDataGrid.ItemsSource = currentJobs.Values; timer.Start(); }
/// <summary> /// Однократный ручной запуск заданий. /// </summary> private static int RunJobsManually ( string[] args ) { string selectedJobName = null; if (args.Length > 1) { selectedJobName = args[1]; } HostLogger.UseLogger ( new NLogLogWriterFactory.NLogHostLoggerConfigurator() ); try { JobController.RunJobsManually(selectedJobName); } catch (Exception exception) { Console.WriteLine(exception.ToString()); return(1); } return(0); }
// Updates the chunk based on its contents // returns whether or not a meshing happens public bool UpdateChunk() { if (!loaded || dying || !NeighborsLoaded()) { return(false); } if (!builtStructures && IsLocalGroupFreeForStructuring()) // build structures like trees and such if you havent yet { JobController.StartStructureJob(this); } else if ((sunBFS.Count > 0 || sunRBFS.Count > 0) && IsLocalGroupFreeForMeshing()) { lightUpdate = false; JobController.StartSunlightJob(this); } else if (lightUpdate && !update && JobController.CanStartLightJob() && IsLocalGroupFreeToUpdateLights()) { lightUpdate = false; JobController.StartLightUpdateJob(this); } else if (update && IsLocalGroupFreeForMeshing()) { update = false; lightUpdate = false; JobController.StartMeshJob(this); return(true); } return(false); }
public void StartJobKeyEvent(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { var now = StartTimer(); JobController.StartJob(SelectedJobType); } }
public void Index() { // Arrange JobController controller = new JobController(); // Assert Assert.AreEqual("Your Job Page", controller.ViewBag.Message); }
void OnTriggerStay2D(Collider2D col) { JobController job = col.gameObject.GetComponent <JobController> (); if (!job.dragging) { job.isSpawn = false; } }
public async Task IndexAsync() { var controller = new JobController(); var result = await controller.Index(1) as ViewResult; var model = (Listing)result.Model; Assert.IsNotNull(result); Assert.IsNotNull(model); }
protected void PresetButton_Click(object sender, EventArgs e) { JobController sysmgr = new JobController(); int presetid = int.Parse(PresetDDL.SelectedValue); StandardJob job = sysmgr.GetPresetsById(presetid); Description.Text = job.Description; Hours.Text = job.StandardHours.ToString(); }
public Jobs(JobController jobC) { jobController = jobC; InitializeComponent(); foreach (City regionCity in jobController.Regions) { lstRegions.Items.Add(regionCity.CityName); } jobController.commandsSplitting(); }
private void DataGridView_ButtonClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataGridView1.Columns["delete_btn_column"].Index) { var row = dataGridView1.Rows[e.RowIndex]; int id = Convert.ToInt32(row.Cells[3].Value); JobController jobController = new JobController(); jobController.Delete(id); } }
public void Details() { // Arrange JobController controller = new JobController(); // Act ViewResult result = controller.Details(1045) as ViewResult; // Assert Assert.AreEqual("Your Job Detail Page", controller.ViewBag.Message); }
public DoWork(JobController jcon) { InitializeComponent(); jCon = jcon; foreach (var c in Services.Providers) { Sources.TabPages.Add( new TabPage { Name = Enum.GetName(typeof(Services.Supported), c.Value.InternalID), Text = c.Value.DisplayedName } ); } }
private void morningJobsToolStripMenuItem_Click(object sender, EventArgs e) { JobController jobController=new JobController(); if (morningJobs == null) { morningJobs = new Jobs(jobController); morningJobs.MdiParent = this; morningJobs.FormClosed += new FormClosedEventHandler(morningJobs_FormClosed); morningJobs.Show(); morningJobs.WindowState = FormWindowState.Maximized; } else { morningJobs.Activate(); //morningJobs.Show(); } }
private void btnStart_Click(object sender, EventArgs e) { string path = txtPath.Text; if (Directory.Exists(path)) { WinRegistry.SetValue(WinRegistry.Keys.DefaultPath, path); WinRegistry.SetValue(WinRegistry.Keys.GroupByAlbum, chkGroup.Checked); WinRegistry.SetValue(WinRegistry.Keys.RecurseTraversing, chkRecurse.Checked); WinRegistry.SetValue(WinRegistry.Keys.SkipExisting, chkSkipExistingArt.Checked); var bw = new BackgroundWorker(); var jcon = new JobController(path, chkGroup.Checked, chkRecurse.Checked, chkSkipExistingArt.Checked); jcon.WorkerInstance = bw; var panel = new Panel(); panel.Size = this.Size; panel.Location = new Point(0, 0); this.Controls.Add(panel); panel.BringToFront(); var message = new Label(); message.TextAlign = ContentAlignment.MiddleCenter; message.Location = new Point(0, 0); message.Size = this.Size; this.Controls.Add(message); message.BringToFront(); bw.DoWork += jcon.FillFilesStack; bw.WorkerReportsProgress = true; bw.ProgressChanged += (o, args) => message.Text = Verbal.FallThrough + Environment.NewLine + args; bw.RunWorkerAsync(); while (bw.IsBusy) { Application.DoEvents(); } message.Location = new Point(0, -30); var pg = new ProgressBar(); pg.Maximum = 100; pg.Size = new Size(this.Width - 30, 15); pg.Location = new Point(15, this.Height / 2 - 8); this.Controls.Add(pg); pg.BringToFront(); bw = new BackgroundWorker(); jcon.WorkerInstance = bw; bw.WorkerReportsProgress = true; bw.DoWork += jcon.GatherJobs; bw.ProgressChanged += (o, args) => { pg.Value = args.ProgressPercentage; message.Text = (string)args.UserState; }; bw.RunWorkerAsync(); while (bw.IsBusy) { Application.DoEvents(); } this.Controls.Remove(pg); this.Controls.Remove(message); this.Controls.Remove(panel); if (jcon.JobsCount > 0) { (new Thread(() => (new DoWork(jcon)).ShowDialog())).Start(); this.Close(); } else { MessageBox.Show(Verbal.AllFilesFiltered); } } else MessageBox.Show(Verbal.DirNotExists); }