示例#1
0
    protected void btn_add_Click1(object sender, EventArgs e)
    {
        try
        {
            tbl_area_BAL objbal = new tbl_area_BAL();
            tbl_area_DAL objdal = new tbl_area_DAL();


            objdal.str_area_name   = txt_area_name.Text;
            objdal.int_district_id = Convert.ToInt16(ddl_district.SelectedItem.Value);
            lblmsg.Visible         = true;
            int val = objbal.insert_data(objdal);

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



            changepanel(1, 0);
        }
        catch (Exception ex)
        {
        }
    }
示例#2
0
    protected void btn_update_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_area_BAL objbal = new tbl_area_BAL();
            tbl_area_DAL objdal = new tbl_area_DAL();


            lblmsg.Visible         = true;
            objdal.str_area_name   = txt_area_name.Text;
            objdal.int_area_id     = Convert.ToInt16(ViewState["id"]);
            objdal.int_district_id = Convert.ToInt16(ddl_district.SelectedItem.Value);
            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)
        {
        }
    }
示例#3
0
 public void binddata(string query)
 {
     try
     {
         tbl_area_BAL objbal = new tbl_area_BAL();
         DataSet      ds     = objbal.getdata(query);
         gvlist.DataSource = ds;
         gvlist.DataBind();
     }
     catch (Exception ex)
     {
     }
 }
示例#4
0
    protected void btn_select_delete_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_area_BAL objbal = new tbl_area_BAL();
            tbl_area_DAL objdal = new tbl_area_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_area_id = Convert.ToInt16(id.Value);
                    objbal.delete_data(objdal);
                    binddata("");
                }
            }
        }
        catch (Exception ex)
        {
        }
    }