Beispiel #1
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,RequestId,RequestDesc,SiteId,LocationId,AssetId,AssetDesc,Date")] WoRequestTbl woRequestTbl)
        {
            if (id != woRequestTbl.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(woRequestTbl);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WoRequestTblExists(woRequestTbl.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(woRequestTbl));
        }
Beispiel #2
0
        public ActionResult CreateWoTas(long id)
        {
            WoRequestTbl schdl     = _context.WoRequestTbl.Where(x => x.Id == id).First();
            var          linestask = _context.WoRequestTaskLine.Where(x => x.WoRequestId == id).First().TaskId;

            WorkOrderTbl wo = new WorkOrderTbl();

            wo.AssetId = schdl.AssetId;
            wo.SiteId  = schdl.SiteId;
            //  wo.TechnicianId = schdl.TechnicianId;
            wo.WoDesc        = schdl.RequestDesc;
            wo.MaentenanceId = null;
            wo.Date          = DateTime.Now;
            wo.CreatedAtWo   = DateTime.Now;
            wo.RequestId     = schdl.Id;
            //  wo.EstimatedWorking = schdl.EstimatedTime;
            // wo.TaskDetail = schdl.TaskDetail;
            wo.EntityId = _context.TaskTbl.Where(x => x.TaskId == linestask).First().TaskCode;


            _context.WorkOrderTbl.Add(wo);
            _context.SaveChanges();



            WoRequestTbl schdl2 = _context.WoRequestTbl.Where(x => x.Id == id).First();

            schdl2.Status = "In Approval";
            // schdl2.LastMaintenance = DateTime.Now;
            _context.Update(schdl2);
            _context.SaveChanges();

            return(Json(new { success = true }));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("Id,RequestId,RequestDesc,SiteId,LocationId,AssetId,AssetDesc,Date,Status")] WoRequestTbl woRequestTbl)
        {
            if (ModelState.IsValid)
            {
                _context.Add(woRequestTbl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(woRequestTbl));
        }