示例#1
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;
        }
    }
示例#2
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);
    }
示例#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;
    }
示例#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)
        {
        }
    }
        public int delete_data(tbl_user_DAL objdal)
        {
            SqlCommand cm = new SqlCommand("delete_tbl_user", cn);

            cm.CommandType = CommandType.StoredProcedure;

            cm.Parameters.AddWithValue("@int_user_id", objdal.int_user_id);

            cn.Open();
            int val = Convert.ToInt16(cm.ExecuteScalar());

            cn.Close();

            return(val);
        }
        public int update_pass(tbl_user_DAL objdal)
        {
            SqlConnection cn = new SqlConnection(ConfigurationSettings.AppSettings["dbconnect"]);
            SqlCommand    cm = new SqlCommand("update_tbl_user_change", cn);

            cm.CommandType = CommandType.StoredProcedure;

            cm.Parameters.AddWithValue("@int_user_id", objdal.int_user_id);
            cm.Parameters.AddWithValue("@str_password", objdal.str_password);

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

            da.Fill(ds);
            cn.Open();
            int val = Convert.ToInt16(cm.ExecuteNonQuery());

            cn.Close();
            return(val);
        }
        public int insert_data(tbl_user_DAL objdal)
        {
            SqlCommand cm = new SqlCommand("insert_tbl_user", cn);

            cm.CommandType = CommandType.StoredProcedure;



            cm.Parameters.AddWithValue("@str_user_name", objdal.str_user_name);
            cm.Parameters.AddWithValue("@str_address", objdal.str_address);
            cm.Parameters.AddWithValue("@int_contact", objdal.int_contact);
            cm.Parameters.AddWithValue("@str_email", objdal.str_email);
            cm.Parameters.AddWithValue("@str_password", objdal.str_password);

            cn.Open();
            int val = Convert.ToInt16(cm.ExecuteScalar());

            cn.Close();

            return(val);
        }
示例#8
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)
        {
        }
    }