예제 #1
0
        public ActionResult MainLogin(LoginModel login)
        {
            LoginBal bdata = new LoginBal();

            bdata.UserId   = login.UserId;
            bdata.Password = login.Password;

            ValidateMainDAL ddata  = new ValidateMainDAL();
            bool            status = ddata.ValidateMainLogin(bdata);

            //session sending login id to every page.....
            Session["loginid"] = bdata.UserId;

            if (status)
            {
                return(RedirectToAction("Dashboard", "Dashboard"));
            }
            else
            {
                return(View());
            }
        }
예제 #2
0
        public ActionResult LoginAction(LoginModel login)
        {
            LoginBal bdata = new LoginBal();

            bdata.UserId   = login.UserId;
            bdata.Password = login.Password;

            LoginDal ddata  = new LoginDal();
            bool     status = ddata.Login(bdata);

            //session sending login id to every page.....
            Session["loginid"] = bdata.UserId;

            if (status)
            {
                return(RedirectToAction("SignUp"));
            }
            else
            {
                return(View());
            }
        }
예제 #3
0
        protected void Login1_Authenticate2(object sender, AuthenticateEventArgs e)
        {
            LoginEntity le = new LoginEntity();

            le.UserID   = int.Parse(Login1.UserName);
            le.password = Login1.Password;
            LoginBal bal = new LoginBal();

            try
            {
                var res = bal.Authenticate(le);
                if (res)
                {
                    // Login1.FailureText = "Login Details Valid";
                    FormsAuthentication.RedirectFromLoginPage(le.UserID.ToString(), false);  //storing of user details
                }
            }
            catch (Exception ex)
            {
                Login1.FailureText = ex.Message;
            }
        }
예제 #4
0
        public bool ValidateMainLogin(LoginBal bal)
        {
            bool          status = false;
            SqlConnection cn     = new SqlConnection(ConfigurationManager.ConnectionStrings["ZigmaCS"].ToString());

            try
            {
                //First Table
                SqlCommand cmd = new SqlCommand("ValidateNewPassword", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@LoginId", bal.UserId);
                cmd.Parameters.AddWithValue("@LoginPass", bal.Password);
                //Second Table
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader();

                if (dr.HasRows)
                {
                    status = true;
                }

                else
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                cn.Close();
                cn.Dispose();
            }

            return(status);
        }