Ejemplo n.º 1
0
        private string QueryActivity(HttpContext context)
        {
            int    pageIndex    = Convert.ToInt32(context.Request["page"]);
            int    pageSize     = Convert.ToInt32(context.Request["rows"]);
            string activityName = context.Request["ActivityName"];
            string activityId   = context.Request["ActivityId"];

            System.Text.StringBuilder sbWhere = new System.Text.StringBuilder(string.Format("IsDelete = 0 And WebsiteOwner='{0}'", bllUser.WebsiteOwner));

            if (!string.IsNullOrEmpty(activityName))
            {
                sbWhere.AppendFormat("And ActivityName like '%{0}%'", activityName);;
            }
            if (!string.IsNullOrEmpty(activityId))
            {
                sbWhere.AppendFormat("And ActivityID  ='{0}'", activityId);;
            }
            List <ActivityInfo> dataList = bllActivity.GetLit <ActivityInfo>(pageSize, pageIndex, sbWhere.ToString(), "ActivityStatus  DESC,ActivityID DESC");

            int totalCount = bllActivity.GetCount <ActivityInfo>(sbWhere.ToString());

            return(Common.JSONHelper.ObjectToJson(
                       new
            {
                total = totalCount,
                rows = dataList
            }));
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            ResponseMessage resp = new ResponseMessage();

            try
            {
                if (string.IsNullOrEmpty(context.Request["activityid"]))
                {
                    resp.Status  = -1;
                    resp.Message = "活动ID不能为空";
                    context.Response.Write(Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                if (string.IsNullOrEmpty(context.Request["sortfield"]))
                {
                    resp.Status  = -1;
                    resp.Message = "排序字段不能为空";
                    context.Response.Write(Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                if (string.IsNullOrEmpty(context.Request["count"]))
                {
                    resp.Status  = -1;
                    resp.Message = "获取数量不能为空";
                    context.Response.Write(Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                BLLJIMP.BLLActivity bll = new BLLJIMP.BLLActivity("");

                int    activityid;
                string sortfield = context.Request["sortfield"];
                int    count;

                //检查有效性
                if (!int.TryParse(context.Request["activityid"], out activityid))
                {
                    resp.Status  = -1;
                    resp.Message = "活动ID错误";
                    context.Response.Write(Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                if (!int.TryParse(context.Request["count"], out count))
                {
                    resp.Status  = -1;
                    resp.Message = "获取数量错误";
                    context.Response.Write(Common.JSONHelper.ObjectToJson(resp));
                    return;
                }



                //筛选活动id范围

                if (bll.GetCount <GameActivityQueryLimit>(string.Format("ActivityID={0}", activityid)) > 0)
                {
                    List <ActivityDataInfo> dataList = bll.GetLit <ActivityDataInfo>(count, 1, string.Format("ActivityID='{0}' And IsDelete !=1", activityid), string.Format(" CAST({0} as INTEGER) DESC", sortfield));

                    for (int i = 0; i < dataList.Count; i++)
                    {
                        dataList[i].WebsiteOwner = null;
                    }

                    context.Response.Write(Common.JSONHelper.ObjectToJson(dataList));
                    return;
                }
                else
                {
                    resp.Status  = -1;
                    resp.Message = "不允许查询的活动";
                    context.Response.Write(Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
            }
            catch (Exception ex)
            {
                resp.Status  = -1;
                resp.Message = ex.Message;
                context.Response.Write(Common.JSONHelper.ObjectToJson(resp));
                return;
            }
        }
Ejemplo n.º 3
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
            }));
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                string activityId = context.Request["activity_id"];
                int    pageIndex  = !string.IsNullOrEmpty(context.Request["pageindex"]) ? int.Parse(context.Request["pageindex"]) : 1;
                int    pageSize   = !string.IsNullOrEmpty(context.Request["pagesize"]) ? int.Parse(context.Request["pagesize"]) : 10;
                string keyWord    = context.Request["keyword"];
                if (string.IsNullOrEmpty(activityId))
                {
                    resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                    resp.errmsg  = "activity_id 为必填项,请检查";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                JuActivityInfo juActivity = bllJuActivity.GetJuActivity(int.Parse(activityId), false);
                if (juActivity == null)
                {
                    resp.errmsg  = "不存在该条活动";
                    resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }

                System.Text.StringBuilder sbWhere = new System.Text.StringBuilder(string.Format(" WebSiteOwner='{0}' AND isDelete=0 AND ActivityID='{1}' ", bllActivity.WebsiteOwner, juActivity.SignUpActivityID));

                if (!string.IsNullOrEmpty(keyWord))
                {
                    sbWhere.AppendFormat(" AND Name like '%{0}%' ", keyWord);
                }

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

                var dataList = bllActivity.GetLit <ActivityDataInfo>(pageSize, pageIndex, sbWhere.ToString());

                List <ActivityFieldMappingInfo> fieldMapList = bllActivity.GetActivityFieldMappingList(juActivity.SignUpActivityID);

                resp.isSuccess = true;

                List <dynamic> list      = new List <dynamic>();
                List <dynamic> maplist   = new List <dynamic>();
                var            fieldlist = bllActivity.GetActivityFieldMappingList(juActivity.SignUpActivityID);
                foreach (var item in fieldlist)
                {
                    maplist.Add(new
                    {
                        key   = item.MappingName,
                        value = item.FieldName
                    });
                }

                for (int i = 0; i < dataList.Count; i++)
                {
                    list.Add(new
                    {
                        name        = dataList[i].Name,
                        phone       = dataList[i].Phone,
                        insert_time = bllActivity.GetTimeStamp(dataList[i].InsertDate),
                        k1          = dataList[i].K1,
                        k2          = dataList[i].K2,
                        k3          = dataList[i].K3,
                        k4          = dataList[i].K4,
                        k5          = dataList[i].K5,
                        k6          = dataList[i].K6,
                        k7          = dataList[i].K7,
                        k8          = dataList[i].K8,
                        k9          = dataList[i].K9,
                        k10         = dataList[i].K10,

                        k11 = dataList[i].K11,
                        k12 = dataList[i].K12,
                        k13 = dataList[i].K13,
                        k14 = dataList[i].K14,
                        k15 = dataList[i].K15,
                        k16 = dataList[i].K16,
                        k17 = dataList[i].K17,
                        k18 = dataList[i].K18,
                        k19 = dataList[i].K19,
                        k20 = dataList[i].K20,

                        k21 = dataList[i].K21,
                        k22 = dataList[i].K22,
                        k23 = dataList[i].K23,
                        k24 = dataList[i].K24,
                        k25 = dataList[i].K25,
                        k26 = dataList[i].K26,
                        k27 = dataList[i].K27,
                        k28 = dataList[i].K28,
                        k29 = dataList[i].K29,
                        k30 = dataList[i].K30,

                        k31 = dataList[i].K31,
                        k32 = dataList[i].K32,
                        k33 = dataList[i].K33,
                        k34 = dataList[i].K34,
                        k35 = dataList[i].K35,
                        k36 = dataList[i].K36,
                        k37 = dataList[i].K37,
                        k38 = dataList[i].K38,
                        k39 = dataList[i].K39,
                        k40 = dataList[i].K40,

                        k41 = dataList[i].K41,
                        k42 = dataList[i].K42,
                        k43 = dataList[i].K43,
                        k44 = dataList[i].K44,
                        k45 = dataList[i].K45,
                        k46 = dataList[i].K46,
                        k47 = dataList[i].K47,
                        k48 = dataList[i].K48,
                        k49 = dataList[i].K49,
                        k50 = dataList[i].K50,

                        k51 = dataList[i].K51,
                        k52 = dataList[i].K52,
                        k53 = dataList[i].K53,
                        k54 = dataList[i].K54,
                        k55 = dataList[i].K55,
                        k56 = dataList[i].K56,
                        k57 = dataList[i].K57,
                        k58 = dataList[i].K58,
                        k59 = dataList[i].K59,
                        k60 = dataList[i].K60,
                    });
                }


                var data = new {
                    totalcount = totalCount,
                    list       = list,
                };

                resp.returnObj = new
                {
                    data    = data,
                    maplist = maplist
                };
            }
            catch (Exception ex)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                resp.errmsg  = ex.Message;
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }