예제 #1
0
        protected ModelListModel PrepareModelListModel(PagedList <FileVersion> models, int projectId, int engineeringId, string selectedState = "")
        {
            ModelListModel model = new ModelListModel();

            var project = new ProjectService().Get(e => e.Id == projectId);

            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            model.ProjectIsFiled = project.IsProjectFiled();
            model.ProjectId      = project.Id;
            model.Roles          = CurrentCustomer.GetCurrentRoles(projectId);

            //检查是否能上传模型
            var engineeringFile =
                new EngineeringFileService().Get(
                    ef => ef.EngineeringId == engineeringId && ef.FileType == FileType.Model);

            if (engineeringFile == null ||
                engineeringFile.Status == FlowCode.Pre_DesignCompany_AwaitUpload ||
                engineeringFile.Status == FlowCode.Pre_DesignCompany_DeletedCurrent ||
                engineeringFile.Status == FlowCode.Pre_BuildCompany_Reject_DesignCompany ||
                engineeringFile.Status == FlowCode.Pre_AuditCompany_Reject_DesignCompany ||
                engineeringFile.Status == FlowCode.DesignCompany_DeletedCurrent ||
                engineeringFile.Status == FlowCode.BuildCompany_Reject_DesignCompany ||
                engineeringFile.Status == FlowCode.AuditCompany_ProjectManager_Confrim_CurrentProcess_End)
            {
                model.CanUploadModel = true;
            }

            foreach (var node in models)
            {
                model.ModelList.Add(new ModelListModel.ModelModel()
                {
                    UploadDescription = node.UploadDescription,
                    RejectDescription = node.RejectDescription,
                    ModelVersionId    = node.Id,
                    ModelStatus       = node.Status,
                    ModelVersionNo    = node.VersionNo,
                    UpdateTime        = node.UpdateStateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                });
            }

            model.SelectedStatus = selectedState;
            model.AvaliableStatus.Add(new SelectListItem()
            {
                Text = "全部", Value = "", Selected = string.IsNullOrWhiteSpace(selectedState)
            });

            WorkFlow.GetAllModelStatus().ForEach(e =>
            {
                model.AvaliableStatus.Add(new SelectListItem()
                {
                    Text     = e,
                    Value    = e,
                    Selected = e == selectedState,
                });
            });

            return(model);
        }
예제 #2
0
        public JsonResult List(DataSourceRequest command, ModelListModel model)
        {
            var ls = _carService.GetAllModel();

            return(Json(new { data = ls }));
        }