コード例 #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(BCW.Model.Shoptg model)
 {
     return(dal.Add(model));
 }
コード例 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BCW.Model.Shoptg model)
 {
     dal.Update(model);
 }
コード例 #3
0
    private void OkBuy()
    {
        int    id     = int.Parse(Utils.GetRequest("id", "post", 1, @"^[0-9]\d*$", "0"));
        string AcEms  = Utils.GetRequest("AcEms", "post", 3, @"^[A-Za-z0-9]+$", "运单号填写错误");
        string AcText = Utils.GetRequest("AcText", "post", 3, @"^[\s\S]{1,300}$", "附言最多300字");
        int    stats  = int.Parse(Utils.GetRequest("stats", "post", 2, @"^[0-4]$", "选择状态错误"));
        string info   = Utils.GetRequest("info", "all", 1, "", "");

        if (info != "ok" && (stats == 3 || stats == 4))
        {
            Master.Title = "确定订单";
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            if (stats == 3)
            {
                builder.Append("确定把订单记录确认为交易成功吗,确认后不可修改");
            }
            else
            {
                builder.Append("确定把订单记录确认为交易失败吗,确认后不可修改");
            }

            builder.Append(Out.Tab("</div>", "<br />"));


            string strName = "AcEms,AcText,stats,id,act,backurl,info";
            string strValu = "" + AcEms + "'" + AcText + "'" + stats + "'" + id + "'ok'" + Utils.getPage(2) + "'ok";
            string strOthe = "确认交易,shopbuy.aspx,post,0,red";

            builder.Append(Out.wapform(strName, strValu, strOthe));


            builder.Append(Out.Tab("<div>", "<br />"));
            builder.Append(" <a href=\"" + Utils.getUrl("shopbuy.aspx?act=view&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + "") + "\">等待确认</a>");
            builder.Append(Out.Tab("</div>", ""));
            builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr()));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("<a href=\"" + Utils.getUrl("shopbuy.aspx?act=view&amp;id=" + id + "") + "\">返回上一级</a><br />");
            builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"));
            builder.Append(Out.Tab("</div>", "<br />"));
        }
        else
        {
            if (!new BCW.BLL.Buylist().Exists(id))
            {
                Utils.Error("不存在的记录", "");
            }
            BCW.Model.Buylist modelBuy = new BCW.BLL.Buylist().GetBuylist(id);
            if (modelBuy.AcStats == 3 || modelBuy.AcStats == 4)
            {
                Utils.Error("此订单已经确认,无法进行更改", "");
            }
            BCW.Model.Buylist model = new BCW.Model.Buylist();
            model.ID      = id;
            model.AcText  = AcText;
            model.AcEms   = AcEms;
            model.AcStats = stats;
            new BCW.BLL.Buylist().UpdateMStats(model);
            if (stats == 4)
            {
                //如果失败,更新出售数量
                new BCW.BLL.Goods().UpdateSellCount(modelBuy.GoodsId, -modelBuy.Paycount);
            }
            if (stats == 3)
            {
                //如果交易成功并有推荐ID,则执行
                long ReTar = Utils.ParseInt64(ub.GetSub("BuylistReTar", xmlPath));
                if (ReTar > 0)
                {
                    int InviteNum = new BCW.BLL.User().GetInviteNum(modelBuy.UserId);
                    if (InviteNum > 0)
                    {
                        //计算分成
                        long gold     = Convert.ToInt64(modelBuy.Paycount * modelBuy.Price);
                        long ReFcGold = Convert.ToInt64(gold * ReTar * 0.01);
                        //更新InviteNum分成金额
                        new BCW.BLL.User().UpdateiFcGold(InviteNum, ReFcGold);

                        BCW.Model.Shoptg tg = new BCW.Model.Shoptg();
                        tg.ZrID     = InviteNum;
                        tg.UsID     = modelBuy.UserId;
                        tg.UsName   = modelBuy.UserName;
                        tg.Notes    = "购买" + modelBuy.Title + "(" + modelBuy.Paycount + "件),分成收入" + ReFcGold + "元";
                        tg.DetailId = modelBuy.GoodsId;
                        tg.AddTime  = DateTime.Now;
                        new BCW.BLL.Shoptg().Add(tg);
                        //发信给推荐ID,提醒分成收入
                        new BCW.BLL.Guest().Add(InviteNum, new BCW.BLL.User().GetUsName(InviteNum), "恭喜!您推荐的会员[url=/bbs/uinfo.aspx?uid=" + modelBuy.UserId + "]" + modelBuy.UserName + "[/url]成功购买了商品[url=/shopdetail.aspx?id=" + modelBuy.GoodsId + "]《" + modelBuy.Title + "》[/url],你的分成收入增加" + ReFcGold + "元");
                    }
                }
            }
            //发信给下订单的会员
            new BCW.BLL.Guest().Add(modelBuy.UserId, modelBuy.UserName, "您的订单[url=/myshop.aspx?act=view&amp;id=" + id + "]" + modelBuy.Title + "[/url]已变更为" + BCW.User.AppCase.CaseBuyStats(stats) + "");

            Utils.Success("确定交易", "确定成功,订单变更为" + BCW.User.AppCase.CaseBuyStats(stats) + "," + modelBuy.UserName + "将收到订单结果的内线..", Utils.getUrl("shopbuy.aspx?act=view&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + ""), "1");
        }
    }