/// <summary> /// BUTTON [查詢]鈕(上方) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_up_Query_Click(object sender, EventArgs e) { #region try { #region 清空商品儲區移轉明細資料 //抓取本頁初次登記的時間 this.gv_Item_Detl.DataSource = null; this.gv_Item_Detl.DataBind(); Session["CRM071_gv_Item_Detl" + PageTimeStamp.Value] = null; #endregion #region 檢查條件 string s_CheckPage = CheckPage(sender); if (s_CheckPage != string.Empty) { this.ErrorMsgLabel.Text = s_CheckPage; return; } #endregion #region 傳入參數 BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_up_TRANS_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false)); ParameterList.Add(Session["UID"].ToString()); #endregion #region 取得資料 DataTable dt_Return = new DataTable(); BCO.RecordCRMOrder bco = new BCO.RecordCRMOrder(ConntionDB); dt_Return = bco.QueryForTransfer(ParameterList); bAfterQueryDataBinding = true; if (dt_Return != null && !dt_Return.Columns.Contains("CHECKED"))//增加欄位以方便判別是否已勾選 dt_Return.Columns.Add("CHECKED"); #endregion #region 資料與GridView繫結 //抓取本頁初次登記的時間 string SessionIDName = "CRM071_gv_WaitForWork" + PageTimeStamp.Value; Session["SessionID"] = SessionIDName; Session[SessionIDName] = dt_Return; this.gv_WaitForWork.DataSource = dt_Return; this.gv_WaitForWork.PageSize = (TextBoxPagesize_Query.Text == "") ? 20 : (int.Parse(TextBoxPagesize_Query.Text) <= 0) ? 20 : int.Parse(TextBoxPagesize_Query.Text); this.gv_WaitForWork.DataBind(); bAfterQueryDataBinding = false; #endregion #region 檢查是否有資料 string s_ScriptManager_Script = string.Empty; if (dt_Return.Rows.Count == 0) { s_ScriptManager_Script = @" document.getElementById('" + this.panel_Tab2.ClientID + @"').style.display = 'none'; document.getElementById('" + this.but_Execute.ClientID + @"').disabled = true;"; this.ErrorMsgLabel.Text = "查無資料"; } else { s_ScriptManager_Script = @" document.getElementById('" + this.panel_Tab2.ClientID + @"').style.display = 'block'; document.getElementById('" + this.but_Execute.ClientID + @"').disabled = false;"; } ScriptManager.RegisterStartupScript(this.up_gv_WaitForWork, typeof(UpdatePanel), "CRM071", s_ScriptManager_Script, true); #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { } #endregion }