Example #1
0
        public static void Initialize()
        {
            var dbName = ConfigurationManager.AppSettings["dbName"];
            var database = new MongoClient().GetServer().GetDatabase(dbName);

            // Users
            var users = new UserService(database);

            if (!users.Read().Any(u => u.email == "*****@*****.**"))
            {
                users.Create(new User
                {
                    email = "*****@*****.**",
                    name = "Authenticated User"
                }, "correct");
            }

            // Jobs
            var jobs = new JobService(database);

            if (!jobs.Read().Any())
            {
                jobs.Create(new Job
                {
                    name = "Honeybadger",
                    description = "It is primarily a carnivorous species and has few natural predators because of its thick skin and ferocious defensive abilities.",
                    words = 365
                });
            }
        }
Example #2
0
 public JobService getJobService()
 {
     if (jobService == null)
     {
         jobService = new JobServiceImpl();
     }
     return jobService;
 }
 private void LoadJobs()
 {
     var jobSvc = new JobService(MyConfiguration, null,
                                 MyOAuthKeyService);
     jobSvc.GetRange(MyCompanyFile, "$filter=IsHeader eq false", MyCredentials, OnJobComplete, OnError);
 }
Example #4
0
 public JobsController(JobService service)
 {
     Jobs = service;
 }
Example #5
0
        public JsonResult RemoveJobFromMarket(int marketJobId)
        {
            var result = JobService.RemoveMarketJob(marketJobId);

            return(result.IsSuccess ? Json(new { Success = true }) : Json(new { Success = false, ErrorMsg = result.ErrorMessage }));
        }
Example #6
0
 public AttachmentsController(JobService jobs, AttachmentService attachments)
 {
     Jobs = jobs;
     Attachments = attachments;
 }
Example #7
0
 public JobsController(JobService service)
 {
     Jobs = service;
 }
Example #8
0
 public RegisterJob()
 {
     InitializeComponent();
     _service = new JobService();
 }
Example #9
0
 public BackgroundContextProvider(JobService parent)
 {
     _parent = parent;
 }
Example #10
0
 public static void AddSchedule <T>(JobService <T> service) where T : IJob
 {
     service.AddJobToSchedule(Scheduler);
 }
Example #11
0
 public JobController(JobRepository jobRepository, RequestJobRepository requestJobRepository, JobService jobService, JWTService jWTService, LevenshteinService levenshteinService, IBackgroundQueue <AddJob> queue, DanhSachDNJobRepository danhSachDNJobRepository, CacheService cacheService)
 {
     this.jobRepository        = jobRepository;
     this.requestJobRepository = requestJobRepository;
     this.jobService           = jobService;
     this.jWTService           = jWTService;
     this.levenshteinService   = levenshteinService;
     this.queue = queue;
     this.danhSachDNJobRepository = danhSachDNJobRepository;
     this.cacheService            = cacheService;
 }
Example #12
0
        public OIMOversightDashboardController(CAPAService capaService, SWAService swaService, WILocalService wiLocalService, JobService jobService)
        {
            GridDataChecklist.Title = "Open OIM Oversight Checklists";
            ChecklistType           = "RO";
            ChecklistSubType        = "OIM";
            GridDataChecklist       = new GridData(oapChecklistGridName, "OIMOversightDashboard", "RigChecklists", "Open OIM Oversight Checklists", "AddNewRigChecklist", "Add Checklist", "search checklists", initializeCallBack: true)
            {
                EditController = "OIMOversight"
            };

            this.capaService    = capaService;
            this.swaService     = swaService;
            this.wiLocalService = wiLocalService;
            this.jobService     = jobService;
        }
Example #13
0
        public void GetJobsWithMatchedCandidate_MultipleJobMultipleCandidates_MatchCandidateToRightJob()
        {
            var candidateClient = Substitute.For <ICandidateClient>();
            var jobClient       = Substitute.For <IJobClient>();

            IList <CandidateResponse> candidates = new List <CandidateResponse>
            {
                new CandidateResponse
                {
                    CandidateId = 1,
                    Name        = "Mr Potato",
                    SkillTags   = "Angular7, SqlServer"
                },
                new CandidateResponse
                {
                    CandidateId = 2,
                    Name        = "Mr Beans",
                    SkillTags   = "React, NodeJs"
                },
                new CandidateResponse
                {
                    CandidateId = 3,
                    Name        = "Thomas",
                    SkillTags   = "Angular7, DotNetCore"
                }
            };

            candidateClient.GetAll().Returns(candidates);


            IList <JobResponse> jobsResponse = new List <JobResponse>
            {
                new JobResponse
                {
                    JobId   = 1,
                    Company = "JobAdder",
                    Skills  = "Angular7, DotNetCore"
                },
                new JobResponse
                {
                    JobId   = 2,
                    Company = "Company2",
                    Skills  = "MVC, SqlServer"
                }
            };

            jobClient.GetAll().Returns(jobsResponse);


            var sut = new JobService(jobClient, candidateClient);
            var jobsWithMatchedCandidate = sut.GetJobsWithMatchedCandidates();

            Assert.Equal(2, jobsWithMatchedCandidate.Count);

            var company1Candidates = jobsWithMatchedCandidate[0].MatchedCandidates;

            Assert.Equal(2, company1Candidates.Count);
            company1Candidates[0].CandidateId  = 3;
            company1Candidates[0].MatchedScore = 398;

            company1Candidates[1].CandidateId  = 1;
            company1Candidates[1].MatchedScore = 200;

            var company2Candidates = jobsWithMatchedCandidate[1].MatchedCandidates;

            Assert.Equal(1, company2Candidates.Count);
            company2Candidates[0].CandidateId  = 1;
            company2Candidates[0].MatchedScore = 198;
        }
