Exemple #1
0
        public int ActiveCard(APIRequest <ActiveCardRP> rp)
        {
            var cardDepositBLL = new CardDepositBLL(CurrentUserInfo);
            var cardDeposit    = PagedSearch(new GetCardRP()
            {
                CardNo = rp.Parameters.CardNo, UseStatus = "0"
            }, CurrentUserInfo.ClientID);

            int result = 0;

            if (cardDeposit != null && cardDeposit.Tables.Count > 0 && cardDeposit.Tables[0].Rows.Count > 0)
            {
                DataRow dr = cardDeposit.Tables[0].Rows[0];
                if (rp.Parameters.CardPassword == System.Text.Encoding.UTF8.GetString(cardDepositBLL.DecryptCardPassword((byte[])dr["CardPassword"])).Replace("\0", ""))
                {
                    System.Data.SqlClient.SqlTransaction tran = GetTran();
                    using (tran.Connection)
                    {
                        string       errorMessage = "";
                        VipAmountBLL vipAmountBLL = new VipAmountBLL(CurrentUserInfo);
                        vipAmountBLL.SetVipAmountChange(CurrentUserInfo.ClientID, 4, rp.Parameters.VipID, decimal.Parse(dr["Amount"].ToString()) + decimal.Parse(dr["Bonus"].ToString()), dr["CardDepositId"].ToString(), "Prepaid card charge", "In", out errorMessage, tran);
                        result = this._currentDAO.ActiveCard(rp.Parameters.CardNo, rp.Parameters.VipID, this.CurrentUserInfo.UserID, this.CurrentUserInfo.ClientID, tran);

                        tran.Commit();
                    }
                }
            }

            return(result);
        }