コード例 #1
0
ファイル: ActivityData.ashx.cs プロジェクト: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            string result = "false";

            currentUserInfo = bllActivity.GetCurrentUserInfo();
            if (!bllActivity.IsLogin)
            {
                goto outoff;
            }
            if ((!currentUserInfo.UserID.Equals(bllActivity.WebsiteOwner)) && (!currentUserInfo.UserType.Equals(1)) && (currentUserInfo.IsSubAccount == "0"))
            {
                goto outoff;
            }
            context.Response.ContentType = "text/plain";
            context.Response.Expires     = 0;
            string action = context.Request["Action"];

            //利用反射找到未知的调用的方法
            if (!string.IsNullOrEmpty(action))
            {
                MethodInfo method = this.GetType().GetMethod(action, BindingFlags.NonPublic | BindingFlags.Instance); //找到方法BindingFlags.NonPublic指定搜索非公有方法
                result = Convert.ToString(method.Invoke(this, new[] { context }));                                    //调用方法
            }
            else
            {
                result = "action not exist";
            }
outoff:
            context.Response.Write(result);
        }
コード例 #2
0
ファイル: ActivityHandler.ashx.cs プロジェクト: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Expires = 0;
            string result = "false";
            try
            {
                currentUserInfo = bllActivity.GetCurrentUserInfo();
                string action = context.Request["Action"];

                switch (action)
                {
                    case "GetActivityInfo":
                        result = GetActivityInfo(context);
                        break;
                    case "GetActivityDataInfo":
                        result = GetActivityDataInfo(context);
                        break;
                    case "GroupSendSms":
                        result = GroupSendSms(context);
                        break;
                    case "GetActivityItemList":
                        result = GetJuActivityItemList(context);
                        break;
                    case "GetMyActivityList":
                        result = GetMyActivityList(context);
                        break;
                    case "ReceiveActivity"://接收活动转赠
                        result = ReceiveActivity(context);
                        break;

                }
            }
            catch (Exception ex)
            {

                this.resp.Status = -1;
                this.resp.Msg = "异常" + ex.Message;

                result = ZentCloud.Common.JSONHelper.ObjectToJson(this.resp);
            }

            context.Response.Write(result);
        }