Example #14
0
        public void GetJobsWithMatchedCandidate_MultipleCandidates_BestScoreOnTop()
        {
            var candidateClient = Substitute.For <ICandidateClient>();
            var jobClient       = Substitute.For <IJobClient>();

            IList <CandidateResponse> candidatesResponse = new List <CandidateResponse>
            {
                new CandidateResponse
                {
                    CandidateId = 1,
                    Name        = "Mr Potato",
                    SkillTags   = "Angular7, React"
                },
                new CandidateResponse
                {
                    CandidateId = 2,
                    Name        = "Mr Beans",
                    SkillTags   = "React, DotNetCore"
                },
                new CandidateResponse
                {
                    CandidateId = 3,
                    Name        = "Thomas",
                    SkillTags   = "Angular7, DotNetCore"
                }
            };

            candidateClient.GetAll().Returns(candidatesResponse);


            IList <JobResponse> jobsResponse = new List <JobResponse>
            {
                new JobResponse
                {
                    JobId   = 1,
                    Company = "JobAdder",
                    Skills  = "Angular7, DotNetCore"
                }
            };

            jobClient.GetAll().Returns(jobsResponse);


            var sut = new JobService(jobClient, candidateClient);
            var jobsWithMatchedCandidatesDto = sut.GetJobsWithMatchedCandidates();

            Assert.Equal(1, jobsWithMatchedCandidatesDto.Count);

            var matchedCandidatesDto = jobsWithMatchedCandidatesDto[0].MatchedCandidates;

            Assert.Equal(3, matchedCandidatesDto.Count);

            Assert.Equal(3, matchedCandidatesDto[0].CandidateId);
            Assert.Equal(2, matchedCandidatesDto[0].MatchedSkills.Length);
            Assert.Equal(398, matchedCandidatesDto[0].MatchedScore);

            Assert.Equal(1, matchedCandidatesDto[1].CandidateId);
            Assert.Single(matchedCandidatesDto[1].MatchedSkills);
            Assert.Equal(200, matchedCandidatesDto[1].MatchedScore);

            Assert.Equal(2, matchedCandidatesDto[2].CandidateId);
            Assert.Single(matchedCandidatesDto[2].MatchedSkills);
            Assert.Equal(198, matchedCandidatesDto[2].MatchedScore);
        }
        public JobDetailsPage(JobService service)
        {
            this.jobService = service;

            this.Title = "Appointment Details";

            TableSection mainSection = new TableSection("Customer Details");     
            
            mainSection.Add(new DataElementCell("CustomerName", "Customer"));
            mainSection.Add(new DataElementCell("Title", "Customer Notes"));
            mainSection.Add(new DataElementCell("CustomerAddress", "Address") { Height = 60 });
            mainSection.Add(new DataElementCell("CustomerPhoneNumber", "Telephone"));

            var statusCell = new DataElementCell("Status");
            statusCell.ValueLabel.SetBinding<Job>(Label.TextColorProperty, job => job.Status, converter: new JobStatusToColorConverter());
            mainSection.Add(statusCell);

            var workSection = new TableSection("Work Performed");            
            var workRowTemplate = new DataTemplate(typeof(SwitchCell));            
            workRowTemplate.SetBinding(SwitchCell.TextProperty, "Name");
            workRowTemplate.SetBinding(SwitchCell.OnProperty, "Completed");
            //workRowTemplate.SetValue(TextCell.TextColorProperty, Color.White);

            // I don't have images working on Android yet
            //if (Device.OS == TargetPlatform.iOS) 			
            //	equipmentRowTemplate.SetBinding (ImageCell.ImageSourceProperty, "ThumbImage");

            var workListView = new ListView {
                RowHeight = 50,
                ItemTemplate = workRowTemplate
            };
            workListView.SetBinding<Job>(ListView.ItemsSourceProperty, job => job.Items);

            var workCell = new ViewCell { View = workListView };
       
            workSection.Add(workCell);

            var actionsSection = new TableSection("Actions");
            
            TextCell completeJob = new TextCell { 
                Text = "Mark Completed",
                TextColor = AppStyle.DefaultActionColor
            };   
         
            completeJob.Tapped += async delegate {
                await this.CompleteJobAsync();
            };

            actionsSection.Add(completeJob);
            
            var table = new TableView
            {
                Intent = TableIntent.Form,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HasUnevenRows = true,
                Root = new TableRoot("Root")
                {
                    mainSection, workSection, actionsSection, 
                }
            };
            
            this.Content = new ScrollView {
                Orientation = ScrollOrientation.Vertical,
                Content = new StackLayout
                {
                    Orientation = StackOrientation.Vertical,
                    Children = { new JobHeaderView(leftPadding: 10, colorBackground: true), table }
                }
            };

            this.BindingContextChanged += delegate
            {
                if (SelectedJob != null && SelectedJob.Items != null)
                    workCell.Height = SelectedJob.Items.Count * workListView.RowHeight;
            };
        }
 public PersistenceTask(JobService caller, JobParameters parameters, MessageDB db)
 {
     _caller    = caller;
     _paramters = parameters;
     _db        = db;
 }
 public JobHub(JobService jobService)
 {
     _jobService = jobService;
 }
 public DutyManagerForwarder(LoginService loginService, JobService jobService)
 {
     this._loginService = loginService;
     this._jobService   = jobService;
 }
        public JobListPage(JobService service)
        {
            this.jobService = service;
            
            JobList = new ListView
            {
                HasUnevenRows = true,
                IsGroupingEnabled = true,
                GroupDisplayBinding = new Binding("Key"),
                GroupHeaderTemplate = new DataTemplate(typeof(JobGroupingHeaderCell)),
                ItemTemplate = new DataTemplate(typeof(JobCell))
            };

            var onlineLabel = new Label { Text = "Online", VerticalTextAlignment = TextAlignment.Center };
            var onlineSwitch = new Switch { IsToggled = DEFAULT_ONLINE_STATE, VerticalOptions = LayoutOptions.Center };

            jobService.Online = onlineSwitch.IsToggled;

            onlineSwitch.Toggled += async (sender, e) =>
            {
                jobService.Online = onlineSwitch.IsToggled;

                if (onlineSwitch.IsToggled)
                {
                    await jobService.SyncAsync();
                    await this.RefreshAsync();
                }
            };

            var syncButton = new Button
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Text = "Refresh",
				FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button)),
                WidthRequest = 80,
            };

            syncButton.Clicked += async (object sender, EventArgs e) =>
            {
                try
				{					
                    syncButton.Text = "Refreshing...";
                    await jobService.SyncAsync();
                    await this.RefreshAsync();
                }
                finally
                {
                    syncButton.Text = "Refresh";
                }
            };


			// Push

			var pushLabel = new Label { Text = "Push", VerticalTextAlignment = TextAlignment.Center };
			var pushSwitch = new Switch { IsToggled = DEFAULT_PUSH_STATE, VerticalOptions = LayoutOptions.Center };

			pushSwitch.Toggled += async (sender, e) =>
			{
				if (pushSwitch.IsToggled)
				{
					try
					{
						if (App.Pusher != null)
						{
							await App.Pusher.RegisterPush();
						}
					}
					catch (Exception) {
						//
					}
				}
				else {
					try
					{
						await App.Pusher.UnregisterPush();
					}
					catch (Exception) {
						//
					}
				}
			};
            
            this.Title = "Appointments";

            //var tapGestureRecognizer = new TapGestureRecognizer();
            //tapGestureRecognizer.Tapped += async (s, e) => {
            //    await App.JobService.EnsureLogin();
            //};
            //logo.GestureRecognizers.Add(tapGestureRecognizer);

            var statusBar = new Label { BackgroundColor = Color.Gray, TextColor = Color.White };
            statusBar.SetBinding(Label.TextProperty, "PendingChanges", stringFormat: "Pending changes: {0}");
            statusBar.BindingContext = this;

            this.Content = new StackLayout {
                Orientation = StackOrientation.Vertical,
                Padding = new Thickness { Top = 15 },
                Children = {
                    new StackLayout {

                        Orientation = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.StartAndExpand,
                        Children = {
							syncButton, new Label { Text = " "}, onlineLabel, onlineSwitch, new Label {Text = " "}, pushLabel, pushSwitch
                        }
                    },
                    JobList,
                    new ContentView {
                        Content = statusBar, Padding = 5, BackgroundColor = Color.Gray,
                    }
                }
            };
        }
