protected void btn_add_Click1(object sender, EventArgs e)
    {
        try
        {
            tbl_rescue_BAL objbal = new tbl_rescue_BAL();
            tbl_rescue_DAL objdal = new tbl_rescue_DAL();


            objdal.int_voluntar_team_id = Convert.ToInt16(ddl_voluntar_team_name.SelectedItem.Value);
            objdal.str_rescue_place     = txt_rescue_place.Text;
            objdal.date_rescue_date     = Convert.ToDateTime(txt_rescue_date.Text);
            lblmsg.Visible = true;
            int val = objbal.insert_data(objdal);
            if (val > 0)
            {
                binddata("");
                lblmsg.Text      = "successfully inserted";
                lblmsg.ForeColor = System.Drawing.Color.Green;
            }
            else if (val == -1)
            {
                lblmsg.Text      = "name duplicate is bot allowed";
                lblmsg.ForeColor = System.Drawing.Color.Red;
            }



            changepanel(1, 0);
        }
        catch (Exception ex)
        {
        }
    }
    protected void btn_update_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_rescue_BAL objbal = new tbl_rescue_BAL();
            tbl_rescue_DAL objdal = new tbl_rescue_DAL();

            objdal.int_rescue_id        = Convert.ToInt16(ViewState["id"]);
            objdal.int_voluntar_team_id = Convert.ToInt16(ddl_voluntar_team_name.SelectedItem.Value);
            objdal.str_rescue_place     = txt_rescue_place.Text;
            objdal.date_rescue_date     = Convert.ToDateTime(txt_rescue_date.Text);

            lblmsg.Visible = true;
            int val = objbal.update_data(objdal);
            objbal.update_data(objdal);
            binddata("");
            changepanel(1, 0);
            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;
            }
        }
        catch (Exception ex)
        {
        }
    }
Exemple #3
0
        public int delete_data(tbl_rescue_DAL objdal)
        {
            SqlCommand cm = new SqlCommand("delete_tbl_rescue", cn);

            cm.CommandType = CommandType.StoredProcedure;

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

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

            cn.Close();

            return(val);
        }
Exemple #4
0
        public int update_data(tbl_rescue_DAL objdal)
        {
            SqlCommand cm = new SqlCommand("update_tbl_rescue", cn);

            cm.CommandType = CommandType.StoredProcedure;

            cm.Parameters.AddWithValue("@int_rescue_id", objdal.int_rescue_id);
            cm.Parameters.AddWithValue("@int_voluntar_team_id", objdal.int_voluntar_team_id);
            cm.Parameters.AddWithValue("@str_rescue_place", objdal.str_rescue_place);
            cm.Parameters.AddWithValue("@date_rescue_date", objdal.date_rescue_date);


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

            cn.Close();

            return(val);
        }
    protected void btn_select_delete_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_rescue_BAL objbal = new tbl_rescue_BAL();
            tbl_rescue_DAL objdal = new tbl_rescue_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_id = Convert.ToInt16(id.Value);
                    objbal.delete_data(objdal);
                    binddata("");
                }
            }
        }
        catch (Exception ex)
        {
        }
    }