Example #1
0
    protected void changepass_Click(object sender, EventArgs e)
    {
        DataView dv     = SqlDataSourceDeveloper.Select(DataSourceSelectArguments.Empty) as DataView;
        bool     exists = false;

        if (dv != null)
        {
            for (int i = 0; i < dv.Table.Rows.Count; i++)
            {
                if (email.Text == dv.Table.Rows[i]["Email"].ToString() &&
                    oldpass.Text == dv.Table.Rows[i]["Password"].ToString())
                {
                    Session["did"] = dv.Table.Rows[i]["Developer_Id"].ToString();
                    exists         = true;
                    break;
                }
            }
            if (exists)
            {
                SqlDataSourceDeveloper.Update();
                Response.Redirect("LoginDeveloper.aspx");
            }
            else
            {
                msg.Text     = "Invalid e-mail 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 #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataView dv = SqlDataSourceDeveloper.Select(DataSourceSelectArguments.Empty) as DataView;

        bool Exists = false;

        if (dv != null)
        {
            for (int i = 0; i < dv.Table.Rows.Count; i++)
            {
                if (Session["did"].ToString() == dv.Table.Rows[i]["Developer_Id"].ToString() &&
                    password.Text == dv.Table.Rows[i]["Password"].ToString())
                {
                    Exists = true;
                    break;
                }
            }
        }

        if (Exists)
        {
            if (Photo.HasFile)
            {
                string FileName = Photo.FileName.ToLower();

                string Extension = FileName.Substring(FileName.LastIndexOf('.'));

                if (Extension == ".jpg" || Extension == ".jpeg" || Extension == ".png")
                {
                    HiddenFieldPhoto.Value = "/user_images/" + FileName;     //photos
                    Photo.SaveAs(Server.MapPath(HiddenFieldPhoto.Value));
                    SqlDataSourceDeveloper.Update();
                    msg.Text     = "Profile Updated";
                    msg.CssClass = "text-success";
                }
                else
                {
                    msg.Text     = "Select an image file.";
                    msg.CssClass = "text-danger";
                }
            }
            else
            {
                SqlDataSourceDeveloper.Update();
                msg.Text     = "Profile Updated";
                msg.CssClass = "text-success";
            }
            //Response.Redirect("ViewDeveloper.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);
        //SqlDataSourceDeveloper.Update();
        //Response.Redirect("ViewDeveloper.aspx");
    }