Пример #1
0
        public override List <CPFlow> GetFlowMaxTwoVer(int flowId)
        {
            CPFlowDbContext _db = this._dbContext as CPFlowDbContext;
            var             q   = (from flow in _db.CPFlowCol
                                   where flow.FlowId.Equals(flowId)
                                   orderby flow.FlowVerId descending
                                   select flow).Take(2);

            return(q.ToList());
        }
Пример #2
0
        public override CPFlow GetFlowMaxVer(int flowId)
        {
            CPFlowDbContext _db = this._dbContext as CPFlowDbContext;
            var             q   = (from flow in _db.CPFlowCol
                                   where flow.FlowId.Equals(flowId)
                                   orderby flow.FlowVerId descending
                                   select flow).Take(1);

            if (q.Count() > 0)
            {
                return(q.ToList()[0]);
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
        public override List <CPFlow> GetAllFlowMaxVer()
        {
            DbHelper   _helper = new DbHelper("CPCommonIns", CPAppContext.CurDbType());
            string     strSql  = @" SELECT FlowId,MAX(FlowVerId)  AS FlowVerId FROM dbo.Flow_Template
                GROUP BY FlowId";
            DataTable  dt      = _helper.ExecuteDataTable(strSql);
            List <int> col     = new List <int>();

            foreach (DataRow dr in dt.Rows)
            {
                col.Add(int.Parse(dr["FlowVerId"].ToString()));
            }
            CPFlowDbContext _db = this._dbContext as CPFlowDbContext;
            var             q   = (from flow in _db.CPFlowCol
                                   where col.Contains(flow.FlowVerId)
                                   select flow);

            return(q.ToList());
        }