public ActionResult Create([Bind(Include = "Created_By,Date,CustomerName,Date,NetWt,TotalRolls,PLNo,DCNO,InvoiceNo")] JobWork jobWork) { if (ModelState.IsValid) { db.JobWorks.Add(jobWork); var customers = TempData["PakingList"]; ProductionCard productionCard = new ProductionCard(); productionCard.Created_By = jobWork.Created_By; // productionCard.BagSize = jobWork.PackingList.BagSize; //productionCard.Colour = jobWork.Colour; productionCard.Date = jobWork.Date; productionCard.DCNO = jobWork.DCNO; //productionCard.Gsm = jobWork.Gsm; // productionCard.Kgs = jobWork.NetWt; productionCard.partyName = jobWork.CustomerName; productionCard.PLNo = jobWork.PLNo; //productionCard.Remarks = jobWork.Remarks; // productionCard.Rsize = jobWork.Rsize; // productionCard.status = jobWork.RollStatus; // productionCard.Type = jobWork.Type; productionCard.JobWorkId = jobWork.JobWorkId; db.ProductionCards.Add(productionCard); List <PackingList> x = customers as List <PackingList>; foreach (var z in x) { z.JobWorkId = jobWork.JobWorkId; db.PackingLists.Add(z); } db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jobWork)); }
public ActionResult PopUp(int id, ProductionCard production) { IList <JobWork> jobWork = db.JobWorks.Select(x => x).ToList(); IList <ProductionCard> productionCard = db.ProductionCards.Where(x => x.productionId == id).ToList(); int jobworkId = productionCard.FirstOrDefault().JobWorkId; foreach (var product in productionCard) { foreach (var jobDetails in jobWork) { JobWork job = jobDetails as JobWork; if (job.JobWorkId == jobworkId) { db.JobWorks.Attach(job); // job.RollStatus= status; db.SaveChanges(); break; } } if (product.productionId == id) { db.ProductionCards.Attach(product); product.status = status; db.SaveChanges(); } } return(RedirectToAction("Index")); }
public void ReportFinished(JobWork work) { lock (this.trackerLock) { this.completedQueueWork += work.Cost; this.completedItems++; } }
public void ReportRemovedFromQueue(JobWork work) { lock (this.trackerLock) { this.totalQueueCost -= work.Cost; this.queuedWork.Remove(work); } }
public void ReportAddedToQueue(JobWork work) { lock (this.trackerLock) { this.totalQueueCost += work.Cost; this.queuedWork.Add(work); } }
public ActionResult Delete(int id) { JobWork emp = db.JobWorks.Where(x => x.JobWorkId == id).FirstOrDefault <JobWork>(); db.JobWorks.Remove(emp); db.SaveChanges(); return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet)); }
// GET: JobWorks/Create public ActionResult Create() { JobWork jobWork = new JobWork(); jobWork.Date = DateTime.Now; if (TempData["Weights"] != null && TempData["rolls"] != null) { jobWork.NetWt = TempData["Weights"]?.ToString(); jobWork.TotalRolls = TempData["rolls"]?.ToString(); } ModelState.Clear(); return(View(jobWork)); }
// GET: JobWorks/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobWork jobWork = db.JobWorks.Find(id); if (jobWork == null) { return(HttpNotFound()); } return(View(jobWork)); }
public ActionResult Edit([Bind(Include = "Created_By,Rsize,Gsm,Colour,NetWt,Type,BagSize,RollStatus,Date,Remarks,PartyName,PLNo,DCNO,InvoiceNo")] JobWork jobWork) { try { //db.JobWorks.Attach(jobWork); db.Entry(jobWork).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception e) { return(View()); } }
internal static void Do <T>(Job <T> tJ, ref Worker wr, Cont <T> tK) { #if TRAMPOLINE unsafe { if (Unsafe.GetStackPtr() < wr.StackLimit) { var w = new JobWork <T>(tJ, tK); w.Next = wr.WorkStack; wr.WorkStack = w; } else { wr.Handler = tK; tJ.DoJob(ref wr, tK); } } #else wr.Handler = tK; tJ.DoJob(ref wr, tK); #endif }
public void CalculateWork() { if (this.Job == null) { throw new InvalidOperationException("Job cannot be null."); } if (this.Job.Length <= TimeSpan.Zero) { this.Logger.LogError($"Invalid length '{this.Job.Length}' on job {this.Job.FinalOutputPath}"); } var profile = this.Job.EncodingProfile; if (profile == null) { throw new InvalidOperationException("Encoding profile cannot be null."); } this.work = new JobWork(this.Job.Length, profile.VideoEncodeRateType != VCVideoEncodeRateType.ConstantQuality && profile.TwoPass, this.SubtitleScan); }
public void CalculateOverallEncodeProgress(double inProgressJobsCompletedWork) { lock (this.trackerLock) { double totalCompletedWork = this.completedQueueWork + inProgressJobsCompletedWork; this.OverallEncodeProgressFraction = this.totalQueueCost > 0 ? totalCompletedWork / this.totalQueueCost : 0; double queueElapsedSeconds = this.elapsedQueueEncodeTime.Elapsed.TotalSeconds; this.OverallWorkCompletionRate = queueElapsedSeconds > 0 ? totalCompletedWork / queueElapsedSeconds : 0; // Only update encode time every 5th update. if (Interlocked.Increment(ref this.pollCount) % 5 == 1) { if (!this.CanShowEta && this.elapsedQueueEncodeTime != null && queueElapsedSeconds > 0.5 && this.OverallEncodeProgressFraction != 0.0) { this.CanShowEta = true; } if (this.CanShowEta) { if (this.OverallEncodeProgressFraction == 1) { this.EstimatedTimeRemaining = Utilities.FormatTimeSpan(TimeSpan.Zero); } else if (this.OverallEncodeProgressFraction >= 0 && this.OverallEncodeProgressFraction <= 1.01) { if (this.OverallEncodeProgressFraction == 0) { this.overallEtaSpan = TimeSpan.MaxValue; } else { try { this.overallEtaSpan = TimeSpan.FromSeconds((long)(((1.0 - this.OverallEncodeProgressFraction) * queueElapsedSeconds) / this.OverallEncodeProgressFraction)); } catch (OverflowException) { this.overallEtaSpan = TimeSpan.MaxValue; } } this.EstimatedTimeRemaining = Utilities.FormatTimeSpan(this.overallEtaSpan); } else { // Something fishy is going on. Dump the queue work contents and all relevant variables. if (!this.diagnosticsLogged) { IAppLogger logger = StaticResolver.Resolve <IAppLogger>(); logger.LogError("Invalid total progress fraction calculated." + Environment.NewLine + $"Total queue cost: {this.totalQueueCost}" + Environment.NewLine + $"Completed queue work: {this.completedQueueWork}" + Environment.NewLine + $"In progress work: {inProgressJobsCompletedWork}" + Environment.NewLine + $"Completed items: {this.completedItems}"); for (int i = 0; i < this.queuedWork.Count; i++) { JobWork workItem = this.queuedWork[i]; logger.LogError($"Queue item {i}: Cost: {workItem.Cost} Video Length: {workItem.JobVideoLength} Completed: {i < this.completedItems}"); } this.diagnosticsLogged = true; } this.EstimatedTimeRemaining = Utilities.FormatTimeSpan(TimeSpan.Zero); } } } this.OverallEncodeTime = this.elapsedQueueEncodeTime.Elapsed; this.OverallEta = this.overallEtaSpan; } }
public async Task <IEnumerable <Profile> > GetProfiles(int appId) { var profiles = new List <Profile>(); var personalProfiles = await Data.GetPersonalProfiles(); var personalProfilesString = String.Join(",", personalProfiles.Select(x => x.ProfileId)); var titles = await Data.GetTitles(); var religions = await Data.GetReligions(); var jobWorks = await Data.GetJobWork(personalProfilesString); var hospitals = await Data.GetHospital(); var departments = await Data.GetDepartment(); var personalEmail = await Data.GetPersonalEmail(personalProfilesString); foreach (var personalProfile in personalProfiles) { var profileId = personalProfile.ProfileId; var jobWork = jobWorks.OrderByDescending(j => j.ProfileId == profileId).FirstOrDefault(); if (jobWork == null) { jobWork = new JobWork() { ProfileId = profileId, WorkId = null, StartDate = null, WorkPosition = "", WorkStatus = "", }; } var titleTh = titles.FirstOrDefault(t => t.TitleId == personalProfile.ProfileTitleThId); var titleEn = titles.FirstOrDefault(t => t.TitleId == personalProfile.ProfileTitleEngId); var religion = religions.FirstOrDefault(r => r.ReligionId == personalProfile.ReligionId); var religionName = religion == null ? "" : religion.ReligionName; var hospital = hospitals.FirstOrDefault(h => h.HospitalId == personalProfile.HospitalId); var hospitalName = hospital == null ? "" : hospital.HospitalShortname; var department = departments.FirstOrDefault(d => d.DepartmentId == personalProfile.DepartmentId); var departmentName = department == null ? "" : department.DepartmentName; var personalEmailPrimary = personalEmail == null ? "" : personalEmail.FirstOrDefault(e => e.EmailType == "P").EmailAddress; var personalEmailSecondary = personalEmail == null ? "" : personalEmail.FirstOrDefault(e => e.EmailType == "S").EmailAddress; try { var profile = new Profile() { ProfileId = profileId, DoctorId = personalProfile.DoctorId, EmpId = personalProfile.EmpId, TitleTh = titleTh == null ? "" : titleTh.TitleName, ThaiName = personalProfile.ThaiName, TitleEn = titleEn == null ? "" : titleEn.TitleName, EngName = personalProfile.EngName, Marital = personalProfile.Marital, Race = personalProfile.Race, RaceOther = personalProfile.RaceOther, Nationality = personalProfile.Nationality, NationalityOther = personalProfile.NationalityOther, ReligionName = religionName, ProfileCardId = personalProfile.ProfileCardId, ProfileCardExpiration = personalProfile.ProfileCardExpiration, SpecialtyName = personalProfile.SpecialtyName, SubSpecialtyName = personalProfile.SubSpecialtyName, StartDate = jobWork?.StartDate, WorkPosition = jobWork.WorkPosition, WorkStatus = jobWork.WorkStatus, HospitalName = hospitalName, Department = departmentName, DateOfBirth = personalProfile.DateOfBirth, Gender = personalProfile.Gender, PrimaryEmail = personalEmailPrimary, SecondaryEmail = personalEmailSecondary, Username = personalProfile.Username, MedicalLicenseID = personalProfile.MedicalLicenseID, PCU_Id = personalProfile.PCU_Id, ProfilePhoto = personalProfile.ProfilePhoto, PCG = personalProfile.PCG, ProfileFlag = personalProfile.ProfileFlag }; profiles.Add(profile); } catch (Exception) { } } return(profiles); }