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); } }
public static int DeleteCashIncome(int id) { int iSuccess = 0; int uSuccess = 0; CashIncomeInfo cashInfo = CashInComeDAL.GetCashIncomeById(id); CardInfo cardInfo = CardDAL.GetCardById(cashInfo.CardId); CashInComeDAL.DeleteCashIncome(id, out iSuccess); if (iSuccess > 0) { float amount = cardInfo.Amount - cashInfo.IncomeAmount; float incomeAmount = cardInfo.IncomeAmount - cashInfo.IncomeAmount; CardDAL.UpdateCardAmount(amount, incomeAmount, cashInfo.CardId, 1, out uSuccess); } if (iSuccess > 0 && uSuccess > 0) { return(1); } else { return(0); } }
public String GetCardName(int id) { CardDAL cardDAL = new CardDAL(); String title = cardDAL.GetCardName(id); return(title); }
public static int DeleteBorrowedById(int id) { int iSuccess = 0; int uSuccess = 0; BorrowORLoanInfo borrowInfo = BorrowDAL.GetBorrowById(id); UserInfo userInfo = UserDAL.GetUserByName(borrowInfo.Borrower); BorrowDAL.DeleteBorrowed(id, out iSuccess); if (iSuccess > 0) { if (borrowInfo.BorrowORLoanType == 2) { CardInfo cardInfo = CardDAL.GetCardByCardNumber(borrowInfo.BorrowedAccount, userInfo.Id); float amount = cardInfo.Amount - borrowInfo.Amount; float borrowAmount = cardInfo.BorrowAmount - borrowInfo.Amount; CardDAL.UpdateCardAmount(amount, borrowAmount, cardInfo.Id, 3, out uSuccess); } } if (iSuccess > 0 && ((borrowInfo.BorrowORLoanType == 2 && uSuccess > 0) || (borrowInfo.BorrowORLoanType != 2 && uSuccess == 0))) { return(1); } else { return(0); } }
public static int DeleteExpenses(int id) { int iSuccess = 0; int uSuccess = 0; ExpensesInfo expenses = ExpensesDAL.GetExpensesById(id); CardInfo cardInfo = CardDAL.GetCardById(expenses.CardId); ExpensesDAL.DeleteExpenses(id, out iSuccess); if (iSuccess > 0) { float amount = cardInfo.Amount + expenses.Amount; float expenditureAmount = cardInfo.ExpenditureAmount - expenses.Amount; CardDAL.UpdateCardAmount(amount, expenditureAmount, expenses.CardId, 2, out uSuccess); } if (iSuccess > 0 && uSuccess > 0) { return(1); } else { return(0); } }
public CardService() { m_dalCard = new CardDAL(); m_dalRecharge = new RechargeDAL(); m_dalSaleGas = new SaleGasDAL(); m_dataRequest = null; m_dataResponse = null; }
public void Delete(int id) { CardDAL card = db.Cards.Find(id); if (card != null) { db.Cards.Remove(card); } }
private DataTransfer GasBuyingUpdateCard(string strCardId, int money, int moneyEx) { CardDAL dalCard = new CardDAL(); CardDTO dtoCard = new CardDTO(); dtoCard.CardID = strCardId; dtoCard.CardRemainingMoney = money; dtoCard.CardMoneyEx = moneyEx; return(dalCard.UpdateSaleGas(dtoCard)); }
public static int DeleteCard(int id) { int iSuccess = 0; CardDAL.DeleteCard(id, out iSuccess); if (iSuccess > 0) { return(1); } else { return(0); } }
public static int InsertOrUpdatetoLoan(BorrowORLoanInfo info) { int iSuccess = 0; int uSuccess = 0; BorrowORLoanInfo loanInfo = new BorrowORLoanInfo(); UserInfo userInfo = UserDAL.GetUserByName(info.Lender); CardInfo cardInfo = CardDAL.GetCardByCardNumber(info.LoanAccount, userInfo.Id); if (info.Id > 0) { loanInfo = LoanDAL.GetLoanById(info.Id); } LoanDAL.InsertOrUpdatetoLoan(info, out iSuccess); if (iSuccess > 0 && info.BorrowORLoanType == 2) { float amount = 0; float loanAmount = 0; if (info.Id > 0) { amount = cardInfo.Amount + (info.Amount - loanInfo.Amount); loanAmount = cardInfo.Amount + (info.Amount - loanInfo.Amount); } else { amount = cardInfo.Amount + info.Amount; loanAmount = cardInfo.Amount + info.Amount; } CardDAL.UpdateCardAmount(amount, loanAmount, cardInfo.Id, 4, out uSuccess); } if ((iSuccess > 0 && info.Id > 0) && ((info.BorrowORLoanType == 2 && uSuccess > 0) || (info.BorrowORLoanType != 2 && uSuccess == 0))) { return(2); } else if ((iSuccess > 0 && info.Id == 0) && ((info.BorrowORLoanType == 2 && uSuccess > 0) || (info.BorrowORLoanType != 2 && uSuccess == 0))) { return(1); } else { return(0); } }
public static int InsertOrUpdatetocashincome(CashIncomeInfo info) { int iSuccess = 0; int uSuccess = 0; CashIncomeInfo cashIncomeInfo = new CashIncomeInfo(); if (info.Id > 0) { cashIncomeInfo = CashInComeDAL.GetCashIncomeById(info.Id); } CashInComeDAL.InsertOrUpdatetocashincome(info, out iSuccess); if (iSuccess > 0 || iSuccess == -1) { CardInfo cardInfo = CardDAL.GetCardById(info.CardId); float amount = 0; float incomeamount = 0; if (info.Id > 0) { amount = cardInfo.Amount + (info.IncomeAmount - cashIncomeInfo.IncomeAmount); incomeamount = cardInfo.IncomeAmount + (info.IncomeAmount - cashIncomeInfo.IncomeAmount); } else { amount = cardInfo.Amount + info.IncomeAmount; incomeamount = cardInfo.IncomeAmount + info.IncomeAmount; } CardDAL.UpdateCardAmount(amount, incomeamount, info.CardId, 1, out uSuccess); } if (iSuccess > 0 && uSuccess > 0) { return(1); } else if (iSuccess == -1 && uSuccess > 0) { return(-1); } else { return(0); } }
public static int InsertOrUpdatetoCard(CardInfo info) { int iSuccess = 0; MySqlTransaction mySqlTransaction = null; CardDAL.InsertOrUpdatetoCard(mySqlTransaction, info, out iSuccess); if (iSuccess > 0) { return(1); } else if (iSuccess == -1) { return(-1); } else { return(0); } }
public static int InsertOrUpdatetoBorrowed(BorrowORLoanInfo info) { int iSuccess = 0; int uSuccess = 0; BorrowORLoanInfo borrowInfo = new BorrowORLoanInfo(); UserInfo userInfo = UserDAL.GetUserByName(info.Borrower); CardInfo cardInfo = CardDAL.GetCardByCardNumber(info.BorrowedAccount, userInfo.Id); if (info.Id > 0) { borrowInfo = BorrowDAL.GetBorrowById(info.Id); } BorrowDAL.InsertOrUpdatetoBorrowed(info, out iSuccess); if (iSuccess > 0 && info.BorrowORLoanType == 2) { float amount = 0; float borrowAmount = 0; if (info.Id > 0) { amount = cardInfo.Amount + (info.Amount - borrowInfo.Amount); borrowAmount = cardInfo.BorrowAmount + (info.Amount - borrowInfo.Amount); } else { amount = cardInfo.Amount + info.Amount; borrowAmount = cardInfo.BorrowAmount + info.Amount; } CardDAL.UpdateCardAmount(amount, borrowAmount, cardInfo.Id, 3, out uSuccess); } if ((iSuccess > 0 && info.Id > 0) && ((info.BorrowORLoanType == 2 && uSuccess > 0) || (info.BorrowORLoanType != 2 && uSuccess == 0))) { return(2); } else if ((iSuccess > 0 && info.Id == 0) && ((info.BorrowORLoanType == 2 && uSuccess > 0) || (info.BorrowORLoanType != 2 && uSuccess == 0))) { return(1); } else { return(0); } }
public static int InsertOrUpdatetoExpenses(ExpensesInfo info) { int iSuccess = 0; int uSuccess = 0; ExpensesInfo expenses = new ExpensesInfo(); if (info.Id > 0) { expenses = ExpensesDAL.GetExpensesById(info.Id); } ExpensesDAL.InsertOrUpdatetoExpenses(info, out iSuccess); if (iSuccess > 0 || iSuccess == -1) { CardInfo cardInfo = CardDAL.GetCardById(info.CardId); float amount = 0; float expenditureAmount = 0; if (info.Id > 0) { amount = cardInfo.Amount - (info.Amount - expenses.Amount); expenditureAmount = cardInfo.ExpenditureAmount + (info.Amount - expenses.Amount); } else { amount = cardInfo.Amount + info.Amount; expenditureAmount = cardInfo.ExpenditureAmount + info.Amount; } CardDAL.UpdateCardAmount(amount, expenditureAmount, info.CardId, 2, out uSuccess); } if (iSuccess > 0 && uSuccess > 0) { return(1); } else if (iSuccess == -1 && uSuccess > 0) { return(-1); } else { return(0); } }
public string ValidateCardId(string strCardId) { CardDAL dalCard = new CardDAL(); DataTable tblCard = dalCard.ValidateCardID(strCardId); DataTransfer dataResult = new DataTransfer(); if (tblCard.Rows.Count > 0) { dataResult.ResponseCode = DataTransfer.RESPONSE_CODE_SUCCESS; DataSet ds = new DataSet(); ds.Tables.Add(tblCard.Copy()); dataResult.ResponseDataSet = ds; } else { dataResult.ResponseCode = DataTransfer.RESPONSE_CODE_FAIL; dataResult.ResponseErrorMsg = SGMText.GAS_STATION_CARD_ID_NOT_EXIST; } return(JSonHelper.ConvertObjectToJSon(dataResult)); }
public void Update(CardDAL card) { db.Entry(card).State = EntityState.Modified; }
public static CardInfo GetCardById(int id) { return(CardDAL.GetCardById(id)); }
public static CardCollection GetCard(List <QueryElement> list) { return(CardDAL.GetCard(list)); }
public bool UpdateDate(CardDTO card) { CardDAL adal = new CardDAL(); return(adal.UpdateDate(card)); }
public bool DeleteCard(CardDTO card) { CardDAL adal = new CardDAL(); return(adal.DeleteCard(card)); }
public static CardInfo GetCardByCardNumber(string cardNumber, int ownerId) { return(CardDAL.GetCardByCardNumber(cardNumber, ownerId)); }
public bool InsertDate(CardDTO card) { CardDAL adal = new CardDAL(); return(adal.InsertDate(card)); }
public CardDTO GetCard(int id) { CardDAL adal = new CardDAL(); return(adal.GetCard(id)); }
public List <CardDTO> GetAllCard(int listId) { CardDAL adal = new CardDAL(); return(adal.GetAllCard(listId)); }
public List <CardDTO> GetAllCard() { CardDAL adal = new CardDAL(); return(adal.GetAllCard()); }
public static CardCollection GetCardByUserId(int userId) { return(CardDAL.GetCardByUserId(userId)); }
public void Create(CardDAL card) { db.Cards.Add(card); }