protected void Page_Load(object sender, EventArgs e)
 {
     if (null != Common.Common.NoHtml(Request.QueryString["action"]))
     {
         strAction = Common.Common.NoHtml(Request.QueryString["action"]);
     }
     if (null != Common.Common.NoHtml(Request.QueryString["id"]))
     {
         strID = Common.Common.NoHtml(Request.QueryString["id"]);
     }
     RC_UsersDAL dal = new RC_UsersDAL();
     switch (strAction)
     {
         case "del":
             if (dal.UpdateRCUserIsDel("IsDel",strID))
             {
                 strMessage = "操作成功!";
             }
             else
             {
                 strMessage = "操作失败!";
             }
             break;
         default:
             break;
     }
     Response.Write(strMessage);
     Response.End();
 }
Beispiel #2
0
 /// <summary>
 /// 获取用户列表
 /// </summary>
 void GetRaceUserList()
 {
     if (strID != null && strID != "")
     {
         RC_UsersDAL dal = new RC_UsersDAL();
         Response.Write(Dataset2Json(dal.GetTopRcUserList(10, " and RaceID='" + strID + "' ")));
     }
 }
Beispiel #3
0
        /// <summary>
        /// 添加或更新用户速度
        /// </summary>
        void AddNewRace()
        {
            string nickname = string.Empty;
            string speed    = string.Empty;

            if (Request["nickname"] != null && Request["nickname"] != "")
            {
                nickname = Common.Common.NoHtml(Request["nickname"].ToString());
            }
            if (Request["speed"] != null && Request["speed"] != "")
            {
                speed = Common.Common.NoHtml(Request["speed"].ToString());
            }
            RC_Users    model = new RC_Users();
            RC_UsersDAL dal   = new RC_UsersDAL();

            if (nickname.Trim() != null && nickname.Trim() != "")
            {
                if (dal.ExistUser(nickname, strID))
                {
                    string uid = string.Empty;
                    uid = dal.GetRaceUserValue("ID", nickname, strID).ToString();
                    if (speed.Trim() != null && speed.Trim() != "")
                    {
                        if (dal.UpdateUserSpeedByOpenID(uid, speed, strID))
                        {
                            Response.Write("{\"success\":\"true\"}");
                        }
                        else
                        {
                            Response.Write("{\"success\":\"操作失败\"}");
                        }
                    }
                }
                else
                {
                    model.ID     = Guid.NewGuid().ToString("N").ToUpper();
                    model.OpenID = nickname;
                    if (speed.Trim() != null && speed.Trim() != "")
                    {
                        model.Speed = speed;
                    }
                    model.IsDel  = 0;
                    model.IsWin  = 0;
                    model.RaceID = strID;
                    if (dal.AddRCUser(model))
                    {
                        Response.Write("{\"success\":\"true\"}");
                    }
                    else
                    {
                        Response.Write("{\"success\":\"操作失败\"}");
                    }
                }
            }
        }
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="strWhere">条件</param>
        void LoadData(string strWhere)
        {
            txtName.Text = "";
            RC_UsersDAL dal = new RC_UsersDAL();
            DataSet     ds  = dal.GetRcUserList(strWhere);
            DataView    dv  = ds.Tables[0].DefaultView;

            AspNetPager1.RecordCount = dv.Count;

            PagedDataSource pds = new PagedDataSource();

            pds.DataSource       = dv;
            pds.AllowPaging      = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize         = AspNetPager1.PageSize;
            Repeater1.DataSource = pds;
            Repeater1.DataBind();
        }