public bool IsViewableBy(User user)
 {
     Debug.Assert(LoanOfficer != null, "Loan officer is null.");
     return(LoanOfficer.Equals(user)
         ? true
         : user.HasAsSubordinate(LoanOfficer));
 }
示例#2
0
        public LoanOfficer bringLOfficer(string id)
        {
            LORepository repo = new LORepository();
            LoanOfficer  data = repo.Get(Convert.ToInt32(id));

            return(data);
        }
        public int Delete(int id)
        {
            LoanOfficer loanofficerToDelete = context.LoanOfficers.SingleOrDefault(d => d.LOfficer_Id == id);

            context.LoanOfficers.Remove(loanofficerToDelete);
            return(context.SaveChanges());
        }
示例#4
0
        public IHttpActionResult Post(LoanOfficer loanOfficer)
        {
            this.lrepo.Insert(loanOfficer);
            string uri = Url.Link("GetLOfficer_Id", new { id = loanOfficer.LOfficer_Id });

            return(Created("GetLOfficer_Id", loanOfficer));
        }
        public ActionResult ConfirmChangePassword(string oldpass, string Pass, string cpass)
        {
            LORepository    orepo = new LORepository();
            LoginRepository lrepo = new LoginRepository();

            LoanOfficer of = orepo.Get(Convert.ToInt32(Session["Id"]));

            Logininfo log = lrepo.Get(Session["Name"].ToString());

            if (Session["Password"].ToString() == oldpass)
            {
                if (Pass != cpass)
                {
                    ViewData["Message"] = "Password Didn't match";
                }
                else
                {
                    of.LOfficer_Password = Pass;
                    log.Login_Password   = Pass;

                    orepo.Update(of);
                    lrepo.Update(log);

                    ViewData["Message"] = "Password Updated Successfully";
                    Session["Officer"]  = of;
                    Session["Password"] = Pass;
                }
            }
            else
            {
                ViewData["Message"] = "Wrong Password";
            }

            return(View("Empty"));
        }
        public int Update(LoanOfficer LoanOfficer)
        {
            LoanOfficer loanofficerToUpdate = context.LoanOfficers.SingleOrDefault(d => d.LOfficer_Id == LoanOfficer.LOfficer_Id);

            loanofficerToUpdate.LOfficer_name = LoanOfficer.LOfficer_name;

            return(context.SaveChanges());
        }
        public ActionResult ConfirmEditProfile(LoanOfficer l)
        {
            LORepository urepo = new LORepository();

            urepo.Update(l);

            ViewData["Message"]    = "Edit Successfull";
            Session["LoanOfficer"] = l;
            return(View("Empty"));
        }
        // GET: LOfficer
        public ActionResult Home(LoanOfficer ho)
        {
            Session["LoanOfficer"] = ho;
            Session["Id"]          = ho.LOfficer_Id;
            Session["Name"]        = ho.LOfficer_name;
            Session["Branch"]      = ho.LOfficer_branch;
            Session["Password"]    = ho.LOfficer_Password;

            return(RedirectToAction("HomePage"));
        }
        public int Insert(LoanOfficer LoanOfficer)
        {
            Logininfo li = new Logininfo();

            li.Login_acc_no   = context.LoanOfficers.Count() + 1;
            li.Login_Name     = LoanOfficer.LOfficer_name;
            li.Login_Password = LoanOfficer.LOfficer_Password;
            li.Login_type     = "LOfficer";
            context.Logininfos.Add(li);

            context.LoanOfficers.Add(LoanOfficer);
            return(context.SaveChanges());
        }
