예제 #1
0
        public ActionResult ChangePassword(Mov move, int id)
        {
            if (Request["Name_1"] != Request["Name_2"])
            {
                return View(move);
            }
            // var log2 = _documentSession.Load<ChangePassword>(chng.UserId);
            var log1 = _documentSession.Query<Mov>()
                .Where(x => x.Email == move.Email && x.Password == Request["Name_0"])
                .Take(1).ToList();

            if (log1.Count > 0)
            {
                if (!ModelState.IsValid)

                    move.Password = "";
                //move.Id = 0;
                move.Password = Request["Name_1"];
                move.RetypePassword = Request["Name_2"];

                _documentSession.Delete(_documentSession.Load<Mov>(move.Id));
                _documentSession.SaveChanges();
                _documentSession.Store(move);
                _documentSession.SaveChanges();
                return RedirectToAction("Users", new { message = string.Format("Password Successfully Changed") });
            }

            else
            {
                // return RedirectToAction("Log","Log", new { message = string.Format("Wrong User Id Or Password {0}") });
                return View(move);
            }
        }
예제 #2
0
        public ActionResult ChangePassword(ChangePassword chng, Mov move)
        {
            var log2 = _documentSession.Load<ChangePassword>(chng.UserId);
            var log1 = _documentSession.Query<Mov>()
                .Where(x => x.Email == chng.UserId && x.Password == chng.OldPassword)
                .Take(1).ToList();
            //var mov = _documentSession.Load<mov>(move.Email);
            // var mov1 = _documentSession.Load<LoginPage>(log.UserID);
            //var move = _documentSession.Store(mov);
            //var move1 = _documentSession.Load<LoginPage>(UserID);
            if (log1.Count > 0)
            {
                if (!ModelState.IsValid)
                    _documentSession.Store(chng);
                _documentSession.SaveChanges();
                return RedirectToAction("ChangePassword", "Log", new { message = string.Format("Password Successfully Changed {0}", chng.Id) });
            }

            else
            {
                // return RedirectToAction("Log","Log", new { message = string.Format("Wrong User Id Or Password {0}") });
                return View(chng);
            }
        }
예제 #3
0
        public ActionResult Log(LoginPage log,Mov move)
        {
            //var log2 = _documentSession.Load<LoginPage>(log.UserID);
            var log1 = _documentSession.Query<Mov>()
                .Where(x => x.Email==log.UserID && x.Password==log.Password)
                .Take(1).ToList();

            //var mov = _documentSession.Load<mov>(move.Email);
               // var mov1 = _documentSession.Load<LoginPage>(log.UserID);
            //var move = _documentSession.Store(mov);
            //var move1 = _documentSession.Load<LoginPage>(UserID);
            if (log1.Count > 0)
            {
                Session["Usr_Nm"] = move.Name;
                Mov[] Mov = _documentSession.Query<Mov>().Where(x => x.Email == log.UserID && x.Password == log.Password).ToArray() ;

                Session["Usr_Nm"] = Mov[0].Name;
                Session["vendor"] = log.UserID;
                Session["user1"] = "us";
                Session["user"] = "******";
                return RedirectToAction("Vendor", "Vendor", new { message = string.Format("Logged In As {0}", log.UserID) });
            }

            else
            {
               // return RedirectToAction("Log","Log", new { message = string.Format("Wrong User Id Or Password {0}") });
                return View(log);
            }
        }
예제 #4
0
 public ActionResult EditUser(Mov move)
 {
     if (Session["user"] != null)
     {
         if (!ModelState.IsValid)
             _documentSession.Store(move);
         _documentSession.SaveChanges();
         return RedirectToAction("Users", new { message = string.Format("Saved changes to mov {0}", move.Id) });
     }
     else
     {
         return RedirectToAction("Login", new { message = string.Format("Please Login Again {0}", "Admin") });
     }
 }
예제 #5
0
 public ActionResult CreateUser(Mov move)
 {
     if (Session["user"] != null)
     {
         if (!ModelState.IsValid)
             return View();
         _documentSession.Store(move);
         _documentSession.SaveChanges();
         Sendmail(move.Email, move.Name);
         return RedirectToAction("Users", new { message = string.Format("Created User {0}", move.Email) });
     }
     else
     {
         return RedirectToAction("Login", new { message = string.Format("Please Login Again {0}", "Admin") });
     }
 }
