Example #1
0
        /// <summary>
        /// 获取医生列表
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetDoctorList(HttpContext context)
        {
            string categoryId     = context.Request["categoryId"];
            string currCategoryid = context.Request["currcategoryid"];
            string tags           = context.Request["tags"];
            List <WXMallProductInfo> productList = new List <WXMallProductInfo>();

            if (!string.IsNullOrEmpty(categoryId))
            {
                string categoryIds = bllMall.GetCateAndChildIds(Convert.ToInt32(categoryId));
                currCategoryid = bllMall.GetCateAndChildIds(Convert.ToInt32(currCategoryid));
                categoryIds   += "," + currCategoryid;
                productList    = bllMall.GetList <WXMallProductInfo>(string.Format(" WebsiteOwner='{0}' And CategoryId in({1}) And ArticleCategoryType='BookingDoctorFuYou'  And Stock>0  And IsDelete=0", bllMall.WebsiteOwner, categoryIds));
                foreach (var item in productList)
                {
                    item.PDescription = "";
                }
            }
            //标签
            if (!string.IsNullOrEmpty(tags))
            {
                foreach (var tag in tags.Split(','))
                {
                    var data = bllMall.GetList <WXMallProductInfo>(string.Format(" WebsiteOwner='{0}'  And Stock>0 And ArticleCategoryType='BookingDoctorFuYou' And IsDelete=0 And Tags like '%{1}%'", bllMall.WebsiteOwner, tag));
                    foreach (var item in data)
                    {
                        item.PDescription = "";
                        productList.Add(item);
                    }
                }
            }

            productList    = productList.DistinctBy(p => p.PID).ToList();
            apiResp.status = true;
            apiResp.result = productList;
            return(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
Example #2
0
        /// <summary>
        /// 医生列表
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string DoctorList(HttpContext context)
        {
            int           pageIndex  = Convert.ToInt32(context.Request["page"]);
            int           pageSize   = Convert.ToInt32(context.Request["rows"]);
            string        keyWord    = context.Request["keyWord"];
            string        categoryId = context.Request["CategoryId"];
            string        isOnSale   = context.Request["IsOnSale"];
            string        type       = context.Request["type"];
            StringBuilder sbWhere    = new StringBuilder(string.Format("WebsiteOwner='{0}'  And IsDelete=0  ", bllMall.WebsiteOwner));

            if (!string.IsNullOrEmpty(type))
            {
                sbWhere.AppendFormat("And ArticleCategoryType='{0}'", type);
            }
            else
            {
                sbWhere.AppendFormat("And ArticleCategoryType='BookingDoctor'");
            }
            if (!string.IsNullOrEmpty(keyWord))
            {
                sbWhere.AppendFormat(" And (PName like '%{0}%' Or ExArticleTitle_2 like '%{0}%' Or ExArticleTitle_4 like '%{0}%')", keyWord);
            }
            if (!string.IsNullOrEmpty(categoryId) && (!categoryId.Equals("0")))
            {
                string categoryIds = bllMall.GetCateAndChildIds(Convert.ToInt32(categoryId));
                sbWhere.AppendFormat(" And CategoryId in ({0})", categoryIds);
            }



            int totalCount = bllMall.GetCount <WXMallProductInfo>(sbWhere.ToString());
            List <WXMallProductInfo> dataList = new List <WXMallProductInfo>();

            dataList = bllMall.GetLit <WXMallProductInfo>(pageSize, pageIndex, sbWhere.ToString(), "Sort DESC, InsertDate DESC");
            for (int i = 0; i < dataList.Count; i++)
            {
                dataList[i].PDescription = null;
            }
            return(Common.JSONHelper.ObjectToJson(
                       new
            {
                total = totalCount,
                rows = dataList
            }));
        }