コード例 #1
0
        public static int DeleteLoanById(int id)
        {
            int iSuccess = 0;
            int uSuccess = 0;

            BorrowORLoanInfo loanInfo = LoanDAL.GetLoanById(id);
            UserInfo         userInfo = UserDAL.GetUserByName(loanInfo.Lender);

            LoanDAL.DeleteLoanById(id, out iSuccess);

            if (iSuccess > 0)
            {
                if (loanInfo.BorrowORLoanType == 2)
                {
                    CardInfo cardInfo   = CardDAL.GetCardByCardNumber(loanInfo.Lender, userInfo.Id);
                    float    amount     = cardInfo.Amount - loanInfo.Amount;
                    float    LoanAmount = cardInfo.LoanAmount - loanInfo.Amount;
                    CardDAL.UpdateCardAmount(amount, LoanAmount, cardInfo.Id, 4, out uSuccess);
                }
            }
            if (iSuccess > 0 && ((loanInfo.BorrowORLoanType == 2 && uSuccess > 0) || (loanInfo.BorrowORLoanType != 2 && uSuccess == 0)))
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }