Ejemplo n.º 1
0
    protected void btn_save_Click(object sender, EventArgs e)
    {
        tbl_user_BAL objbal = new tbl_user_BAL();
        tbl_user_DAL objdal = new tbl_user_DAL();

        cryptography objcrypt = new cryptography();

        SqlConnection cn    = new SqlConnection(ConfigurationManager.AppSettings["dbconnect"]);
        string        query = "select_tbl_user";
        SqlCommand    cm    = new SqlCommand(query, cn);

        cm.CommandType = CommandType.StoredProcedure;

        cm.Parameters.AddWithValue("@cnd", " where int_user_id=" + Session["uid"].ToString());


        SqlDataAdapter da = new SqlDataAdapter(cm);
        DataSet        ds = new DataSet();

        da.Fill(ds);

        if (ds.Tables[0].Rows.Count > 0)
        {
            string pwd = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString());

            if (pwd == old_pass.Text)
            {
                objdal.int_user_id = Convert.ToInt16(Session["uid"]);



                string str = objcrypt.Encrypt(new_pass.Text);


                objdal.str_password = str;

                int val = objbal.update_pass(objdal);

                objbal.update_pass(objdal);


                if (val > 0)
                {
                    lblmsg.Text      = "your password is successfully updated.";
                    lblmsg.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    lblmsg.Text      = "Error in Process,try again.";
                    lblmsg.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                lblmsg.Text      = "your have entered wrong password.";
                lblmsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        changepanel(1, 0, 0);
    }
Ejemplo n.º 2
0
    protected void btn_update_Click(object sender, EventArgs e)
    {
        tbl_user_BAL objbal = new tbl_user_BAL();
        tbl_user_DAL objdal = new tbl_user_DAL();


        lblmsg.Visible       = true;
        objdal.int_user_id   = Convert.ToInt16(Session["uid"]);
        objdal.str_user_name = txt_name.Text;
        objdal.str_address   = txt_add.Text;
        objdal.int_contact   = Convert.ToInt64(txt_con.Text);
        objdal.str_email     = txt_email.Text;


        int val = objbal.update_data(objdal);

        objbal.update_data(objdal);
        binddata("");


        if (val > 0)
        {
            lblmsg.Text      = "Your data is successfully updated";
            lblmsg.ForeColor = System.Drawing.Color.Green;
        }
        else
        {
            lblmsg.Text      = "Error in Process,try again";
            lblmsg.ForeColor = System.Drawing.Color.Red;
        }
    }
Ejemplo n.º 3
0
    protected void l_back_Click(object sender, EventArgs e)
    {
        tbl_user_BAL objbal = new tbl_user_BAL();
        tbl_user_DAL objdal = new tbl_user_DAL();


        SqlConnection cn    = new SqlConnection(ConfigurationManager.AppSettings["dbconnect"]);
        string        query = "select_tbl_user";
        SqlCommand    cm    = new SqlCommand(query, cn);

        cm.CommandType = CommandType.StoredProcedure;
        cm.Parameters.AddWithValue("@cnd", " where int_user_id=" + Session["uid"].ToString());

        SqlDataAdapter da = new SqlDataAdapter(cm);
        DataSet        ds = new DataSet();

        da.Fill(ds);

        if (ds.Tables[0].Rows.Count > 0)
        {
            lblname.Text  = ds.Tables[0].Rows[0]["str_user_name"].ToString();
            lbladd.Text   = ds.Tables[0].Rows[0]["str_address"].ToString();
            lblcont.Text  = ds.Tables[0].Rows[0]["int_contact"].ToString();
            lblemail.Text = ds.Tables[0].Rows[0]["str_email"].ToString();
        }

        changepanel(1, 0, 0);
        lblmsg.Visible = false;
    }
Ejemplo n.º 4
0
    protected void btn_add_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_user_BAL objbal   = new tbl_user_BAL();
            tbl_user_DAL objdal   = new tbl_user_DAL();
            cryptography objcrypt = new cryptography();

            string str = objcrypt.Encrypt(txt_password.Text);


            objdal.str_user_name = txt_user_name.Text;
            objdal.str_address   = txt_address.Text;
            objdal.int_contact   = Convert.ToInt64(txt_contact.Text);
            objdal.str_email     = txt_email.Text;
            objdal.str_password  = str;

            int val = objbal.insert_data(objdal);

            if (val > 0)
            {
                lblmsg.Text      = "Registration successfully Complate";
                lblmsg.ForeColor = System.Drawing.Color.Green;
            }
            Response.Redirect("home_page.aspx");
            cleardata();
        }
        catch (Exception ex)
        {
        }
    }
    protected void btn_add_Click1(object sender, EventArgs e)
    {
        try
        {
            tbl_user_BAL objbal   = new tbl_user_BAL();
            cryptography objcrypt = new cryptography();

            string query = "where str_email='" + txt_user_name.Text + "'";

            DataSet ds = objbal.getdata(query);


            if (ds.Tables[0].Rows.Count > 0)
            {
                string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString());
                //int cnt = Convert.ToInt16(ds.Tables[0].Rows[0]["int_user_id"]);
                if (str.Equals(txt_password.Text))
                {
                    Session["uname"] = txt_user_name.Text;
                    Session["uid"]   = ds.Tables[0].Rows[0]["int_user_id"];
                    Session["unm"]   = ds.Tables[0].Rows[0]["str_user_name"];
                    Session["add"]   = ds.Tables[0].Rows[0]["str_address"];
                    Session["con"]   = ds.Tables[0].Rows[0]["int_contact"];
                    Session["email"] = ds.Tables[0].Rows[0]["str_email"];
                    Response.Redirect("inquiry_page.aspx");
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 6
0
 public void binddata(string query)
 {
     try
     {
         tbl_user_BAL objbal = new tbl_user_BAL();
         DataSet      ds     = objbal.getdata(query);
         gvlist.DataSource = ds;
         gvlist.DataBind();
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 7
0
    public void binddata(string query)
    {
        tbl_user_BAL objbal = new tbl_user_BAL();
        DataSet      ds     = objbal.getdata(query);



        //DataBind();

        lblname.Text  = Session["unm"].ToString();
        lbladd.Text   = Session["add"].ToString();
        lblcont.Text  = Session["con"].ToString();
        lblemail.Text = Session["email"].ToString();
    }
Ejemplo n.º 8
0
    protected void btn_login_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_user_BAL objbal   = new tbl_user_BAL();
            cryptography objcrypt = new cryptography();

            string query = "where str_email='" + txt_user_name.Text + "'";

            DataSet ds = objbal.getdata(query);

            if (ds.Tables[0].Rows.Count > 0)
            {
                string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString());
                //int cnt = Convert.ToInt16(ds.Tables[0].Rows[0]["int_user_id"]);
                if (str == txt_password.Text)
                {
                    if (str.Equals(txt_password.Text))
                    {
                        Session["uname"] = txt_user_name.Text;
                        Session["uid"]   = ds.Tables[0].Rows[0]["int_user_id"];
                        Session["unm"]   = ds.Tables[0].Rows[0]["str_user_name"];
                        Session["add"]   = ds.Tables[0].Rows[0]["str_address"];
                        Session["con"]   = ds.Tables[0].Rows[0]["int_contact"];
                        Session["email"] = ds.Tables[0].Rows[0]["str_email"];
                        Response.Redirect("user_profile.aspx");
                    }
                }

                else
                {
                    lblmsg.Text      = "wrong emailid and password ..try again...";
                    lblmsg.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                lblmsg.Text      = "wrong emailid and password ..try again...";
                lblmsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 9
0
    protected void btn_select_delete_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_user_BAL objbal = new tbl_user_BAL();
            tbl_user_DAL objdal = new tbl_user_DAL();

            foreach (GridViewRow row in gvlist.Rows)
            {
                var check = row.FindControl("chkselect") as CheckBox;
                if (check.Checked)
                {
                    var id = row.FindControl("Hiddenid") as HiddenField;
                    objdal.int_user_id = Convert.ToInt16(id.Value);
                    objbal.delete_data(objdal);
                    binddata("");
                }
            }
        }
        catch (Exception ex)
        {
        }
    }