Esempio n. 1
0
        public IList <dynamic> GetRecords(string instanceID)
        {
            string query = ResourceManage.GetString(ResourceManage.SQL_WORKFLOW_PROCESS_RECORD);

            return(Connection.Query(query, new
            {
                InstanceID = instanceID
            }).OrderBy(order => order.CreateDateTime).ToList());
        }
        public IList <WorkflowProcess> GetLatestRecords(string instanceID, string NID, int increment)
        {
            string query = ResourceManage.GetString(ResourceManage.SQL_WORKFLOW_PROCESS_LATEST);

            return(Connection.Query <WorkflowProcess>(query, new
            {
                InstanceID = instanceID,
                NID = NID,
                Increment = increment
            }).OrderBy(order => order.CreateDateTime).ToList <WorkflowProcess>());
        }
Esempio n. 3
0
        /// <summary>
        /// 获取节点的审批记录
        /// </summary>
        /// <param name="instanceID">流程实例ID</param>
        /// <returns></returns>
        public static DataTable GetRecord(string instanceID)
        {
            string sql = ResourceManage.GetString(ResourceManage.SQL_ACTOR_RECORD);

            using (IDataReader dr = DapperFactory.CreateWorkflowConnection().ExecuteReader(sql,
                                                                                           new { InstanceID = instanceID }))
            {
                DataTable dt = new DataTable(Guid.NewGuid().ToString());
                dt.Load(dr);
                return(dt);
            }
        }
Esempio n. 4
0
        public DataTable GetRecord(string instanceID)
        {
            string sql = ResourceManage.GetString(ResourceManage.SQL_ACTOR_RECORD);

            LogService.Info(string.Format("查询获取参与者 SQL:{0} INSTANCEID:{1}", sql, instanceID));

            using (IDataReader dr = Connection.ExecuteReader(sql, new { INSTANCEID = instanceID }))
            {
                DataTable dt = new DataTable(Guid.NewGuid().ToString());
                dt.Load(dr);
                return(dt);
            }
        }
        public WorkflowProcess GetRecord(string instanceID, string destinationID)
        {
            WorkflowProcess instance = new WorkflowProcess();
            string          query    = ResourceManage.GetString(ResourceManage.SQL_WORKFLOW_PROCESS);

            instance = Connection.Query <WorkflowProcess>(query, new
            {
                InstanceID  = instanceID,
                Destination = destinationID
            }).OrderByDescending(order => order.CreateDateTime).FirstOrDefault();

            return(instance);
        }
Esempio n. 6
0
        public static WorkflowProcess GetWorkflowProcessInstance(string instanceID, string NID)
        {
            WorkflowProcess instance = new WorkflowProcess();
            string          query    = ResourceManage.GetString(ResourceManage.SQL_WORKFLOW_PROCESS);

            instance = instance.Connection.Query <WorkflowProcess>(query, new
            {
                InstanceID = instanceID,
                NID        = NID,
                Operation  = WorkflowAction.Jump
            }).OrderByDescending(order => order.CreateDateTime).FirstOrDefault();

            return(instance);
        }
Esempio n. 7
0
        public IList <WorkflowInstance> Query(object condition)
        {
            string sql = ResourceManage.GetString(ResourceManage.SQL_WORKFLOW_INSTANCE);

            try
            {
                return(Connection.Query <WorkflowInstance, Node, WorkflowInstance>(sql, (instance, node) =>
                {
                    instance.Current = WorkflowGlobalServiceProvider.Resolve <IWorkflowNodeService>().GetNode(node);
                    return instance;
                }, param: condition, splitOn: "Name").ToList());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 8
0
        public static IDbConnection CreateWorkflowConnection()
        {
            SmartflowConfiguration config = ConfigurationManager.GetSection("smartflowConfiguration") as SmartflowConfiguration;

            Assert.CheckNull(config, "smartflowConfiguration");
            Assert.StringNull(config.ConnectionString, "ConnectionString");
            Assert.StringNull(config.DatabaseCategory, "DatabaseCategory");

            DatabaseCategory dbc;

            if (Enum.TryParse(config.DatabaseCategory, true, out dbc) || String.IsNullOrEmpty(config.ConnectionString))
            {
                return(DapperFactory.CreateConnection(dbc, config.ConnectionString));
            }
            else
            {
                throw new WorkflowException(ResourceManage.GetString(ResourceManage.CONNECTION_CONFIG));
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 获取流程实例
        /// </summary>
        /// <param name="instanceID">实例ID</param>
        /// <returns>流程实例</returns>
        public static WorkflowInstance GetInstance(string instanceID)
        {
            WorkflowInstance workflowInstance = new WorkflowInstance();

            workflowInstance.InstanceID = instanceID;
            string sql = ResourceManage.GetString(ResourceManage.SQL_WORKFLOW_INSTANCE);

            try
            {
                workflowInstance = workflowInstance.Connection.Query <WorkflowInstance, ASTNode, WorkflowInstance>(sql, (instance, node) =>
                {
                    instance.Current = WorkflowNode.ConvertToReallyType(node);
                    return(instance);
                }, param: new { INSTANCEID = instanceID }, splitOn: "APPELLATION").FirstOrDefault <WorkflowInstance>();

                return(workflowInstance);
            }
            catch (Exception ex)
            {
                throw new WorkflowException(ex, instanceID);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 获取消息列表
        /// </summary>
        /// <param name="from">发件人邮件地址</param>
        /// <param name="sender">发件人显示名称</param>
        /// <param name="to">收件人地址</param>
        /// <param name="subject">邮件标题</param>
        /// <param name="body">邮件正文</param>
        protected List <MailMessage> GetSendMessageList(string from, string sender, string[] recvierArray, string subject, string body)
        {
            if (recvierArray.Any(MAddress => !Regex.IsMatch(MAddress, ResourceManage.GetString(ResourceManage.MAIL_URL_EXPRESSION))))
            {
                return(null);
            }

            List <MailMessage> messageList = new List <MailMessage>();

            foreach (string recvier in recvierArray)
            {
                MailMessage message = new MailMessage(new MailAddress(from, sender), new MailAddress(recvier));
                message.Subject         = subject;
                message.SubjectEncoding = Encoding.UTF8;
                message.Body            = body;
                message.BodyEncoding    = Encoding.UTF8;
                message.IsBodyHtml      = true;
                message.Priority        = MailPriority.Normal;
                messageList.Add(message);
            }
            return(messageList);
        }
 public WorkflowLoggingService()
 {
     logging.Source = ResourceManage.GetString(ResourceManage.SMARTFLOW_SHARP_NAME);
 }
Esempio n. 12
0
        public IList <WorkflowProcess> Query(object condition)
        {
            string query = ResourceManage.GetString(ResourceManage.SQL_WORKFLOW_PROCESS_LATEST);

            return(Connection.Query <WorkflowProcess>(query, condition).ToList <WorkflowProcess>());
        }
Esempio n. 13
0
 public WorkflowException(Exception innerException, string instanceID)
     : base(ResourceManage.GetString(ResourceManage.SMARTFLOW_SHARP_NAME), innerException)
 {
     logging.Error(string.Format("异常消息:{0} 实例ID:{1}", innerException.ToString(), instanceID));
 }
Esempio n. 14
0
 public WorkflowException(Exception innerException)
     : base(ResourceManage.GetString(ResourceManage.SMARTFLOW_SHARP_NAME), innerException)
 {
     logging.Error(innerException.ToString());
 }