Пример #1
0
        public AddMoneyPage()
        {
            InitializeComponent();

            string             sum;
            EnterViaCardNumber viaCardNumber = new EnterViaCardNumber();

            if (viaCardNumber.cardNumberExists == true)
            {
                using (var context = new BankSystemContext())
                {
                    currentAccount = context.Accounts.Where(account => account.Id.Equals(viaCardNumber.currentAccountId)).FirstOrDefault();
                    sum            = currentAccount.Sum.ToString();
                }
                currentSumText.Text = "У вас на счету " + sum + " тг.";
            }
            else
            {
                EnterViaIIN viaIIN = new EnterViaIIN();
                using (var context = new BankSystemContext())
                {
                    currentAccount = context.Accounts.Where(account => account.Id.Equals(viaIIN.currentAccountId)).FirstOrDefault();
                    sum            = currentAccount.Sum.ToString();
                }
                currentSumText.Text = "У вас на счету " + sum + " тг.";
            }
        }
Пример #2
0
        public MainPage()
        {
            InitializeComponent();

            string             name;
            EnterViaCardNumber viaCardNumber = new EnterViaCardNumber();

            if (viaCardNumber.cardNumberExists == true)
            {
                using (var context = new BankSystemContext())
                {
                    name = context.Accounts.Where(account => account.Id.Equals(viaCardNumber.currentAccountId))
                           .Select(account => account.FullName).FirstOrDefault();
                }
                greetingText.Text = "Здравствуйте, " + name + "!";
            }
            else
            {
                EnterViaIIN viaIIN = new EnterViaIIN();
                using (var context = new BankSystemContext())
                {
                    name = context.Accounts.Where(account => account.Id.Equals(viaIIN.currentAccountId))
                           .Select(account => account.FullName).FirstOrDefault();
                }
                greetingText.Text = "Здравствуйте, " + name + "!";
            }
        }
Пример #3
0
 private double ChangeSumInDB(double writtemSum)
 {
     using (var context = new BankSystemContext())
     {
         currentAccount.Sum += writtemSum;
         context.SaveChanges();
         return(currentAccount.Sum);
     }
 }
Пример #4
0
 private Account CheckIfCardNumberExists(string cardNumber)
 {
     using (var context = new BankSystemContext())
     {
         var bankAccount = context.Accounts.Where(account => account.CardNumber.Equals(cardNumber)).FirstOrDefault();
         if (bankAccount != null)
         {
             cardNumberExists = true; return(bankAccount);
         }
         else
         {
             cardNumberExists = false; return(bankAccount);
         }
     }
 }
Пример #5
0
 private Account CheckIfIINExists(string iin)
 {
     using (var context = new BankSystemContext())
     {
         var bankAccount = context.Accounts.Where(account => account.IIN.Equals(iin)).FirstOrDefault();
         if (bankAccount != null)
         {
             iinExists = true; return(bankAccount);
         }
         else
         {
             iinExists = false; return(bankAccount);
         }
     }
 }