Ejemplo n.º 1
0
        public async Task <ApiResult <IEnumerable <Role> > > List(int pageIndex, string title)
        {
            // 以接口的形式返回数据
            var res = new ApiResult <IEnumerable <Role> >()
            {
                statusCode = (int)ApiEnum.Status
            };

            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            //DBPage dp = new DBPage(pageIndex, 15);
            var parm = Expressionable.Create <Role>();

            parm.AndIF(!string.IsNullOrEmpty(title), m => m.Names.Contains(title));
            var data = db.GetPages(parm.ToExpression(), new PageParm(pageIndex), "Sorting,ID DESC");

            res.success = true;
            res.data    = data.DataSource;
            res.index   = pageIndex;
            res.count   = data.TotalCount;
            res.size    = data.PageSize;
            return(await Task.Run(() => res));
        }
        public List <MenuButtonEntity> MenuButtonByPage(DateTime?startTime, DateTime?endTime, string keyword, ref int totalCount, int pageSize = 20, int pageIndex = 1)
        {
            var exp = Expressionable.Create <B_TbMenuButton, B_TbMenu, B_TbButton>();

            if (startTime != null)
            {
                exp = exp.And((mb, m, b) => mb.UpdateTime > startTime);
            }
            if (endTime != null)
            {
                exp = exp.And((mb, m, b) => mb.UpdateTime < endTime);
            }
            if (!string.IsNullOrEmpty(keyword))
            {
                exp = exp.And((mb, m, b) => m.Name.Contains(keyword) || b.Name.Contains(keyword));
            }

            var list = db.Queryable <B_TbMenuButton, B_TbMenu, B_TbButton>(
                (mb, m, b) =>
                new object[] {
                JoinType.Left, mb.MenuId == m.ID,
                JoinType.Left, mb.ButtonId == b.ID,
            })
                       .Where(exp.ToExpression())
                       .OrderBy((mb) => mb.ID, OrderByType.Desc)
                       .Select((mb, m, b) => new MenuButtonEntity {
                ID = mb.ID, MenuId = mb.MenuId, MenuName = m.Name, ButtonId = b.ID, ButtonName = b.Name
            })
                       .ToPageList(pageIndex, pageSize, ref totalCount);

            return(list);
        }
Ejemplo n.º 3
0
        public async Task <ApiResult <IEnumerable <AdverViewModel> > > List(int pageIndex, string Title, bool?IsEnable, int TypeID, string?SelStartDate, string?SelEndDate)
        {
            // 以接口的形式返回数据
            var res = new ApiResult <IEnumerable <AdverViewModel> >()
            {
                statusCode = (int)ApiEnum.Status
            };

            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            //DBPage dp = new DBPage(pageIndex, 3);
            //var departments = await db.QueryList(dp, Title);
            DateTime?SelStartDate1 = null;
            DateTime?SelEndDate1   = null;

            if (!string.IsNullOrWhiteSpace(SelStartDate))
            {
                SelStartDate1 = C.DateTimes(SelStartDate);
            }
            if (!string.IsNullOrWhiteSpace(SelStartDate))
            {
                SelEndDate1 = C.DateTimes(SelEndDate);
            }
            var parm = Expressionable.Create <Advert>()
                       .AndIF(!string.IsNullOrEmpty(Title), m => m.Title.Contains(Title))
                       .AndIF(TypeID != 0, m => m.TypeID == TypeID)
                       .AndIF(IsEnable != null, m => m.IsEnable == IsEnable)
                       .AndIF(SelStartDate1 != null, m => m.StartDate >= SelStartDate1)
                       .AndIF(SelEndDate1 != null, m => m.EndDate <= SelEndDate1);
            //var list = db.GetWhere(parm.ToExpression());
            //var list = db.GetPages(parm.ToExpression(), new PageParm(pageIndex), a => a.ID, "Desc");
            //var list = db.GetPages(parm.ToExpression(), new PageParm(pageIndex), a => new { a.ID, a.Sorting }, "Desc");
            var list = db.GetPages(parm.ToExpression(), new PageParm(pageIndex), "Sorting,ID DESC");

            res.success = true;
            List <AdverViewModel> list2 = new List <AdverViewModel>();

            if (list.DataSource != null)
            {
                foreach (var item in list.DataSource)
                {
                    list2.Add(IMapper.Map <AdverViewModel>(item));
                }
                res.success    = true;
                res.data       = list2;
                res.index      = pageIndex;
                res.count      = list.TotalCount;
                res.size       = list.PageSize;
                res.pages      = list.TotalPages;
                res.statusCode = (int)ApiEnum.Status;
            }
            else
            {
                res.success    = false;
                res.statusCode = (int)ApiEnum.Status;
            }
            return(await Task.Run(() => res));
        }
