Beispiel #1
0
        private static void LBTestApp()
        {
            //string bankName = null;
            Console.WriteLine("Press enter to see all banks.");
            Console.ReadLine();

            //initialize new context
            var context = new LBModel.LBEntities();
            var query = from b in context.Banks  select b;
            foreach (Bank comp in query)
                Console.WriteLine("{0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8}",
                    comp.BankID, comp.BankName, comp.BankDesc, comp.RoutingNumber, comp.IsOpen, comp.CreateDate, comp.CreatedBy, comp.UpdateDate, comp.UpdatedBy);
            Console.WriteLine("");

            //lambda for getting creating object where bankid = 1.  Good for short, small queries and updates
            //var bank = context.Banks.Where(b => b.BankID == 1);
            //var bank1 = context.Banks;
            //Console.WriteLine(bank1.OrderBy(b => b.BankID).FirstOrDefault().BankName);

            Console.WriteLine("Please enter the ID of the bank you wish to view.");

            int myBankID;

            bool i = false;
            while (i == false )
            {

                try
                {

                    myBankID = Convert.ToInt32(Console.ReadLine());
                    var bankIChoose = context.Banks.Find(myBankID);
                    Console.WriteLine("{0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8}", bankIChoose.BankID, bankIChoose.BankName, bankIChoose.BankDesc, bankIChoose.RoutingNumber,
                                        bankIChoose.IsOpen, bankIChoose.CreateDate, bankIChoose.CreatedBy, bankIChoose.UpdateDate, bankIChoose.UpdatedBy);
                    i = true;
                }
                catch (NullReferenceException e)
                {
                    Console.WriteLine("That bankID does not exist.  Please enter a new bankID.");
                }
                catch (Exception e)
                {
                    Console.WriteLine("Invalid input.  Please enter a new bankID.");
                }
            }
            Console.WriteLine("-----------------------------------------------------");
            Console.WriteLine("Press Enter To Close");
            Console.ReadLine();
            /*
             * this is working...I can use code like this to insert records using an insert method.
             string newBankName = "North Looney Bank";
             string newBankDesc = "blreaf";
             int newBankRoute = 654321;
             bool newBankOpen = true;

               context.spLOONEYBANK_Bank_Insert(newBankName, newBankDesc, newBankOpen, newBankRoute);
            */
        }
Beispiel #2
0
        public Bank(int BankID)
        {
            var context = new LBModel.LBEntities();
            var thisBank = context.Banks.Find(BankID);

            this.BankID = thisBank.BankID;
            this.bankName = thisBank.BankName;
            this.bankDescription = thisBank.BankDesc;
            this.routingNumber = thisBank.RoutingNumber;
            this.isOpen = thisBank.IsOpen;
            this.createDate = thisBank.CreateDate;
            this.createdBy = thisBank.CreatedBy;
            this.updateDate = Convert.ToDateTime(thisBank.UpdateDate);
            this.updatedBy = thisBank.UpdatedBy;
        }
Beispiel #3
0
        public Bank(int BankID)
        {
            var context  = new LBModel.LBEntities();
            var thisBank = context.Banks.Find(BankID);

            this.BankID          = thisBank.BankID;
            this.bankName        = thisBank.BankName;
            this.bankDescription = thisBank.BankDesc;
            this.routingNumber   = thisBank.RoutingNumber;
            this.isOpen          = thisBank.IsOpen;
            this.createDate      = thisBank.CreateDate;
            this.createdBy       = thisBank.CreatedBy;
            this.updateDate      = Convert.ToDateTime(thisBank.UpdateDate);
            this.updatedBy       = thisBank.UpdatedBy;
        }
Beispiel #4
0
        private static void LBTestApp()
        {
            //string bankName = null;
            Console.WriteLine("Press enter to see all banks.");
            Console.ReadLine();


            //initialize new context
            var context = new LBModel.LBEntities();
            var query   = from b in context.Banks select b;

            foreach (Bank comp in query)
            {
                Console.WriteLine("{0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8}",
                                  comp.BankID, comp.BankName, comp.BankDesc, comp.RoutingNumber, comp.IsOpen, comp.CreateDate, comp.CreatedBy, comp.UpdateDate, comp.UpdatedBy);
            }
            Console.WriteLine("");


            //lambda for getting creating object where bankid = 1.  Good for short, small queries and updates
            //var bank = context.Banks.Where(b => b.BankID == 1);
            //var bank1 = context.Banks;
            //Console.WriteLine(bank1.OrderBy(b => b.BankID).FirstOrDefault().BankName);

            Console.WriteLine("Please enter the ID of the bank you wish to view.");

            int myBankID;


            bool i = false;

            while (i == false)
            {
                try
                {
                    myBankID = Convert.ToInt32(Console.ReadLine());
                    var bankIChoose = context.Banks.Find(myBankID);
                    Console.WriteLine("{0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8}", bankIChoose.BankID, bankIChoose.BankName, bankIChoose.BankDesc, bankIChoose.RoutingNumber,
                                      bankIChoose.IsOpen, bankIChoose.CreateDate, bankIChoose.CreatedBy, bankIChoose.UpdateDate, bankIChoose.UpdatedBy);
                    i = true;
                }
                catch (NullReferenceException e)
                {
                    Console.WriteLine("That bankID does not exist.  Please enter a new bankID.");
                }
                catch (Exception e)
                {
                    Console.WriteLine("Invalid input.  Please enter a new bankID.");
                }
            }
            Console.WriteLine("-----------------------------------------------------");
            Console.WriteLine("Press Enter To Close");
            Console.ReadLine();

            /*
             * this is working...I can use code like this to insert records using an insert method.
             * string newBankName = "North Looney Bank";
             * string newBankDesc = "blreaf";
             * int newBankRoute = 654321;
             * bool newBankOpen = true;
             *
             * context.spLOONEYBANK_Bank_Insert(newBankName, newBankDesc, newBankOpen, newBankRoute);
             */
        }
Beispiel #5
0
 public static void SaveBank(LooneyBank.Core.Bank bank, LBModel.LBEntities currentContext)
 {
     //add code to update bank object's information in the currentContext.
 }
Beispiel #6
0
 public static void InsertNewBank(LooneyBank.Core.Bank bank, LBModel.LBEntities currentContext)
 {
     currentContext.spLOONEYBANK_Bank_Insert(bank.bankName, bank.bankDescription, bank.isOpen, bank.routingNumber);
 }