示例#1
0
        /// <summary>
        /// 查询报名数据
        /// </summary>
        private string Query(HttpContext context)
        {
            string activityId    = context.Request["ActivityID"];
            int    pageIndex     = Convert.ToInt32(context.Request["page"]);
            int    pageSize      = Convert.ToInt32(context.Request["rows"]);
            string keyWord       = context.Request["SearchTitle"];
            string linkName      = context.Request["LinkName"];
            string status        = context.Request["Status"];
            string source        = context.Request["Source"];
            string paymentStatus = context.Request["PaymentStatus"];
            string dealStatus    = context.Request["DealStatus"];
            string orderBy       = " InsertDate DESC";

            var strWhere = string.Format("ActivityID='{0}' AND IsDelete = 0 ", activityId);

            if (!string.IsNullOrEmpty(keyWord))
            {
                strWhere += "And Name like '%" + keyWord + "%'";
            }

            if (!string.IsNullOrEmpty(linkName))
            {
                strWhere += string.Format(" AND SpreadUserID='{0}'", linkName);
            }

            if (!string.IsNullOrWhiteSpace(status))
            {
                strWhere += string.Format(" AND Status in ({0}) ", status);
            }
            if (!string.IsNullOrWhiteSpace(paymentStatus))
            {
                strWhere += string.Format(" AND PaymentStatus ={0}", paymentStatus);
            }
            if (!string.IsNullOrWhiteSpace(dealStatus))
            {
                strWhere += string.Format(" AND Status ={0}", dealStatus);
            }
            if (!string.IsNullOrWhiteSpace(source))
            {
                switch (source)
                {
                case "0":
                    strWhere += string.Format(" AND (SpreadUserID='' or SpreadUserID is null) ", status);
                    break;

                case "1":
                    strWhere += string.Format(" AND SpreadUserID!=''", status);
                    break;

                default:
                    break;
                }
            }
            List <ActivityDataInfo> data = bllActivity.GetLit <ActivityDataInfo>(pageSize, pageIndex, strWhere, orderBy);
            var webSiteInfo = bllActivity.GetWebsiteInfoModelFromDataBase();

            for (int i = 0; i < data.Count; i++)
            {
                int rcode = 0;
                if (int.TryParse(data[i].DistributionOffLineRecommendCode, out rcode))
                {
                    var rUser = bllUser.GetUserInfoByAutoID(rcode);

                    if (rUser != null)
                    {
                        if (rUser.UserID == bllActivity.WebsiteOwner)
                        {
                            data[i].DistributionOffLineRecommendName = webSiteInfo.WebsiteName;
                        }
                        else
                        {
                            data[i].DistributionOffLineRecommendName = bllUser.GetUserDispalyName(rUser);

                            //如果是当前站点所有者,则显示站点的名称
                            if (bllActivity.WebsiteOwner == rUser.UserID)
                            {
                                data[i].DistributionOffLineRecommendName = bllActivity.GetWebsiteInfoModel().WebsiteName;
                            }
                        }
                    }
                }
            }

            int totalCount = bllActivity.GetCount <ActivityDataInfo>(strWhere);

            return(Common.JSONHelper.ObjectToJson(
                       new
            {
                total = totalCount,
                rows = data
            }));
        }