Exemplo n.º 1
0
        public ActionResult WODetail(string WoId)
        {
            WOViewModel woVM = new WOViewModel();
            TWO         wo   = _woTasks.One(WoId);

            if (wo != null)
            {
                woVM.WOID            = wo.Id;
                woVM.CustomerName    = wo.CustomerId.CustomerName;
                woVM.CustomerPhone   = wo.CustomerId.CustomerPhone;
                woVM.CustomerAddress = wo.CustomerId.CustomerAddress;
                woVM.WODate          = wo.WODate;
                woVM.WONo            = wo.WONo;
                woVM.WOItemType      = wo.WOItemType;
                woVM.WOItemSN        = wo.WOItemSn;
                woVM.WOIsGuarantee   = wo.WOIsGuarantee;
                woVM.WOEquipments    = wo.WOEquipments;
                woVM.WOScStore       = wo.WOScStore;
                woVM.WOPriority      = wo.WOPriority;
                woVM.WOBrokenDesc    = wo.WOBrokenDesc;
                woVM.WOLastStatus    = wo.WOLastStatus;
                woVM.WOStartDate     = wo.WOStartDate;
                woVM.WOTotal         = wo.WOTotal;
                woVM.WODp            = wo.WODp;
                woVM.WOTakenDate     = wo.WOTakenDate;
                woVM.WOInvoiceNo     = wo.WOInvoiceNo;
                woVM.WOComplain      = wo.WOComplain;
                woVM.WORemarkStatus  = wo.WORemarkStatus;
                woVM.WOReceivedBy    = wo.WOReceivedBy;
                woVM.WORepairedBy    = wo.WORepairedBy;
            }
            IEnumerable <TWOStatus> woStatus = _woStatusTasks.GetWOStatus(WoId);

            WODetailViewModel vm = new WODetailViewModel();

            vm.Wo       = woVM;
            vm.WOStatus = (from wos in woStatus
                           select new WOStatusViewModel
            {
                WOStatusId = wos.Id,
                WOStatusUser = wos.WOStatusUser,
                WOStatus = wos.WOStatus,
                WOStatusDate = wos.WOStatusDate,
                WOStatusBrokenDesc = wos.WOStatusBrokenDesc,
                WOStatusStartDate = wos.WOStatusStartDate,
                WOStatusFinishDate = wos.WOStatusFinishDate,
                WOStatusDesc = wos.WOStatusDesc
            }).ToList <WOStatusViewModel>();
            return(View(vm));
        }
        public ActionResult WO_Update([DataSourceRequest] DataSourceRequest request, WOViewModel WOVM, FormCollection formCol)
        {
            if (WOVM != null && ModelState.IsValid)
            {
                var wo = _woTasks.One(WOVM.WOID);
                if (wo != null)
                {
                    ConvertToWO(WOVM, wo, formCol);

                    wo.ModifiedDate = DateTime.Now;
                    wo.ModifiedBy   = User.Identity.Name;
                    wo.DataStatus   = "Updated";

                    _woTasks.Update(wo);
                }
            }

            return(Json(ModelState.ToDataSourceResult()));
        }