示例#10
0
        public IHttpActionResult Get(int LOfficer_Id)
        {
            LoanOfficer u = new LoanOfficer();

            u = this.lrepo.Get(LOfficer_Id);

            if (u == null)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(Ok(u));
            }
        }
 public ActionResult CreateLoanOfficer(LoanOfficer loanOfficerModel)
 {
     try
     {
         var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
         loanOfficerModel.IdentityUserId = userId;
         _context.LoanOfficer.Add(loanOfficerModel);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
示例#12
0
        public ActionResult ConfirmLoanOfficer_Salary(int LOfficer_Id)
        {
            LORepository brepo = new LORepository();
            LoanOfficer  br    = brepo.Get(LOfficer_Id);
            DateTime     d     = DateTime.Now;

            if (d >= Convert.ToDateTime(br.LOfficer_LastPaymentDate).AddDays(30))
            {
                br.LOfficer_LastPaymentDate = d.ToString();
                br.LOfficer_TotalPayment   += br.LOfficer_Salary;
                br.LOfficer_Balance        += br.LOfficer_Salary;

                brepo.Update(br);
                ViewData["Message"] = "Salary Payment Successfull";
            }
            else
            {
                ViewData["Message"] = "To Early to Pay Salary";
            }

            return(View("Empty"));
        }
示例#13
0
 public DisplayOfficerViewModel(string officerKey)
 {
     loanOfficer = (new LoanOfficerDataModel()).GetLoanOfficers(officerKey).FirstOrDefault();
 }
        // GET: LoanOfficers/Create
        public ActionResult CreateLoanOfficer()
        {
            LoanOfficer loanOfficer = new LoanOfficer();

            return(View(loanOfficer));
        }
示例#15
0
 public IHttpActionResult Put([FromBody] LoanOfficer loanOfficer, [FromUri] int LOfficer_Id)
 {
     loanOfficer.LOfficer_Id = LOfficer_Id;
     this.lrepo.Update(loanOfficer);
     return(Ok(loanOfficer));
 }
        public ActionResult ConfirmAddEmployee(string Emp_name, string Emp_password, string Emp_address, string Emp_mobile, double Emp_salary, string Emp_branch, string Emp_position)
        {
            LoginRepository lrepo = new LoginRepository();

            Logininfo li = lrepo.Get(Emp_name);

            if (li == null)
            {
                if (Emp_position == "HROfficer")
                {
                    HROfficerRepository repo = new HROfficerRepository();
                    HROfficer           bm   = new HROfficer();
                    bm.HR_address         = Emp_address;
                    bm.HR_Balance         = 0;
                    bm.HR_branch          = Emp_branch;
                    bm.HR_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd");
                    bm.HR_mobile          = Emp_mobile;
                    bm.HR_name            = Emp_name;
                    bm.HR_password        = Emp_password;
                    bm.HR_Salary          = Emp_salary;
                    bm.HR_TotalPayment    = 0;

                    repo.Insert(bm);
                }
                else if (Emp_position == "LOfficer")
                {
                    LORepository repo = new LORepository();
                    LoanOfficer  bm   = new LoanOfficer();
                    bm.LOfficer_address         = Emp_address;
                    bm.LOfficer_Balance         = 0;
                    bm.LOfficer_branch          = Emp_branch;
                    bm.LOfficer_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd");
                    bm.LOfficer_mobile          = Emp_mobile;
                    bm.LOfficer_name            = Emp_name;
                    bm.LOfficer_Password        = Emp_password;
                    bm.LOfficer_Salary          = Emp_salary;
                    bm.LOfficer_TotalPayment    = 0;

                    repo.Insert(bm);
                }
                else if (Emp_position == "Manager")
                {
                    BranchManagerRepository repo = new BranchManagerRepository();
                    BranchManager           bm   = new BranchManager();
                    bm.Manager_address         = Emp_address;
                    bm.Manager_Balance         = 0;
                    bm.Manager_branch          = Emp_branch;
                    bm.Manager_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd");
                    bm.Manager_mobile          = Emp_mobile;
                    bm.Manager_Name            = Emp_name;
                    bm.Manager_password        = Emp_password;
                    bm.Manager_Salary          = Emp_salary;
                    bm.Manager_TotalPayment    = 0;

                    repo.Insert(bm);
                }
                else if (Emp_position == "Cashier")
                {
                    CashierRepository repo = new CashierRepository();
                    Cashier           bm   = new Cashier();
                    bm.Cashier_address         = Emp_address;
                    bm.Cashier_Balance         = 0;
                    bm.Cashier_branch          = Emp_branch;
                    bm.Cashier_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd");
                    bm.Cashier_mobile          = Emp_mobile;
                    bm.Cashier_Name            = Emp_name;
                    bm.Cashier_password        = Emp_password;
                    bm.Cashier_Salary          = Emp_salary;
                    bm.Cashier_TotalPayment    = 0;

                    repo.Insert(bm);
                }
                else if (Emp_position == "Officer")
                {
                    OfficerRepository repo = new OfficerRepository();
                    Officer           bm   = new Officer();
                    bm.Officer_address         = Emp_address;
                    bm.Officer_Balance         = 0;
                    bm.Officer_branch          = Emp_branch;
                    bm.Officer_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd");
                    bm.Officer_mobile          = Emp_mobile;
                    bm.Officer_Name            = Emp_name;
                    bm.Officer_password        = Emp_password;
                    bm.Officer_Salary          = Emp_salary;
                    bm.Officer_TotalPayment    = 0;

                    repo.Insert(bm);
                }
                ViewData["Message"] = "Entry Successfull";
            }
            else
            {
                ViewData["Message"] = "Username in Use";
            }

            return(View("Empty"));
        }
示例#17
0
        public static async Task SeedUsers(UserManager <User> _adminManager, IRepository _repo)
        {
            var email = "*****@*****.**";

            if (await _adminManager.FindByEmailAsync(email) == null)
            {
                var password = "******";
                var admin    = new User {
                    FirstName = "Admin",
                    LastName  = "Joestar",
                    Email     = email,
                    UserName  = email,
                };
                await _adminManager.CreateAsync(admin, password);

                await _adminManager.AddToRoleAsync(admin, "Admin");

                var adminEntity = new Admin()
                {
                    User = admin
                };


                var customer = new Customer {
                    FirstName = "Jon",
                    LastName  = "Snow",
                    CNP       = "1233211233212",
                    City      = "Los Santos",
                    Address   = "Grove St.",
                    ZipCode   = "4204"
                };

                var customerUser = new User {
                    FirstName = "Jon",
                    LastName  = "Snow",
                    Email     = "*****@*****.**",
                    UserName  = "******"
                };

                await _adminManager.CreateAsync(customerUser, "Drag0ns");

                await _adminManager.AddToRoleAsync(customerUser, "Customer");

                customer.User = customerUser;


                var loanOfficer = new LoanOfficer {
                    FirstName = "Private",
                    LastName  = "Ryan",
                    City      = "'Murica",
                    Address   = "Freedom st.",
                    ZipCode   = "8008"
                };

                var loanUser = new User {
                    FirstName = "Private",
                    LastName  = "Ryan",
                    Email     = "*****@*****.**",
                    UserName  = "******"
                };

                await _adminManager.CreateAsync(loanUser, "pr0tection");

                await _adminManager.AddToRoleAsync(loanUser, "LoanOfficer");

                loanOfficer.User = loanUser;

                await _repo.Add(loanOfficer);

                await _repo.Add(adminEntity);

                await _repo.Add(customer);
            }
        }