Example #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataView dv = SqlDataSourceAdmin.Select(DataSourceSelectArguments.Empty) as DataView;

        if (dv != null)
        {
            bool exists = false;
            for (int i = 0; i < dv.Table.Rows.Count; i++)
            {
                if (username.Text.ToLower() == dv.Table.Rows[i]["Username"].ToString().ToLower() || emailid.Text == dv.Table.Rows[i]["Emailid"].ToString())
                {
                    exists = true;
                    break;
                }
            }
            if (exists)
            {
                msg.Text     = "Account already exists with Username or Email-id";
                msg.CssClass = "text-danger";
            }
            else
            {
                msg.Text = "";
                SqlDataSourceAdmin.Insert();
                msg.Text     = "Account created successfully!";
                msg.CssClass = "text-success";
            }
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "$('#myModal').modal('hide');$('body').removeClass('modal-open');$('.modal-backdrop').remove();$('#myModal').modal('show');", true);
        }
    }
Example #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataView dv = SqlDataSourceAdmin.Select(DataSourceSelectArguments.Empty) as DataView;

        if (dv != null)
        {
            for (int i = 0; i < dv.Table.Rows.Count; i++)
            {
                if (password.Text == dv.Table.Rows[i]["Password"].ToString())
                {
                    SqlDataSourceAdmin.Update();
                    msg.Text = "done";
                    Response.Redirect("ViewAdmin.aspx");
                }
                else
                {
                    msg.Text     = "incorrect password";
                    msg.CssClass = "text-danger";
                }
            }
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "$('#myModal').modal('hide');$('body').removeClass('modal-open');$('.modal-backdrop').remove();$('#myModal').modal('show');", true);
        }
        //SqlDataSourceAdmin.Update();
        //Response.Redirect("ViewAdmin.aspx");
    }
Example #3
0
    protected void changepass_Click(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataView dv    = SqlDataSourceAdmin.Select(DataSourceSelectArguments.Empty) as DataView;
            bool     Exist = false;

            if (dv != null)
            {
                for (int i = 0; i < dv.Table.Rows.Count; i++)
                {
                    if (username.Text == dv.Table.Rows[i]["Username"].ToString() && oldpass.Text == dv.Table.Rows[i]["Password"].ToString())
                    {
                        Exist = true;
                        break;
                    }
                }
            }

            if (Exist)
            {
                SqlDataSourceAdmin.Update();
                msg.Text     = "password changed successfully";
                msg.CssClass = "text success";
            }
            else
            {
                msg.Text     = "enter valid Username or Password";
                msg.CssClass = "text-danger";
            }
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "$('#myModal').modal('hide');$('body').removeClass('modal-open');$('.modal-backdrop').remove();$('#myModal').modal('show');", true);
        }
    }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["type"] != null)
        {
            if (Session["type"].ToString() != "Admin")
            {
                Response.Redirect("unauth.aspx");
            }
        }

        if (Request.QueryString["id"] == null)
        {
            Response.Redirect("ViewAdmin.aspx");
        }

        if (!IsPostBack)
        {
            DataView dv = SqlDataSourceAdmin.Select(DataSourceSelectArguments.Empty) as DataView;

            if (dv != null)
            {
                for (int i = 0; i < dv.Table.Rows.Count; i++)
                {
                    if (Request.QueryString["id"] == dv.Table.Rows[i]["Username"].ToString())
                    {
                        username.Text = dv.Table.Rows[i]["Username"].ToString();
                        fullname.Text = dv.Table.Rows[i]["Fullname"].ToString();
                        mobile.Text   = dv.Table.Rows[i]["Contactno"].ToString();
                        emailid.Text  = dv.Table.Rows[i]["Emailid"].ToString();
                        RadioButtonList1.SelectedValue = dv.Table.Rows[i]["Gender"].ToString();
                        break;
                    }
                }
            }
        }
    }