Ejemplo n.º 1
0
    //钱包更改
    protected void CardList_SelectionChanged(object sender, EventArgs e)
    {
        int userId = Int32.Parse(Session["UserID"].ToString());
        int cardId = Int32.Parse(this.CardList.SelectedValue);

        Response.Cookies["CardID"].Value   = cardId.ToString();
        Response.Cookies["CardID"].Expires = DateTime.MaxValue;

        CardEntity card = CardAccess.GetCardByCardId(cardId, userId);

        this.Label14.Text = "¥ " + card.CardMoney.ToString("0.0##");
    }
Ejemplo n.º 2
0
    //类别删除操作
    protected void CardList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int cardId = Int32.Parse(CardList.DataKeys[e.RowIndex].Value.ToString());

        if (cardId == 0)
        {
            Utility.Alert(this, "不能删除我的钱包!");
            return;
        }

        CardEntity card = CardAccess.GetCardByCardId(cardId, userId);

        card.CardLive    = 0;
        card.Synchronize = 1;

        bool success = CardAccess.CheckItemListByCardId(userId, cardId);

        if (!success)
        {
            success = CardAccess.UpdateCard(card);
            if (success)
            {
                Utility.Alert(this, "删除成功。");

                CardList.EditIndex = -1;
                BindGrid();
            }
            else
            {
                Utility.Alert(this, "删除失败!");
            }
        }
        else
        {
            Utility.Alert(this, "不能删除已使用的钱包!");
        }
    }