Пример #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int lastId;
        int num5;
        decimal singMoney = Convert.ToDecimal(this.InMoneyList.SelectedValue);
        int allCount = Convert.ToInt32(this.inNumTx.Text.Trim());
        switch (new StockLogManager().AddModel(this.userName, singMoney, allCount, false))
        {
            case 1:
                {
                    lastId = new StockLogManager().GetLastId();
                    List<StockLog> listByMoney = new StockLogManager().GetListByMoney(singMoney, true);
                    num5 = 0;
                    foreach (StockLog log in listByMoney)
                    {
                        int nowNum = allCount - num5;
                        if (nowNum > 0)
                        {
                            if (log.nowCount <= nowNum)
                            {
                                new StockLogManager().UpdateNowNum(log.id, log.nowCount);
                                new StockPayLogManager().AddModel(log.userName, this.userName, singMoney, log.nowCount, true, Helper.NowDay(), log.id, lastId);
                                num5 += log.nowCount;
                                continue;
                            }
                            new StockLogManager().UpdateNowNum(log.id, nowNum);
                            new StockPayLogManager().AddModel(log.userName, this.userName, singMoney, nowNum, true, Helper.NowDay(), log.id, lastId);
                            num5 += nowNum;
                        }
                        break;
                    }
                    break;
                }
            case 2:
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "alert('账号不存在或登录过期');window.location.replace('" + base.Request.RawUrl + "')", true);
                return;

            case 5:
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "alert('您的可用余额不足');window.location.replace('" + base.Request.RawUrl + "')", true);
                return;

            default:
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "alert('操作太频繁,请稍后再试');window.location.replace('" + base.Request.RawUrl + "')", true);
                return;
        }
        new StockLogManager().UpdateNowNum(lastId, num5);
        this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "alert('购买订单挂出成功');window.location.replace('" + base.Request.RawUrl + "')", true);
    }
Пример #2
0
 private void GetOutList()
 {
     StringBuilder builder = new StringBuilder();
     List<StockLog> listByName = new StockLogManager().GetListByName(this.userName, 2);
     builder.Append("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width: 98%; float: right;\"><tr><td style=\"width: 40%\">未成交之出售订单</td><td style=\"width: 40%\">出售价格</td><td>撤销</td></tr>");
     foreach (StockLog log in listByName)
     {
         if (log.nowCount > 0)
         {
             string str = (log.IoNum && (log.allCount == log.nowCount)) ? ("<a href='#' onclick=\"DelOk('" + log.id + "')\">点击撤销</a>") : "无法撤销";
             builder.Append("<tr onmouseover=\"this.className='move'\" onmouseout=\"this.className='over'\" style=\"backgroud-color:#D2E9FF\" ><td style=\"width: 40%\">" + log.nowCount.ToString() + "</td><td style=\"width: 40%\">" + log.singMoney.ToString("F2") + "</td><td>" + str + "</td></tr>");
         }
     }
     builder.Append("</table>");
     this.outListDiv.InnerHtml = builder.ToString();
     builder = null;
 }