Exemple #1
0
        /// <summary>
        /// 查询某个id的店铺管理人员
        /// </summary>
        public List <XMPost> GetXMPostListById(int id)
        {
            //IQueryable<XMPost>
            var query = from p in this._context.XMPosts
                        join s in this._context.XMNickCustomerMappings on p.Id equals s.CustomerTypeID
                        into JoinedPB
                        from s in JoinedPB.DefaultIfEmpty()
                        join b in this._context.CustomerInfoes on s.CustomerID equals b.CustomerID
                        into JoinedPB2
                        from b in JoinedPB2.DefaultIfEmpty()
                        where p.IsEnable == false && s.NickId == id
                        select
                        new XMPost
            {
                Post     = p.Post,
                FullName = b.FullName,
                Id       = s.NickCustomerID
            };

            return(new List <XMPost>(query).ToList());
//            string sql = @"select p.Post from XM_Post p
//                            join XM_Nick_Customer_Mapping N on p.Id=N.CustomerTypeID
//                            join Sys_CustomerInfo b on N.CustomerID=b.CustomerID
//                            where p.IsEnable='false' and N.NickId={0} ";
//            var XMPostList = this._context.ExecuteStoreQuery<XMPost>(sql, id).ToList();//, "%" + shopManager + "%"
//            return XMPostList.ToList();
        }
Exemple #2
0
        /// <summary>
        /// 根据商品名称、是赠品 查询商品名称、商品编码、尺寸、出厂价
        /// </summary>
        /// <param name="ProductName"></param>
        /// <returns></returns>
        public List <XMProductDetailsMapping> GetXMProductDetailsByProductName(string ProductName)
        {
            //var query = from p in this._context.XMProducts
            //            join b in this._context.XMProductDetails
            //            on p.Id equals b.ProductId
            //            where p.ProductName.Contains(ProductName)
            //            && p.IsEnable.Value == false
            //            && b.IsEnable.Value == false
            //            && p.IsPremiums == true
            //            select new XMProductDetailsMapping
            //            {
            //                Id = p.Id,
            //                ProductName = p.ProductName,
            //                ManufacturersCode = p.ManufacturersCode,
            //                Specifications = p.Specifications,
            //                Costprice = b.Costprice
            //            };
            //return new List<XMProductDetailsMapping>(query);

            //&& b.IsEnable.Value == false

            //左链接
            var query = from p in this._context.XMProducts
                        join b in this._context.XMProductDetails
                        on p.Id equals b.ProductId into JoinedPB
                        from b in JoinedPB.DefaultIfEmpty()
                        where p.ProductName.Equals(ProductName) &&
                        p.IsEnable.Value == false &&
                        b.IsEnable == false &&
                        p.IsPremiums == true
                        select new XMProductDetailsMapping
            {
                Id                   = p.Id,
                ProductName          = p.ProductName,
                ManufacturersCode    = p.ManufacturersCode,
                Specifications       = p.Specifications,
                Costprice            = b.Costprice,
                PlatformMerchantCode = b.PlatformMerchantCode,
                DetailId             = b.Id
            };

            return(new List <XMProductDetailsMapping>(query.Distinct()).ToList());
        }