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;
        }
    }
Пример #2
0
    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;
        }
    }