예제 #6
0
        public ActionResult ResetPassword(Mov move)
        {
            Mov[] Mov = _documentSession.Query<Mov>().Where(x => x.Email == move.Email).ToArray();
            var log1 = _documentSession.Query<Mov>()
                .Where(x => x.Email == move.Email)
                .Take(1).ToList();

            if (log1.Count > 0)
            {
                if (!ModelState.IsValid)

                    move.Password = "";
                Mov[0].Password = Request["Name1"];
                Mov[0].RetypePassword = Request["Name2"];

                _documentSession.Delete(_documentSession.Load<Mov>(Mov[0].Id));
                _documentSession.SaveChanges();
                _documentSession.Store(Mov[0]);
                _documentSession.SaveChanges();
                Sendmail(move.Email, Mov[0].Id);
                return RedirectToAction("Home", "Index", new { message = string.Format("Password Successfully Changed") });
            }
            else
            {
                return RedirectToAction("Recover_Password", new { message = string.Format("Password Change For{0}", move.Id) });
            }
        }
예제 #7
0
        public ActionResult Recover_Password(Mov move)
        {
            Mov[] Mov = _documentSession.Query<Mov>().Where(x => x.Email == Request["ch_uid"]).ToArray();

            var log1 = _documentSession.Query<Mov>()
                    .Where(x => x.Email == Request["ch_uid"])
                    .Take(1).ToList();

            if (log1.Count > 0)
            {
                //  Sendmail(Request["ch_uid"], Mov[0].Id);
                return RedirectToAction("ResetPassword", new { message = string.Format("Mail sent Successfully to {0}", Mov[0].Id) });

            }
            else
            {
                return View();
            }
        }
예제 #8
0
        public ActionResult EditUser(Mov move)
        {
            if (Session["vendor"] != null)
            {

                _documentSession.Store(move);
            _documentSession.SaveChanges();
            return RedirectToAction("Users", new { message = string.Format("Saved changes to mov {0}", move.Id) });
            }
             else
             {
                 return RedirectToAction("LogOff", new { message = string.Format("Please Login Again {0}", move.Id) });
             }
        }
예제 #9
0
        public ActionResult CreateUser(Mov move)
        {
            if (move.Email != null)
            {
                var log1 = _documentSession.Query<Mov>()
                  .Where(x => x.Email == move.Email)
                  .Take(1).ToList();

                if (log1.Count > 0)
                {
                    return Json(string.Format("{0} is already exist!", move.Email),
                         JsonRequestBehavior.AllowGet);
                }
                if (move.Country == "0")
                {
                    return Json(string.Format("Please select a country!", move.Country),
                             JsonRequestBehavior.AllowGet);
                }
                if (Request["pass"] == "")
                {
                    return Json(string.Format("Please enter a password!"),
                             JsonRequestBehavior.AllowGet);
                }
                if (Request["pass"] != move.RetypePassword)
                {
                    return Json(string.Format("Password mismatched!"),
                             JsonRequestBehavior.AllowGet);
                }
            }

            if (move.Email != null && move.Name != null && move.Address1 != null && move.City != null && move.Pin != null && move.Country != "0" && move.Phone != null && move.Dob != null && Request["pass"] != null && move.RetypePassword != null && Request["pass"] == move.RetypePassword)
            {
                move.Country = "";
                List<State1> objCountry = new List<State1>();
                objCountry = GetAllState1().Where(m => m.Id.ToString() == Request.Form["Country"]).ToList();
                var objCoun = objCountry[0].StateName;
                move.Country = objCoun;
                //-----------------------------------------------------------------
                Session["vendor"] = move.Email;
                move.Password = Request["pass"];
                _documentSession.Store(move);
                _documentSession.SaveChanges();
              //  Sendmail(move.Email, move.Name);

                //return View();
                return RedirectToAction("Users", new { message = string.Format("Created User {0}", move.Email) });
            }
            else
            {
                move.StateModel = new List<State>();
                move.StateModel = GetAllState();
                return View(move);
            }
        }
예제 #10
0
 public ActionResult CreateUser(FormCollection collection)
 {
     Mov objcountrymodel = new Mov();
     objcountrymodel.StateModel = new List<State>();
     objcountrymodel.StateModel = GetAllState();
     return View(objcountrymodel);
     //  return View();
 }