Ejemplo n.º 1
0
        /// <summary>
        /// 保存转办
        /// </summary>
        /// <returns></returns>
        public JsonResult SaveWorkflowTurnToDo(CompleteActivityModel model)
        {
            var retModel = new JsonReturnModel();

            try
            {
                var user = UserDA.GetUserByFirstName(model.delegateToName);
                if (user == null)
                {
                    retModel.AddError("errorMessage", "选择的转办不存在!");
                    return(Json(retModel, JsonRequestBehavior.AllowGet));
                }

                if (model.delegateToName == Userinfo.UserName)
                {
                    retModel.AddError("errorMessage", "转办人不能选择自己!");
                    return(Json(retModel, JsonRequestBehavior.AllowGet));
                }

                IDENTITY dentity      = IdentityDA.GetIdentityByActivityAssignmentId(model.activityAssignmentId);
                string   identityName = dentity.KEYED_NAME;
                if (identityName.Trim() != Userinfo.UserName)
                {
                    retModel.AddError("errorMessage", "代理权限不能进行转办!");
                    return(Json(retModel, JsonRequestBehavior.AllowGet));
                }

                string errorString = ActivityDA.CompleteActivity(inn, model.activityId, model.activityAssignmentId, "", "Delegate", model.delegateToName, Userinfo.UserName + "转办到:" + model.delegateToName, Userinfo);
                if (string.IsNullOrEmpty(errorString))
                {
                    WorkFlowBll.TurnToDoSendEmail(Userinfo.UserName, model.delegateToName, model.recordNo, model.linkStr, user.EMAIL);
                }
            }
            catch (Exception ex)
            {
                retModel.AddError("errorMessage", ex.Message);
            }
            return(Json(retModel, JsonRequestBehavior.AllowGet));
        }