Esempio n. 1
0
        public async Task<ActionResult> ReOpenFA(int id, LogViewModel viewmodel)
        {
            ViewBag.RedMessage = null;
            viewmodel.Reason = ReasonRepository.GetAll();

            if (!ModelState.IsValid)
                return View(viewmodel);

            LOGHistoryDto hrl = new LOGHistoryDto();
            hrl.MasterId = id;
            hrl.ReasonId = viewmodel.ReasonId;
            hrl.StatusId = (int)StatusType.OPEN;// "O";
            hrl.LogDate = DateTime.Now;
            hrl.LastUpdatedBy = this.CurrentName;

            var result = await LogHisRep.AddAsync(hrl);
            if (result == Model.SaveResult.SUCCESS)
            {
                //Update Master is Open 
                var master = await MasterRepository.SingleAsync(id);
                master.StatusId = (int)StatusType.OPEN;
                master.LastUpdatedBy = this.CurrentName;

                await MasterRepository.UpdateAsync(master);
            }
            else
            {
                ViewBag.RedMessage = "Has error while ReOpened FA!";
                return View(viewmodel);
            }

            return RedirectToAction("Index", "ReOpen", new { id = id });
        }
Esempio n. 2
0
        public async Task<ActionResult> ReOpenFA(int id)
        {
            if (id == 0)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            var master = await MasterRepository.SingleAsync(id);
            LogViewModel bind = new LogViewModel();
            if (master != null)
            {
                bind = new LogViewModel
                {
                    MasterId = id,
                    Number = master.Number,
                    ReasonId = 0,
                    StatusId = (int)StatusType.OPEN,// "O",
                    LastUpdatedBy = this.CurrentName,
                    LastUpdate = DateTime.Now,
                };
            }
            return View(bind);
        }
Esempio n. 3
0
        public async Task<ActionResult> AnaReleaseFA(int id)
        {
            LogViewModel hrl = new LogViewModel();
            var result = await MasterRepository.SingleAsync(id);
            if (result != null)
            {
                hrl.Number = result.Number;
                hrl.ReasonId = 0;
                hrl.StatusId = (int)StatusType.RELEASE;// "G";
                hrl.MasterId = id;
                hrl.Reason = ReasonRepository.GetAll();
            }

            return View(hrl);
        }
Esempio n. 4
0
        public async Task<ActionResult> AnaReleaseFA(int id, LogViewModel log)
        {
            ViewBag.RedMessage = null;
            log.Reason = ReasonRepository.GetAll();

            if (!ModelState.IsValid)
                return View(log);

            LOGHistoryDto hrl = new LOGHistoryDto();
            hrl.MasterId = id;
            hrl.ReasonId = log.ReasonId;
            hrl.StatusId = (int)StatusType.ONGOING;// "G";
            hrl.LastUpdatedBy = this.CurrentName;
            hrl.LogDate = DateTime.Now;

            var result = await LogHisRep.AddAsync(hrl);
            if (result == Model.SaveResult.SUCCESS)
            {
                //Upate master field status is Ongoing
                var master = await MasterRepository.SingleAsync(id);
                if (master != null)
                {
                    master.StatusId = (int)StatusType.RELEASE;
                    await MasterRepository.UpdateAsync(master);
                }
            }
            else
            {
                ViewBag.RedMessage = "Has error while Release FA!";
                return View(log);
            }
            return RedirectToAction("AnaEditFA", "Dashboard", new { id = id });
        }
Esempio n. 5
0
        public async Task<JsonResult> Onhold(LogViewModel log)
        {
            LOGHistoryDto hrl = new LOGHistoryDto();
            hrl.MasterId = log.MasterId;
            hrl.ReasonId = log.ReasonId;
            hrl.StatusId = (int)StatusType.HOLD; //"H";
            hrl.LastUpdatedBy = this.CurrentName;
            hrl.LogDate = DateTime.Now;

            var result = await LogHisRep.AddAsync(hrl);
            if (result == Model.SaveResult.SUCCESS)
            {
                //Update status Master is Hold
                var master = await MasterRepository.SingleAsync(hrl.MasterId);
                if (master == null)
                {
                    Response.StatusCode = (int)HttpStatusCode.NotFound;
                    return new JsonResult
                        {
                            JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                            Data = new { code = "OH02" }
                        };
                }

                if (master != null)
                {
                    master.StatusId = (int)StatusType.HOLD;
                    result = await MasterRepository.UpdateAsync(master);
                    if (result == Model.SaveResult.SUCCESS)
                    {
                        Response.StatusCode = (int)HttpStatusCode.OK;
                        return new JsonResult
                        {
                            JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                            Data = new { code = "OH01" }
                        };
                    }
                    else
                    {
                        Response.StatusCode = (int)HttpStatusCode.BadGateway;
                        return new JsonResult
                        {
                            JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                            Data = new { code = "OH02" }
                        };
                    }
                }
            }
            Response.StatusCode = (int)HttpStatusCode.BadGateway;
            return new JsonResult
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = new { code = "OH02" }
            };
        }