public ActionResult ConfirmChangePassword(string oldpass, string Pass, string cpass)
        {
            OfficerRepository orepo = new OfficerRepository();
            LoginRepository   lrepo = new LoginRepository();

            Officer of = orepo.Get(Convert.ToInt32(Session["OfficerID"]));

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

            if (Session["Password"].ToString() == oldpass)
            {
                if (Pass != cpass)
                {
                    ViewData["Message"] = "Password Didn't match";
                }
                else
                {
                    of.Officer_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(Officer ho)
        {
            OfficerRepository orepo = new OfficerRepository();

            orepo.Update(ho);

            ViewData["Message"] = "Edit Successfull";
            Session["Officer"]  = ho;
            return(View("Empty"));
        }
Beispiel #3
0
        public ActionResult ConfirmOfficer_Salary(int Officer_Id)
        {
            OfficerRepository brepo = new OfficerRepository();
            Officer           br    = brepo.Get(Officer_Id);
            DateTime          d     = DateTime.Now;

            if (d >= Convert.ToDateTime(br.Officer_LastPaymentDate).AddDays(30))
            {
                br.Officer_LastPaymentDate = d.ToString();
                br.Officer_TotalPayment   += br.Officer_Salary;
                br.Officer_Balance        += br.Officer_Salary;

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

            return(View("Empty"));
        }