Exemple #1
0
        /// <summary>
        /// 通用分页查询 韦德 2018年9月22日16:11:04
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="condition"></param>
        /// <param name="state"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public IList <ProductDetail> GetLimit(int page, string limit, string condition, int state, string beginTime, string endTime)
        {
            page         = ConditionUtil.ExtractPageIndex(page, limit);
            String where = ExtractLimitWhere(condition, state, beginTime, endTime);
            List <ProductDetail> list = productRepository.SelectLimit(page, limit, state, beginTime, endTime, where);

            return(list);
        }
 /// <summary>
 /// 通用分页查询 韦德 2018年9月22日16:11:04
 /// </summary>
 /// <param name="page"></param>
 /// <param name="limit"></param>
 /// <param name="condition"></param>
 /// <param name="type"></param>
 /// <param name="beginTime"></param>
 /// <param name="endTime"></param>
 /// <returns></returns>
 public virtual IList <T> GetPageLimit <T>(int page, string limit, string condition, int type, string beginTime, string endTime)
 {
     page         = ConditionUtil.ExtractPageIndex(page, limit);
     String where = ExtractLimitWhere(condition, type, beginTime, endTime);
     //List<T> list = productRepository.SelectLimit(page, limit, state, beginTime, endTime, where);
     //return list;
     return(null);
 }
        public override IList <Accounts> GetAccountPageLimit(int page, string limit, string condition, int type, string beginTime, string endTime)
        {
            page         = ConditionUtil.ExtractPageIndex(page, limit);
            String where = ExtractLimitWhere(condition, type, beginTime, endTime);
            IList <Accounts> list = accountsRepository.SelectLimit(page, limit, type, beginTime, endTime, where);

            return(list);
        }
Exemple #4
0
        public override IList <PaysDetail> GetPayPageLimit(int page, string limit, string condition, int tradeType, int type, string beginTime, string endTime)
        {
            page         = ConditionUtil.ExtractPageIndex(page, limit);
            String where = ExtractLimitWhere(condition, tradeType, type, beginTime, endTime);
            IList <PaysDetail> list = paysRepository.SelectLimit(page, limit, tradeType, type, beginTime, endTime, where);

            return(list);
        }
Exemple #5
0
        private bool getData()
        {
            ConditionUtil c  = new ConditionUtil();
            DataSet       ds = new DataSet();

            string[] sqls = tranSql.Split(';');
            if (sqls.Length <= 0)
            {
                return(true);
            }
            foreach (string sql in sqls)
            {
                ds.Clear();
                string[] ss = sql.Split(',');
                try
                {
                    ds = dao.getDataSet(ss[1], c);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ss[1].Contains("tx"))
                        {
                            //处理Sqlite图像数据
                            if (dao.getDbType() == "sqllite")
                            {
                                logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 获得上传数据" + ss[0] + ",数据总数为:" + ds.Tables[0].Rows.Count.ToString());
                                wirteXmlToFile(toXmlForSqlite(ds, "datas"), ss[0] + ".xml");
                            }
                            else
                            {
                                logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 获得上传数据" + ss[0] + ",数据总数为:" + ds.Tables[0].Rows.Count.ToString());
                                wirteXmlToFile(DsUtil.toXml(ds, "datas"), ss[0] + ".xml");
                            }
                        }
                        else
                        {
                            logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 获得上传数据" + ss[0] + ",数据总数为:" + ds.Tables[0].Rows.Count.ToString());
                            wirteXmlToFile(DsUtil.toXml(ds, "datas"), ss[0] + ".xml");
                        }
                    }
                    updateOneData(ss[2], ss[0]);
                }
                catch (Exception e)
                {
                    logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 获得上传数据" + ss[0] + "失败,失败原因:" + e.Message + e.StackTrace);
                    return(false);
                }
            }
            return(true);
        }
Exemple #6
0
        private void updateOneData(string sql, string tablename)
        {
            ConditionUtil c = new ConditionUtil();

            c.F_transmit_date = DateTime.Now;
            try
            {
                dao.execDml(sql.Trim(), c);
                logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 更新数据" + tablename + "标志成功");
            }
            catch (Exception ex)
            {
                logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 更新数据" + tablename + "标志失败,失败原因:" + ex.Message);
            }
        }
        protected override string ExtractLimitWhere(string condition, int type, string beginTime, string endTime)
        {
            // 查询模糊条件
            String where = " 1=1";


            if (type > 0)
            {
                where += " AND t1.accountsType = " + type + " ";
            }

            if (condition != null && condition.Length > 1)
            {
                condition = condition.Trim();

                if (condition.Contains("-"))
                {
                    where += " AND  " + ConditionUtil.Match("accountsType", "2", true, "t1");
                    where += " AND " + ConditionUtil.Match("amount", condition.Replace("-", "").Trim(), true, "t1");
                }
                else if (condition.Contains("+"))
                {
                    where += " AND  " + ConditionUtil.Match("accountsType", "1", true, "t1");
                    where += " AND " + ConditionUtil.Match("amount", condition.Replace("+", "").Trim(), true, "t1");
                }
                else
                {
                    where += " AND (" + ConditionUtil.Like("accountsId", condition, true, "t1");
                    where += " AND (" + ConditionUtil.Like("payId", condition, true, "t1");
                    if (condition.Split('-').Length >= 1)
                    {
                        where += " OR " + ConditionUtil.Like("addTime", condition, true, "t1");
                    }
                    where += " OR " + ConditionUtil.Like("tradeAccountName", condition, true, "t1");
                    where += " OR " + ConditionUtil.Like("remark", condition, true, "t1") + ")";

                    where += ")";
                }
            }

            // 取两个日期之间或查询指定日期
            where = ExtractBetweenTime(beginTime, endTime, where);
            return(where.Trim());
        }
