Esempio n. 1
0
 public ActionResult Signin(Model_login obj)
 {
     if (db.tbl_logins.Where(x => x.email == obj.email && x.password == obj.password).Count() > 0)
     {
         if (db.tbl_logins.Where(x => x.email == obj.email && x.password == obj.password && x.log_status == "Active").Count() > 0)
         {
             tbl_login        tbl = db.tbl_logins.Where(x => x.email == obj.email && x.password == obj.password).Single <tbl_login>();
             tbl_registration tb  = db.tbl_registrations.Where(x => x.login_id == tbl.login_id).Single <tbl_registration>();
             SessionData.fname  = tb.reg_fname;
             SessionData.UserId = tbl.login_id;
             SessionData.photo  = tb.reg_photo;
             SessionData.RegId  = tb.reg_id;
             if (db.tbl_subscriptions.Where(x => x.sub_end_date > DateTime.Now && x.login_id == tbl.login_id).Count() > 0)
             {
                 SessionData.ustatus = "Paid";
             }
             return(Redirect(SessionData.currenturl));
         }
         else
         {
             ModelState.AddModelError("error", "Error! Please check your Email to Activate Your Account");
             return(View());
         }
     }
     else
     {
         ModelState.AddModelError("error", "Error! Please check your Username And/or Password");
         return(View());
     }
 }
        public ActionResult Profileinfo()
        {
            int id = SessionData.UserId;
            Model_registration obj = db.tbl_registrations.Where(x => x.login_id == id).Select(x => new Model_registration()
            {
                reg_id      = x.reg_id,
                reg_fname   = x.reg_fname,
                reg_lname   = x.reg_lname,
                login_id    = x.login_id,
                reg_photo   = x.reg_photo,
                reg_address = x.reg_address,
                country_id  = x.country_id,
                state_id    = x.state_id,
                city_id     = x.city_id,
                reg_phno    = x.reg_phno,
                reg_gender  = x.reg_gender
            }).SingleOrDefault();

            ViewBag.countryid = new SelectList(db.tbl_countries.ToList(), "country_id", "country_name", obj.country_id);
            ViewBag.stateid   = new SelectList(db.tbl_states.ToList(), "state_id", "state_name", obj.state_id);
            ViewBag.cityid    = new SelectList(db.tbl_cities.ToList(), "city_id", "city_name", obj.city_id);
            ViewBag.genderid  = new SelectList(db.tbl_genders.ToList(), "gen_id", "gen_name", obj.reg_gender);

            Model_login obj2 = db.tbl_logins.Where(x => x.login_id == obj.login_id).Select(x => new Model_login()
            {
                login_id = x.login_id,
                email    = x.email,
                password = x.password
            }).SingleOrDefault();
            Model_Login_Register mdlgrg = new Model_Login_Register();

            mdlgrg.mdregister = obj;
            mdlgrg.mdlogin    = obj2;
            return(View(mdlgrg));
        }
        public ActionResult Resend(Model_login obj)
        {
            if (db.tbl_logins.Where(x => x.email == obj.email && x.log_status == "Active").Count() > 0)
            {
                ModelState.AddModelError("error", "Your Email ID is already Activated Please Sign In");
                return(View());
            }
            else if (db.tbl_logins.Where(x => x.email == obj.email).Count() > 0)
            {
                tbl_login        tbl  = db.tbl_logins.Where(x => x.email == obj.email).Single <tbl_login>();
                tbl_registration tbl2 = db.tbl_registrations.Where(x => x.login_id == tbl.login_id).Single <tbl_registration>();

                string host    = Request.Url.Authority;
                string key     = GetUniqueKey(64);
                string sendurl = "http://" + host + "/login/Activate/" + key;
                SendMail(obj.email, tbl2.reg_fname, "Confirm Registration Email", sendurl);
                tbl.log_status = key;
                db.SubmitChanges();
                ModelState.AddModelError("error", "Activation Email Sent");
                return(View());
            }
            else
            {
                ModelState.AddModelError("error", "Email ID not registered Plz register First");

                return(View());
            }
        }
 public ActionResult Signin(Model_login obj)
 {
     if (obj.email == "viralghosh" && obj.password == "viral.com")
     {
         SessionData.AdminId = 1;
         return(RedirectToAction("Index"));
     }
     ViewBag.error = "Please check your username n password";
     return(Redirect(SessionData.currenturl));
 }
Esempio n. 5
0
        public ActionResult Activate()
        {
            string host = Request.Url.PathAndQuery;

            host = host.Replace("/login/Activate/", "");
            if (db.tbl_logins.Where(x => x.log_status == host).Count() > 0)
            {
                Model_login log = db.tbl_logins.Where(x => x.log_status == host).Select(x => new Model_login()
                {
                    login_id = x.login_id,
                    email    = x.email
                }).SingleOrDefault();
                return(View(log));
            }
            ModelState.AddModelError("error", "Invalid activation url or account already activated");
            return(View());
        }
Esempio n. 6
0
 public ActionResult Forgot(Model_login obj)
 {
     if (db.tbl_logins.Where(x => x.email == obj.email).Count() > 0)
     {
         tbl_login        tbl  = db.tbl_logins.Where(x => x.email == obj.email).Single <tbl_login>();
         tbl_registration tbl2 = db.tbl_registrations.Where(x => x.login_id == tbl.login_id).Single <tbl_registration>();
         //SendMail(obj.email, "Forgot Password,"+ tbl2.reg_fname + ",Your password : "******"Forgot Password", "Your password : "******"sucess", "Email Sucessfully sent, check your Email address");
         return(View());
     }
     else
     {
         ModelState.AddModelError("error", "Error! Please check your Email address");
         return(View());
     }
 }
Esempio n. 7
0
        public ActionResult Activate(Model_login obj)
        {
            if (db.tbl_logins.Where(x => x.login_id == obj.login_id && x.log_status == "Active").Count() > 0)
            {
                ModelState.AddModelError("error", "Your email is already activated");
                return(RedirectToAction("Signin"));
            }
            else
            {
                if (obj.login_id != 0)
                {
                    tbl_login tbl = db.tbl_logins.Where(x => x.login_id == obj.login_id).Single <tbl_login>();
                    tbl.log_status = "Active";
                    db.SubmitChanges();
                    return(RedirectToAction("SignIn"));
                }
                ModelState.AddModelError("error", "Invalid activation url");

                return(View());
            }
        }