Example #1
0
        public IList <StaffInfo> GetListByOrg(int pageIndex, int pageSize, out int totalRecords, object orgId, string sqlWhere, params SqlParameter[] cmdParms)
        {
            var queryModel = ConvertToModel.ToModel <LiteQueryModel>(cmdParms);

            IEnumerable <StaffInfo> staffs = null;

            if (!string.IsNullOrEmpty(queryModel.Keyword))
            {
                staffs = _db.Staffs.Find(m => (m.Coded + m.Phone).Contains(queryModel.Keyword));
            }
            else
            {
                staffs = _db.Staffs.FindAll();
            }
            if (staffs == null)
            {
                totalRecords = 0;
                return(null);
            }

            totalRecords = staffs.Count();

            var datas = staffs.Skip((pageIndex - 1) * pageSize).Take(pageSize);

            return(datas.ToList());
        }
Example #2
0
        public IList <SiteMultiInfo> GetListByJoin(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            var queryModel = ConvertToModel.ToModel <LiteQueryModel>(cmdParms);

            IEnumerable <SiteMultiInfo> siteMultis = null;

            if (!string.IsNullOrEmpty(queryModel.Keyword))
            {
                siteMultis = _db.SiteMultis.Find(m => m.Coded.Contains(queryModel.Keyword) || m.Named.Contains(queryModel.Keyword));
            }
            else
            {
                siteMultis = _db.SiteMultis.FindAll();
            }
            if (siteMultis == null)
            {
                totalRecords = 0;
                return(null);
            }

            totalRecords = siteMultis.Count();

            var datas = siteMultis.Skip((pageIndex - 1) * pageSize).Take(pageSize);

            foreach (var item in datas)
            {
                var sitePictureInfo = _db.SitePictures.FindOne(m => (m.FileDirectory + m.FileName).Equals(item.SiteLogo));
                item.SiteLogoId = sitePictureInfo == null ? Guid.Empty : sitePictureInfo.Id;
            }

            return(datas.ToList());
        }
Example #3
0
        public IList <ComboboxInfo> GetCbbList(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            var queryModel = ConvertToModel.ToModel <LiteQueryModel>(cmdParms);

            IEnumerable <SitePictureInfo> sitePictures = null;

            if (!string.IsNullOrEmpty(queryModel.Keyword))
            {
                sitePictures = _db.SitePictures.Find(m => m.FunType.Contains(queryModel.Keyword));
            }
            else
            {
                sitePictures = _db.SitePictures.FindAll();
            }
            if (sitePictures == null)
            {
                totalRecords = 0;
                return(null);
            }

            totalRecords = sitePictures.Count();

            var datas = sitePictures.Skip((pageIndex - 1) * pageSize).Take(pageSize);

            var cbbDatas = new List <ComboboxInfo>();

            foreach (var item in datas)
            {
                cbbDatas.Add(new ComboboxInfo(item.Id.ToString(), string.Format("{0}{1}{2}", "/Asset", item.FileDirectory, item.FileName)));
            }

            return(cbbDatas);
        }
Example #4
0
        public PandianInfo GetModelByJoin(string sqlWhere, params SqlParameter[] cmdParms)
        {
            PandianInfo pandianInfo = ConvertToModel.ToModel <PandianInfo>(cmdParms);

            if (!pandianInfo.Id.Equals(Guid.Empty))
            {
                return(_db.Pandians.FindById(pandianInfo.Id));
            }

            return(null);
        }
Example #5
0
        public IList <SiteMenusInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            LiteQueryModel queryModel = ConvertToModel.ToModel <LiteQueryModel>(cmdParms);

            if (!queryModel.ApplicationId.Equals(Guid.Empty))
            {
                return(_db.SiteMenus.Find(m => m.ApplicationId.Equals(queryModel.ApplicationId)).ToList());
            }

            return(_db.SiteMenus.FindAll().ToList());
        }
Example #6
0
        public IList <BarcodeTemplateInfo> GetList(int pageIndex, int pageSize, string sqlWhere, params SqlParameter[] cmdParms)
        {
            BarcodeTemplateInfo model = ConvertToModel.ToModel <BarcodeTemplateInfo>(cmdParms);
            IEnumerable <BarcodeTemplateInfo> datas = _db.BarcodeTemplates.FindAll();

            if (!string.IsNullOrEmpty(model.TypeName))
            {
                datas = datas.Where(m => m.TypeName.Equals(model.TypeName));
            }

            return(datas.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList());
        }
