示例#1
0
        public ActionResult Emps_Update([DataSourceRequest] DataSourceRequest request, EmpViewModel empVM)
        {
            if (empVM != null && ModelState.IsValid)
            {
                var emp = empTasks.One(empVM.EmpID);
                if (emp != null)
                {
                    ConvertToEmp(empVM, emp);

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

                    empTasks.Update(emp);
                }
            }

            return(Json(ModelState.ToDataSourceResult()));
        }
 private void ConvertToWOSPart(RequestWOSPartViewModel WOVM, TWOSPart woSPart)
 {
     woSPart.WOId               = _woTasks.One(WOVM.WOId);
     woSPart.SPartId            = string.IsNullOrEmpty(WOVM.SPartId) ? null : _spartTasks.One(WOVM.SPartId);
     woSPart.WOSPartPrice       = WOVM.WOSPartPrice;
     woSPart.WOSPartTotal       = WOVM.WOSPartTotal;
     woSPart.WOSPartQty         = WOVM.WOSPartQty;
     woSPart.WOSPartDisc        = WOVM.WOSPartDisc;
     woSPart.WOSPartDate        = WOVM.WOSPartDate;
     woSPart.WOSPartStatus      = EnumWOSPartStatus.Request.ToString();
     woSPart.WOSPartRequestBy   = string.IsNullOrEmpty(WOVM.WOSPartRequestBy) ? null : _empTasks.One(WOVM.WOSPartRequestBy);
     woSPart.WOSPartDateRequest = WOVM.WOSPartDate;
 }
示例#3
0
        public ActionResult ChangeStatus([DataSourceRequest] DataSourceRequest request, RequestWOSPartViewModel WOVM, FormCollection formCol)
        {
            if (WOVM != null && ModelState.IsValid)
            {
                TWOSPart woSPart = _woSPartTasks.One(WOVM.WOSPartId);
                if (woSPart != null)
                {
                    woSPart.WOSPartStatus = WOVM.WOSPartStatus;
                    if (WOVM.WOSPartStatus == EnumWOSPartStatus.Serah_Terima_dan_Gunakan.ToString())
                    {
                        woSPart.WOSPartDateReceived = WOVM.WOSPartDateReceived;
                        woSPart.WOSPartReceivedBy   = string.IsNullOrEmpty(WOVM.WOSPartReceivedBy) ? null : _empTasks.One(WOVM.WOSPartReceivedBy);
                    }
                    else if (WOVM.WOSPartStatus == EnumWOSPartStatus.Retur.ToString())
                    {
                        woSPart.WOSPartDateReturn = WOVM.WOSPartDateReceived;
                        woSPart.WOSPartReturnBy   = string.IsNullOrEmpty(WOVM.WOSPartReceivedBy) ? null : _empTasks.One(WOVM.WOSPartReceivedBy);
                    }

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

                    _woSPartTasks.Update(woSPart);

                    //update wo spare part total
                    TWO wo = woSPart.WOId;
                    if (wo != null)
                    {
                        wo.WOSPartTotal = wo.WOSPartTotal + woSPart.WOSPartTotal;
                        wo.WOTotal      = wo.WOServiceFee + wo.WOSPartTotal;

                        wo.ModifiedDate = DateTime.Now;
                        wo.ModifiedBy   = User.Identity.Name;
                        wo.DataStatus   = "Updated";
                        _woTasks.Update(wo);
                    }
                }
            }

            return(Json(new[] { WOVM }.ToDataSourceResult(request, ModelState)));
        }