/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ImgBtnExportUnionBook_Click(object sender, EventArgs e) { try { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } BLL_Crew_Admin objBLL = new BLL_Crew_Admin(); DataTable dt = objBLL.CRUD_UnionBook("", "R", 0, 0, txtUnionBookFilter.Text != "" ? txtUnionBookFilter.Text : null, sortbycoloumn, sortdirection, null, null, ref rowcount, ref Result); string[] HeaderCaptions = { "Union Book" }; string[] DataColumnsName = { "UnionBook" }; GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Union Book", "Union Book", ""); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void BindUnionBook() { ddlUnionBook.DataSource = objCrewAdmin.CRUD_UnionBook("", "R", 0, 0, null, null, null, 1, 100, ref i, ref i); ddlUnionBook.DataValueField = "ID"; ddlUnionBook.DataTextField = "UnionBook"; ddlUnionBook.DataBind(); ddlUnionBook.Items.Insert(0, new ListItem("-SELECT-", "0")); }
/// <summary> /// Delete Oil Major /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void onDeleteUnionBook(object source, CommandEventArgs e) { try { int rowcount = 0; BLL_Crew_Admin objBLL = new BLL_Crew_Admin(); DataTable dt = objBLL.CRUD_UnionBook("", "D", GetSessionUserID(), Convert.ToInt32(e.CommandArgument.ToString()), null, "", null, null, null, ref rowcount, ref Result); if (Result > 0) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ShowMessage", "alert('Record deleted successfully')", true); } BindUnionBook(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
/// <summary> /// To save or update oil major /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveUnionBook_OnClick(object sender, EventArgs e) { try { if (Convert.ToInt32(hdnUnionBookId.Value) > 0) { int rowcount = 0; BLL_Crew_Admin objBLL = new BLL_Crew_Admin(); DataTable dt = objBLL.CRUD_UnionBook(txtUnionBook.Text.Trim(), "U", GetSessionUserID(), Convert.ToInt32(hdnUnionBookId.Value), null, "", null, null, null, ref rowcount, ref Result); ///Result == 2 Already exists if (Result < 0) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AlreadyExists", "alert('The selected Union Book already exist in the system');showModal('divAddUnionBook', false);", true); } else if (Result > 0) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AlreadyExists", "alert('" + UDFLib.GetException("SuccessMessage/UpdateMessage") + "');hideModal('divAddUnionBook');", true); BindUnionBook(); } } else { int rowcount = 0; BLL_Crew_Admin objBLL = new BLL_Crew_Admin(); DataTable dt = objBLL.CRUD_UnionBook(txtUnionBook.Text.Trim(), "I", GetSessionUserID(), 0, null, "", null, null, null, ref rowcount, ref Result); ///Result == 2 Already exists if (Result < 0) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AlreadyExists", "alert('The selected Union Book already exist in the system');showModal('divAddUnionBook', false);", true); } else if (Result > 0) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AlreadyExists", "alert('" + UDFLib.GetException("SuccessMessage/SaveMessage") + "');hideModal('divAddUnionBook');", true); BindUnionBook(); } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
/// <summary> /// Bind School /// </summary> public void BindUnionBook() { try { int rowcount = ucCustomPager1UnionBook.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN_UNIONBOOK"] == null) ? null : (ViewState["SORTBYCOLOUMN_UNIONBOOK"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION_UNIONBOOK"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION_UNIONBOOK"].ToString()); } BLL_Crew_Admin objBLL = new BLL_Crew_Admin(); DataTable dt = objBLL.CRUD_UnionBook("", "R", 0, 0, txtUnionBookFilter.Text != "" ? txtUnionBookFilter.Text : null, sortbycoloumn, sortdirection , ucCustomPager1UnionBook.CurrentPageIndex, ucCustomPager1UnionBook.PageSize, ref rowcount, ref Result); if (ucCustomPager1UnionBook.isCountRecord == 1) { ucCustomPager1UnionBook.CountTotalRec = rowcount.ToString(); ucCustomPager1UnionBook.BuildPager(); } if (dt.Rows.Count > 0) { gvUnionBook.DataSource = dt; gvUnionBook.DataBind(); ImgBtnExportUnionBook.Visible = true; } else { gvUnionBook.DataSource = null; gvUnionBook.DataBind(); ImgBtnExportUnionBook.Visible = false; } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }