public ActionResult ScoreProfessionData(int modelVersionId) { var modelVersion = new FileVersionService().Get(e => e.Id == modelVersionId); if (modelVersion == null) { throw new ArgumentNullException(nameof(modelVersion)); } if (!new PermissionService().CanUserVisitProject(CurrentCustomer, modelVersion.EngineeringFile.Engineering.ProjectId)) { return(NoAuthorityJson()); } if (CurrentCustomer.Organization.OrganizationType != OrganizationType.Censorship) { return(NoAuthorityJson()); } int canPass; var modelProfessions = new ModelProfessionService().GetMany(e => e.ModelVersionId == modelVersionId).ToList(); var models = PrepareProfessionEvaluateModels(modelProfessions, out canPass); string lastVersionId = modelVersion.EngineeringFile.FileVersions.OrderByDescending(e => e.UpLoadeTime).FirstOrDefault(e => e.FileType == FileType.Model)?.Id.ToString(); return(Json(new { result = true, lastVersionId = lastVersionId, canPass = canPass, listHtml = base.RenderPartialViewToString("_ProfessionEvaluate", models) }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetModelProfessionState(int modelVersionId, int professionId) { var modelVersion = new FileVersionService().Get(e => e.Id == modelVersionId); if (modelVersion == null) { throw new ArgumentNullException(nameof(modelVersion)); } if (!new PermissionService().CanUserVisitProject(CurrentCustomer, modelVersion.EngineeringFile.Engineering.ProjectId)) { return(NoAuthorityJson()); } var modelProfession = new ModelProfessionService().Get(e => e.ModelVersionId == modelVersionId && e.ProfessionId == professionId); var customerRoles = CurrentCustomer.CustomerRoles.Where(e => e.ProjectId == modelVersion.EngineeringFile.Engineering.ProjectId && e.FinishTime == null); string roleDes = CurrentCustomer.GetCurrentRoleDes(professionId, modelVersion.EngineeringFile.Engineering); ModelProfessionOperateModel operateModel = null; if (professionId != 0 && modelProfession != null) { var roles = CurrentCustomer.GetCurrentRoles(professionId, modelProfession.EngineerFile.Engineering); operateModel = PrepareOperateModel(modelProfession, roles); } return(Json(new { result = true, roleDes = roleDes, htmlStr = base.RenderPartialViewToString("_ModelProfessionOperate", operateModel) }, JsonRequestBehavior.AllowGet)); }
public ActionResult OperateModelProfession(int modelProfessionId, ModelProfessionOperationType type) { var modelProfession = new ModelProfessionService().Get(e => e.Id == modelProfessionId); if (modelProfession == null) { throw new ArgumentNullException(nameof(modelProfession)); } var professionalAudit = new ProfessionalAudit(CurrentCustomer, modelProfession.EngineerFile, modelProfession.ModelVersion, modelProfession.ProfessionId); var professionalReAudit = new ProfessionalReAudit(CurrentCustomer, modelProfession.EngineerFile, modelProfession.ModelVersion, modelProfession.ProfessionId); var result = false; if (type == ModelProfessionOperationType.CheckerApplyForReview) { if (!new PermissionService().CanCheckProject(CurrentCustomer, modelProfession.EngineerFile.Engineering, modelProfession.ProfessionId)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.Checker; result = professionalAudit.Submit(); } else if (type == ModelProfessionOperationType.ReviewerPassCheckerApply) { if (!new PermissionService().CanReviewProject(CurrentCustomer, modelProfession.EngineerFile.Engineering, modelProfession.ProfessionId)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.Reviewer; result = professionalReAudit.Submit(); } else if (type == ModelProfessionOperationType.ReviewerSendBackCheckerApply) { if (!new PermissionService().CanReviewProject(CurrentCustomer, modelProfession.EngineerFile.Engineering, modelProfession.ProfessionId)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.Reviewer; result = professionalReAudit.Reject(); } else if (type == ModelProfessionOperationType.ReviewerHandledDesignManagerReject) { if (!new PermissionService().CanReviewProject(CurrentCustomer, modelProfession.EngineerFile.Engineering, modelProfession.ProfessionId)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.Reviewer; result = professionalReAudit.Submit(); } return(Json(new { result = result, errmsg = "" })); }
public ActionResult GetAllModelProfessionState(int modelVersionId) { var modelVersion = new FileVersionService().Get(e => e.Id == modelVersionId); if (modelVersion == null) { throw new ArgumentNullException(nameof(modelVersion)); } if (!new PermissionService().CanUserVisitProject(CurrentCustomer, modelVersion.EngineeringFile.Engineering.ProjectId)) { return(NoAuthorityJson()); } var modelProfessions = new ModelProfessionService().GetMany(e => e.ModelVersionId == modelVersionId).ToList(); List <ProfessionStateModel> list = PrepareProfessionStateModel(modelProfessions); return(Json(new { result = true, list = list }, JsonRequestBehavior.AllowGet)); }