Exemplo n.º 1
0
 public Login1 CheckExternalEmail(String Email)
 {
     MySqlCommand cmd = new MySqlCommand("CheckExternalEmail", connection);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@MEmail", Email);
     MySqlDataReader reader = cmd.ExecuteReader();
     if (reader.HasRows)
     {
         Login1 login1 = new Login1();
         if (reader.Read())
         {
             login1.Id = reader.GetInt32("Id");
             login1.FirstName = reader.GetString("FirstName");
             login1.LastName = reader.GetString("LastName");
             login1.Email = reader.GetString("Email");
             login1.Password = reader.GetString("Password");
             login1.FavouriteGenre = reader.GetString("FavouriteGenre");
         }
         return login1;
     }
     else
     {
         reader.Dispose();
         cmd.Dispose();
         return null;
     }
 }
Exemplo n.º 2
0
 public Logins(Login1 log)
 {
     Id = log.Id;
     FirstName = log.FirstName;
     LastName = log.LastName;
     Password = log.Password;
 }
Exemplo n.º 3
0
 public ActionResult CheckExternalLoginRegister()
 {
     String Email = Session["LogedUserEmail"].ToString();
     logDAL = login.CheckExternalEmail(Email);
     if (logDAL!=null)
     {
         Session["LogedUserId"] = logDAL.Id.ToString();
         Session["LogedUserName"] = logDAL.FirstName.ToString();
         Session["LogedUserGenre"] = logDAL.FavouriteGenre.ToString();
         return RedirectToAction("MyPage","Movie");
     }
     return RedirectToAction("CheckExternalLoginRegister","Login");
 }
Exemplo n.º 4
0
        public ActionResult ExternalLoginRegister(Models.Logins user)
        {
            user.FirstName= Session["LogedUserName"].ToString();
            user.LastName=Session["LogedUserLastName"].ToString();
            user.Email=Session["LogedUserEmail"].ToString();

            String EncryptPassword = "******";
            EncryptPassword = Helper.Encryption.Encrypt(EncryptPassword);

            logDAL = login.RegisterAdmin(user.FirstName, user.LastName, user.Email, EncryptPassword, user.FavouriteGenre);
            Session["LogedUserName"] = logDAL.FirstName.ToString();
            Session["LogedUserGenre"] = logDAL.FavouriteGenre.ToString();
            return RedirectToAction("MyPage", "Movie");
        }
Exemplo n.º 5
0
        public Login1 RegisterAdmin(String FirstName, String LastName, String Email, String Password, String FavouriteGenre)
        {
            Login1 login1 = new Login1();
            try
            {

                MySqlCommand cmd = new MySqlCommand("Register", connection);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@FirstName", FirstName);
                cmd.Parameters.AddWithValue("@LastName", LastName);
                cmd.Parameters.AddWithValue("@Email", Email);
                cmd.Parameters.AddWithValue("@Password", Password);
                cmd.Parameters.AddWithValue("@FavouriteGenre", FavouriteGenre);
                cmd.ExecuteNonQuery();

                login1.FirstName = FirstName;
                login1.LastName = LastName;
                login1.Email = Email;
                login1.Password = Password;
                login1.FavouriteGenre = FavouriteGenre;
            }

            catch (Exception ex)
            {
                logger.Error(ex.ToString());
            }

            return login1;
        }
Exemplo n.º 6
0
        public ActionResult Register(Models.Logins user, bool captchaValid, string captchaErrorMessage)
        {
            if (ModelState.IsValid)
            {
                if (captchaValid)
                {
                    Response.Write("Captcha is correct");
                }
                ModelState.AddModelError("", captchaErrorMessage);
            }
            try
            {
                String EncryptPassword = user.Password;
                EncryptPassword = Helper.Encryption.Encrypt(EncryptPassword);
                logDAL = login.RegisterAdmin(user.FirstName, user.LastName, user.Email, EncryptPassword, user.FavouriteGenre);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
            }

            Session["LogedUserName"] = logDAL.FirstName.ToString();
            Session["LogedUserGenre"] = logDAL.FavouriteGenre.ToString();
            return RedirectToAction("MyPage", "Movie");
        }
Exemplo n.º 7
0
        public ActionResult Registered(String Email, String Password)
        {
            String EncryptPassword = Password;

            try
            {
                EncryptPassword = Helper.Encryption.Encrypt(EncryptPassword);
                logDAL = login.Registered(Email, EncryptPassword);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
            }
            if (logDAL == null)
            {
                TempData["Error"] = "Login Failed. Please enter valid Email-Id and Password";
                return RedirectToAction("AlreadyRegistered", "Login");
            }
            Session["LogedUserId"] = logDAL.Id.ToString();
            Session["LogedUserName"] = logDAL.FirstName.ToString();
            Session["LogedUserGenre"] = logDAL.FavouriteGenre.ToString();
            return RedirectToAction("MyPage", "Movie");
        }