Exemple #1
0
        protected void LotteryUserInfo(System.Web.HttpContext context)
        {
            int           queryInt      = GameRequest.GetQueryInt("userid", 0);
            string        queryString   = GameRequest.GetQueryString("signature");
            string        queryString2  = GameRequest.GetQueryString("time");
            AjaxJsonValid ajaxJsonValid = new AjaxJsonValid();
            Message       message       = new Message();

            message = FacadeManage.aideAccountsFacade.CheckUserSignature(queryInt, queryString2, queryString);
            if (!message.Success)
            {
                ajaxJsonValid.msg = message.Content;
                context.Response.Write(ajaxJsonValid.SerializeToJson());
            }
            else
            {
                UserInfo userInfo  = message.EntityList[0] as UserInfo;
                string   logonPass = userInfo.LogonPass;
                message = FacadeManage.aideTreasureFacade.GetLotteryUserInfo(queryInt, logonPass);
                if (!message.Success)
                {
                    ajaxJsonValid.msg = message.Content;
                    context.Response.Write(ajaxJsonValid.SerializeToJson());
                }
                else
                {
                    LotteryUserInfo value = message.EntityList[0] as LotteryUserInfo;
                    ajaxJsonValid.AddDataItem("list", value);
                    ajaxJsonValid.SetValidDataValue(true);
                    context.Response.Write(ajaxJsonValid.SerializeToJson());
                }
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["lotteryId"]))
            {
                int lotteryId = Convert.ToInt32(Request["lotteryId"]);

                lottery = bllLotery.Get <WXLotteryV1>(string.Format(" WebsiteOwner='{0}' AND  LotteryID={1} ", bllLotery.WebsiteOwner, lotteryId));

                webSite = bllLotery.GetWebsiteInfoModel();

                var currentUserInfo = bllUser.GetCurrentUserInfo();


                if (string.IsNullOrEmpty(currentUserInfo.WXNickname))
                {
                    Session.Clear();
                    Response.Redirect(Request.Url.ToString());
                }


                lotteryUser = bllUser.Get <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryId={1} AND UserId='{2}' ", bllUser.WebsiteOwner, lotteryId, currentUserInfo.UserID));
                if (lotteryUser == null)
                {
                    lotteryUser = new BLLJIMP.Model.LotteryUserInfo();
                    lotteryUser.WebsiteOwner = bllUser.WebsiteOwner;
                    lotteryUser.CreateDate   = DateTime.Now;
                    lotteryUser.WinnerDate   = DateTime.Now;
                    lotteryUser.IsWinning    = 0;
                    lotteryUser.LotteryId    = Convert.ToInt32(lotteryId);
                    lotteryUser.UserId       = currentUserInfo.UserID;
                    lotteryUser.WXHeadimgurl = currentUserInfo.WXHeadimgurl;
                    lotteryUser.WXNickname   = bllUser.GetUserDispalyName(currentUserInfo);
                    if (bllUser.Add(lotteryUser))
                    {
                        msg       = "加入成功";
                        isSuccess = true;
                        int count = bllUser.GetCount <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryID={1}", bllUser.WebsiteOwner, lotteryId));
                        bllUser.UpdateByKey <WXLotteryV1>("LotteryID", Request["lotteryId"], "WinnerCount", count.ToString());
                    }
                    else
                    {
                        isSuccess = false;
                        msg       = "加入失败";
                    }
                }
                else
                {
                    msg       = "您已参加抽奖";
                    isSuccess = true;
                }
            }
        }