Example #7
0
        public IList <ProductInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            LiteQueryModel queryModel = ConvertToModel.ToModel <LiteQueryModel>(cmdParms);

            Query query = null;

            if (!queryModel.MgrDepmtId.Equals(Guid.Empty))
            {
                query = Query.And(Query.EQ("MgrDepmtId", queryModel.MgrDepmtId));
            }
            if (!queryModel.CategoryId.Equals(Guid.Empty))
            {
                query = Query.And(Query.EQ("CategoryId", queryModel.CategoryId));
            }
            if (!queryModel.UseDepmtId.Equals(Guid.Empty))
            {
                query = Query.And(Query.EQ("UseDepmtId", queryModel.CategoryId));
            }
            if (!queryModel.StoragePlaceId.Equals(Guid.Empty))
            {
                query = Query.And(Query.EQ("StoragePlaceId", queryModel.CategoryId));
            }
            if (queryModel.StartDate != DateTime.MinValue && queryModel.EndDate != DateTime.MinValue)
            {
                query = Query.And(Query.Between("BuyDate", queryModel.StartDate, queryModel.EndDate));
            }
            else
            {
                if (queryModel.StartDate != DateTime.MinValue)
                {
                    query = Query.And(Query.GTE("BuyDate", queryModel.StartDate));
                }
                if (queryModel.EndDate != DateTime.MinValue)
                {
                    query = Query.And(Query.LT("BuyDate", queryModel.EndDate));
                }
            }

            if (!string.IsNullOrEmpty(queryModel.UserRule))
            {
                query = Query.And(Query.Where("MgrDepmtId", m => queryModel.UserRule.Contains(m)));
            }

            if (query != null)
            {
                return(_db.Products.Find(query).ToList());
            }
            else
            {
                return(_db.Products.FindAll().ToList());
            }
        }
Example #8
0
        public IList <FeatureUserInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            FeatureUserInfo model = ConvertToModel.ToModel <FeatureUserInfo>(cmdParms);

            IEnumerable <FeatureUserInfo> datas = _db.FeatureUsers.FindAll();

            if (!model.UserId.Equals(Guid.Empty))
            {
                datas = datas.Where(m => m.UserId.Equals(model.UserId));
            }
            if (!string.IsNullOrEmpty(model.TypeName))
            {
                datas = datas.Where(m => m.TypeName.Equals(model.TypeName));
            }

            return(datas.ToList());
        }
Example #9
0
        public List <SiteRolesInfo> GetAspnetList(string appName, string sqlWhere, params SqlParameter[] cmdParms)
        {
            var queryModel = ConvertToModel.ToModel <LiteQueryModel>(cmdParms);
            IEnumerable <SiteRolesInfo> siteRoles = null;

            var appid = new Applications().GetAspnetAppId(appName);

            if (!string.IsNullOrEmpty(queryModel.SqlIn))
            {
                siteRoles = _db.SiteRoles.Find(m => m.ApplicationId.Equals(appid) && queryModel.SqlIn.Contains(m.Named));
            }
            else
            {
                siteRoles = _db.SiteRoles.Find(m => m.ApplicationId.Equals(appid));
            }

            return(siteRoles.ToList());
        }
Example #10
0
        public IList <ProductRepairExtendInfo> GetListByJoin(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            LiteQueryModel queryModel = ConvertToModel.ToModel <LiteQueryModel>(cmdParms);

            Query query = null;

            if (!string.IsNullOrEmpty(queryModel.Keyword))
            {
                query = Query.And(Query.Or(Query.Contains("Named", queryModel.Keyword), Query.Contains("Coded", queryModel.Keyword)));
            }

            IEnumerable <ProductRepairInfo> datas = null;

            if (query == null)
            {
                datas = _db.ProductRepairs.FindAll();
            }
            else
            {
                datas = _db.ProductRepairs.Find(query);
            }

            if (datas == null)
            {
                totalRecords = 0;

                return(null);
            }

            totalRecords = datas.Count();

            IEnumerable <ProductRepairInfo> pageDatas = datas.Skip((pageIndex - 1) * pageSize).Take(pageSize);
            List <ProductRepairExtendInfo>  result    = new List <ProductRepairExtendInfo>();

            foreach (ProductRepairInfo pr in pageDatas)
            {
                result.Add(ToProductRepairExtendInfo(pr));
            }

            return(result);
        }