Ejemplo n.º 4
0
        private List <T_Base> schText()
        {
            List <T_Base> getAll = null;
            var           exp    = Expressionable.Create <T_Base>().And(it => it.leibie == YUANGONG);

            //.And(it => it.Id == 1)
            //.ToExpression();//拼接表达式
            if (chkTxt2.chk.Checked)
            {
                exp.And(it => it.bianhao.Contains(chkTxt2.txt.Text));
            }
            if (chkTxt1.chk.Checked)
            {
                exp.And(it => it.itemName.Contains(chkTxt1.txt.Text));
            }
            if (chkTxt3.chk.Checked)
            {
                exp.And(it => it.item0.Contains(chkTxt3.txt.Text));
            }
            if (chkTxt4.chk.Checked)
            {
                exp.And(it => it.item1.Contains(chkTxt4.txt.Text));
            }
            getAll = db.Queryable <T_Base>()
                     .Where(exp.ToExpression())
                     .ToList();
            return(getAll);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 分页获取
        /// for user
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public async Task <JsonResultModel <ArticleInfo> > GetPageLsit(GridParams param)
        {
            //只查询已发布的
            var exp = Expressionable.Create <ArticleInfo>().And(it => it.IsPublished);

            return(await base.GetPageList(param, exp.ToExpression()));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取菜单分页
        /// </summary>
        /// <param name="moduleViewModels"></param>
        /// <returns></returns>
        public TableModel <ModuleViewModels> ListPageModules(ModuleViewModels moduleViewModels)
        {
            List <ModuleViewModels> viewModels = new List <ModuleViewModels>();

            var total         = moduleViewModels.TotalCount;
            var orderByFileds = !string.IsNullOrEmpty(moduleViewModels.OrderByFileds) ? "" : moduleViewModels.OrderByFileds;

            //动态拼接拉姆达
            var query = Expressionable.Create <Module>().AndIF(!string.IsNullOrEmpty(moduleViewModels.Name), s => s.Name == moduleViewModels.Name).ToExpression();


            var models = dal.Query(query, moduleViewModels.PageIndex, moduleViewModels.PageSize, moduleViewModels.OrderByFileds, ref total);

            //var models2 = dal.GetSimpleClient()
            //                .Queryable<Module, ModulePermission>((ml, mp) => new object[] { JoinType.Left, ml.Id == mp.ModuleId })
            //                .WhereIF(!string.IsNullOrEmpty(moduleViewModels.Name), (ml, mp) => ml.Name == moduleViewModels.Name)
            //                .Select((ml, mp) =>new ModulePermission {CreateBy=mp.CreateBy,CreateTime=mp.CreateTime })
            //                .ToPageList(moduleViewModels.PageIndex, moduleViewModels.PageSize, ref total);

            foreach (var s in models)
            {
                viewModels.Add(IMapper.Map <ModuleViewModels>(s));
            }

            return(new TableModel <ModuleViewModels>()
            {
                Code = 1, Count = total, Data = viewModels, Msg = "success"
            });
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 根据权限ID 获取用户列表 分页
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public List <B_TbUser> UserListByRoleId(DateTime?startTime, DateTime?endTime, int roleId, ref int totalCount,
                                                int pageSize = 20, int pageIndex = 1)
        {
            var exp = Expressionable.Create <B_TbUser, B_TbUserRole>();

            if (roleId > 0)
            {
                exp = exp.And((u, r) => r.RoleId == roleId);
            }
            if (startTime != null)
            {
                exp = exp.And((u, r) => u.UpdateTime > startTime);
            }
            if (endTime != null)
            {
                exp = exp.And((u, r) => u.UpdateTime < endTime);
            }

            var list = db.Queryable <B_TbUser, B_TbUserRole>(
                (u, r) =>
                new object[] {
                JoinType.Left, u.ID == r.UserId,
            })
                       .Where(exp.ToExpression())
                       .OrderBy((u, r) => u.UpdateTime, OrderByType.Asc)
                       .ToPageList(pageIndex, pageSize, ref totalCount);

            return(list);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 查询按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            var exp = Expressionable.Create <RSManage>();

            if (chkTxt1.chk.Checked)
            {
                exp.And(it => SqlFunc.ToString(it.SN).Contains(chkTxt1.txt.Text));
            }
            if (chkTxt3.chk.Checked)
            {
                exp.And(it => it.Name.Contains(chkTxt3.txt.Text));
            }
            if (chkCoboEX1.chk.Checked)
            {
                exp.And(it => it.Xingbie.Contains(chkCoboEX1.coboex.Text));
            }
            if (chkTxt2.chk.Checked)
            {
                exp.And(it => it.JiGuan.Contains(chkTxt2.txt.Text));
            }
            if (chkTxt4.chk.Checked)
            {
                exp.And(it => it.phone.Contains(chkTxt4.txt.Text));
            }
            if (chkTxt5.chk.Checked)
            {
                exp.And(it => it.EMail.Contains(chkTxt5.txt.Text));
            }
            var getAll = db.Queryable <RSManage>()
                         .Where(exp.ToExpression())
                         .OrderBy(it => it.SN, OrderByType.Desc)
                         .ToList();

            InitdgvEX1(getAll);
        }
Ejemplo n.º 9
0
        public OrderDto GetWxPay(string UserId, string HouseId)
        {
            var conditions = Expressionable.Create <wy_houseinfo, wy_shopinfo, wy_ropertycosts>();

            if (!string.IsNullOrEmpty(HouseId))
            {
                conditions = conditions.And((ho, sh, co) => ho.FWID == HouseId);
            }
            if (!string.IsNullOrEmpty(UserId))
            {
                conditions = conditions.And((ho, sh, co) => sh.CZ_SHID == UserId);
            }
            OrderDto Data = this._db.Db().Queryable <wy_houseinfo, wy_shopinfo, wy_ropertycosts>((ho, sh, co) => new object[] {
                JoinType.Left, ho.FWID == sh.FWID,
                JoinType.Left, sh.FEE_ID == co.FEE_ID
            }).Where(conditions.ToExpression())
                            .Select((ho, sh, co) => new OrderDto
            {
                Houseinfo = ho,
                Shopinfo  = sh,
                Costs     = co
            }).First();

            return(Data);
        }
Ejemplo n.º 10
0
        private List <T_Base> schText()
        {
            List <T_Base> getAll = null;

            try
            {
                var exp = Expressionable.Create <T_Base>().And(it => it.leibie == SHENGCHANGX);
                //.And(it => it.Id == 1)
                //.ToExpression();//拼接表达式
                if (chkBianhao.chk.Checked)
                {
                    exp.And(it => it.itemName == chkBianhao.txt.Text);
                    //itemName = chkTxt2.txt.Text;
                }
                if (chkType.chk.Checked)
                {
                    exp.And(it => it.itemName == chkType.txt.Text);
                    //item2 = chkTxt1.txt.Text;
                }
                getAll = db.Queryable <T_Base>()
                         .Where(exp.ToExpression())
                         .ToList();
            }catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message);
            }


            return(getAll);
        }
Ejemplo n.º 11
0
        public async Task <ApiResult <IEnumerable <ProUserInfoViewModel> > > TeamList(int pageIndex, string Title, string ProjectID, int ProjectNodeID, bool?IsEnable, int?Role)
        {
            // 以接口的形式返回数据
            var res = new ApiResult <IEnumerable <ProUserInfoViewModel> >()
            {
                statusCode = (int)ApiEnum.Status
            };

            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            if (Role == null)
            {
                Role = 0;
            }
            var parm = Expressionable.Create <ProjectUserInfo>()
                       .AndIF(!string.IsNullOrEmpty(Title), m => SqlFunc.Subqueryable <UserInfo>().Where(a => a.ID == m.UserID && a.NickName.Contains(Title)).Any())
                       .AndIF(IsEnable != null, m => m.IsEnable == IsEnable)
                       .AndIF(!string.IsNullOrEmpty(ProjectID), m => m.ProjectID == ProjectID)
                       .AndIF(ProjectNodeID != 0, m => m.ProjectNodeID == ProjectNodeID)
                       .AndIF(Role != 0, m => m.Role == Role);
            var list = projectUserdb.GetPages(parm.ToExpression(), new PageParm(pageIndex), "Role,Sorting DESC");
            List <ProUserInfoViewModel> list2 = new List <ProUserInfoViewModel>();

            if (list.DataSource != null)
            {
                foreach (var item in list.DataSource)
                {
                    ProUserInfoViewModel pm = new ProUserInfoViewModel();
                    pm.ID            = item.ID;
                    pm.ProjectID     = item.ProjectID;
                    pm.ProjectNodeID = item.ProjectNodeID;
                    pm.UserID        = item.UserID;
                    UserInfo userInfo = userdb.GetId(item.UserID);
                    if (userInfo != null)
                    {
                        pm.UserName = userdb.GetNames(userInfo);
                    }
                    pm.Role       = item.Role;
                    pm.Proportion = item.Proportion;
                    pm.AddDate    = Utility.GetDateFormat(item.AddDate);
                    pm.IsEnable   = item.IsEnable;
                    list2.Add(pm);
                }
                res.success    = true;
                res.data       = list2;
                res.index      = pageIndex;
                res.count      = list.TotalCount;
                res.size       = list.PageSize;
                res.pages      = list.TotalPages;
                res.statusCode = (int)ApiEnum.Status;
            }
            else
            {
                res.success    = false;
                res.statusCode = (int)ApiEnum.Status;
            }
            return(await Task.Run(() => res));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 查询合作伙伴列表(分页)
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        public PagedInfo <CustomerVM> QueryCustomerPages(CustomerQueryDto parm)
        {
            var predicate = Expressionable.Create <uf_khxx>();

            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.tyxydm), (a) => a.tyxydm.Contains(parm.tyxydm));
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.zzmc), (a) => a.zzmc.Contains(parm.zzmc));

            var source = Db.Queryable <uf_khxx>()
                         .WhereIF(!string.IsNullOrEmpty(parm.zzmc), (a) => a.zzmc.Contains(parm.zzmc))
                         .WhereIF(!string.IsNullOrEmpty(parm.tyxydm), (a) => a.tyxydm.Contains(parm.tyxydm))
                         .Select(a => new CustomerVM
            {
                ID     = a.ID,
                oaid   = a.odid,
                qybm   = a.qybm,
                zzmc   = a.zzmc,
                xzqhmc = a.xzqhmc,
                fgs    = a.fgs,
                ywy    = a.ywy,
                hzdwmc = a.hzdwmc,
                zzdh   = a.zzdh,
                zzcz   = a.zzcz,
                qyrs   = a.qyrs
            });

            return(source.ToPage(new PageParm {
                PageIndex = parm.PageIndex, PageSize = parm.PageSize, OrderBy = parm.OrderBy, Sort = parm.Sort
            }));
        }
