Beispiel #1
0
        public ObjectModel.OrgChart GetSingleOrDefault(Expression <Func <ObjectModel.OrgChart, bool> > filter, string orderBy)
        {
            var newfilter = ExpressionConverter <OrgChart> .Convert(filter);

            var dao         = new OrgChartRepository();
            int recordCount = 0;
            var data        = dao.QueryByPage(newfilter, orderBy, 1, 1, out recordCount).ToList().FirstOrDefault();

            if (null == data)
            {
                return(null);
            }
            var list   = new List <ObjectModel.OrgChart>();
            var rmodel = new ConvertModel();

            return(rmodel.ReturnModel <ObjectModel.OrgChart, OrgChart>(data));
        }
Beispiel #2
0
        public IList <ObjectModel.OrgChart> QueryByPage(Expression <Func <ObjectModel.OrgChart, bool> > filter, string orderBy, int pageSize, int pageIndex, out int recordsCount)
        {
            var newfilter = ExpressionConverter <OrgChart> .Convert(filter);

            var dao      = new OrgChartRepository();
            var dataList = dao.QueryByPage(newfilter, orderBy, pageSize, pageIndex, out recordsCount).ToList();

            if (null == dataList)
            {
                return(null);
            }
            var list   = new List <ObjectModel.OrgChart>();
            var rmodel = new ConvertModel();

            foreach (var vartemp in dataList)
            {
                var omOrgChart = rmodel.ReturnModel <ObjectModel.OrgChart, OrgChart>(vartemp);
                list.Add(omOrgChart);
            }
            return(list);
        }