Пример #1
0
        public override List <T> GetSelectedRecords <T>(List <ColumnInfo> _parameter, bool paging, int start, int num, ref int totalRecordCount)
        {
            try
            {
                string sSql1 = BuildWhereSql("otcd,from|apdt,to|apdt,from|lmtm,to|lmtm,lmur", _parameter);
                string sSql2 = BuildWhereSql("sfid,stfn,emno", _parameter);

                var q = from p in gDB.totaplctns.Where(sSql1)
                        join t in gDB.vw_employments.Where(sSql2) on p.emno equals t.emno
                        join s in gDB.tottypes on p.otcd equals s.otcd
                        select new
                {
                    p.emno,
                    t.sfid,
                    stfn = t.ntnm,
                    p.lmtm,
                    p.lmur,
                    p.remk,
                    p.apdt,
                    p.frtm,
                    p.apno,
                    p.othr,
                    p.othm,
                    p.otst,
                    p.otcd,
                    p.totm,
                    frtm_date = UtilDatetime.FormatDate1(p.frtm),
                    frtm_time = UtilDatetime.FormatTime1(p.frtm),
                    totm_date = UtilDatetime.FormatDate1(p.totm),
                    totm_time = UtilDatetime.FormatTime1(p.totm)
                };

                List <T> obj = q.Cast <T>().ToList();

                totalRecordCount = obj.Count;

                List <T> appList = null;

                if (paging)
                {
                    appList = obj.Skip(start).Take(num).ToList();
                }
                else
                {
                    appList = obj;
                }

                return(appList);
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }