public static int CreateNewAccount2(Customer user) //entity framework function { int flag = 0; using (DBBankingSystemEntities model = new DBBankingSystemEntities()) { CustomerDetail data1 = model.CustomerDetails.FirstOrDefault(r => r.Name == user.Name); if (data1.Name != user.Name) { CustomerDetail data = new CustomerDetail() { Name = user.Name, AccountType = user.AccountType, Balance = user.Deposit, Password = user.password }; model.CustomerDetails.Add(data1); model.SaveChanges(); Console.WriteLine("Successful"); flag = 1; } } if (flag == 1) { return(1); } else { return(0); } }
public static int Balance1(Login login) //entity framework function { int balance = 0; using (DBBankingSystemEntities model = new DBBankingSystemEntities()) { CustomerDetail data1 = model.CustomerDetails.FirstOrDefault(r => r.Name == login.Name); balance = data1.Balance; } return(balance); }
enum Accounts { Salary = 0, Current, DMAT }; //enums public static string Interest1(Login login) //entity framework function { string account = ""; using (DBBankingSystemEntities model = new DBBankingSystemEntities()) { CustomerDetail data1 = model.CustomerDetails.FirstOrDefault(r => r.Name == login.Name); account = data1.AccountType; } return(account); }
public static int AccountDetails1(Login login, int Data, int checkValue) //entity framework function { int result = 0; using (DBBankingSystemEntities model = new DBBankingSystemEntities()) { CustomerDetail data1 = model.CustomerDetails.FirstOrDefault(r => r.Name == login.Name); if (checkValue == 3) { if ((data1.Balance + Data) <= 8500) { data1.Balance = data1.Balance + Data; } model.SaveChanges(); } if (checkValue == 4) { if ((data1.Balance - Data) > 1000 && data1.AccountType == "Saving Account") { data1.Balance = data1.Balance - Data; } else if ((data1.Balance - Data) >= 0 && data1.AccountType == "Current Account") { data1.Balance = data1.Balance - Data; } else if ((data1.Balance - Data) >= -10000 && data1.AccountType == "DMAT Account") { data1.Balance = data1.Balance - Data; } else { data1.Balance = data1.Balance; Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("--------------------------------------------------"); Console.WriteLine("Sorry, we are not able to process your Transaction"); Console.WriteLine("--------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } model.SaveChanges(); } result = data1.Balance; } return(result); }
public static int Calculted_Interest(Login login, int choice, int value) //entity framework function { int balance = 0; int interest = 0; using (DBBankingSystemEntities model = new DBBankingSystemEntities()) { CustomerDetail data1 = model.CustomerDetails.FirstOrDefault(r => r.Name == login.Name); interest = data1.Balance; if (value == 1) { balance = (4 * interest) / 100; } if (value == 2) { balance = (1 * interest) / 100; } } return(balance); }
public static int LoginData2(Login login) //entity framework function { int flag = 0; if (flag == 0) { using (DBBankingSystemEntities model = new DBBankingSystemEntities()) { CustomerDetail data1 = model.CustomerDetails.FirstOrDefault(r => r.Name == login.Name); int ID = data1.AccountID; if (data1.Name == login.Name && data1.Password == login.password) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("You are logging in...."); Console.WriteLine("-----------------------------------------------------------"); Console.WriteLine("Name: " + data1.Name + " Your ID is: " + ID); Console.WriteLine("Password: "******"-----------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; flag = 1; } } } if (flag == 1) { return(1); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Invalid"); Console.ForegroundColor = ConsoleColor.White; return(0); } }