Ejemplo n.º 13
0
        public IActionResult Query([FromBody] PlanQueryDto parm)
        {
            //开始拼装查询条件
            var predicate = Expressionable.Create <view_MakePlan>();

            //合同编号
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ContractNo), m => m.ContractNo.Contains(parm.ContractNo));
            //客户名称
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.khmc), m => m.zzmc.Contains(parm.khmc));
            //合作伙伴
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.hzhb), m => m.mc.Contains(parm.hzhb));
            //受理日期开始
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptDateStart), m => m.CreateTime >= DateTime.Parse(parm.AcceptDateStart));
            //受理日期结束
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptDateEnd), m => m.CreateTime <= DateTime.Parse(parm.AcceptDateEnd));

            //var response = _contractitemsubService.GetPages(predicate.ToExpression(), parm);

            var response = Core.DbContext.CurrentDB.SqlQueryable <view_MakePlan>(@"
SELECT  m.ID,m.ContractNo,m.CustomerID,m.CreateTime, k.zzmc,k.xzqhmc, h.mc,s.ID as ContractItemSubID, s.MainContractID, s.ContractItemID,ContractItemSubType, ContractItemSubTypeCode
				   ,c.ItemName,c.ContractItemNo
FROM   Biz_ContractItem_Sub s
inner join Biz_MainContract m on m.ID = s.MainContractID
inner join Biz_ContractItem c on c.ID = s.ContractItemID
LEFT JOIN uf_khxx k ON k.ID = m.CustomerID 
LEFT JOIN uf_hzhb h ON k.hzdwID = h.ID
WHERE   m.deleted = 0 and s.status = 20000
").ToPage <view_MakePlan>(predicate.ToExpression(), parm);

            return(toResponse(response));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 通过关系获取另一实体类
        /// </summary>
        /// <typeparam name="TB">要获得的对象</typeparam>
        /// <typeparam name="TLink">特殊的关系类</typeparam>
        /// <param name="roleA">已知对象</param>
        /// <param name="exp">额外条件表达式</param>
        /// <returns>所求对象集合</returns>
        protected virtual List <TB> GetChildren <TB, TLink>(T roleA, Expression <Func <TB, bool> > exp = null)
            where TB : BaseModel, new() where TLink : BaseLink, new()
        {
            if (!IsExist(roleA))
            {
                throw new ArgumentException($"{typeof(T).Name}[{roleA.ObjId}]不存在", nameof(roleA));
            }

            Refresh(ref roleA);
            var children = DbClient.Queryable <TLink>().AS("L_" + typeof(T).Name + typeof(TB).Name)
                           .Where(l => l.RoleAId == roleA.ObjId).ToList();

            if (children.IsNullOrEmpty())
            {
                return(null);
            }

            var expTemp = new Expressionable <TB>();

            foreach (var link in children)
            {
                expTemp.Or(b => b.ObjId == link.RoleBId);
            }

            return(DbClient.Queryable <TB>().Where(expTemp.AndIF(exp != null, exp).ToExpression()).ToList());
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 获取医院列表
        /// </summary>
        /// <param name="page"></param>
        /// <param name="row"></param>
        /// <returns></returns>
        public async Task <(IEnumerable <Hospital>, int)> GetHospitalListAsync(int page, int rows, string codeOrName, HospitalLevel?level)
        {
            var exp = Expressionable.Create <Hospital>();

            if (!string.IsNullOrEmpty(codeOrName))
            {
                exp.And(h => h.name.Contains(codeOrName) || h.code == codeOrName);
            }
            if (level != null && Enum.IsDefined(typeof(HospitalLevel), level))
            {
                exp.And(h => h.level == level);
            }
            var lambda       = exp.ToExpression();
            var count        = new RefAsync <int>(0);
            var hospitalList = await _db.Queryable <Hospital>().Where(lambda).OrderBy(h => h.id).ToPageListAsync(page, rows, count);

            if (hospitalList.Any())
            {
                var codes = hospitalList.Select(h => h.code).ToArray();
                var tags  = ExecuteSelectQuery <Tag>(@"
                                select
                                ht.hospitalCode,
                                t.id,t.name
                                from HospitalTag ht
                                left join Tag t on ht.tagId=t.id
                                where ht.hospitalCode in (@codes)", new { codes });
                foreach (var hospital in hospitalList)
                {
                    hospital.Tags = tags.Where(t => t.hospitalCode == hospital.code);
                }
            }
            return(hospitalList, count.Value);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 获取菜单分页
        /// </summary>
        /// <param name="sysUserInfoViewModels"></param>
        /// <returns></returns>
        public TableModel <sysUserInfoViewModels> ListPagesysUserInfos(sysUserInfoViewModels sysUserInfoViewModels)
        {
            List <sysUserInfoViewModels> viewModels = new List <sysUserInfoViewModels>();

            var total         = sysUserInfoViewModels.TotalCount;
            var orderByFileds = !string.IsNullOrEmpty(sysUserInfoViewModels.OrderByFileds) ? "" : sysUserInfoViewModels.OrderByFileds;

            //动态拼接拉姆达
            var query = Expressionable.Create <sysUserInfo>().AndIF(!string.IsNullOrEmpty(sysUserInfoViewModels.uRealName), s => s.uRealName == sysUserInfoViewModels.uRealName).ToExpression();


            var models = dal.Query(query, sysUserInfoViewModels.PageIndex, sysUserInfoViewModels.PageSize, sysUserInfoViewModels.OrderByFileds, ref total);

            //var models2 = dal.GetSimpleClient()
            //                .Queryable<Module, ModulePermission>((ml, mp) => new object[] { JoinType.Left, ml.Id == mp.ModuleId })
            //                .WhereIF(!string.IsNullOrEmpty(moduleViewModels.Name), (ml, mp) => ml.Name == moduleViewModels.Name)
            //                .Select((ml, mp) =>new ModulePermission {CreateBy=mp.CreateBy,CreateTime=mp.CreateTime })
            //                .ToPageList(moduleViewModels.PageIndex, moduleViewModels.PageSize, ref total);

            foreach (var s in models)
            {
                //s.uHeaderImgUrl = Path.Combine(Directory.GetCurrentDirectory(), s.uHeaderImgUrl);
                viewModels.Add(IMapper.Map <sysUserInfoViewModels>(s));
            }

            return(new TableModel <sysUserInfoViewModels>()
            {
                Code = 1, Count = total, Data = viewModels, Msg = "success"
            });
        }
Ejemplo n.º 17
0
        public IActionResult Query([FromBody] DataRecoveryDto parm)
        {
            //开始拼装查询条件
            var predicate = Expressionable.Create <view_dataRecovery>();

            switch (parm.status)
            {
            case 0:
                predicate = predicate.And(m => m.status == 30020);
                break;

            case 1:
                predicate = predicate.And(m => m.status == 30025);
                break;

            case 2:
                predicate = predicate.And(m => m.status == 30028);
                break;

            case 3:
                predicate = predicate.And(m => m.status == 30030);
                break;

            default:
                return(toResponse(StatusCodeType.Error, "状态匹配失败,请核对!"));
                //break;
            }


            //项目编号
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ContractItemNo), m => m.ContractItemNo.Contains(parm.ContractItemNo));
            //客户名称
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.khmc), m => m.zzmc.Contains(parm.khmc));

            //审核开始起
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptStartDateStart), m => m.PlanStartDate >= DateTime.Parse(parm.AcceptStartDateStart));
            //审核开始止
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptStartDateEnd), m => m.PlanStartDate <= DateTime.Parse(parm.AcceptStartDateEnd));

            //审核结束起
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptEndDateStart), m => m.PlanEndDate >= DateTime.Parse(parm.AcceptEndDateStart));
            //审核结束止
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptEndDateEnd), m => m.PlanEndDate <= DateTime.Parse(parm.AcceptEndDateEnd));

            //var response = _contractitemsubService.GetPages(predicate.ToExpression(), parm);

            var response = Core.DbContext.CurrentDB.SqlQueryable <view_dataRecovery>(@"
select cp.*,k.zzmc,h.mc,c.ContractNo,ci.AuditTypeName,ci.ItemName,ci.ContractItemNo,p.UserName
from Biz_Contract_Plan cp
inner join Biz_ContractItem_Sub cis on cis.ContractPlanID = cp.ID
inner join Biz_ContractItem ci on ci.ID = cis.ContractItemID
inner join Biz_MainContract c on c.ID = ci.MainContractID
inner join uf_khxx k on k.ID = cp.CustomerID
left join uf_hzhb h ON k.hzdwID = h.ID
outer apply(select top 1 * from Biz_Contract_PlanAuditor p 
where p.ContractPlanID = cp.ID and exists(select 1 from Biz_Contract_PlanAuditor_Item i where i.GroupIdentityName = '组长' and i.PlanAuditorID = p.ID)) p
").ToPage <view_dataRecovery>(predicate.ToExpression(), parm);

            return(toResponse(response));
        }
