Ejemplo n.º 1
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        admin_infoBO admin_credentials = new admin_infoBO();
        AdminFunctionsBAL admin_login = new AdminFunctionsBAL();

        try
        {

            admin_credentials.email_id = txtadmin_email_id.Value.ToString();
            admin_credentials.password = txtpassword.Value.ToString();

            if (admin_login.AdminLoginAuthenticate(admin_credentials))
            {

                admin_infoBO admin_info = new admin_infoBO();

                admin_info = admin_login.AdminCompleteInfoFetch(admin_credentials);      //fetching the admin_id
                Session["admin_id"] = admin_info.admin_id;
                Response.Redirect("~/Admin/AdminHome.aspx");
            }
            else
            {
                Response.Write("<script type='text/javascript'> $(function(){alert('Please enter correct email id or password')}); </script>"); ;
            }

        }

        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
    }                                                                           //end of adming information fetch function

    public Boolean AdminPasswordChange(admin_infoBO admin_info, String newpass) //Admin passwrod change function
    {
        try
        {
            if (AdminPasswordCheck(admin_info.admin_id, admin_info.password))
            {
                newcon.Open();
                query = "update admin_info set admin_password='******' where admin_id=@admin_id";

                command = new SqlCommand(query, newcon);

                command.Parameters.AddWithValue("@admin_id", admin_info.admin_id);
                command.Parameters.AddWithValue("@newpass", newpass);
                command.ExecuteNonQuery();

                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch
        {
            throw;
        }

        finally
        {
            command.Dispose();
            newcon.Close();
        }
    }
Ejemplo n.º 3
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        admin_infoBO      admin_credentials = new admin_infoBO();
        AdminFunctionsBAL admin_login       = new AdminFunctionsBAL();


        try
        {
            admin_credentials.email_id = txtadmin_email_id.Value.ToString();
            admin_credentials.password = txtpassword.Value.ToString();

            if (admin_login.AdminLoginAuthenticate(admin_credentials))
            {
                admin_infoBO admin_info = new admin_infoBO();

                admin_info          = admin_login.AdminCompleteInfoFetch(admin_credentials); //fetching the admin_id
                Session["admin_id"] = admin_info.admin_id;
                Response.Redirect("~/Admin/AdminHome.aspx");
            }
            else
            {
                String scr = "<script type='text/javascript'>alert('Please enter correct email id or password'); </script>";

                Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorMessage", scr);
            }
        }

        catch (Exception ex)
        {
            Response.Write("<script type='text/javascript'>alert('Please enter correct email id or password'); </script>");
        }
    }
 public Boolean AdminLoginAuthenticate(admin_infoBO admin_credentials)
 {
     try
     {
         return(adminfunction.AdminLoginAuthenticate(admin_credentials));
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 5
0
    public admin_infoBO AdminCompleteInfoFetch(admin_infoBO admin_info)
    {
        try
        {
            return adminfunction.AdminCompleteInfoFetch(admin_info);
        }

        catch
        {
            throw;
        }
    }
    public String AdminPasswordChange(admin_infoBO admin_info, String newpass)
    {
        if (adminfunction.AdminPasswordChange(admin_info, newpass))
        {
            return("Password Changed successfully");
        }

        else
        {
            return("Something went wrong and password didn't change");
        }
    }
    public admin_infoBO AdminCompleteInfoFetch(admin_infoBO admin_info)
    {
        try
        {
            return(adminfunction.AdminCompleteInfoFetch(admin_info));
        }

        catch
        {
            throw;
        }
    }
    }                                                                          //end of admin login authentication

    public admin_infoBO AdminCompleteInfoFetch(admin_infoBO admin_credentials) //fetching the admin general information
    {
        try
        {
            newcon.Open();

            query = "Select * from admin_info where email_id=@email";

            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@email", admin_credentials.email_id);


            reader = command.ExecuteReader();

            command.Dispose();

            if (reader.HasRows)
            {
                admin_infoBO admin_info = new admin_infoBO();

                reader.Read();

                admin_info.admin_id   = Convert.ToInt32(reader[0]);            //admin_id
                admin_info.first_name = Convert.ToString(reader[3]);           //admin_firstname
                admin_info.last_name  = Convert.ToString(reader[4]);           //admin_lastname
                return(admin_info);
            }
            else
            {
                return(null);
            }
        }

        catch
        {
            throw;
        }

        finally
        {
            reader.Dispose();
            newcon.Close();
        }
    }                                                                           //end of adming information fetch function
    public Boolean AdminLoginAuthenticate(admin_infoBO admin_credinatials)
    {
        try
        {
            newcon.Open();
            query = "Select admin_id from admin_info where email_id=@email and password=@pass";

            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@email", admin_credinatials.email_id);
            command.Parameters.AddWithValue("@pass", admin_credinatials.password);

            reader = command.ExecuteReader();

            command.Dispose();

            if (reader.HasRows)  //username or password is correct
            {
                return(true);
            }
            else
            {
                return(false);              //Username or password not correct
            }
        }
        catch
        {
            throw;
        }

        finally
        {
            reader.Dispose();
            newcon.Close();
        }
    }                                                                          //end of admin login authentication
Ejemplo n.º 10
0
    public Boolean AdminLoginAuthenticate(admin_infoBO admin_credentials)
    {
        try
        {

            return adminfunction.AdminLoginAuthenticate(admin_credentials);
        }
        catch
        {
            throw;
        }
    }
Ejemplo n.º 11
0
    public String AdminPasswordChange(admin_infoBO admin_info,String newpass)
    {
        if (adminfunction.AdminPasswordChange(admin_info, newpass))
        {
            return "Password Changed successfully";
        }

        else
        {
            return "Something went wrong and password didn't change";
        }
    }
Ejemplo n.º 12
0
 protected void btnChangepass_Click(object sender, EventArgs e)
 {
     AdminFunctionsBAL adminfunction = new AdminFunctionsBAL();
     admin_infoBO admin_info = new admin_infoBO();
 }
Ejemplo n.º 13
0
    //Admin passwrod change function
    public Boolean AdminPasswordChange(admin_infoBO admin_info,String newpass)
    {
        try
        {

            if (AdminPasswordCheck(admin_info.admin_id, admin_info.password))
            {
                newcon.Open();
                query = "update admin_info set admin_password='******' where admin_id=@admin_id";

                command = new SqlCommand(query, newcon);

                command.Parameters.AddWithValue("@admin_id", admin_info.admin_id);
                command.Parameters.AddWithValue("@newpass", newpass);
                command.ExecuteNonQuery();

                return true;

            }
            else
            {
                return false;
            }
        }
        catch
        {
            throw;
        }

        finally
        {
            command.Dispose();
            newcon.Close();
        }
    }
Ejemplo n.º 14
0
    public Boolean AdminLoginAuthenticate(admin_infoBO admin_credinatials)
    {
        try
        {
            newcon.Open();
            query = "Select admin_id from admin_info where email_id=@email and password=@pass";

            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@email", admin_credinatials.email_id);
            command.Parameters.AddWithValue("@pass", admin_credinatials.password);

            reader = command.ExecuteReader();

            command.Dispose();

            if (reader.HasRows)  //username or password is correct
            {
                return true;
            }
            else
            {
                return false;              //Username or password not correct
            }

        }
        catch
        {
            throw;

        }

        finally
        {
            reader.Dispose();
            newcon.Close();
        }
    }
Ejemplo n.º 15
0
    //fetching the admin general information
    public admin_infoBO AdminCompleteInfoFetch(admin_infoBO admin_credentials)
    {
        try
        {

            newcon.Open();

            query = "Select * from admin_info where email_id=@email";

            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@email", admin_credentials.email_id);

            reader = command.ExecuteReader();

            command.Dispose();

            if (reader.HasRows)
            {
                admin_infoBO admin_info = new admin_infoBO();

                reader.Read();

                admin_info.admin_id = Convert.ToInt32(reader[0]);              //admin_id
                admin_info.first_name = Convert.ToString(reader[3]);           //admin_firstname
                admin_info.last_name = Convert.ToString(reader[4]);            //admin_lastname
                return admin_info;
            }
            else
            {
                return null;
            }
        }

        catch
        {
            throw;
        }

        finally
        {
            reader.Dispose();
            newcon.Close();
        }
    }
Ejemplo n.º 16
0
 protected void btnChangepass_Click(object sender, EventArgs e)
 {
     AdminFunctionsBAL adminfunction = new AdminFunctionsBAL();
     admin_infoBO      admin_info    = new admin_infoBO();
 }