コード例 #1
0
ファイル: DAL.cs プロジェクト: nblnt/BankingChatbot
 public List <Branch> GetBranches()
 {
     using (BankingChatbotDataContext db = new BankingChatbotDataContext())
     {
         return(db.Branches.ToList());
     }
 }
コード例 #2
0
ファイル: DAL.cs プロジェクト: nblnt/BankingChatbot
 public Branch GetBranch(int branchId)
 {
     using (BankingChatbotDataContext db = new BankingChatbotDataContext())
     {
         return(db.Branches.Single(x => x.BranchId == branchId));
     }
 }
コード例 #3
0
ファイル: DAL.cs プロジェクト: nblnt/BankingChatbot
 public DebitCard GetDebitCard(int cardId)
 {
     using (BankingChatbotDataContext db
                = new BankingChatbotDataContext())
     {
         return(db.DebitCards
                .Single(x => x.DebitCardId == cardId));
     }
 }
コード例 #4
0
ファイル: DAL.cs プロジェクト: nblnt/BankingChatbot
 public string GetIsoCurrency(int cardId)
 {
     using (BankingChatbotDataContext db = new BankingChatbotDataContext())
     {
         return(db.DebitCards
                .Where(x => x.DebitCardId == cardId)
                .Select(x => x.Account.Currency)
                .Single());
     }
 }
コード例 #5
0
ファイル: DAL.cs プロジェクト: nblnt/BankingChatbot
 public List <Account> GetClientAccounts(int clientId)
 {
     using (BankingChatbotDataContext db
                = new BankingChatbotDataContext())
     {
         return(db.Accounts
                .Where(x => x.ClientId == clientId)
                .ToList());
     }
 }
コード例 #6
0
ファイル: DAL.cs プロジェクト: nblnt/BankingChatbot
 public List <DebitCard> GetClientDebitCards(int clientId)
 {
     using (BankingChatbotDataContext db = new BankingChatbotDataContext())
     {
         return(db.DebitCards
                .Where(x => x.ClientId == clientId)
                .Include(x => x.Account)
                .Include(x => x.DebitCardType)
                .ToList());
     }
 }
コード例 #7
0
ファイル: DAL.cs プロジェクト: nblnt/BankingChatbot
 public void InsertAppointmentBooking(int branchId, int clientId, int caseType, DateTime dateTime)
 {
     using (BankingChatbotDataContext db = new BankingChatbotDataContext())
     {
         BookedAppointment appointment = new BookedAppointment()
         {
             BranchId = branchId,
             CaseType = caseType,
             ClientId = clientId,
             Date     = dateTime
         };
         db.BookedAppointments.Add(appointment);
         db.SaveChanges();
     }
 }
コード例 #8
0
ファイル: DAL.cs プロジェクト: nblnt/BankingChatbot
        public void UpdateCardLimit(int cardId, CardLimitType limitType, int newLimit)
        {
            using (BankingChatbotDataContext db = new BankingChatbotDataContext())
            {
                DebitCard selectedCard = db.DebitCards.Single(x => x.DebitCardId == cardId);
                switch (limitType)
                {
                case CardLimitType.PurchaseLimit:
                    selectedCard.DailyPaymentLimit = newLimit;
                    break;

                case CardLimitType.CashWithdrawalLimit:
                    selectedCard.DailyCashWithdrawalLimit = newLimit;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                db.SaveChanges();
            }
        }