예제 #1
0
 public static string GetCurrentUserDeptName()
 {
     try
     {
         EDoc2UserInfo userInfo = WebsiteUtility.CurrentUser;
         return(userInfo.DepartmentName);
     }
     catch
     {
         return(string.Empty);
     }
 }
예제 #2
0
 public static string GetCurrentUserAccount()
 {
     try
     {
         EDoc2UserInfo userInfo = WebsiteUtility.CurrentUser;
         return(userInfo.UserLoginName);
     }
     catch
     {
         return(string.Empty);
     }
 }
예제 #3
0
 public static int GetCurrentUserDeptId()
 {
     try
     {
         EDoc2UserInfo userInfo = WebsiteUtility.CurrentUser;
         return(userInfo.DeptId);
     }
     catch
     {
         return(0);
     }
 }
        /// <summary>
        ///     发起流程
        /// </summary>
        /// <param name="processId">流程编号</param>
        /// <param name="incidentId">事件编号</param>
        /// <param name="remark">流程备注</param>
        /// <param name="hashVariation">流程变量</param>
        /// <returns></returns>
        public ITask Start(string processId, string incidentId, string remark, Hashtable hashVariation)
        {
            EDoc2UserInfo userInfo    = WebsiteUtility.CurrentUser;
            string        startUserId = userInfo.UserId.ToString(CultureInfo.InvariantCulture);
            IProcess      process     = GetProcess(processId);

            if (process == null)
            {
                throw new Exception(string.Format("无法获取processId:{0}的流程", processId));
            }
            IStep startStep = GetStartStep(processId);

            if (startStep == null)
            {
                throw new Exception(string.Format("无法获取processId:{0}的开始步骤", processId));
            }

            var task = new Task
            {
                Remark      = remark,
                IncidentId  = incidentId,
                ProcessId   = processId,
                ProcessName = process.Name,
                TaskStarter = startUserId,
                StepId      = startStep.Id
            };
            IExecutionHandler handler = new ExecutionHandler();

            if (hashVariation == null)
            {
                hashVariation = new Hashtable();
            }
            int result = handler.StartProcessInstance(task, hashVariation);

            if (result != 0)
            {
                throw new Exception(string.Format("SubmitTask出错:{0}", result));
            }

            var mailHandler = new ExecutionHandler();

            mailHandler.SendMail(task, task.NextStepType);
            return(task);
        }