public ActionResult ChangePassword(Mov move, int id)
        {
            // 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>(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);
            }
        }
        public ActionResult CreateUser(Mov move, FormCollection collection)
        {
            var log1 = _documentSession.Query<Mov>()
                .Where(x => x.Email == move.Email)
                .Take(1).ToList();

             if (log1.Count > 0)
             {
                 return View();

             }
             else
             {
                 if (!ModelState.IsValid)
                     return View();
                 _documentSession.Store(move);
                 _documentSession.SaveChanges();
                 Sendmail(move.Email, move.Name);

                 return RedirectToAction("Welcome", "Welcome", new { message = string.Format("Created user {0}", move.Email) });
             }
        }
Example #3
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);
            }
        }
Example #4
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);
            }
        }
        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("Welcome", "Welcome", new { message = string.Format("Password Successfully Changed") });
            }
            else
            {
                return RedirectToAction("Recover_Password", new { message = string.Format("Password Change For{0}", move.Id) });
            }
        }
        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();
            }
        }
 public ActionResult EditUser(Mov move)
 {
     if (ModelState.IsValid)
         _documentSession.Store(move);
     _documentSession.SaveChanges();
     return RedirectToAction("Users", new { message = string.Format("Saved changes to mov {0}", move.Id) });
 }
        public ActionResult CreateUser(Mov move)
        {
            //if (!ModelState.IsValid)
            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.Email != null && move.Name != 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);
            }
        }
 public ActionResult CreateUser(FormCollection collection)
 {
     Mov objcountrymodel = new Mov();
     objcountrymodel.StateModel = new List<State>();
     objcountrymodel.StateModel = GetAllState();
     return View(objcountrymodel);
     //  return View();
 }
Example #10
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") });
     }
 }
Example #11
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") });
     }
 }