private void QueryData() { #region LabelQueryRecordCount.Text = ""; string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); ALOModel.MaintainChainPO BCO = new ALOModel.MaintainChainPO(ConnectionDB); //DataTable dtMain = null; DataTable Dt = null; try { #region 取得主檔 2009-07-17 cyhsu add ArrayList ParameterList = new ArrayList();//20091113 ParameterList.Clear(); ParameterList.Add(SLP_StoreChain1.Text.Trim() == "" ? null : SLP_StoreChain1.Text.Trim()); //通路 dtMain = BCO.QueryPOSourceNoMainByFind(ParameterList); if (dtMain == null || (dtMain != null && dtMain.Rows.Count <= 0)) { ResultMsgLabel.Text = "通路主檔查無資料"; hdCanAddMain.Value = "1"; //可新增主檔 return; } hdCanAddMain.Value = "0"; //不可新增主檔 #endregion #region 取得明細 2009-07-17 cyhsu add // Dt = BCO.QueryChainPOByFind(GetInputValues()); Dt = BCO.QueryChainPODetlByFind2(GetDetlCondition()); #endregion Session[SessionIDName] = Dt; dtForMasterAndDetail = Dt; SmartGridView1.Visible = true; SmartGridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text); SmartGridView1.PageIndex = 0; SmartGridView1.DataSource = Dt; SmartGridView1.DataBind(); LabelQueryRecordCount.Text = string.Format(" {0} Rows ", Dt.Rows.Count.ToString()); if (Dt == null || (Dt != null && Dt.Rows.Count <= 0)) { SmartGridView1.Visible = false; ResultMsgLabel.Text = "明細檔查無資料"; } //20090722 modified BindingMasterDetailData(0); LastPageMode = PageCurrentMode.Query; CurrentPageMode = PageCurrentMode.Readonly; } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } #endregion }
private bool CheckCanAddMain(string strChanNo) { bool bResult = true; if (hdCanAddMain.Value == "0") { bResult = false; } else { if (CurrentPageMode == PageCurrentMode.Insert && strChanNo != string.Empty) { #region 取得主檔 ArrayList ParameterList = new ArrayList();//20091113 ParameterList.Clear(); ParameterList.Add(strChanNo); //通路 ALOModel.MaintainChainPO BCO = new ALOModel.MaintainChainPO(ConnectionDB); DataTable dtTmp = BCO.QueryPOSourceNoMainByFind(ParameterList); if (dtTmp == null || (dtTmp != null && dtTmp.Rows.Count == 0)) { hdCanAddMain.Value = "1"; //可新增主檔 } else { bResult = false; hdCanAddMain.Value = "0"; //不可新增主檔 } BCO = null; dtTmp.Dispose(); #endregion } } return bResult; }