public List <JobPart> GetJobParts(string ccmasterid) { string[] readText = File.ReadAllLines(@"C:\Visual Studio 2015\Projects\SoloDashboard\Dashboard.Repository\TestData\parts.csv"); List <JobPart> jobpart = new List <JobPart>(); int counter = 0; foreach (var item in readText) { string[] record = item.Split('\t'); JobPart part = null; if (counter > 0) { part = new JobPart(); part.ccmasterid = record[0] != null ? record[0].Trim() : "NA"; part.ccjobpart = record[1] != null ? record[1].Trim() : "NA"; part.componentdescription = record[2] != null ? record[2].Trim() : "NA"; part.ccpartdesc = record[3] != null ? record[3].Trim() : "NA"; part.ccpages = record[4] != null ? record[4].Trim() : "NA"; part.finalsize = record[5] != null ? record[5].Trim() : "NA"; part.flatsize = record[6] != null ? record[6].Trim() : "NA"; } if (jobpart != null) { jobpart.Add(part); } counter++; } return(jobpart); }
public List <JobPart> GetJobParts(string ccmasterid) { string selectCommand = $@"SELECT ccmasterid,ccjobpart,componentdescription,ccpartdesc, ccpages , CONCAT(ccfinalsizew ,' x ',ccfinalsizeh) AS finalsize,concat(ccflatsizew,' x ',ccflatsizeh) AS flatsize FROM jobpart WHERE ccmasterid = '{ccmasterid}' ORDER BY ccjobpart asc"; try { using (NpgsqlDataAdapter data = new NpgsqlDataAdapter(selectCommand, ConnectionManager.GetMyNpgConnection())) { DataTable dt = new DataTable(); data.SelectCommand.CommandType = CommandType.Text; var jobparts = new List <JobPart>(); data.Fill(dt); if (dt.Rows.Count > 0) // this is the record returned from epace { for (int i = 0; i < dt.Rows.Count; i++) { DataRow dRow = dt.Rows[i]; var jobpart = new JobPart(); jobpart.ccmasterid = dRow["ccmasterid"].ToString(); jobpart.ccjobpart = dRow["ccjobpart"].ToString(); jobpart.componentdescription = dRow["componentdescription"].ToString(); jobpart.ccpartdesc = dRow["ccpartdesc"].ToString(); jobpart.ccpages = dRow["ccpages"].ToString(); jobpart.finalsize = dRow["finalsize"].ToString(); jobpart.flatsize = dRow["flatsize"].ToString(); jobparts.Add(jobpart); } return(jobparts); } return(jobparts); } } catch (NpgsqlException ex) { throw new Exception("Npgsql exception: " + ex.Message); } catch (Exception ex) { throw new Exception("Exception: " + ex.Message); } finally { ConnectionManager.CloseNpgSqlConnection(); } }
public async Task <JobPart> UpdateJobPartAsync(JobPart jobPart, int userId) { Repo.AddOrUpdate(jobPart); await Repo.SaveAsUserAsync(userId); // ACTUALLY, should return something that I can send back as viewmodel ... // just to make sure it works ... //var result = Repo.GetGraphs(x => x.Id == jobPart.Id).SingleOrDefault(); //if (result == null) // throw new InvalidCastException(); //return result; return(jobPart); }
public async Task <JobPart> CreateJobPartAsync(int jobId, JobPart jobPart, int UserId) { jobPart.JobId = jobId; Repo.AddOrUpdate(jobPart); await Repo.SaveAsUserAsync(UserId); var jobPartGraph = Repo.GetGraphs(x => x.Id == jobPart.Id).SingleOrDefault(); NettingManager.EnsureDaughterJob(jobPartGraph); await Repo.SaveAsUserAsync(UserId); return(jobPartGraph); }
public void EnsureDaughterJob(JobPart entity) { if (entity.IsProviderOffice()) { if (entity.HasDaughterJob()) { MapToDaughterJob(entity); } else { CreateDaughterJob(entity); } } }
public static async void ProcessMessage([QueueTrigger(JobQueues.RawIncoming)] string jobDescription) { Console.WriteLine("ProcessMessageFired"); var job = Newtonsoft.Json.JsonConvert.DeserializeObject <JobDescription>(jobDescription); Console.WriteLine("Incoming Job: {0}, recipient: {1}, time: {2}", job.PullRequestURL, job.RequestingEmail, job.RequestTime); var queue = Utils.GetQueue(JobQueues.ProcessedIncoming); foreach (var repo in Utils.RepoList) { var jobPart = new JobPart(job.PullRequestURL, job.RequestingEmail, job.JobID, repo); var msg = new CloudQueueMessage(Newtonsoft.Json.JsonConvert.SerializeObject(jobPart)); Console.WriteLine("Posting JobPart: {0}, recipient: {1}, time: {2}, target: {3}", jobPart.PullRequestURL, jobPart.RequestingEmail, jobPart.RequestTime, jobPart.TargetRepoURL); await queue.AddMessageAsync(msg); } }
public void MapToDaughterJob(JobPart entity) { var job = entity.DaughterJob; var officeId = entity.Provider.Office.Id; job.Initial = entity.Initial; job.Final = entity.Final; job.LanguageId = entity.LanguageId; job.JobTypeId = entity.JobTypeId; job.Document = entity.Job.Document; job.OrderId = entity.Job.OrderId; job.StatusId = MapJobParticipantStatusToJobStatus(entity.StatusId); job.StartDate = entity.StartDate; job.CompletionDate = entity.CompletionDate; job.EndDate = entity.EndDate; job.ParentJobPart = entity; job.CurrencyId = entity.CurrencyId; job.UOMId = entity.UOMId; job.DelegatedToOfficeId = officeId; job.CreatedBy = entity.CreatedBy; job.CreatedDate = entity.CreatedDate; job.ModifiedBy = entity.ModifiedBy; job.ModifiedDate = entity.ModifiedDate; }
public void CreateDaughterJob(JobPart entity) { entity.DaughterJob = new Job(); MapToDaughterJob(entity); }
public static bool HasDaughterJob(this JobPart @this) { return(@this.DaughterJob != null); }
public static bool IsProviderOffice(this JobPart @this) { return(@this.Provider.Office != null); }