private void BindData() { plcPaging.Controls.Clear(); lblSearchResult.Text = ""; DataTable dt = new DataTable(); string Criteria = ""; if (Request.QueryString["printmode"] != null) { Criteria = Session["Criteria"].ToString(); } else { Criteria = GetCriteria(); Session["Criteria"] = Criteria; } if (!User.IsInRole("SuperAdmin")) { DataTable CommonDt = new bllCommon().GetSystemUserByUserName(User.Identity.Name); if (CommonDt.Rows.Count > 0) { string userId = CommonDt.Rows[0]["UserId"].ToString(); string unit = CommonDt.Rows[0]["CdoUnitId"].ToString(); UnitId = Convert.ToInt32(unit); } dt = new bllBasicInfo().GetBySearchParameter(CurrentPage * PageSize, PageSize, Criteria, PrintMode, UnitId); } else { dt = new bllBasicInfo().GetBySearchParameterForSuperAdmin(CurrentPage * PageSize, PageSize, Criteria, PrintMode); } gv.DataSource = dt; gv.DataBind(); if (dt.Rows.Count > 0) { TotalRec = Convert.ToInt32(dt.Rows[0]["TotalRecords"].ToString()); } else { lblSearchResult.Text = "No record found."; litPagingSummary.Text = ""; TotalRec = 0; } if (TotalRec <= 500) { plcPaging.Visible = false; } else { plcPaging.Visible = true; } }
protected void btnDelete_OnCommand(object sender, CommandEventArgs e) { try { string id = e.CommandArgument.ToString(); int del = new bllBasicInfo().Delete(id); MessageController.Show("Delete Sucessfully.", MessageType.Information, Page); BindData(); managePaging(); } catch (Exception ex) { MessageController.Show(ex.Message, MessageType.Error, Page); } }
protected void btnNext_Click(object sender, EventArgs e) { string BaNo = Session["ArmyNo"] as string; if (BaNo != null) { DataTable dt = new bllBasicInfo().SearchCommandoByStuBaNo(BaNo); if (dt.Rows.Count > 0) { TabContainer1.ActiveTabIndex++; } } else { MessageController.Show("First save basic information.", MessageType.Warning, Page); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["ArmyNo"] != null) { string armyNo = Request.QueryString["ArmyNo"].ToString(); namePnl.Visible = true; DataTable dt = new bllBasicInfo().SearchCommandoByStuBaNo(armyNo); tbxRnk.Text = dt.Rows[0]["RankName"].ToString(); tbxName.Text = dt.Rows[0]["Name"].ToString(); tbxArmsNo.Text = " (" + dt.Rows[0]["ArmyNo"].ToString() + ")"; } else { Session["ArmyNo"] = null; namePnl.Visible = false; } } MessageController.Clear(Page); }
private void LoadData() { string Criteria = ""; Criteria = SearchText; DataTable dtAdvanceSearch = new DataTable(); if (!User.IsInRole("SuperAdmin")) { DataTable CommonDt = new bllCommon().GetSystemUserByUserName(User.Identity.Name); if (CommonDt.Rows.Count > 0) { string userId = CommonDt.Rows[0]["UserId"].ToString(); string unit = CommonDt.Rows[0]["CdoUnitId"].ToString(); UnitId = Convert.ToInt32(unit); } dtAdvanceSearch = new bllBasicInfo().GetByAdvanceSearchParameter(0, 500000, Criteria, false, UnitId); } else { dtAdvanceSearch = new bllBasicInfo().GetByAdvanceSearchParameterForSuperAdmin(0, 500000, Criteria, false); } //DataTable CommonDt = new bllCommon().GetSystemUserByUserName(User.Identity.Name); //if (CommonDt.Rows.Count > 0) //{ // string userId = CommonDt.Rows[0]["UserId"].ToString(); // string unit = CommonDt.Rows[0]["CdoUnitId"].ToString(); // UnitId = Convert.ToInt32(unit); //} //DataTable dtAdvanceSearch = new bllBasicInfo().GetByAdvanceSearchParameter(0, 500000, Criteria, false, UnitId); Hashtable hTable = new Hashtable(); ArrayList duplicateList = new ArrayList(); foreach (DataRow drow in dtAdvanceSearch.Rows) { if (hTable.Contains(drow["ArmyNo"])) { duplicateList.Add(drow); } else { hTable.Add(drow["ArmyNo"], string.Empty); } } foreach (DataRow dRow in duplicateList) { dtAdvanceSearch.Rows.Remove(dRow); } dtAdvanceSearch.AcceptChanges(); gv.DataSource = dtAdvanceSearch; gv.DataBind(); if (dtAdvanceSearch.Rows.Count > 0) { TotalRec = dtAdvanceSearch.Rows.Count; //TotalRec = Convert.ToInt32(dtt.Rows[0]["TotalRecords"].ToString()); } else { lblSearchResult.Text = "No record found."; litPagingSummary.Text = ""; TotalRec = 0; } }
private void BindData() { DataTable dt = new bllBasicInfo().SearchCommandoByStuBaNo(ArmyNo); lbPrefix.Text = dt.Rows[0]["PrefixName"].ToString(); if (lbPrefix.Text == "") { lbPrefix.Text = "N/A"; } lbName.Text = dt.Rows[0]["Name"].ToString(); if (lbName.Text == "") { lbName.Text = "N/A"; } lbRank.Text = dt.Rows[0]["RankName"].ToString(); if (lbRank.Text == "") { lbRank.Text = "N/A"; } lblRankAndName.Text = lbRank.Text + " " + lbName.Text; lbService.Text = dt.Rows[0]["ServiceStatus"].ToString(); if (lbService.Text == "") { lbService.Text = "N/A"; } lbTrade.Text = dt.Rows[0]["TradeName"].ToString(); if (lbTrade.Text == "") { lbTrade.Text = "N/A"; } lbArms.Text = dt.Rows[0]["ArmsName"].ToString(); if (lbArms.Text == "") { lbArms.Text = "N/A"; } lbArmyNo.Text = dt.Rows[0]["ArmyNo"].ToString(); if (lbArmyNo.Text == "") { lbArmyNo.Text = "N/A"; } lbContact.Text = dt.Rows[0]["Contact"].ToString(); if (lbContact.Text == "") { lbContact.Text = "N/A"; } lbUnit.Text = dt.Rows[0]["UnitName"].ToString(); if (lbUnit.Text == "") { lbUnit.Text = "N/A"; } lbAccount.Text = dt.Rows[0]["TBLSalaryAccount"].ToString(); if (lbAccount.Text == "") { lbAccount.Text = "N/A"; } if (dt.Rows[0]["IsApproved"].ToString() == "False") { lbStatus.Text = "Unapproved"; } else { lbStatus.Text = "Approved"; } if (dt.Rows[0]["Image"].ToString() != "") { Img.ImageUrl = "~/UserFile/Photos/" + dt.Rows[0]["Image"].ToString(); } else { Img.ImageUrl = "~/App_Themes/Olive/images/NoImage.gif"; } DataTable dtMsn = new bllMSNInfo().GetMSNInfoByArmyNo(ArmyNo); if (dtMsn.Rows.Count > 0) { gvMSN.DataSource = dtMsn; gvMSN.DataBind(); } else { fsMsn.Visible = false; } DataTable dtDisState = new bllDiscipStateInfo().GetDiscipStateInfoByArmyNo(ArmyNo); if (dtDisState.Rows.Count > 0) { gvDiscState.DataSource = dtDisState; gvDiscState.DataBind(); } else { fsDiscState.Visible = false; } DataTable dtMedical = new bllMedicalInfo().GetMedicalInfoByArmyNo(ArmyNo); if (dtMedical.Rows.Count > 0) { gvMedical.DataSource = dtMedical; gvMedical.DataBind(); } else { fsMedical.Visible = false; } DataTable dtApr = new bllAPRInfo().GetAPRInfoByArmNo(ArmyNo); if (dtApr.Rows.Count > 0) { gvApr.DataSource = dtApr; gvApr.DataBind(); } else { fsApr.Visible = false; } DataTable dtSpQual = new bllSpecialQualityInfo().GetSpecialQualityInfoByArmyNo(ArmyNo); if (dtSpQual.Rows.Count > 0) { gvSq.DataSource = dtSpQual; gvSq.DataBind(); } else { fsSq.Visible = false; } DataTable dtCourse = new bllCourseInfo().GetCourseInfoByArmyNo(ArmyNo); if (dtCourse.Rows.Count > 0) { gvCourse.DataSource = dtCourse; gvCourse.DataBind(); } else { fsCourse.Visible = false; } DataTable dtCadre = new bllCadreInfo().GetCadreInfoByArmyNo(ArmyNo); if (dtCadre.Rows.Count > 0) { gvCadre.DataSource = dtCadre; gvCadre.DataBind(); } else { fsCadre.Visible = false; } DataTable dtCmdService = new bllCommandoServiceInfo().GetCommandoServiceInfoByArmyNo(ArmyNo); if (dtCmdService.Rows.Count > 0) { gvCmdService.DataSource = dtCmdService; gvCmdService.DataBind(); } else { fsCmdService.Visible = false; } DataTable dtNok = new bllNOKInfo().GetNOKInfoByArmyNo(ArmyNo); if (dtNok.Rows.Count > 0) { gvNok.DataSource = dtNok; gvNok.DataBind(); } else { fsNok.Visible = false; } }