public ActionResult Approve() { List <Loan> loanList = new List <Loan>(); try { IBusinessLoan iloan = GenericFactory <Business, IBusinessLoan> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; loanList = iloan.getAllUnapprovedLoans(); foreach (Loan l in loanList) { if (l.Status == "UA") { l.Status = "Not yet Approved"; } else if (l.Status == "A") { l.Status = "Approved"; } } Loan loan = new Loan(); } catch (Exception ex) { ViewBag.Message = ex.Message; } return(View(loanList)); }
public ActionResult LoanApproval(LoanApprovalModel lam) { IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; if (ui.Username != "mark") { ViewBag.Message = "Only manager is available to change the loan status.."; } try { if (ModelState.IsValid && ui.Username == "mark") { bool ret = ibank.LoanApproval(ui.CheckingAcccountNumber, ui.SavingAccountNumber, lam.Amount, lam.UserName); if (ret == true) { ViewBag.Message = "Loan status changed successfully.."; ModelState.Clear(); // otherwise, textbox will display the old amount lam.Status = "Approved"; } } } catch (Exception ex) { ViewBag.Message = ex.Message; } //alm.Amount = ibank.GetAmountDue(ui.CheckingAcccountNumber); return(View(lam)); }
public ValueConverterDefinition(string fieldName, string converterName, string converterParameter) { this.FieldName = fieldName; this.ConverterName = converterName; this.converter = GenericFactory.GetInstance <ValueConverterBase>(this.ConverterName); this.ConverterParameter = converterParameter; }
public ActionResult PhoneBillPayment(PhoneBillModel pbm) { IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; try { if (ModelState.IsValid) { bool ret = ibank.TransferBillFromChecking(ui.CheckingAcccountNumber, ui.SavingAccountNumber, pbm.Amount); if (ret == true) { ViewBag.Message = "Transfer successful.."; ModelState.Clear(); // otherwise, textbox will display the old amount pbm.Amount = 0; } } } catch (Exception ex) { ViewBag.Message = ex.Message; } pbm.CheckingBalance = ibank.GetCheckingBalance(ui.CheckingAcccountNumber); pbm.Amount = ibank.GetAmountDue(ui.CheckingAcccountNumber); return(View(pbm)); }
public ActionResult TransferSavingToChecking(TransferSToCModel tcs) { IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; try { if (ModelState.IsValid) { bool ret = ibank.TransferSavingToChecking(ui.CheckingAcccountNumber, ui.SavingAccountNumber, tcs.Amount); if (ret == true) { ViewBag.Message = "Transfer successful.."; ModelState.Clear(); // otherwise, textbox will display the old amount tcs.Amount = 0; } } } catch (Exception ex) { ViewBag.Message = ex.Message; } tcs.CheckingBalance = ibank.GetCheckingBalance(ui.CheckingAcccountNumber); tcs.SavingBalance = ibank.GetSavingBalance(ui.SavingAccountNumber); return(View(tcs)); }
public ActionResult Apply(Loan loan) { int result = 0; try { IBusinessLoan iLoan = GenericFactory <Business, IBusinessLoan> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; result = iLoan.applyForLoan(ui.Username, loan.LoanName, loan.LoanAmt); if (result > 0) { ModelState.Clear(); } else { ViewBag.Message = "Error in Applying for the loan, Please try later"; } } catch (Exception ex) { ViewBag.Message = ex.Message; } return(View()); }
public UserControl CreateUserControl(string controlName) { if (string.IsNullOrEmpty(controlName)) { throw new ArgumentNullException("controlName", "The parameter controlname must not be null"); } return(GenericFactory.GetInstance <UserControl>(controlName)); }
public ActionResult TransferHistory() { IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; List <TransactionHistoryModel> THList = ibank.GetTransactionHistory(ui.CheckingAcccountNumber); return(View(THList)); }
// GET: Banking public ActionResult ApplyLoan() { ApplyLoanModel alm = new ApplyLoanModel(); UserInfo ui = CookieFacade.USERINFO; IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); alm.UserName = ui.Username; alm.Amount = ibank.GetAmountDue(ui.CheckingAcccountNumber); //alm.Status = ibank.GetAmountDue(ui.CheckingAcccountNumber); ViewBag.Message = ""; return(View(alm)); }
// GET: Banking public ActionResult PhoneBillPayment() { PhoneBillModel pbm = new PhoneBillModel(); UserInfo ui = CookieFacade.USERINFO; IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); pbm.CheckingAccountNumber = ui.CheckingAcccountNumber; pbm.CheckingBalance = ibank.GetCheckingBalance(ui.CheckingAcccountNumber); pbm.Amount = ibank.GetAmountDue(ui.CheckingAcccountNumber); ViewBag.Message = ""; return(View(pbm)); }
public ActionResult TransferSavingToChecking() { TransferSToCModel tcs = new TransferSToCModel(); UserInfo ui = CookieFacade.USERINFO; IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); tcs.CheckingBalance = ibank.GetCheckingBalance(ui.CheckingAcccountNumber); tcs.SavingBalance = ibank.GetSavingBalance(ui.SavingAccountNumber); tcs.Amount = 5; ViewBag.Message = "There is a $5 fee to transfer from Saving Account To Checking Account"; return(View(tcs)); }
public ActionResult LoanStatus() { LoanStatusModel lsm = new LoanStatusModel(); UserInfo ui = CookieFacade.USERINFO; IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); lsm.Username = ui.Username; string ret = ibank.ShowLoanStatus(ui.Username); lsm.Status = ret; ViewBag.Message = ""; return(View(lsm)); }
// GET: Banking public ActionResult LoanApproval() { LoanApprovalModel lam = new LoanApprovalModel(); UserInfo ui = CookieFacade.USERINFO; IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); lam.UserName = ibank.GetAllLoanUsers("pending"); for (int i = 0; i < lam.UserName.Count; i++) { lam.Status = ibank.ShowLoanStatus(lam.UserName[i]); } ViewBag.Message = ""; return(View(lam)); }
public ActionResult ApproveLoan(int?loanid) { int res = 0; List <Loan> loanList = new List <Loan>(); try { IBusinessLoan iloan = GenericFactory <Business, IBusinessLoan> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; if (loanid != null) { Loan appliedLoan = iloan.getLoan((int)loanid); bool eligible = iloan.checkEligibilityforLoan(appliedLoan.UserName, (int)loanid); if (eligible) { res = iloan.approveLoan((int)loanid); if (res > 0) { ViewBag.Message = "Loan approved"; } } else { ViewBag.Message = "Not eligible for loan"; } } loanList = iloan.getAllLoans(); foreach (Loan l in loanList) { if (l.Status == "UA") { l.Status = "Not yet Approved"; } else if (l.Status == "A") { l.Status = "Approved"; } } Loan loan = new Loan(); } catch (Exception ex) { ViewBag.Message = ex.StackTrace; } return(View(loanList)); }
public ActionResult Login(LoginModel lm) { IBusinessAuthentication iba = GenericFactory <Business, IBusinessAuthentication> .GetInstance(); IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); IBusinessLoan iloan = GenericFactory <Business, IBusinessLoan> .GetInstance(); if (ModelState.IsValid) { // check if valid user bool ret = iba.CheckIfValidUser(lm.Username, lm.Password); if (ret == true) { string roles = iba.GetRolesForUser(lm.Username); // send the pipedelimited roles as an authentication cookie back to the browser FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, lm.Username, DateTime.Now, DateTime.Now.AddMinutes(15), false, roles); string encryptedTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie ck = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); Response.Cookies.Add(ck); // ----obtaing checking account number and saving account number for user long checkingAccountNum = ibank.GetCheckingAccountNumForUser(lm.Username); long savingAccountNumber = ibank.GetSavingAccountNumForUser(lm.Username); UserInfo ui = new UserInfo(); ui.CheckingAcccountNumber = checkingAccountNum; ui.SavingAccountNumber = savingAccountNumber; ui.Username = lm.Username; //HttpCookie ckuser = new HttpCookie("UserInfo"); //ckuser["USERDATA"] = ui.LosSerialize(); //Response.Cookies.Add(ckuser); CookieFacade.USERINFO = ui; CacheAbstraction cabs = new CacheAbstraction(); cabs.Remove("TRHISTORY" + ":" + checkingAccountNum); //---------------------------------------------------- string redirectURL = FormsAuthentication.GetRedirectUrl(lm.Username, false); if (redirectURL == "/default.aspx") { redirectURL = "~/home/index"; } //Response.Redirect(redirectURL); // causes antiforgery token exception return(Redirect(redirectURL)); } ViewBag.Message = "Invalid login.."; } return(View(lm)); }
public ActionResult BillPayment() { List <BillPayment> billPayments = new List <BillPayment>(); try { IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; billPayments = ibank.GetBills(ui.Username); BillPayment bp = new BillPayment(); } catch (Exception ex) { ViewBag.Message = ex.Message; } return(View(billPayments)); }
public ActionResult Pay(PayBills pay) { bool res = false; try { IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; int selectedID = pay.selectedBill; pay.billPayments = ibank.GetUnPaidBills(ui.Username); BillPayment Bill = null; foreach (BillPayment bill in pay.billPayments) { if (bill.BillID == selectedID) { Bill = bill; break; } } if (Bill != null) { res = ibank.payBill(ui.CheckingAcccountNumber, Bill.BillID, Bill.Amount); if (res) { ViewBag.Message = "Bill Paid"; ModelState.Clear(); pay.selectedBill = 0; } } else { ViewBag.Message = "This bill is already paid"; ModelState.Clear(); pay.selectedBill = 0; } } catch (Exception ex) { ViewBag.Message = ex.Message; } return(View(pay)); }
public ActionResult Pay() { PayBills pay = new PayBills(); try { IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; List <BillPayment> billPayments = ibank.GetUnPaidBills(ui.Username); pay.billPayments = billPayments; } catch (Exception ex) { ViewBag.Message = ex.Message; } return(View(pay)); }
public ActionResult ApplyLoan(ApplyLoanModel alm) { int count = 0; IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance(); UserInfo ui = CookieFacade.USERINFO; if (ui.Username == "mark") { ViewBag.Message = "Only customer is available to apply the loan .."; } try { if (ModelState.IsValid && ui.Username != "mark" && count == 0) { if (count != 0) { ViewBag.Message = "You already applied the loan .."; } bool ret = ibank.ApplyLoan(ui.CheckingAcccountNumber, ui.SavingAccountNumber, alm.Amount, ui.Username); if (ret == true) { ViewBag.Message = "Applied a loan successfully.."; ModelState.Clear(); // otherwise, textbox will display the old amount alm.Amount = 0; } } } catch (Exception ex) { ViewBag.Message = ex.Message; } //alm.Amount = ibank.GetAmountDue(ui.CheckingAcccountNumber); return(View(alm)); }
public Business() : this(GenericFactory <Repository, IRepositoryAuthentication> .GetInstance(), GenericFactory <Repository, IRepositoryBanking> .GetInstance(), GenericFactory <Repository, IRepositoryLoan> .GetInstance()) { }
public void Test_CreateAdapterDynamic() { var csvAdapter = GenericFactory.GetInstance <DataAdapterBase>("CsvAdapter"); Assert.IsInstanceOfType(csvAdapter, typeof(CsvAdapter)); }
public static DataAdapter GetInstance(string typeName) { return(GenericFactory.GetInstance <DataAdapter>(typeName)); }
public float CompareRecords(DataTable table1, DataTable table2, CompareDefinitionGroup compareDefinitionGroup, out string explainPlan) { explainPlan = ""; if (table1 == null) { throw new ArgumentNullException("table1"); } if (table2 == null) { throw new ArgumentNullException("table2"); } if (compareDefinitionGroup == null) { throw new ArgumentNullException("compareDefinitionGroup"); } if (compareDefinitionGroup.CompareDefinitions == null) { throw new ArgumentNullException("compareDefinitionGroup.CompareDefinitions"); } var matchScores = new List <float>(); float finalMatchScore = 0; table1.Columns.Add("Key"); table2.Columns.Add("Key"); var compareAlgorithm = GenericFactory.GetInstance <CompareAlgorithm>("SortedNeighborHood"); compareAlgorithm.Table1 = table1; compareAlgorithm.Table2 = table2; // no comparedefinition, generate a comparedefinition with all fields if (!compareDefinitionGroup.CompareDefinitions.Any()) { var compareDefinition = this.GenerateDefaultCompareDefinition(table1, table2); compareDefinitionGroup.CompareDefinitions.Add(compareDefinition); } foreach (var compareDefinition in compareDefinitionGroup.CompareDefinitions) { compareAlgorithm.Matches.Clear(); compareAlgorithm.PossibleMatches.Clear(); compareAlgorithm.RowComparer.CompareDefinition = compareDefinition; compareAlgorithm.KeyFields1.Clear(); compareAlgorithm.KeyFields1.Add("Key"); compareAlgorithm.KeyFields2.Clear(); compareAlgorithm.KeyFields2.Add("Key"); compareAlgorithm.MatchLimit = 0; compareAlgorithm.PossibleMatchLimit = 0; compareAlgorithm.Execute(); var match = compareAlgorithm.Matches.First(); explainPlan = explainPlan.Append("-----Group: " + compareDefinition.Name + "------"); var explainations = compareAlgorithm.RowComparer.Explain(match.From.Value, match.To.Value); explainPlan = explainPlan.Append(string.Join(Environment.NewLine, explainations)); explainPlan = explainPlan.Append("Result = " + match.Cost + " (" + compareDefinition.Aggregator.ToStringOrEmpty() + ")"); explainPlan = explainPlan.Append("----------------------------------------"); matchScores.Add((float)match.Cost); } finalMatchScore = compareDefinitionGroup.Aggregator.AggregatedSimilarity(matchScores.ToArray()); explainPlan = explainPlan.Append("final result = " + finalMatchScore + " (" + compareDefinitionGroup.Aggregator.ToStringOrEmpty() + ")"); return(finalMatchScore); }
public IEnumerable <TType> GetAll() { IRepository <TType> genericrepo = GenericFactory <TType> .GetInstance().GetObject(); return(genericrepo.All()); }
public static ValueConverterBase GetInstance(string typeName) { return(GenericFactory.GetInstance <ValueConverterBase>(typeName)); }
public static StringTokenizer GetInstance(string typeName) { return(GenericFactory.GetInstance <StringTokenizer>(typeName)); }