public int update_data(tbl_rescue_person_DAL objdal)
        {
            SqlCommand cm = new SqlCommand("update_tbl_rescue_person", cn);

            cm.CommandType = CommandType.StoredProcedure;

            cm.Parameters.AddWithValue("@int_rescue_person_id", objdal.int_rescue_person_id);
            cm.Parameters.AddWithValue("@int_lost_id", objdal.int_lost_id);
            cm.Parameters.AddWithValue("@str_address", objdal.str_address);
            cm.Parameters.AddWithValue("@int_contact", objdal.int_contact);
            cm.Parameters.AddWithValue("@str_description", objdal.str_description);
            cm.Parameters.AddWithValue("@int_voluntar_team_id", objdal.int_voluntar_team_id);



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

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

            cn.Close();
            return(val);
        }
Пример #2
0
    protected void btn_add_Click1(object sender, EventArgs e)
    {
        tbl_rescue_person_BAL objbal = new tbl_rescue_person_BAL();
        tbl_rescue_person_DAL objdal = new tbl_rescue_person_DAL();


        objdal.int_voluntar_team_id = Convert.ToInt16(ddl_voluntar_team_name.SelectedItem.Value);
        objdal.int_lost_id          = Convert.ToInt16(ddl_lost_person_name.SelectedItem.Value);

        objdal.str_address     = txt_address.Text;
        objdal.int_contact     = Convert.ToInt64(txt_contact.Text);
        objdal.str_description = txt_description.Text;
        lblmsg.Visible         = true;
        int val = objbal.insert_data(objdal);

        if (val > 0)
        {
            lblmsg.Text      = "successfully inserted";
            lblmsg.ForeColor = System.Drawing.Color.Green;
            binddata("");
        }
        else if (val == -1)
        {
            lblmsg.Text      = "name duplicate is not allowed";
            lblmsg.ForeColor = System.Drawing.Color.Red;
        }



        changepanel(1, 0);
    }
Пример #3
0
    protected void btn_update_Click(object sender, EventArgs e)
    {
        tbl_rescue_person_BAL objbal = new tbl_rescue_person_BAL();
        tbl_rescue_person_DAL objdal = new tbl_rescue_person_DAL();

        objdal.int_rescue_person_id = Convert.ToInt16(ViewState["id"]);
        objdal.int_voluntar_team_id = Convert.ToInt16(ddl_voluntar_team_name.SelectedItem.Value);
        objdal.int_lost_id          = Convert.ToInt16(ddl_lost_person_name.SelectedItem.Value);

        objdal.str_address     = txt_address.Text;
        objdal.int_contact     = Convert.ToInt64(txt_contact.Text);
        objdal.str_description = txt_description.Text;
        lblmsg.Visible         = true;
        int val = objbal.update_data(objdal);

        objbal.update_data(objdal);
        binddata("");
        if (val > 0)
        {
            lblmsg.Text      = "Data Update";
            lblmsg.ForeColor = System.Drawing.Color.Green;
        }
        else
        {
            lblmsg.Text      = "Error in Process,try again";
            lblmsg.ForeColor = System.Drawing.Color.Red;
        }
        changepanel(1, 0);
    }
        public int delete_data(tbl_rescue_person_DAL objdal)
        {
            SqlCommand cm = new SqlCommand("delete_tbl_rescue_person", cn);

            cm.CommandType = CommandType.StoredProcedure;

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

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

            cn.Close();

            return(val);
        }
Пример #5
0
    protected void btn_select_delete_Click(object sender, EventArgs e)
    {
        tbl_rescue_person_BAL objbal = new tbl_rescue_person_BAL();
        tbl_rescue_person_DAL objdal = new tbl_rescue_person_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_rescue_person_id = Convert.ToInt16(id.Value);
                objbal.delete_data(objdal);
                binddata("");
            }
        }
    }
        public int insert_data(tbl_rescue_person_DAL objdal)
        {
            SqlCommand cm = new SqlCommand("insert_tbl_rescue_person", cn);

            cm.CommandType = CommandType.StoredProcedure;



            cm.Parameters.AddWithValue("@int_lost_id", objdal.int_lost_id);
            cm.Parameters.AddWithValue("@str_address", objdal.str_address);
            cm.Parameters.AddWithValue("@int_contact", objdal.int_contact);
            cm.Parameters.AddWithValue("@str_description", objdal.str_description);
            cm.Parameters.AddWithValue("@int_voluntar_team_id", objdal.int_voluntar_team_id);



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

            cn.Close();

            return(val);
        }