protected void btn_OK_Click(object sender, EventArgs e)
    {
        double MoneyStart = 0;
        double MoneyEnd = 0;
        int BuyShareStart = 1;
        int BuyShareEnd = 1;

        //if (!_User.isAlipayNameValided)
        //{
        //    Shove._Web.JavaScript.Alert(this.Page, "对不起,您的支付宝账号还未绑定,请先绑定您的支付宝账号。谢谢!", "BindAlipay.aspx");

        //    return;
        //}

        if (string.IsNullOrEmpty(_User.IDCardNumber) || string.IsNullOrEmpty(_User.RealityName))
        {
            Shove._Web.JavaScript.Alert(this.Page, "对不起,您的身份证号码或者真实姓名没有填写,为了不影响您的领奖,请先完善这些资料。谢谢!", "UserEdit.aspx");

            return;
        }

        try
        {
            MoneyEnd = double.Parse(tbMaxMoney.Text);
            MoneyStart = double.Parse(tbMinMoney.Text);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有误");

            return;
        }

        if (MoneyEnd < MoneyStart)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有误,最低金额不能大于最高金额");

            return;
        }

        BuyShareStart = Shove._Convert.StrToInt(tbBuyShareStart.Text, -1);
        BuyShareEnd = Shove._Convert.StrToInt(tbBuyShareEnd.Text, -1);

        if (BuyShareStart < 1 || BuyShareEnd < 1 || BuyShareStart > BuyShareEnd)
        {
            Shove._Web.JavaScript.Alert(this.Page, "份数输入有误");

            return;
        }

        if (_User.ID == Shove._Convert.StrToLong(HidFollowUserID.Value, 0))
        {
            Shove._Web.JavaScript.Alert(this.Page,"您不能定制自己的跟单!");

            return;
        }
        DAL.Tables.T_CustomFriendFollowSchemes tcffs = new DAL.Tables.T_CustomFriendFollowSchemes();

        tcffs.SiteID.Value = 1;
        tcffs.UserID.Value = _User.ID;
        tcffs.FollowUserID.Value = HidFollowUserID.Value;
        tcffs.LotteryID.Value = ddlLotteries.SelectedValue;
        tcffs.PlayTypeID.Value = ddlPlayTypes.SelectedValue;
        tcffs.MoneyStart.Value = MoneyStart;
        tcffs.MoneyEnd.Value = MoneyEnd;
        tcffs.BuyShareStart.Value = BuyShareStart;
        tcffs.BuyShareEnd.Value = BuyShareEnd;
        tcffs.Type.Value = 1;

        long l = tcffs.Insert();

        if (l > 0)
        {
            //刷新缓存
            string CacheKey = "T_CustomFriendFollowSchemes" + ddlLotteries.SelectedValue;
            Shove._Web.Cache.ClearCache(CacheKey);

            if (ddlLotteries.SelectedValue == "-1")
            {
                foreach (KeyValuePair<int, string> kvp in DataCache.Lotteries)
                {
                    CacheKey = "T_CustomFriendFollowSchemes" + kvp.Key.ToString();

                    Shove._Web.Cache.ClearCache(CacheKey);
                }
            }

            Response.Redirect("FollowSchemeHistory.aspx?Type='divSetMyFollowSchemes", true);

            return;
        }
        else
        {
            PF.GoError(ErrorNumber.Unknow, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }
    }
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        if (_User == null)
        {
            return;
        }
        double MoneyStart = 0;
        double MoneyEnd = 0;
        int BuyShareStart = 1;
        int BuyShareEnd = 1;
        if (Source == "1")
        {
            if (lbUserName.Text == "")
            {
                Shove._Web.JavaScript.Alert(this.Page, "对不起,用户访问错误.");
                Response.Write("<scrpit type=\"text/javascript\" language=\"javascript\">top.location = \"UserEdit.aspx\" </script>");
                return;
            }
        }

        if (string.IsNullOrEmpty(_User.IDCardNumber) || string.IsNullOrEmpty(_User.RealityName))
        {
            Response.Write("<script>alert('对不起,您的身份证号码或者真实姓名没有填写,为了不影响您的领奖,请先完善这些资料。谢谢');parent.location.href ='UserEdit.aspx';</script>");
            return;
        }

        try
        {
            MoneyEnd = double.Parse(tbMaxMoney.Text);
            MoneyStart = double.Parse(tbMinMoney.Text);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有误");

            return;
        }

        if (MoneyEnd < MoneyStart)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有误,最低金额不能大于最高金额");

            return;
        }

        BuyShareStart = Shove._Convert.StrToInt(tbBuyShareStart.Text, -1);
        BuyShareEnd = Shove._Convert.StrToInt(tbBuyShareEnd.Text, -1);

        if (BuyShareStart < 1 || BuyShareEnd < 1 || BuyShareStart > BuyShareEnd)
        {
            Shove._Web.JavaScript.Alert(this.Page, "份数输入有误");

            return;
        }

        long count = new DAL.Tables.T_CustomFriendFollowSchemes().GetCount("LotteryID in(" + ddlLotteries.SelectedValue + ",-1) and PlayTypeID in(" + ddlPlayTypes.SelectedValue + ",-1) and UserID=" + _User.ID.ToString() + " and FollowUserID=" + HidFollowUserID.Value + "");

        if (count > 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您已经订制过此好友的跟单!");

            return;
        }

        if (_User.ID == Shove._Convert.StrToLong(HidFollowUserID.Value, 0))
        {
            Shove._Web.JavaScript.Alert(this.Page, "您不能定制自己的跟单!");

            return;
        }

        DAL.Tables.T_CustomFriendFollowSchemes tcffs = new DAL.Tables.T_CustomFriendFollowSchemes();

        tcffs.SiteID.Value = 1;
        tcffs.UserID.Value = _User.ID;
        tcffs.FollowUserID.Value = HidFollowUserID.Value;
        tcffs.LotteryID.Value = ddlLotteries.SelectedValue;
        tcffs.PlayTypeID.Value = ddlPlayTypes.SelectedValue;
        tcffs.MoneyStart.Value = MoneyStart;
        tcffs.MoneyEnd.Value = MoneyEnd;
        tcffs.BuyShareStart.Value = BuyShareStart;
        tcffs.BuyShareEnd.Value = BuyShareEnd;
        tcffs.Type.Value = 1;

        long l = tcffs.Insert();

        Shove._Web.JavaScript.Alert(this.Page, "定制跟单成功");
        if (l > 0)
        {
            //刷新缓存
            string CacheKey = "T_CustomFriendFollowSchemes" + ddlLotteries.SelectedValue;
            Shove._Web.Cache.ClearCache(CacheKey);

            if (ddlLotteries.SelectedValue == "-1")
            {
                foreach (KeyValuePair<int, string> kvp in DataCache.Lotteries)
                {
                    CacheKey = "T_CustomFriendFollowSchemes" + kvp.Key.ToString();

                    Shove._Web.Cache.ClearCache(CacheKey);
                }
            }

            Response.Redirect("FollowScheme.aspx?LotteryID=" + Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("LotteryID"), 5) + "&Go=-1", true);

            return;
        }
        else
        {
            PF.GoError(ErrorNumber.Unknow, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }
    }
    private void BindData(int FollowUserID)
    {
        DataTable dt = new DAL.Tables.T_CustomFriendFollowSchemes().Open("", "FollowUserID = " + FollowUserID.ToString() + " and UserID = " + Shove._Web.Utility.FilteSqlInfusion(HidUserID.Value), "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count == 0)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "参数错误", this.GetType().BaseType.FullName);

            return;
        }

        DataRow drfs = dt.Rows[0];

        int LotteryID = Shove._Convert.StrToInt(drfs["LotteryID"].ToString(), -1);
        int PlayTypeID = Shove._Convert.StrToInt(drfs["PlayTYpeID"].ToString(), -1);
        double MoneyStart = Shove._Convert.StrToDouble(drfs["MoneyStart"].ToString(), 0);
        double MoneyEnd = Shove._Convert.StrToDouble(drfs["MoneyEnd"].ToString(), 0);
        int BuyShareStart = Shove._Convert.StrToInt(drfs["BuyShareStart"].ToString(), 1);
        int BuyShareEnd = Shove._Convert.StrToInt(drfs["BuyShareEnd"].ToString(), 1);

        tbMaxMoney.Text = MoneyEnd.ToString().Replace(".0000", "");
        tbMinMoney.Text = MoneyStart.ToString().Replace(".0000", "");
        tbBuyShareStart.Text = BuyShareStart.ToString();
        tbBuyShareEnd.Text = BuyShareEnd.ToString();

        HidFollowUserID.Value = drfs["FollowUserID"].ToString();
        HidPlayTypeID.Value = PlayTypeID.ToString();

        string CacheKey = "dtLotteriesUseLotteryList";
        DataTable dtLotteries = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (dtLotteries == null)
        {
            dtLotteries = new DAL.Tables.T_Lotteries().Open("[ID], [Name], [Code]", "[ID] in(" + (_Site.UseLotteryList == "" ? "-1" : _Site.UseLotteryList) + ")", "[ID]");

            if (dtLotteries == null)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName + "(-39)");

                return;
            }

            Shove._Web.Cache.SetCache(CacheKey, dtLotteries, 6000);
        }

        if (dtLotteries == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName + "(-49)");

            return;
        }

        ddlLotteries.Items.Clear();
        ddlLotteries.Items.Add(new ListItem("全部彩种", "-1"));

        foreach (DataRow dr in dtLotteries.Rows)
        {
            string strLotteryName = dr["Name"].ToString();
            if (dr["ID"].ToString() == "61")
            {
                strLotteryName = strLotteryName.Replace("江西", "");
            }
            ddlLotteries.Items.Add(new ListItem(strLotteryName, dr["ID"].ToString()));
        }

        if (ddlLotteries.Items.FindByValue(LotteryID.ToString()) != null)
        {
            ddlLotteries.SelectedValue = LotteryID.ToString();
        }

        ddlLotteries_SelectedIndexChanged(ddlLotteries, new EventArgs());
    }
 private void BindData(int FollowUserID)
 {
     DataTable table = new Tables.T_CustomFriendFollowSchemes().Open("", "FollowUserID = " + FollowUserID.ToString() + " and UserID = " + Utility.FilteSqlInfusion(this.HidUserID.Value), "");
     if (table == null)
     {
         PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName);
     }
     else if (table.Rows.Count == 0)
     {
         PF.GoError(4, "参数错误", base.GetType().BaseType.FullName);
     }
     else
     {
         DataRow row = table.Rows[0];
         int num = _Convert.StrToInt(row["LotteryID"].ToString(), -1);
         int num2 = _Convert.StrToInt(row["PlayTYpeID"].ToString(), -1);
         double num3 = _Convert.StrToDouble(row["MoneyStart"].ToString(), 0.0);
         double num4 = _Convert.StrToDouble(row["MoneyEnd"].ToString(), 0.0);
         int num5 = _Convert.StrToInt(row["BuyShareStart"].ToString(), 1);
         int num6 = _Convert.StrToInt(row["BuyShareEnd"].ToString(), 1);
         this.tbMaxMoney.Text = num4.ToString().Replace(".0000", "");
         this.tbMinMoney.Text = num3.ToString().Replace(".0000", "");
         this.tbBuyShareStart.Text = num5.ToString();
         this.tbBuyShareEnd.Text = num6.ToString();
         this.HidFollowUserID.Value = row["FollowUserID"].ToString();
         this.HidPlayTypeID.Value = num2.ToString();
         string key = "dtLotteriesUseLotteryList";
         DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key);
         if (cacheAsDataTable == null)
         {
             cacheAsDataTable = new Tables.T_Lotteries().Open("[ID], [Name], [Code]", "[ID] in(" + ((base._Site.UseLotteryList == "") ? "-1" : base._Site.UseLotteryList) + ")", "[ID]");
             if (cacheAsDataTable == null)
             {
                 PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName + "(-39)");
                 return;
             }
             Shove._Web.Cache.SetCache(key, cacheAsDataTable, 0x1770);
         }
         if (cacheAsDataTable == null)
         {
             PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName + "(-49)");
         }
         else
         {
             this.ddlLotteries.Items.Clear();
             this.ddlLotteries.Items.Add(new ListItem("全部彩种", "-1"));
             foreach (DataRow row2 in cacheAsDataTable.Rows)
             {
                 string text = row2["Name"].ToString();
                 if (row2["ID"].ToString() == "61")
                 {
                     text = text.Replace("江西", "");
                 }
                 this.ddlLotteries.Items.Add(new ListItem(text, row2["ID"].ToString()));
             }
             if (this.ddlLotteries.Items.FindByValue(num.ToString()) != null)
             {
                 this.ddlLotteries.SelectedValue = num.ToString();
             }
             this.ddlLotteries_SelectedIndexChanged(this.ddlLotteries, new EventArgs());
         }
     }
 }