public static OrderJob GetOrderJob(int workerID) { using (MydataEntities1 db = new MydataEntities1()) { var worker = db.Userrs.FirstOrDefault(a => a.ID == workerID); var jobs = db.JobWorkers.Where(a => a.fk_UserID == worker.ID).ToList(); OrderJob currentJob = null; foreach (var item in jobs) { var jobInList = db.OrderJobs.FirstOrDefault(a => a.status == 1 && a.id_OrderJob == item.fk_OrderJobid_OrderJob); if (jobInList == null) { continue; } currentJob = jobInList; break; } return(currentJob); } }
public ActionResult DeleteConfirmed(int id) { OrderJob orderJob = db.OrderJobs.Find(id); db.OrderJobs.Remove(orderJob); db.SaveChanges(); return(RedirectToAction("Index")); }
public static Job GetJobDescription(OrderJob currentJob) { if (currentJob == null) { return(null); } using (MydataEntities1 db = new MydataEntities1()) { return(db.Jobs.FirstOrDefault(a => a.workNumer == currentJob.fk_JobworkNumer)); } }
public ActionResult AppointJobsAndWorkers(Merged merged) { int joborderid; int k = 0; int siaip; int succes; int successor; CustumerOrder CO = new CustumerOrder(); Userr us = new Userr(); JobWorker jbWorker = new JobWorker(); Job jbs = new Job(); OrderJob ordjooobs = new OrderJob(); List <Job> jobs = jbs.SelectJobList(); foreach (var jooob in jobs) { var obj = db.OrderJobs.Where(a => a.fk_CustumerOrderorderNumer.Equals(merged.id) && a.fk_JobworkNumer.Equals(jooob.workNumer)).FirstOrDefault(); if (obj == null) { joborderid = ordjooobs.InsertOrderJob(jooob.workNumer, merged.id); if (k == 0) { siaip = jbWorker.InsertJobWorker(joborderid, merged.first); succes = us.UpdateWorkerStarus(merged.first); } else if (k == 1) { siaip = jbWorker.InsertJobWorker(joborderid, merged.second); succes = us.UpdateWorkerStarus(merged.second); } else if (k == 2) { siaip = jbWorker.InsertJobWorker(joborderid, merged.third); succes = us.UpdateWorkerStarus(merged.third); } else if (k == 3) { siaip = jbWorker.InsertJobWorker(joborderid, merged.fourth); succes = us.UpdateWorkerStarus(merged.fourth); } else if (k == 4) { siaip = jbWorker.InsertJobWorker(joborderid, merged.fifth); succes = us.UpdateWorkerStarus(merged.fifth); } else if (k == 5) { siaip = jbWorker.InsertJobWorker(joborderid, merged.six); succes = us.UpdateWorkerStarus(merged.six); } } k++; } successor = CO.UpdateOrderStatus(merged.id); return(RedirectToAction("Index", "CustumerOrders", new { area = "Index" })); }
public ActionResult Edit([Bind(Include = "start,place,status,id_OrderJob,fk_JobworkNumer,fk_WarehouseAdditionadditionNumer,fk_CustumerOrderorderNumer")] OrderJob orderJob) { if (ModelState.IsValid) { db.Entry(orderJob).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.fk_CustumerOrderorderNumer = new SelectList(db.CustumerOrders, "orderNumer", "orderNumer", orderJob.fk_CustumerOrderorderNumer); ViewBag.fk_JobworkNumer = new SelectList(db.Jobs, "workNumer", "name", orderJob.fk_JobworkNumer); ViewBag.fk_WarehouseAdditionadditionNumer = new SelectList(db.WarehouseAdditions, "additionNumer", "additionNumer", orderJob.fk_WarehouseAdditionadditionNumer); ViewBag.status = new SelectList(db.Status, "id_Status", "name", orderJob.status); return(View(orderJob)); }
// GET: OrderJobs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OrderJob orderJob = db.OrderJobs.Find(id); if (orderJob == null) { return(HttpNotFound()); } return(View(orderJob)); }
// GET: OrderJobs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OrderJob orderJob = db.OrderJobs.Find(id); if (orderJob == null) { return(HttpNotFound()); } ViewBag.fk_CustumerOrderorderNumer = new SelectList(db.CustumerOrders, "orderNumer", "orderNumer", orderJob.fk_CustumerOrderorderNumer); ViewBag.fk_JobworkNumer = new SelectList(db.Jobs, "workNumer", "name", orderJob.fk_JobworkNumer); ViewBag.fk_WarehouseAdditionadditionNumer = new SelectList(db.WarehouseAdditions, "additionNumer", "additionNumer", orderJob.fk_WarehouseAdditionadditionNumer); ViewBag.status = new SelectList(db.Status, "id_Status", "name", orderJob.status); return(View(orderJob)); }
private void LoadCurrentJob() { currentJob = JobExecutionController.GetOrderJob(workerID); Job jobDescription = JobExecutionController.GetJobDescription(currentJob); if (currentJob == null) { noTasksLabel.Text = "Šiuo metu neturite priskirtų darbų, galite pailsėti :)"; if (timerHasBeenStarted) { return; } activeJobTimer.Tick += new EventHandler(CheckForActiveJobs); activeJobTimer.Interval = 1000; activeJobTimer.Start(); ToogleJobInfo(false); timerHasBeenStarted = !timerHasBeenStarted; } else { playSimpleSound(); ToogleJobInfo(true); taskPlaceLabel.Text = "Sandėlis " + currentJob.place; jobTitleLabel.Text = jobDescription.name; jobTotalTimer.Tick += new EventHandler(UpdateTotalJobTime); jobTotalTimer.Interval = 1000; jobTotalTimer.Start(); activeJobTimer.Stop(); } }