Esempio n. 1
0
        public ActionResult LoanOfficer_details()
        {
            LORepository       orepo = new LORepository();
            List <LoanOfficer> ll    = orepo.GetAll();

            return(View(ll));
        }
Esempio n. 2
0
        public override void OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext)
        {
            base.OnAuthorization(actionContext);
            if (actionContext.Request.Headers.Authorization == null)
            {
                actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized);
            }
            else
            {
                string   encodedString = actionContext.Request.Headers.Authorization.Parameter;
                string   decodedString = Encoding.UTF8.GetString(Convert.FromBase64String(encodedString));
                string[] arr           = decodedString.Split(new char[] { ':' });
                string   username      = arr[0];
                string   password      = arr[1];

                LORepository urepo = new LORepository();

                if (username == urepo.Get(username).LOfficer_name&& password == urepo.Get(username).LOfficer_Password)
                {
                    Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity(username), null);
                }
                else
                {
                    actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized);
                }
            }
        }
        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 ActionResult ConfirmEditProfile(LoanOfficer l)
        {
            LORepository urepo = new LORepository();

            urepo.Update(l);

            ViewData["Message"]    = "Edit Successfull";
            Session["LoanOfficer"] = l;
            return(View("Empty"));
        }
Esempio n. 5
0
        public ActionResult LoanOfficer_Salary()
        {
            LORepository       brepo = new LORepository();
            List <LoanOfficer> blist = brepo.GetAll();
            List <LoanOfficer> slist = new List <LoanOfficer>();

            foreach (LoanOfficer of in blist)
            {
                if (of.LOfficer_branch != Session["Branch"].ToString())
                {
                }
                else
                {
                    slist.Add(of);
                }
            }

            return(View(slist));
        }
Esempio n. 6
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"));
        }
        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"));
        }