Exemple #8
0
        protected string ExtractLimitWhere(string condition, int tradeType, int type, string beginTime, string endTime)
        {
            // 查询模糊条件
            String where = " 1=1";

            if (type == 0)
            {
                if (condition != null && condition.Length > 1)
                {
                    condition = condition.Trim();
                    where    += " AND (" + ConditionUtil.Like("payId", condition, true, "t1");
                    where    += " OR " + ConditionUtil.Like("systemRecordId", condition, true, "t1");
                    where    += " OR " + ConditionUtil.Like("fromName", condition, true, "t1");
                    where    += " OR " + ConditionUtil.Like("toName", condition, true, "t1");
                    if (condition.Split('-').Length == 2)
                    {
                        where += " OR " + ConditionUtil.Like("addTime", condition, true, "t1");
                    }
                    where += " OR " + ConditionUtil.Like("tradeType", condition, true, "t1");
                    where += " OR " + ConditionUtil.Like("remark", condition, true, "t1") + ")";
                }

                // 查询全部数据或者只有一类数据
                if (tradeType != 0)
                {
                    where += $" AND t1.tradeType = {tradeType}";
                }
                // 取两个日期之间或查询指定日期
                where = ExtractBetweenTime(beginTime, endTime, where);
            }
            else
            {
                if (condition != null && condition.Length > 1)
                {
                    condition = condition.Trim();
                    where    += " AND (" + ConditionUtil.Like("fromName", condition, true, "t1");
                    where    += " OR " + ConditionUtil.Like("toName", condition, true, "t1");
                    where    += " OR " + ConditionUtil.Like("amount", condition, true, "t1") + ")";
                }
            }
            return(where.Trim());
        }
Exemple #9
0
        private byte[] getTx(string f_id, string sqlid)
        {
            byte[]        buf = null;
            ConditionUtil c   = new ConditionUtil();

            c.Sitem1 = f_id;
            DataSet ds = dao.getDataSet(sqlid, c);

            if (ds.Tables[0].Rows.Count > 0)
            {
                IDataReader dr = dao.getDataRead(sqlid, c);
                if (dr != null)
                {
                    dr.Read();
                    int ndatalen = (int)dr.GetBytes(0, 0, null, 0, 0);
                    buf = new byte[ndatalen];
                    dr.GetBytes(0, 0, buf, 0, buf.Length);
                }
            }
            return(buf);
        }
Exemple #10
0
        /// <summary>
        /// 提取分页条件
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="isEnable"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        private String ExtractLimitWhere(String condition, int isEnable, String beginTime, String endTime)
        {
            // 查询模糊条件
            String where = " 1=1";
            if (condition != null)
            {
                condition = condition.Trim();
                where    += " AND (" + ConditionUtil.Like("sid", condition, true, "t1");
                if (condition.Split('-').Length == 2)
                {
                    where += " OR " + ConditionUtil.Like("addTime", condition, true, "t1");
                    where += " OR " + ConditionUtil.Like("editTime", condition, true, "t1");
                }
                where += " OR " + ConditionUtil.Like("productName", condition, true, "t1");
                where += " OR " + ConditionUtil.Like("categoryId", condition, true, "t1") + ")";
            }

            // 查询全部数据或者只有一类数据
            // where = extractQueryAllOrOne(isEnable, where);

            // 取两个日期之间或查询指定日期
            where = ExtractBetweenTime(beginTime, endTime, where);
            return(where.Trim());
        }
Exemple #11
0
 public void AllNullTest()
 {
     Assert.IsTrue(ConditionUtil.AllNull <int?>(null, null, null));
     Assert.IsFalse(ConditionUtil.AllNull <int?>(null, null, null, 0));
 }
