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 AduitOperateComment(int commentId, AduitCommentOperationType operationType) { var comment = new CommentService().Get(e => e.Id == commentId); if (comment == null) { throw new ArgumentNullException(nameof(comment)); } if (!new PermissionService().CanCheckProject(CurrentCustomer, comment.EngineeringFile.Engineering, comment.ProfessionId)) { return(NoAuthorityJson()); } var professionalAudit = new ProfessionalAudit(CurrentCustomer, comment.EngineeringFile, comment.EngineeringFile.FileVersions.OrderByDescending(e => e.Id).FirstOrDefault(), comment.ProfessionId); CurrentCustomer.CurrentRole = Role.Checker; var result = false; if (operationType == AduitCommentOperationType.Pre_AuditDeleteComment) { result = professionalAudit.DeleteComment(commentId, string.Empty, operationType.GetDescription(), FlowCode.Pre_AuditCompany_ProfessionAudit_Delete_Comment); } else if (operationType == AduitCommentOperationType.DeleteComment) { result = professionalAudit.DeleteComment(commentId, string.Empty, operationType.GetDescription()); } else if (operationType == AduitCommentOperationType.AgreeRepaired) { result = professionalAudit.AgreeRepari(commentId, string.Empty, operationType.GetDescription()); } else if (operationType == AduitCommentOperationType.DisagreeRepaired) { result = professionalAudit.DisagreeRepari(commentId, string.Empty, operationType.GetDescription()); } else if (operationType == AduitCommentOperationType.Back) { result = professionalAudit.UndoComment(commentId, string.Empty, operationType.GetDescription()); } return(Json(new { result = result, errmsg = "" })); }
public ActionResult BulkOperation(string strCommentIds, CommentBulkOperationType type) { var commentIds = strCommentIds.Split(',').Select(e => { return(Convert.ToInt32(e)); }).ToArray(); if (commentIds.Count() == 0) { return(Json(new { result = false, errmsg = "未选择意见" })); } var first = commentIds[0]; var comment = new CommentService().Get(e => e.Id == first); if (comment == null) { throw new ArgumentNullException(nameof(comment)); } var result = true; string errmsg = ""; var designCompanyProjectManager = new DesignCompanyProjectManager(CurrentCustomer, comment.EngineeringFile, comment.EngineeringFile.FileVersions.OrderByDescending(e => e.Id).FirstOrDefault()); var professionalAudit = new ProfessionalAudit(CurrentCustomer, comment.EngineeringFile, comment.EngineeringFile.FileVersions.OrderByDescending(e => e.Id).FirstOrDefault(), comment.ProfessionId); var professionalReAudit = new ProfessionalReAudit(CurrentCustomer, comment.EngineeringFile, comment.EngineeringFile.FileVersions.OrderByDescending(e => e.Id).FirstOrDefault(), comment.ProfessionId); if (type == CommentBulkOperationType.DesignManagerRepaired) { if (!new PermissionService().CanManagerProject(CurrentCustomer, comment.EngineeringFile.Engineering.Project)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.DesignCompanyManager; foreach (var id in commentIds) { var dic = new Dictionary <int, bool>(); dic.Add(id, true); if (!designCompanyProjectManager.CommentsRepair(dic, "", type.GetDescription())) { result = false; errmsg = SetBulkOperationErrsmg(errmsg, id); } } } else if (type == CommentBulkOperationType.DesignManagerUnrepaired) { if (!new PermissionService().CanManagerProject(CurrentCustomer, comment.EngineeringFile.Engineering.Project)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.DesignCompanyManager; foreach (var id in commentIds) { var dic = new Dictionary <int, bool>(); dic.Add(id, false); if (!designCompanyProjectManager.CommentsRepair(dic, "", type.GetDescription())) { result = false; errmsg = SetBulkOperationErrsmg(errmsg, id); } } } else if (type == CommentBulkOperationType.CheckerAgreeRepaired) { if (!new PermissionService().CanCheckProject(CurrentCustomer, comment.EngineeringFile.Engineering, comment.ProfessionId)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.Checker; foreach (var id in commentIds) { if (!professionalAudit.AgreeRepari(id, string.Empty, type.GetDescription())) { result = false; errmsg = SetBulkOperationErrsmg(errmsg, id); } } } else if (type == CommentBulkOperationType.ChecherDisagreeRepaired) { if (!new PermissionService().CanCheckProject(CurrentCustomer, comment.EngineeringFile.Engineering, comment.ProfessionId)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.Checker; foreach (var id in commentIds) { if (!professionalAudit.DisagreeRepari(id, string.Empty, type.GetDescription())) { result = false; errmsg = SetBulkOperationErrsmg(errmsg, id); } } } else if (type == CommentBulkOperationType.ReviewerAgreeRepaired) { if (!new PermissionService().CanReviewProject(CurrentCustomer, comment.EngineeringFile.Engineering, comment.ProfessionId)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.Reviewer; foreach (var id in commentIds) { if (!professionalReAudit.AgreeRepair(id, string.Empty, type.GetDescription())) { result = false; errmsg = SetBulkOperationErrsmg(errmsg, id); } } } else if (type == CommentBulkOperationType.ReviewerDisagreeRepaired) { if (!new PermissionService().CanReviewProject(CurrentCustomer, comment.EngineeringFile.Engineering, comment.ProfessionId)) { return(NoAuthorityJson()); } CurrentCustomer.CurrentRole = Role.Reviewer; foreach (var id in commentIds) { if (!professionalReAudit.DisagreeRepair(id, string.Empty, type.GetDescription())) { result = false; errmsg = SetBulkOperationErrsmg(errmsg, id); } } } return(Json(new { result = result, errmsg = errmsg })); }