Example #20
0
        public static void CreateContextForCreateOrderFromConsignmentTest(
            Guid jobId, Guid supplierId, Guid consignmentId, Guid jobItem1Id, Guid jobItem2Id, Guid jobItem3Id)
        {
            var dispatcher     = MockRepository.GenerateMock <IQueueDispatcher <IMessage> >();
            var userRepository = new UserAccountRepository();
            var user           = userRepository.GetByEmail("*****@*****.**", false);
            var userContext    = new TestUserContext(user);

            var consignmentRepository     = new ConsignmentRepository();
            var consignmentItemRepository = new ConsignmentItemRepository();
            var supplierRepository        = new SupplierRepository();
            var jobRepository             = new JobRepository();
            var jobItemRepository         = new JobItemRepository();
            var listItemRepository        = new ListItemRepository();
            var customerRepository        = new CustomerRepository();
            var entityIdProvider          = new DirectEntityIdProvider();
            var instrumentRepository      = new InstrumentRepository();

            var instrumentId      = Guid.NewGuid();
            var instrumentService = new InstrumentService(userContext, instrumentRepository, dispatcher);

            instrumentService.Create(instrumentId, "Druck", "DPI601IS", "None", "Digital Pressure Indicator", 15);

            var customerId      = Guid.NewGuid();
            var customerService = new CustomerService(userContext, customerRepository, dispatcher);

            customerService.Create(customerId, "Gael Ltd", String.Empty, new Address(), new ContactInfo(), "Gael Ltd", new Address(), new ContactInfo(), "Gael Ltd", new Address(), new ContactInfo());

            var supplierService = new SupplierService(userContext, supplierRepository, dispatcher);

            supplierService.Create(supplierId, "Supplier 1", new Address(), new ContactInfo(), new Address(), new ContactInfo());

            var listItemService = new ListItemService(userContext, listItemRepository, dispatcher);
            var jobService      = new JobService(userContext, null, jobRepository, listItemRepository, customerRepository, entityIdProvider, dispatcher);

            jobService.CreateJob(jobId, "some instructions", "order no", "advice no", listItemService.GetAllByCategory(ListItemCategoryType.JobType).First().Id, customerId, "notes", "contact");

            var jobItemService = new JobItemService(userContext, jobRepository, jobItemRepository, listItemService, instrumentService, dispatcher);

            jobItemService.CreateJobItem(
                jobId, jobItem1Id, instrumentId, "12345", String.Empty,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemInitialStatus).First().Id,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemCategory).First().Id,
                12, "instructions", String.Empty, false, String.Empty, String.Empty);
            jobItemService.CreateJobItem(
                jobId, jobItem2Id, instrumentId, "123456", String.Empty,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemInitialStatus).First().Id,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemCategory).First().Id,
                12, "instructions", String.Empty, false, String.Empty, String.Empty);
            jobItemService.CreateJobItem(
                jobId, jobItem3Id, instrumentId, "123457", String.Empty,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemInitialStatus).First().Id,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemCategory).First().Id,
                12, "instructions", String.Empty, false, String.Empty, String.Empty);
            jobService.ApproveJob(jobId);

            var consignmentItemService = new ConsignmentItemService(
                userContext,
                consignmentRepository, consignmentItemRepository, jobItemRepository, new ListItemRepository(), supplierRepository, dispatcher);
            var consignmentService = new ConsignmentService(userContext, consignmentRepository, supplierRepository, new DirectEntityIdProvider(), consignmentItemService, dispatcher);

            consignmentService.Create(consignmentId, supplierId);
            consignmentItemService.Create(Guid.NewGuid(), jobItem1Id, consignmentId, "some consignment instructions");
            consignmentItemService.Create(Guid.NewGuid(), jobItem2Id, consignmentId, "some consignment instructions");
            consignmentItemService.Create(Guid.NewGuid(), jobItem3Id, consignmentId, "some consignment instructions");
        }