Ejemplo n.º 18
0
        public HttpResponseMessage ReservedEQMList(string MemberCode, int pageIndex, int pageSize, int Status, bool isManager, string EqmUID)
        {
            var response = new MyHttpResponseMessage();

            response.apiNumber = "C054_EQMController_ReservedEQMList";
            var msg = "";

            try
            {
                var exp = Expressionable.Create <ORM.SqlSugar.Model.order.order_Reserved>();
                exp.And(p => p.Status == Status);
                if (!isManager)
                {
                    exp.And(p => p.MemberCode == MemberCode);
                }
                if (string.IsNullOrEmpty(EqmUID))
                {
                    exp.And(p => p.EqmUID == EqmUID);
                }

                var totalCount = 0;
                var list       = db.SqlServerClient.Queryable <ORM.SqlSugar.Model.order.order_Reserved>().Where(exp.ToExpression()).OrderBy(it => it.ReservedTime).ToPageList(pageIndex, pageSize, ref totalCount);
                var rbj        = new { list = list, totalCount = totalCount };
                response.SetContent(HttpStatus.ok, "获取成功", rbj, ResponseType.josn);
                return(response);
            }
            catch (Exception ex)
            {
                msg = "ERROR";
                AddErrorLog(LogEnum.eqm, ex.Message, ex.StackTrace);
                response.SetContent(HttpStatus.error, ex.Message, msg, ResponseType.josn);
            }
            return(response);
        }
