public ActionResult DeleteBank(long id) { var gVal = new GenericValidator(); try { if (id < 1) { gVal.Code = -1; gVal.Error = message_Feedback.Invalid_Selection; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var k = new BankServices().DeleteBank(id); if (k) { gVal.Code = 5; gVal.Error = message_Feedback.Delete_Success; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = -1; gVal.Error = message_Feedback.Delete_Failure; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch { gVal.Code = 5; gVal.Error = message_Feedback.Process_Failed; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public ActionResult DeleteBank(long id) { var gVal = new GenericValidator(); try { if (id < 1) { gVal.Code = -1; gVal.Error = "Invalid selection"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var delStatus = new BankServices().DeleteBank(id); if (delStatus < 1) { gVal.Code = -1; gVal.Error = "Bank could not be deleted. Please try again later."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = 5; gVal.Error = "Bank Information was successfully deleted"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public ExceptionTest() { _UserService = new UserServices(_session); _AdminService = new AdminServices(_session); _BankService = new BankServices(_session); _LoginService = new LoginServices(_session); }
public void TestFunctions() { var bank = new BankAccount("Newb", 20, new List <string>()); var service = new BankServices(); Assert.ThrowsException <System.ArgumentException>(() => service.CreateBankAccount(bank.FullName)); }
public FunctionalTest() { _UserService = new UserServices(_session); _AdminService = new AdminServices(_session); _LoginService = new LoginServices(_session); _BankServices = new BankServices(_session); }
/// <summary> /// On bank services combo box selected index change /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Event args</param> private void bankServicesCb_SelectedIndexChanged(object sender, EventArgs e) { try { // Retrieve selected bank service from combo box var item = (BankServices)bankServicesCb.SelectedItem; if (item == CurrentServiceFilter) { return; } // Remember filter for future use var current = ServicesDictionary.FirstOrDefault(k => k.Key == item); var past = ServicesDictionary.FirstOrDefault(k => k.Key == CurrentServiceFilter); this.CurrentServiceFilter = item; // Hide based on filter current.Value.Button.Visible = true; current.Value.DataGridView.Visible = true; past.Value.DataGridView.Visible = false; past.Value.Button.Visible = false; } catch (Exception eas) { } }
private void SetDataSources() { bankServicesCb.DataSource = Enum.GetValues(typeof(BankServices)); this.CurrentServiceFilter = BankServices.Račun; // Hide data grid views loanDgv.Visible = false; savingAccountDgv.Visible = false; // Sets bank services filters var accountFilter = new AccountOverviewFilter() { Client = this.Client }; var savingAccountFilter = new SavingOverviewFilter() { Client = this.Client }; var loanFilter = new LoanOverviewFilter() { Client = this.Client }; // Sets bank services data sources accountDgv.DataSource = this.bankServicesVmService.GetAccountsOverview(accountFilter); savingAccountDgv.DataSource = this.bankServicesVmService.GetSavingAccountsOverview(savingAccountFilter); loanDgv.DataSource = this.bankServicesVmService.GetLoansOverview(loanFilter); }
/// <summary> /// On bank services combobox selected index change /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Event args</param> private void bankServicesCb_SelectedIndexChanged(object sender, EventArgs e) { try { // Selected filter item var item = (BankServices)bankServicesCb.SelectedItem; // If selected item is as same as previous, skip if (item == CurrentServiceFilter) { return; } // Save filter states var current = ServicesDictionary.FirstOrDefault(k => k.Key == item); var past = ServicesDictionary.FirstOrDefault(k => k.Key == CurrentServiceFilter); this.CurrentServiceFilter = item; // Hide/show based on filter current.Value.Visible = true; past.Value.Visible = false; } catch (Exception eas) { } }
public void DisplayMainMenu() { Console.WriteLine("Welcome to The Bank Application Project \n \n"); Console.WriteLine("Please enter option from the list :- \n"); Console.WriteLine("1. Create a Bank"); Console.WriteLine("2. Login for Staff / Account holder"); Console.WriteLine("3. Save and Exit"); int res = Convert.ToInt32(Console.ReadLine()); BankServices bankServices = new BankServices(bankData); switch (res) { case 1: Console.WriteLine("Registereing a new bank"); bankServices.RegisterBank(); break; case 2: DisplayLoginMenu(); break; case 3: Console.WriteLine("Option 3 is under work !"); break; default: Console.WriteLine("Please select a valid option !!"); DisplayMainMenu(); break; } }
public ActionResult GetBankBranch(int id) { try { if (id < 1) { return(Json(new BankBranchObject(), JsonRequestBehavior.AllowGet)); } var bank = new BankServices().GetBankBranch(id); if (bank == null || bank.BankId < 1) { return(Json(new BankBranchObject(), JsonRequestBehavior.AllowGet)); } Session["_bankBranch"] = bank; return(Json(bank, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new BankBranchObject(), JsonRequestBehavior.AllowGet)); } }
public ActionResult GetBank(long id) { try { if (id < 1) { return(Json(new BankObject(), JsonRequestBehavior.AllowGet)); } var bank = new BankServices().GetBank(id); if (id < 1) { return(Json(new BankObject(), JsonRequestBehavior.AllowGet)); } Session["_bank"] = bank; if (!string.IsNullOrEmpty(bank.LogoPath)) { bank.LogoPath = bank.LogoPath.Replace("~", ""); } return(Json(bank, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new BankObject(), JsonRequestBehavior.AllowGet)); } }
public ActionResult GetBankObjects(JQueryDataTableParamModel param) { try { IEnumerable <BankObject> filteredBankObjects; var countG = new BankServices().GetObjectCount(); var pagedBankObjects = GetBanks(param.iDisplayLength, param.iDisplayStart); if (!string.IsNullOrEmpty(param.sSearch)) { filteredBankObjects = new BankServices().Search(param.sSearch); } else { filteredBankObjects = pagedBankObjects; } if (!filteredBankObjects.Any()) { return(Json(new List <BankObject>(), JsonRequestBehavior.AllowGet)); } var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]); Func <BankObject, string> orderingFunction = (c => sortColumnIndex == 1 ? c.FullName : sortColumnIndex == 2 ? c.ShortName : c.SortCode ); var sortDirection = Request["sSortDir_0"]; // asc or desc if (sortDirection == "asc") { filteredBankObjects = filteredBankObjects.OrderBy(orderingFunction); } else { filteredBankObjects = filteredBankObjects.OrderByDescending(orderingFunction); } var displayedUserProfilenels = filteredBankObjects; var result = from c in displayedUserProfilenels select new[] { Convert.ToString(c.BankId), c.FullName, c.ShortName, c.SortCode }; return(Json(new { param.sEcho, iTotalRecords = countG, iTotalDisplayRecords = filteredBankObjects.Count(), aaData = result }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(Json(new List <BankObject>(), JsonRequestBehavior.AllowGet)); } }
public ActionResult AddBank(BankObject bank) { var gVal = new GenericValidator(); try { if (ModelState.IsValid) { var valStatus = ValidateBank(bank); if (valStatus.Code < 1) { gVal.Code = 0; gVal.Error = valStatus.Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } bank.LastUpdated = DateTime.Now.ToString("yyyy/mm/dd hh:mm:ss tt"); var logoPath = SaveFile(""); if (!string.IsNullOrEmpty(logoPath)) { bank.LogoPath = logoPath; } var k = new BankServices().AddBank(bank); if (k < 1) { if (k == -3) { gVal.Error = message_Feedback.Item_Duplicate; } if (k == -4) { gVal.Error = message_Feedback.Duplicate_Sort_Code; } if (k != -3 && k != -4) { gVal.Error = message_Feedback.Update_Failure; } gVal.Code = 0; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = k; gVal.Error = message_Feedback.Insertion_Success; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = -5; gVal.Error = message_Feedback.Model_State_Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch { gVal.Code = 0; gVal.Error = message_Feedback.Process_Failed; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetBankUsers(JQueryDataTableParamModel param) { try { var importerInfo = GetLoggedOnCompanyInfo(); if (importerInfo == null || importerInfo.Id < 1) { return(Json(new List <UserProfileObject>(), JsonRequestBehavior.AllowGet)); } IEnumerable <UserProfileObject> filteredUsers; var countG = 0; var pagedParentMenuObjects = GetBankUsers(param.iDisplayLength, param.iDisplayStart, out countG, importerInfo.Id); if (!string.IsNullOrEmpty(param.sSearch)) { filteredUsers = new BankServices().SearchUsers(param.sSearch, importerInfo.Id); } else { filteredUsers = pagedParentMenuObjects; } if (!filteredUsers.Any()) { return(Json(new List <UserProfileObject>(), JsonRequestBehavior.AllowGet)); } var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]); Func <UserProfileObject, string> orderingFunction = (c => sortColumnIndex == 1 ? c.LastName : sortColumnIndex == 2 ? c.FirstName.ToString(CultureInfo.InvariantCulture) : sortColumnIndex == 3 ? c.Email : sortColumnIndex == 4 ? c.PhoneNumber : c.StatusStr); var sortDirection = Request["sSortDir_0"]; // asc or desc filteredUsers = sortDirection == "desc" ? filteredUsers.OrderBy(orderingFunction) : filteredUsers.OrderByDescending(orderingFunction); var displayedPersonnels = filteredUsers; var result = from c in displayedPersonnels select new[] { Convert.ToString(c.Id), c.LastName, c.FirstName, c.Email, c.PhoneNumber, c.StatusStr }; return(Json(new { param.sEcho, iTotalRecords = countG, iTotalDisplayRecords = filteredUsers.Count(), aaData = result }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(Json(new List <UserProfileObject>(), JsonRequestBehavior.AllowGet)); } }
public void BlockOrUnblockPerson(string personID, bool blockOrUnblock) { IPerson person = BankServices.FindPerson(personID); if (person == null) { throw new Exception("Could't Find Person"); } BlockOrUnblockPerson(person, blockOrUnblock); }
public void ReceiveSendMoneyRequest(double amount, IAccount senderAccount, string receiverAccountID) { IAccount receiver = BankServices.FindAccount(receiverAccountID); if (receiver == null) { throw new Exception("Could't Find AccountID"); } SendMoney(amount, senderAccount, receiver); }
public void BlockOrUnblockAccount(string accountID, bool blockOrUnblock) { IAccount account = BankServices.FindAccount(accountID); if (account == null) { throw new Exception("Could't Find Account"); } BlockOrUnblockAccount(account, blockOrUnblock); }
public ActionResult UpdateBankBranch(BankBranchObject bankBranch) { var gVal = new GenericValidator(); try { if (string.IsNullOrEmpty(bankBranch.Name) || string.IsNullOrEmpty(bankBranch.BranchCode)) { gVal.Code = -1; gVal.Error = "All fields marked '*' are required."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (Session["_bankBranch"] == null) { gVal.Code = -1; gVal.Error = "Session has timed out."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var oldbankBranch = Session["_bankBranch"] as BankBranchObject; if (oldbankBranch == null || oldbankBranch.Id < 1) { gVal.Code = -1; gVal.Error = "Session has timed out."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } oldbankBranch.Name = bankBranch.Name.Trim(); oldbankBranch.BranchCode = bankBranch.BranchCode.Trim(); var appStatus = new BankServices().UpdateBankBranch(oldbankBranch); if (appStatus < 1) { gVal.Code = -1; gVal.Error = appStatus == -2 ? "Bank Branch Processing failed. Please try again." : "Bank Branch Information already exists"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = appStatus; gVal.Error = "Bank Branch was successfully updated."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch (Exception) { gVal.Error = "Bank Branch processing failed. Please try again later"; gVal.Code = -1; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddBank(BankObject bank) { var gVal = new GenericValidator(); try { var validationResult = ValidateBank(bank); if (validationResult.Code == 1) { return(Json(validationResult, JsonRequestBehavior.AllowGet)); } var company = new ImporterObject { Id = 0, Name = bank.Name, TIN = bank.TIN, RCNumber = bank.RCNumber, IsActive = true, DateAdded = DateTime.Now.ToString("dd/MM/yyyy") }; var cmStatus = AddCompany(company); if (cmStatus.Code < 1) { return(Json(cmStatus, JsonRequestBehavior.AllowGet)); } bank.ImporterId = cmStatus.Code; var appStatus = new BankServices().AddBank(bank); if (appStatus < 1) { validationResult.Code = -1; validationResult.Error = appStatus == -2 ? "Bank processing failed. Please try again." : "Bank Information already exists"; return(Json(validationResult, JsonRequestBehavior.AllowGet)); } gVal.Code = appStatus; gVal.Error = "Bank was successfully added."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch (Exception) { gVal.Error = "Bank processing failed. Please try again later"; gVal.Code = -1; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetBankBranches() { try { var importerInfo = GetLoggedOnUserInfo(); if (importerInfo == null || importerInfo.Id < 1) { return(Json(new List <BankBranchObject>(), JsonRequestBehavior.AllowGet)); } var branches = new BankServices().GetBankBranches(importerInfo.Id); return(Json(branches, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new BankBranchObject(), JsonRequestBehavior.AllowGet)); } }
/// <summary> /// Sets data sources for this form /// </summary> private void SetDataSources() { // Set initial filter data bankServicesCb.DataSource = Enum.GetValues(typeof(BankServices)); this.CurrentServiceFilter = BankServices.Račun; // Initial hide loanDgv.Visible = false; savingAccountDgv.Visible = false; createLoanBtn.Visible = false; createSavingAccountBtn.Visible = false; // Set data sources for all grid views savingAccountDgv.DataSource = this.savingAccountTypeRepository.GetAll(); accountDgv.DataSource = this.accountTypeRepository.GetAll(); loanDgv.DataSource = this.loanTypeRepository.GetAll(); }
public ActionResult GetBankAdmin(int id) { try { var bankAdmin = new BankServices().GetBankAdmin(id); if (bankAdmin == null || bankAdmin.BankId < 1) { return(Json(new UserProfileObject(), JsonRequestBehavior.AllowGet)); } Session["_bankAdmin"] = bankAdmin; return(Json(bankAdmin, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new UserProfileObject(), JsonRequestBehavior.AllowGet)); } }
private List <UserProfileObject> GetBankUsers(int?itemsPerPage, int?pageNumber, out int countG, long Id) { try { var users = new BankServices().GetBankUsers(itemsPerPage, pageNumber, out countG, Id); if (!users.Any()) { countG = 0; return(new List <UserProfileObject>()); } return(users); } catch (Exception) { countG = 0; return(new List <UserProfileObject>()); } }
public ActionResult AddBankBranch(BankBranchObject bankBranch) { var gVal = new GenericValidator(); try { if (string.IsNullOrEmpty(bankBranch.Name) || string.IsNullOrEmpty(bankBranch.BranchCode)) { gVal.Code = -1; gVal.Error = "All fields marked '*' are required."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var importerInfo = GetLoggedOnUserInfo(); if (importerInfo == null || importerInfo.Id < 1) { gVal.Code = -1; gVal.Error = "Your session has timed out"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } bankBranch.ImporterId = importerInfo.Id; var appStatus = new BankServices().AddBankBranch(bankBranch); if (appStatus < 1) { gVal.Code = -1; gVal.Error = appStatus == -2 ? "Bank Branch Processing failed. Please try again." : "Bank Branch Information already exists"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = appStatus; gVal.Error = "Bank Branch was successfully added."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch (Exception) { gVal.Error = "Bank Branch processing failed. Please try again later"; gVal.Code = -1; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
static void Main(string[] args) { Console.WriteLine("Welcome to the ATM app"); Console.WriteLine("Please enter your card numer:"); long cardNumber; long.TryParse(Console.ReadLine(), out cardNumber); Console.WriteLine("Enter Pin:"); int pin; int.TryParse(Console.ReadLine(), out pin); var bankServices = new BankServices(); Customer customer = new Customer("Bob", "Bobsky", 1234123412341234, 4325, 1000); Console.WriteLine($"Welkome {customer.GetInfo()}"); while (true) { Console.WriteLine("What would like to do:"); Console.WriteLine("1.Check Balance"); Console.WriteLine("2.Cash Withdrawal"); Console.WriteLine("3.Cash Deposit"); string transaction = Console.ReadLine(); if (transaction == "1") { Console.WriteLine($"Your Balance is: {bankServices.CheckBalance(customer)}"); } ; if (transaction == "2") { Console.WriteLine("Enter the amount you want to Withdrawal"); int amountWithdrawal; int.TryParse(Console.ReadLine(), out amountWithdrawal); if (amountWithdrawal > bankServices.CheckBalance(customer)) { Console.WriteLine($"Your Ballance on account is {bankServices.CheckBalance(customer)} enter valid amount you want to Withdrawal"); } else { Console.WriteLine($"You Withdrawal{amountWithdrawal} You have {customer.CashWithdrawal(amountWithdrawal)} left on your account."); } } if (transaction == "3") { Console.WriteLine("Enter the amount you want to Deposit"); int amountDeposit; int.TryParse(Console.ReadLine(), out amountDeposit); Console.WriteLine($"You deposit {amountDeposit}. You have {customer.CashDeposit(amountDeposit)} now on your account."); } Console.WriteLine("If you want another transaction enter yes. Otherwise enter no"); if (Console.ReadLine() == "yes") { continue; } if (Console.ReadLine() == "no") { break; } } Console.ReadLine(); }
public BankController() { bankingServices = new BankServices(); }
public ActionResult EditBank(BankObject bank) { var gVal = new GenericValidator(); try { var stat = ValidateBank(bank); if (stat.Code < 1) { return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (Session["_bank"] == null) { gVal.Code = -1; gVal.Error = "Session has timed out."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var oldbank = Session["_bank"] as BankObject; if (oldbank == null) { gVal.Code = -1; gVal.Error = "Session has timed out."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var company = new ImporterObject { Id = oldbank.ImporterId, Name = bank.Name, TIN = bank.TIN, RCNumber = bank.RCNumber }; var cmStatus = EditCompany(company); if (cmStatus.Code < 1) { return(Json(cmStatus, JsonRequestBehavior.AllowGet)); } oldbank.Name = bank.Name; oldbank.NotificationEmail = bank.NotificationEmail; oldbank.SortCode = bank.SortCode; var docStatus = new BankServices().UpdateBank(oldbank); if (docStatus < 1) { gVal.Code = -1; gVal.Error = docStatus == -3 ? "Bank already exists." : "Bank information could not be updated. Please try again later"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = oldbank.BankId; gVal.Error = "Bank information was successfully updated"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch (Exception) { gVal.Code = -1; gVal.Error = "Bank information could not be updated. Please try again later"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public ActionResult BulkUpload(HttpPostedFileBase file) { var gVal = new GenericValidator(); try { var importerInfo = GetLoggedOnUserInfo(); if (importerInfo == null || importerInfo.Id < 1) { gVal.Code = -1; gVal.Error = "Your session has timed out"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var bankid = new AspNetUserServices().GetBankId(importerInfo.Id); if (bankid < 1) { gVal.Code = -1; gVal.Error = "Error: process could not be completed. Please try again later"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (file.ContentLength > 0) { var folderPath = HostingEnvironment.MapPath("~/BankBranchBulkUploads/" + importerInfo.Id.ToString(CultureInfo.InvariantCulture)); if (string.IsNullOrEmpty(folderPath)) { gVal.Code = -1; gVal.Error = "Folder access was denied"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); var dInfo = new DirectoryInfo(folderPath); var dSecurity = dInfo.GetAccessControl(); dSecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.NoPropagateInherit, AccessControlType.Allow)); dInfo.SetAccessControl(dSecurity); } var fileName = file.FileName; var path = Path.Combine(folderPath, fileName); if (string.IsNullOrEmpty(path)) { gVal.Code = -1; gVal.Error = "Folder access was denied"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } file.SaveAs(path); gVal.BankUserInfoList = new List <BankUserInfo>(); var msg = string.Empty; var errorList = new List <long>(); var branches = new List <BankBranchObject>(); var successfulUploads = ReadExcelData(path, "Branches", ref errorList, ref msg, ref branches, importerInfo.Id); var saveCount = 0; if (!successfulUploads.Any()) { gVal.Code = -1; gVal.Error = msg; return(Json(gVal, JsonRequestBehavior.AllowGet)); } branches.ForEach(s => { s.BankId = bankid; var tt = new BankServices().AddBankBranch(s); if (tt > 0) { saveCount++; } else { errorList.Add(1); } }); if (errorList.Any() && saveCount > 0) { var feedbackMessage = saveCount + " records were successfully uploaded." + "\n" + errorList.Count + " record(s) could not be uploaded due to specified/unspecified errors."; if (msg.Length > 0) { feedbackMessage += "<br/>" + msg; } gVal.Code = -7; gVal.Error = feedbackMessage; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (saveCount != branches.Count && saveCount > 0) { var feedbackMessage = saveCount + " records were successfully uploaded." + "\n" + (branches.Count - saveCount) + " record(s) could not be uploaded due to specified/unspecified errors."; if (msg.Length > 0) { feedbackMessage += "<br/>" + msg; } gVal.Code = -7; gVal.Error = feedbackMessage; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (errorList.Any() && saveCount < 1) { var feedbackMessage = errorList.Count + " record(s) could not be uploaded due to specified/unspecified errors."; ViewBag.ErrorCode = -1; if (msg.Length > 0) { feedbackMessage += "<br/>" + msg; } gVal.Code = -1; gVal.Error = feedbackMessage; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (!errorList.Any() && saveCount > 0) { var feedbackMessage = saveCount + " records were successfully uploaded."; if (msg.Length > 0) { feedbackMessage += "<br/>" + msg; } gVal.Code = 5; gVal.Error = feedbackMessage; return(Json(gVal, JsonRequestBehavior.AllowGet)); } } gVal.Code = -1; gVal.Error = "The selected file is invalid"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); gVal.Code = -1; gVal.Error = "File processing failed."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public static void Main(string[] args) { BankServices Admin = new BankServices(); StaffServices NewStaffService = new StaffServices(); Bank FirstBank = Admin.CreateBank("STATE BANK INDIA"); Console.WriteLine(FirstBank.BankID); Staff NewStaff = NewStaffService.CreateStaffMember(FirstBank, "arun"); Console.WriteLine("Name:" + NewStaff.Name); Console.WriteLine("Username:"******"Password:"******"HDFC"); Console.WriteLine(SecondBank.BankID); NewStaff = NewStaffService.CreateStaffMember(SecondBank, "arun"); Console.WriteLine("Name:" + NewStaff.Name); Console.WriteLine("Username:"******"Password:"******"TECHNOVERT"); Console.WriteLine(ThirdBank.BankID); NewStaff = NewStaffService.CreateStaffMember(ThirdBank, "arun"); Console.WriteLine("Name:" + NewStaff.Name); Console.WriteLine("Username:"******"Password:"******"1 -> STATE BANK OF INDIA\n2 -> HDFC\n3 -> TECHNOVERT\n0 -> EXIT"); string BankName = Console.ReadLine(); if (Convert.ToInt32(BankName) == 0) { break; } Bank Bank = BankList.ListOfBanks.ElementAt(Convert.ToInt32(BankName) - 1); while (true) { string Username, Password; string userType; login: Console.WriteLine("1 -> staff\n2 -> customer\n0 -> back"); userType = Console.ReadLine(); CustomerServices NewCustomerService = new CustomerServices(Bank); switch (Convert.ToInt32(userType)) { case 1: { Console.WriteLine("enter username: "******"enter password: "******"1 -> create account\n2 -> remove account\n3 -> revert transaction\n4 -> transaction history\n5 -> set charges\n6 -> update account\n7 -> Add Currency\n0 -> logout"); string staffAction; staffAction = Console.ReadLine(); switch (Convert.ToInt32(staffAction)) { case 1: { string Name; Console.WriteLine("enter name:"); Name = Console.ReadLine(); Customer NewCustomer = NewCustomerService.CreateAccount(Name.ToUpper()); Console.WriteLine("Account number: " + NewCustomer.AccountID); Console.WriteLine("Balance: " + NewCustomer.Balance); Console.WriteLine(NewCustomer.Name + "\n" + NewCustomer.Username + "\n" + NewCustomer.Password); break; } case 2: { string AccountID; Console.WriteLine("enter accountID:"); AccountID = Console.ReadLine(); if (NewCustomerService.RemoveAccount(AccountID.ToUpper())) { Console.WriteLine("Removed successfully!!"); } else { Console.WriteLine("accountID not found"); } break; } case 3: { string AccountID, TransactionID; Console.WriteLine("enter Account number: "); AccountID = Console.ReadLine(); Console.WriteLine("enter TransactionID: "); TransactionID = Console.ReadLine(); AccountServices NewAccountService = new AccountServices(Bank); BankList bankList = new BankList(); if (NewAccountService.RevertTransaction(bankList, AccountID.ToUpper(), TransactionID.ToUpper())) { Console.WriteLine("Reverted successfully!!"); } else { Console.WriteLine("failed to Revert the Transaction"); } break; } case 4: { string AccountID; Console.WriteLine("enter account number"); AccountID = Console.ReadLine(); TransactionServices NewTransactionService = new TransactionServices(NewService.GetCustomer(Bank, Username, Password)); NewTransactionService.DisplayAllTransactions(); break; } case 5: { double srtgs, simps, drtgs, dimps; Console.WriteLine("enter RTGS for same bank account: "); srtgs = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("enter IMPS for same bank account: "); simps = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("enter RTGS for different bank account: "); drtgs = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("enter IMPS for different bank account: "); dimps = Convert.ToDouble(Console.ReadLine()); Admin.SetCharges(Bank, srtgs, simps, drtgs, dimps); break; } case 6: { Console.WriteLine("enter accountID"); string AccountID = Console.ReadLine(); Console.WriteLine("enter login details to make changes\nusername:"******"password:"******"enter new password:"******"Updated successfully!!"); } else { Console.WriteLine("check the detials you have entered"); } break; } case 7: { Console.WriteLine("enter currency name:"); string Name = Console.ReadLine(); Console.WriteLine("enter currency Id:"); string Id = Console.ReadLine(); Console.WriteLine("enter exchangerate:"); double ExchangeRate = Convert.ToDouble(Console.ReadLine()); if (Admin.AddCurrency(Bank, Name, Id.ToUpper(), ExchangeRate)) { Console.WriteLine("Currency added successfully"); } else { Console.WriteLine("Currency already exists"); } break; } case 0: goto login; } } } else { Console.WriteLine("incorrect username or password"); goto login; } } case 2: { Console.WriteLine("enter username: "******"enter password: "******"1 -> withdraw\n2 -> deposit\n3 -> transfer\n4 -> balance check\n5 -> transaction history\n6 -> display transactions by date\n0 -> logout"); string customerAction = Console.ReadLine(); switch (Convert.ToInt32(customerAction)) { case 1: { string Amount; Console.WriteLine("enter amount:"); Amount = Console.ReadLine(); if (NewAccountService.Withdraw(Convert.ToDouble(Amount), Customer)) { Console.WriteLine("Withdrawn Successfully!!"); } else { Console.WriteLine("Transaction Failed"); } break; } case 2: { string Amount; Console.WriteLine("enter amount:"); Amount = Console.ReadLine(); if (NewAccountService.Deposit(Convert.ToDouble(Amount), Customer) != null) { Console.WriteLine("Deposited Successfully!!"); } else { Console.WriteLine("Transaction Failed"); } break; } case 3: { Console.WriteLine("enter account number:"); string ToAccountID = Console.ReadLine(); Console.WriteLine("enter BankID"); string BankID = Console.ReadLine(); Console.WriteLine("enter amount:"); string Amount = Console.ReadLine(); Console.WriteLine("enter currency Id"); string CurrencyId = Console.ReadLine(); Console.WriteLine("1 -> RTGS\n2 -> IMPS"); int TypeOfTransfer = Console.Read(); BankList bankList = new BankList(); Bank ToBank = Admin.GetBank(bankList, BankID); if (NewAccountService.Transfer(Convert.ToDouble(Amount), ToAccountID.ToUpper(), ToBank, CurrencyId.ToUpper(), Customer, TypeOfTransfer)) { Console.WriteLine("Transfered Successfullly!!"); } else { Console.WriteLine("Transaction Failed"); } break; } case 4: { Console.WriteLine(Customer.Balance); break; } case 5: { NewTransactionService.DisplayAllTransactions(); break; } case 6: { Console.WriteLine("enter date:"); string Date = Console.ReadLine(); NewTransactionService.DisplayTransaction(Date); break; } case 0: goto login; } } } else { Console.WriteLine("incorrect username or password"); goto login; } } case 0: { goto begin; } } } } }
public ActionResult EditBank(BankObject bank) { var gVal = new GenericValidator(); try { if (ModelState.IsValid) { var valStatus = ValidateBank(bank); if (valStatus.Code < 1) { gVal.Code = 0; gVal.Error = valStatus.Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (Session["_bank"] == null) { gVal.Code = -1; gVal.Error = message_Feedback.Session_Time_Out; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var oldBank = Session["_bank"] as BankObject; if (oldBank == null || oldBank.BankId < 1) { gVal.Code = -1; gVal.Error = message_Feedback.Session_Time_Out; return(Json(bank, JsonRequestBehavior.AllowGet)); } oldBank.FullName = bank.FullName.Trim(); oldBank.ShortName = bank.ShortName.Trim(); oldBank.SortCode = bank.SortCode.Trim(); var formerLogoPath = string.Empty; if (!string.IsNullOrEmpty(oldBank.LogoPath)) { formerLogoPath = oldBank.LogoPath; } var logoPath = SaveFile(formerLogoPath); if (!string.IsNullOrEmpty(logoPath)) { oldBank.LogoPath = logoPath; } var k = new BankServices().UpdateBank(oldBank); if (k < 1) { if (k == -3) { gVal.Error = message_Feedback.Item_Duplicate; } if (k == -4) { gVal.Error = message_Feedback.Duplicate_Sort_Code; } if (k != -3 && k != -4) { gVal.Error = message_Feedback.Update_Failure; } gVal.Error = message_Feedback.Update_Success; gVal.Code = 0; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Error = message_Feedback.Insertion_Success; gVal.Code = 5; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = -5; gVal.Error = message_Feedback.Model_State_Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch { gVal.Code = 0; gVal.Error = message_Feedback.Process_Failed; return(Json(bank, JsonRequestBehavior.AllowGet)); } }