public JobHelper(JobHeader job) { log = new Scribe(System.Web.HttpContext.Current.Server.MapPath("~/logs"), "JobHelper_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".log"); dbServer = WebConfigurationManager.AppSettings.Get("DBServer"); dbName = WebConfigurationManager.AppSettings.Get("DBName"); this.Job = job; }
public void ShouldReturnGuid() { JobData data = Jobs.TickTockData; JobHeader header = repository.New(data); header.Identifier.Should().NotBeEmpty(); }
public JobDataHandler(JobHeader job, string dbServer, string dbName) : base(dbServer) { this.log = new Scribe(System.Web.HttpContext.Current.Server.MapPath("~/logs"), "JobDataHandler_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".log"); this.dbServer = dbServer; this.dbName = dbName; this.dataConnectionString = GetDataConnectionString(); this.Job = job; }
public void ShouldReturnFirstVersion() { JobData data = Jobs.TickTockData; JobHeader header = repository.New(data); header.Version.Should().Be(1); }
public void UpdatingJobShouldReturnNextVersion() { JobData data = Jobs.TickTockData; JobHeader created = repository.New(data); JobData upgrade = Jobs.TickTockDataV2; JobHeader header = repository.Update(created.Identifier, upgrade); header.Version.Should().Be(created.Version + 1); }
private new JobHeader Add(JobData data) { JobHeader header = new JobHeader { Identifier = Guid.NewGuid(), Version = 1 }; items[header] = data; return(header); }
private new JobExecution Add(JobHeader job) { JobExecution execution = new JobExecution { Identifier = Guid.NewGuid(), Job = job, }; items.Add(execution); return(execution); }
public void RequestingAddedJobShouldReturnItsIdentifier() { JobData data = Jobs.TickTockData; JobHeader created = repository.New(data); Job job = repository.Single(with => { with.Identifier = created.Identifier; }); job.Header.Identifier.Should().Be(created.Identifier); }
public void RequestingJobByNotUpgradedVersionShouldReturnNull() { JobData data = Jobs.TickTockData; JobHeader created = repository.New(data); Job job = repository.Single(with => { with.Identifier = created.Identifier; with.Version = created.Version + 1; }); job.Should().BeNull(); }
// Shows the elements of a JobHeader public String printJobHeader(JobHeader header) { String Output = " User " + header.jobParam.user + " JobID: " + header.jobId + " State: " + header.state.ToString() + " Progress: " + header.progress + " Rate: " + header.rate + " Prio: " + header.jobParam.prio + header.jobParam.user + " Title: " + header.jobParam.title; return(Output); }
public void RequestingAddedJobShouldReturnItsData() { JobData initial = Jobs.TickTockData; JobHeader created = repository.New(initial); Job job = repository.Single(with => { with.Identifier = created.Identifier; }); job.Extract(data => { data.ShouldBeEquivalentTo(initial); }); }
public void RequestingUpgradedJobByVersionShouldReturnRequestedVersion() { JobData initial = Jobs.TickTockData; JobHeader created = repository.New(initial); JobData upgrade = Jobs.TickTockDataV2; JobHeader header = repository.Update(created.Identifier, upgrade); Job job = repository.Single(with => { with.Identifier = created.Identifier; with.Version = created.Version; }); job.Extract(data => { data.ShouldBeEquivalentTo(initial); }); }
public async Task <Job> RequestNewJobAsync(TInput input, CancellationToken cancel) { var identifier = CreateJobIdentifier(Guid.NewGuid().ToString("N")); var header = new JobHeader(identifier) { State = JobState.Created, Created = DateTimeOffset.UtcNow }; var job = new Job(header) { Input = _inputSerializer.Serialize(input) }; await _repository.CreateAsync(job, cancel); using var publisher = _queue.GetPublisher(CreatePublisherConfiguration()); await publisher.EnqueueAsync(job, cancel); return(job); }
public Response HandlePostJob(dynamic model) { JobData data = new JobData { Name = model.name, Description = model.description, Executable = model.executable, Arguments = model.arguments, Blob = model.blob }; JobHeader header = jobs.New(data); Guid identifier = header.Identifier; return(Response.AsJson(new { id = identifier.ToHex() })); }
public bool LoadJobHeader(int jobID) { log.WriteLogEntry("Begin LoadJobHeader..."); bool result = false; string cmdString = string.Format(@"select * from {0}.dbo.job_header where job_id = @jobID", dbName); log.WriteLogEntry("SQL command string: " + cmdString); using (SqlConnection conn = new SqlConnection(dataConnectionString)) { using (SqlCommand cmd = new SqlCommand(cmdString, conn)) { cmd.Parameters.AddWithValue("@jobID", jobID); try { conn.Open(); using (SqlDataReader rdr = cmd.ExecuteReader()) { if (rdr.Read()) { Job = new JobHeader(jobID); Job.TemplateID = (int)rdr["template_id"]; Job.FormDataID = (int)rdr["data_id"]; Job.JobDescription = rdr["job_description"].ToString(); var entryDate = rdr["entry_dt"]; if (entryDate != DBNull.Value) { Job.EntryDate = DateTime.Parse(entryDate.ToString()); } var completeDate = rdr["complete_dt"]; if (completeDate != DBNull.Value) { Job.CompleteDate = DateTime.Parse(completeDate.ToString()); } var duration = rdr["duration"]; if (duration != DBNull.Value) { Job.Duration = (int)duration; } var jobPriority = rdr["job_priority"]; if (jobPriority != DBNull.Value) { Job.JobPriority = (int)jobPriority; } var jobWeight = rdr["job_weight"]; if (jobWeight != DBNull.Value) { Job.JobWeight = (int)jobWeight; } Job.JobType = rdr["job_type"].ToString(); log.WriteLogEntry("Job header retrieved " + jobID + " " + Job.JobDescription); result = true; } } } catch (SqlException ex) { result = false; log.WriteLogEntry("SQL error " + ex.Message); } catch (Exception ex) { result = false; log.WriteLogEntry("General program error " + ex.Message); } } } log.WriteLogEntry("End LoadJobHeader."); return(result); }
public void Job(JobHeader header, JobData data) { items[header] = data; }
private static void CreateOtherJobs() { const int MaxLength = 50; foreach (var item in JobXRefList.Where(x => x.OriginalJob.StartsWith("G") || x.OriginalJob.StartsWith("M") || x.OriginalJob.StartsWith("P") || x.OriginalJob.StartsWith("T") || x.OriginalJob.StartsWith("V")).OrderBy(x => x.OriginalJob)) { var jobinfo = SageJobHeaders.FirstOrDefault(x => x.JobNo == item.OriginalJob); if (jobinfo == null) { ErrorList += String.Format("Job Header not found for Job: {0}", item.OriginalJob); ErrorList += Environment.NewLine; } var custinfo = currentCustomers.FirstOrDefault(x => x.CustID == jobinfo.CustomerNo); if (custinfo == null) { MissingCustomers += String.Format("Customer {0} for Job {1} was not found in Epicor", jobinfo.CustomerNo, item.OriginalJob); MissingCustomers += Environment.NewLine; custinfo = new DMT05CustomerVUKMasterLoad { }; } var partnum = jobinfo.JobDesc; if (partnum.Length > MaxLength) { partnum = partnum.Substring(0, MaxLength); } var jobhead = new JobHeader { Company = CompanyID, JobEngineered = true, JobFirm = true, JobReleased = true, JobNum = item.NewJob, PartNum = partnum, Plant = "MfgSys", CustID = jobinfo.CustomerNo, PartDescription = partnum, ProdQty = 1, ReqDueDate = jobinfo.ContractDate, StartDate = jobinfo.ContractDate, SyncReqBy = false, }; if (String.IsNullOrEmpty(jobhead.ReqDueDate)) { jobhead.ReqDueDate = "01/01/2019"; } JobHeaders.Add(jobhead); var op1 = new JobOperation { Company = CompanyID, AssemblySeq = 0, OpCode = item.OpCode, OpComplete = false, OprSeq = 10, ProdStandard = 0, QtyCompleted = 0, StdFormat = "HP", LaborEntryMethod = "T", JobNum = jobhead.JobNum, SchedRelation = "FS", Plant = "MfgSys", AutoReceive = true, FinalOpr = true, }; JobOperations.Add(op1); //int mtlseq = 10; var camtl = new JobMaterial { Company = jobhead.Company, JobNum = jobhead.JobNum, //Plant = jobhead.Plant, IssuedComplete = true, PartNum = "CostAdjustment", Description = "CostAdjustment", //MaterialMtlCost = 0, MtlSeq = 5, QtyPer = 1, AssemblySeq = 0, FixedQty = true, RelatedOperation = 10 //RequiredQty = 1 }; JobMaterials.Add(camtl); } }
/// <summary> /// Creates a new ModJob for the specific header. /// </summary> /// <param name="jobHeader">Header this job is for</param> /// <param name="mod">Mod object this job is for. This object is not saved and is only used to pull the path in and other necessary variables.</param> public ModJob(JobHeader jobHeader, Mod mod = null) { this.Header = jobHeader; }