Ejemplo n.º 19
0
        public async Task <ApiResult <IEnumerable <AdvertType> > > List(int pageIndex, string Title)
        {
            var res = new ApiResult <IEnumerable <AdvertType> >()
            {
                statusCode = (int)ApiEnum.Status
            };

            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            var parm = Expressionable.Create <AdvertType>().
                       AndIF(!string.IsNullOrEmpty(Title), m => m.Names.Contains(Title));
            var list = db.GetPages(parm.ToExpression(), new PageParm(pageIndex), a => a.Sorting, "Asc");

            if (list != null)
            {
                res.success = true;
                res.data    = list.DataSource;
                res.index   = pageIndex;
                res.count   = list.TotalCount;
                res.size    = list.PageSize;
                res.pages   = list.TotalPages;
            }
            else
            {
                res.success    = false;
                res.statusCode = (int)ApiEnum.Status;
            }
            return(await Task.Run(() => res));
        }
        public IActionResult Query([FromBody] PlanManageDto parm)
        {
            //开始拼装查询条件
            var predicate = Expressionable.Create <view_ItemPlanVM>();

            //switch(parm.status)
            //{
            //    case 0:
            //        predicate = predicate.And(m => m.status == 30000);
            //        break;
            //    case 1:
            //        predicate = predicate.And(m => m.status == 30010);
            //        break;
            //    case 3:
            //        predicate = predicate.And(m => m.status == 30020);
            //        break;
            //    case 4:
            //        predicate = predicate.And(m => m.status == 39999);
            //        break;
            //    default:
            //        return toResponse(StatusCodeType.Error, "状态匹配失败,请核对!");
            //        //break;
            //}

            //项目编号
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ContractItemNo), m => m.ContractItemNo.Contains(parm.ContractItemNo));
            //客户名称
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.khmc), m => m.zzmc.Contains(parm.khmc));
            //合作伙伴
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.hzhb), m => m.mc.Contains(parm.hzhb));
            //审核开始起
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptStartDateStart), m => m.PlanStartDate >= DateTime.Parse(parm.AcceptStartDateStart));
            //审核开始止
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptStartDateEnd), m => m.PlanStartDate <= DateTime.Parse(parm.AcceptStartDateEnd));

            //审核结束起
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptEndDateStart), m => m.PlanEndDate >= DateTime.Parse(parm.AcceptEndDateStart));
            //审核结束止
            predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AcceptEndDateEnd), m => m.PlanEndDate <= DateTime.Parse(parm.AcceptEndDateEnd));

            //var response = _contractitemsubService.GetPages(predicate.ToExpression(), parm);

            var response = Core.DbContext.CurrentDB.SqlQueryable <view_ItemPlanVM>(@"
SELECT  m.ID, m.ContractNo, m.CustomerID, m.CreateTime, k.zzmc, k.xzqhmc, h.mc, s.ID AS ContractItemSubID, s.MainContractID, 
                   s.ContractItemID, s.ContractItemSubType, s.ContractItemSubTypeCode, c.ItemName, c.ContractItemNo,p.ContractPlanNo,
				   p.PlanStartDate,p.PlanEndDate,p.ApproveTime,
				   dbo.GetNodeName(p.status) as StatusName
FROM      dbo.Biz_ContractItem_Sub AS s 
inner join Biz_Contract_Plan p on s.ContractPlanID = p.ID
INNER JOIN
                   dbo.Biz_MainContract AS m ON m.ID = s.MainContractID INNER JOIN
                   dbo.Biz_ContractItem AS c ON c.ID = s.ContractItemID LEFT OUTER JOIN
                   dbo.uf_khxx AS k ON k.ID = m.CustomerID LEFT OUTER JOIN
                   dbo.uf_hzhb AS h ON k.hzdwID = h.ID
WHERE   (m.deleted = 0)
").ToPage <view_ItemPlanVM>(predicate.ToExpression(), parm);

            return(toResponse(response));
        }
