public int insert_data(tbl_member_DAL objdal)
        {
            SqlCommand cm = new SqlCommand("insert_tbl_member", cn);

            cm.CommandType = CommandType.StoredProcedure;



            cm.Parameters.AddWithValue("@int_disaster_id", objdal.int_disaster_id);
            cm.Parameters.AddWithValue("@str_member_name", objdal.str_member_name);
            cm.Parameters.AddWithValue("@int_designation_id", objdal.int_designation_id);
            cm.Parameters.AddWithValue("@str_current_working", objdal.str_current_working);
            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);
        }
        public int update_data(tbl_member_DAL objdal)
        {
            SqlConnection cn = new SqlConnection(ConfigurationSettings.AppSettings["dbconnect"]);
            SqlCommand    cm = new SqlCommand("update_tbl_member", cn);

            cm.CommandType = CommandType.StoredProcedure;

            cm.Parameters.AddWithValue("@int_member_id", objdal.int_member_id);
            cm.Parameters.AddWithValue("@int_disaster_id", objdal.int_disaster_id);
            cm.Parameters.AddWithValue("@str_member_name", objdal.str_member_name);
            cm.Parameters.AddWithValue("@int_designation_id", objdal.int_designation_id);
            cm.Parameters.AddWithValue("@str_current_working", objdal.str_current_working);
            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);

            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 delete_data(tbl_member_DAL objdal)
        {
            SqlCommand cm = new SqlCommand("delete_tbl_member", cn);

            cm.CommandType = CommandType.StoredProcedure;

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

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

            cn.Close();

            return(val);
        }
    protected void btn_add_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_member_BAL objbal   = new tbl_member_BAL();
            tbl_member_DAL objdal   = new tbl_member_DAL();
            cryptography   objcrypt = new cryptography();

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

            objdal.int_disaster_id    = Convert.ToInt16(ddl_disaster_master.SelectedItem.Value);
            objdal.str_member_name    = txt_member_name.Text;
            objdal.int_designation_id = Convert.ToInt16(ddl_designation_name.SelectedItem.Value);


            objdal.str_current_working = txt_currentworking.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      = "Data successfully inserted";
                lblmsg.ForeColor = System.Drawing.Color.Green;
                ddl_disaster_master.ClearSelection();
                txt_member_name.Text = string.Empty;
                ddl_designation_name.ClearSelection();
                txt_currentworking.Text = string.Empty;
                txt_address.Text        = string.Empty;
                txt_contact.Text        = string.Empty;
                txt_email.Text          = string.Empty;
            }
        }
        catch (Exception ex)
        {
        }
    }
示例#5
0
    protected void btn_select_delete_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_member_BAL objbal = new tbl_member_BAL();
            tbl_member_DAL objdal = new tbl_member_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_member_id = Convert.ToInt16(id.Value);
                    objbal.delete_data(objdal);
                    binddata("");
                }
            }
        }
        catch (Exception ex)
        {
        }
    }