Exemple #12
0
 public void AllTest()
 {
     Assert.IsTrue(ConditionUtil.All(true, true, true));
     Assert.IsTrue(ConditionUtil.All(true));
     Assert.IsFalse(ConditionUtil.All(true, false, true));
 }
        // private static Logger log = LoggerFactory.getLogger(typeof(ExclusiveGatewayActivityBehavior));

        /// <summary>
        /// The default behaviour of BPMN, taking every outgoing sequence flow (where the condition evaluates to true), is not valid for an exclusive gateway.
        ///
        /// Hence, this behaviour is overridden and replaced by the correct behavior: selecting the first sequence flow which condition evaluates to true (or which hasn't got a condition) and leaving the
        /// activity through that sequence flow.
        ///
        /// If no sequence flow is selected (ie all conditions evaluate to false), then the default sequence flow is taken (if defined).
        /// </summary>
        public override void Leave(IExecutionEntity execution)
        {
            if (log.IsEnabled(LogLevel.Debug))
            {
                log.LogDebug($"Leaving exclusive gateway '{execution.CurrentActivityId}'");
            }

            ExclusiveGateway exclusiveGateway = (ExclusiveGateway)execution.CurrentFlowElement;

            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;

            if (processEngineConfiguration is object && processEngineConfiguration.EventDispatcher.Enabled)
            {
                processEngineConfiguration.EventDispatcher.DispatchEvent(ActivitiEventBuilder.CreateActivityEvent(ActivitiEventType.ACTIVITY_COMPLETED, exclusiveGateway.Id, exclusiveGateway.Name, execution.Id, execution.ProcessInstanceId, execution.ProcessDefinitionId, exclusiveGateway));
            }

            SequenceFlow outgoingSequenceFlow  = null;
            SequenceFlow defaultSequenceFlow   = null;
            string       defaultSequenceFlowId = exclusiveGateway.DefaultFlow;

            // Determine sequence flow to take
            foreach (SequenceFlow sequenceFlow in exclusiveGateway.OutgoingFlows)
            {
                string skipExpressionString = sequenceFlow.SkipExpression;
                if (!SkipExpressionUtil.IsSkipExpressionEnabled(execution, skipExpressionString))
                {
                    bool conditionEvaluatesToTrue = ConditionUtil.HasTrueCondition(sequenceFlow, execution);
                    if (conditionEvaluatesToTrue && (defaultSequenceFlowId is null || !defaultSequenceFlowId.Equals(sequenceFlow.Id)))
                    {
                        if (log.IsEnabled(LogLevel.Debug))
                        {
                            log.LogDebug($"Sequence flow '{sequenceFlow.Id}'selected as outgoing sequence flow.");
                        }
                        outgoingSequenceFlow = sequenceFlow;
                        break;
                    }
                }
                else if (SkipExpressionUtil.ShouldSkipFlowElement(Context.CommandContext, execution, skipExpressionString))
                {
                    outgoingSequenceFlow = sequenceFlow;
                    break;
                }

                // Already store it, if we would need it later. Saves one for loop.
                if (defaultSequenceFlowId is object && defaultSequenceFlowId.Equals(sequenceFlow.Id))
                {
                    defaultSequenceFlow = sequenceFlow;
                }
            }

            // We have to record the end here, or else we're already past it
            Context.CommandContext.HistoryManager.RecordActivityEnd(execution, null);

            // Leave the gateway
            if (outgoingSequenceFlow != null)
            {
                execution.CurrentFlowElement = outgoingSequenceFlow;

                log.LogInformation($"条件表达式:id={outgoingSequenceFlow.Id} expression={outgoingSequenceFlow.ConditionExpression}");
            }
            else
            {
                if (defaultSequenceFlow != null)
                {
                    execution.CurrentFlowElement = defaultSequenceFlow;

                    log.LogInformation($"条件表达式:id={defaultSequenceFlow.Id} expression={defaultSequenceFlow.ConditionExpression}");
                }
                else
                {
                    // No sequence flow could be found, not even a default one
                    throw new ActivitiException("No outgoing sequence flow of the exclusive gateway '" + exclusiveGateway.Id + "' could be selected for continuing the process");
                }
            }

            base.Leave(execution);
        }