Ejemplo n.º 21
0
        public v_pay_record GetPayReminder(string openId)
        {
            var conditions = Expressionable.Create <v_pay_record>();

            conditions = conditions.And(c => c.OPEN_ID == openId && c.JFZT != 1);
            return(_db.Db().Queryable <v_pay_record>().Where(conditions.ToExpression())
                   .OrderBy(c => c.CREATE_TIME).First());
        }
Ejemplo n.º 22
0
        public in_reginfo GetReginfo(string inid)
        {
            var exp = Expressionable.Create <in_reginfo>()
                      .And(x => x.inid == Convert.ToInt32(inid))
                      .ToExpression();

            return(iInReginfo.Get(exp));
        }
Ejemplo n.º 23
0
        public IActionResult GetAll(bool?enable = null)
        {
            var predicate = Expressionable.Create <uf_hzhb>();

            //predicate = predicate.AndIF(enable != null, m => m.Enable == enable);

            return(toResponse(_partnerService.GetAll()));
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 分页获取
        /// </summary>
        /// <param name="searchRequest">查询参数</param>
        /// <returns></returns>
        public async Task <JsonResultModel <CategoryInfo> > GetPageList(CategorySearchRequest searchRequest)
        {
            var exp = Expressionable.Create <CategoryInfo>()
                      .OrIF(!string.IsNullOrEmpty(searchRequest.CategoryName),
                            it => it.CategoryName.Contains(searchRequest.CategoryName)).ToExpression();

            return(await base.GetPageList(searchRequest, exp));
        }
Ejemplo n.º 25
0
        public IActionResult GetAll(bool?enable = null)
        {
            var predicate = Expressionable.Create <Base_Company>();

            predicate = predicate.AndIF(enable != null, m => m.Enable == enable);

            return(toResponse(_companyService.GetWhere(predicate.ToExpression())));
        }
Ejemplo n.º 26
0
        public List <UserRoleEntity> UsersByPage(B_TbUser info, DateTime?startTime, DateTime?endTime, int isAble,
                                                 ref int totalCount,
                                                 int pageSize = 20, int pageIndex = 1)
        {
            var exp = Expressionable.Create <B_TbUser, B_TbUserRole, B_TbRole>();

            if (!string.IsNullOrEmpty(info.AccountName))
            {
                exp = exp.And((u, ur, r) => u.AccountName.Contains(info.AccountName));
            }
            if (!string.IsNullOrEmpty(info.RealName))
            {
                exp = exp.And((u, ur, r) => u.RealName.Contains(info.RealName));
            }
            if (isAble != -1)
            {
                bool temp = isAble == 1?true:false;
                exp = exp.And((u, ur, r) => u.IsAble == temp);
            }
            if (startTime != null)
            {
                exp = exp.And((u, ur, r) => u.CreateTime > startTime);
            }
            if (endTime != null)
            {
                exp = exp.And((u, ur, r) => u.CreateTime < endTime);
            }
            var list = db.Queryable <B_TbUser, B_TbUserRole, B_TbRole>((u, ur, r) =>
                                                                       new object[] {
                JoinType.Left, u.ID == ur.UserId,
                JoinType.Left, ur.RoleId == r.ID
            })
                       .Where(exp.ToExpression()).OrderBy((u, ur, r) => u.CreateTime, OrderByType.Asc)
                       .Select((u, ur, r) => new UserRoleEntity()
            {
                ID          = u.ID,
                AccountName = u.AccountName,
                RealName    = u.RealName,
                Creater     = u.Creater,
                CreateTime  = u.CreateTime,
                Description = u.Description,
                Email       = u.Email,
                IfChangePwd = u.IfChangePwd,
                IsAble      = u.IsAble,
                MobilePhone = u.MobilePhone,
                Password    = null,
                Position    = u.Position,
                RoleId      = r.ID,
                RoleName    = r.RoleName,
                Updater     = u.Updater,
                UpdateTime  = u.UpdateTime,
                WorkNumber  = u.WorkNumber,
            })
                       .ToPageList(pageIndex, pageSize, ref totalCount);

            return(list);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 分页获取用户信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <JsonResultModel <UserInfo> > GetPageList(UserSearchRequest request)
        {
            var exp = Expressionable.Create <UserInfo>()
                      .AndIF(true, it => it.IsActive == request.IsActive)
                      .AndIF(!string.IsNullOrEmpty(request.UserName), it => it.UserName.Contains(request.UserName))
                      .ToExpression();

            return(await _userRepository.Query(request, exp));
        }
        public IActionResult Query([FromBody] UserSystemTypeQueryDto parm)
        {
            //开始拼装查询条件
            var predicate = Expressionable.Create <Sys_User_SystemType>();

            var response = _usersystemtypeService.GetPages(predicate.ToExpression(), parm);

            return(toResponse(response));
        }
Ejemplo n.º 29
0
        public virtual ActionResult List(string keyword, Pagination pagination, string baseId = "")
        {
            var predicate = Expressionable.Create <T>().AndIF(!string.IsNullOrEmpty(keyword),
                                                              n => n.Name.Contains(keyword)).ToExpression();
            var count  = 0;
            var result = Context.Queryable <T>().Where(predicate).OrderBy(n => n.CreateTime, OrderByType.Desc).ToPageList(pagination.page, pagination.limit, ref count);

            return(Success(result, count));
        }
Ejemplo n.º 30
0
        public int DeletePraized_CommentReply_Res(long replyId, string userId)
        {
            var exp = Expressionable.Create <EPraize_CommentReply>()
                      .And(a => a.replyId == replyId)
                      .AndIF(!string.IsNullOrEmpty(userId), a => a.userId == userId).ToExpression();

            var op = Db.Deleteable(exp);

            return(op.ExecuteCommand());
        }