Example #11
0
        public IList <ProductInfo> GetListByJoin(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            LiteQueryModel queryModel = ConvertToModel.ToModel <LiteQueryModel>(cmdParms);

            Query query = null;

            if (!queryModel.MgrDepmtId.Equals(Guid.Empty))
            {
                query = Query.And(Query.EQ("MgrDepmtId", queryModel.MgrDepmtId));
            }
            if (!string.IsNullOrEmpty(queryModel.UserRule))
            {
                query = Query.And(Query.Where("MgrDepmtId", m => queryModel.UserRule.Contains(m)));
            }
            if (!string.IsNullOrEmpty(queryModel.Keyword))
            {
                query = Query.And(Query.Or(Query.Contains("Named", queryModel.Keyword), Query.Contains("Coded", queryModel.Keyword)));
            }

            IEnumerable <ProductInfo> datas = null;

            if (query != null)
            {
                datas = _db.Products.Find(query);
            }
            else
            {
                datas = _db.Products.FindAll();
            }

            totalRecords = datas.Count();
            IEnumerable <ProductInfo> pageDatas = datas.Skip((pageIndex - 1) * pageSize).Take(pageSize);

            foreach (ProductInfo p in pageDatas)
            {
                AppendFullInfo(p);
            }
            return(pageDatas.ToList());
        }
Example #12
0
        public DataSet GetExportData(string sqlWhere, params SqlParameter[] cmdParms)
        {
            DataSet   ds = new DataSet("products");
            DataTable dt = new DataTable("products");

            dt.Columns.Add("资产编码", typeof(string));
            dt.Columns.Add("资产名称", typeof(string));
            dt.Columns.Add("规格型号", typeof(string));
            dt.Columns.Add("数量", typeof(string));
            dt.Columns.Add("单价", typeof(string));
            dt.Columns.Add("金额", typeof(string));
            dt.Columns.Add("计量单位", typeof(string));
            dt.Columns.Add("资产属性", typeof(string));
            dt.Columns.Add("资产来源", typeof(string));
            dt.Columns.Add("供应商", typeof(string));
            dt.Columns.Add("购入日期", typeof(string));
            dt.Columns.Add("启用日期", typeof(string));
            dt.Columns.Add("使用期限", typeof(string));
            dt.Columns.Add("使用人", typeof(string));
            dt.Columns.Add("资产分类编码", typeof(string));
            dt.Columns.Add("资产分类", typeof(string));
            dt.Columns.Add("使用部门编码", typeof(string));
            dt.Columns.Add("使用部门", typeof(string));
            dt.Columns.Add("实物管理部门编码", typeof(string));
            dt.Columns.Add("实物管理部门", typeof(string));
            dt.Columns.Add("存放地点编码", typeof(string));
            dt.Columns.Add("存放地点", typeof(string));

            Query          query      = null;
            LiteQueryModel queryModel = ConvertToModel.ToModel <LiteQueryModel>(cmdParms);

            if (!string.IsNullOrEmpty(queryModel.UserRule))
            {
                query = Query.Where("DepmtId", m => queryModel.UserRule.Contains(m));
            }

            IEnumerable <ProductInfo> datas = null;

            if (query == null)
            {
                datas = _db.Products.FindAll();
            }
            else
            {
                datas = _db.Products.Find(query);
            }

            if (datas != null)
            {
                foreach (ProductInfo p in datas)
                {
                    AppendFullInfo(p);

                    DataRow dr = dt.NewRow();
                    dr["资产编码"]     = p.Coded;
                    dr["资产名称"]     = p.Named;
                    dr["规格型号"]     = p.SpecModel;
                    dr["数量"]       = p.Qty;
                    dr["单价"]       = p.Price;
                    dr["金额"]       = p.Amount;
                    dr["计量单位"]     = p.MeterUnit;
                    dr["资产属性"]     = p.Pattr;
                    dr["资产来源"]     = p.SourceFrom;
                    dr["供应商"]      = p.Supplier;
                    dr["购入日期"]     = p.BuyDate.ToString("yyyy-MM-dd");
                    dr["启用日期"]     = p.EnableDate;
                    dr["使用期限"]     = p.UseDateLimit;
                    dr["使用人"]      = p.UsePersonName;
                    dr["资产分类编码"]   = p.CategoryCode;
                    dr["资产分类"]     = p.CategoryName;
                    dr["使用部门编码"]   = p.UseOrgCode;
                    dr["使用部门"]     = p.UseOrgName;
                    dr["实物管理部门编码"] = p.MgrOrgCode;
                    dr["实物管理部门"]   = p.MgrOrgName;
                    dr["存放地点编码"]   = p.StoragePlaceCode;
                    dr["存放地点"]     = p.StoragePlaceName;

                    dt.Rows.Add(dr);
                }
            }

            ds.Tables.Add(dt);

            return(ds);
        }