Exemple #14
0
 public void NothingTest()
 {
     Assert.IsTrue(ConditionUtil.Nothing(false, false, false));
     Assert.IsTrue(ConditionUtil.Nothing(false));
     Assert.IsFalse(ConditionUtil.Nothing(false, true, false));
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="flowNode"></param>
        protected internal virtual void LeaveFlowNode(FlowNode flowNode)
        {
            log.LogDebug($"Leaving flow node {flowNode.GetType()} with id '{flowNode.Id}' by following it's {flowNode.OutgoingFlows.Count} outgoing sequenceflow");

            // Get default sequence flow (if set)
            string defaultSequenceFlowId = null;

            if (flowNode is Activity)
            {
                defaultSequenceFlowId = ((Activity)flowNode).DefaultFlow;
            }
            else if (flowNode is Gateway)
            {
                defaultSequenceFlowId = ((Gateway)flowNode).DefaultFlow;
            }

            // Determine which sequence flows can be used for leaving
            IList <SequenceFlow> outgoingSequenceFlows = new List <SequenceFlow>();

            foreach (SequenceFlow sequenceFlow in flowNode.OutgoingFlows)
            {
                string skipExpressionString = sequenceFlow.SkipExpression;
                if (!SkipExpressionUtil.IsSkipExpressionEnabled(execution, skipExpressionString))
                {
                    if (!evaluateConditions || (evaluateConditions && ConditionUtil.HasTrueCondition(sequenceFlow, execution) && (defaultSequenceFlowId is null || !defaultSequenceFlowId.Equals(sequenceFlow.Id))))
                    {
                        outgoingSequenceFlows.Add(sequenceFlow);
                    }
                }
                else if (flowNode.OutgoingFlows.Count == 1 || SkipExpressionUtil.ShouldSkipFlowElement(commandContext, execution, skipExpressionString))
                {
                    // The 'skip' for a sequence flow means that we skip the condition, not the sequence flow.
                    outgoingSequenceFlows.Add(sequenceFlow);
                }
            }

            // Check if there is a default sequence flow
            if (outgoingSequenceFlows.Count == 0 && evaluateConditions)
            { // The elements that set this to false also have no support for default sequence flow
                if (defaultSequenceFlowId is object)
                {
                    foreach (SequenceFlow sequenceFlow in flowNode.OutgoingFlows)
                    {
                        if (defaultSequenceFlowId.Equals(sequenceFlow.Id))
                        {
                            outgoingSequenceFlows.Add(sequenceFlow);
                            break;
                        }
                    }
                }
            }

            // No outgoing found. Ending the execution
            if (outgoingSequenceFlows.Count == 0)
            {
                if (flowNode.OutgoingFlows == null || flowNode.OutgoingFlows.Count == 0)
                {
                    log.LogDebug($"No outgoing sequence flow found for flow node '{flowNode.Id}'.");
                    Context.Agenda.PlanEndExecutionOperation(execution);
                }
                else
                {
                    throw new ActivitiException("No outgoing sequence flow of element '" + flowNode.Id + "' could be selected for continuing the process");
                }
            }
            else
            {
                // Leave, and reuse the incoming sequence flow, make executions for all the others (if applicable)

                IExecutionEntityManager  executionEntityManager = commandContext.ExecutionEntityManager;
                IList <IExecutionEntity> outgoingExecutions     = new List <IExecutionEntity>(flowNode.OutgoingFlows.Count);

                SequenceFlow sequenceFlow = outgoingSequenceFlows[0];

                // Reuse existing one
                execution.CurrentFlowElement = sequenceFlow;
                execution.IsActive           = true;
                outgoingExecutions.Add(execution);

                // Executions for all the other one
                if (outgoingSequenceFlows.Count > 1)
                {
                    for (int i = 1; i < outgoingSequenceFlows.Count; i++)
                    {
                        IExecutionEntity parent = execution.ParentId is object?execution.Parent : execution;
                        IExecutionEntity outgoingExecutionEntity = commandContext.ExecutionEntityManager.CreateChildExecution(parent);

                        SequenceFlow outgoingSequenceFlow = outgoingSequenceFlows[i];
                        outgoingExecutionEntity.CurrentFlowElement = outgoingSequenceFlow;

                        executionEntityManager.Insert(outgoingExecutionEntity);
                        outgoingExecutions.Add(outgoingExecutionEntity);
                    }
                }

                // Leave (only done when all executions have been made, since some queries depend on this)
                foreach (IExecutionEntity outgoingExecution in outgoingExecutions)
                {
                    Context.Agenda.PlanContinueProcessOperation(outgoingExecution);
                }
            }
        }
Exemple #16
0
 public void AnyNullTest()
 {
     Assert.IsTrue(ConditionUtil.AnyNull <int?>(1, 2, 3, null));
     Assert.IsTrue(ConditionUtil.AnyNull <int?>(1, null, 3, null));
     Assert.IsFalse(ConditionUtil.AnyNull <int?>(1, 2, 3, 4, 5));
 }
Exemple #17
0
 public void NothingNullTest()
 {
     Assert.IsTrue(ConditionUtil.NothingNull <int?>(1, 2, 3, 4, 5));
     Assert.IsFalse(ConditionUtil.NothingNull <int?>(1, 2, 3, 4, null));
 }
Exemple #18
0
 public void AnyTest()
 {
     Assert.IsTrue(ConditionUtil.Any(false, false, false, true));
     Assert.IsTrue(ConditionUtil.Any(false, true, true));
     Assert.IsFalse(ConditionUtil.Any(false, false));
 }