private void QueryRecordMainFromToolbar(string s_Code, BrowseType bt) { #region try { BCO.RecordCRMRecord bco = new BCO.RecordCRMRecord(ConntionDB); ArrayList ParameterList = new ArrayList(); #region 查詢指定之CODE ParameterList.Clear(); ParameterList.Add(txt_CODE.Text); ParameterList.Add(slp_STORE.Text); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(bt.ToString()); string strCodeWanted = ""; strCodeWanted = bco.QueryRecordMainByTool(ParameterList); #endregion #region 查詢條件設定 ParameterList.Clear(); ParameterList.Add(null); ParameterList.Add(strCodeWanted); ParameterList.Add(null); ParameterList.Add(null); ParameterList.Add(null); ParameterList.Add(null); ParameterList.Add(null); ParameterList.Add(null); ParameterList.Add(null); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); #endregion #region 取得查詢資料 DataSet ds_Return = new DataSet(); ds_Return = bco.QueryCRMRecordByFind2(ParameterList); if (ds_Return.Tables.Count == 0) {//沒查到資料 System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('查無資料')", true); #region 設定頁面模式 this.hid_Page_Status.Value = "QUERY"; this.txt_Page_Status.Text = "QUERY"; #endregion return; } else {//有查到資料 #region 使用XML放置到前端資料 #region 將空白的資料做處理 GetDataSetBeforeSaveXML(ref ds_Return); #endregion xml_OLDData.InnerHtml = ds_Return.GetXml(); #endregion #region 設定各個欄位 this.slp_Up_CHAN_NO.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["CHAN_NO"].ToString();//通路 this.slp_Z_O.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["Z_O"].ToString();//營業所 this.txt_CODE.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["CODE"].ToString();//流水編號 this.slp_STORE.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["STORE"].ToString();//門市 this.slp_Up_BUSDATE.Text = ((DateTime)ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["BUSDATE"]).ToShortDateString();//處理日期 this.txt_ANSWER_TIME.Text = ((DateTime)ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["ANSWER_TIME"]).ToString("HH:mm");//接聽時間 yyyy/MM/dd HH:mm:ss this.slp_SAL_ID.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["SAL_ID"].ToString();//營業人員 this.slp_BUSUID.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["BUSUID"].ToString();//處理人員 this.txt_ROUTD_ID.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["ROUTE_ID"].ToString();//路線 this.txt_ROUTD_STEP.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["ROUTE_STEP"].ToString();//路順 this.txt_STORE_TEL_AREA.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["STORE_TEL_AREA"].ToString();//電話-區域號碼 this.txt_STORE_TEL_NO.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["STORE_TEL_NO"].ToString();//電話號碼 this.txt_STORE_FAX_AREA.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["FAX_AREA"].ToString();//傳真-區域號碼 this.txt_STORE_FAX_NO.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["FAX_NO"].ToString();//傳真號碼 this.txt_STORE_ADDRESS.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["STORE_ADDRESS"].ToString();//地址 this.txt_DEAL_CONTENT.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["DEAL_CONTENT"].ToString();//處理內容 foreach (DataRow dRow in ds_Return.Tables["VDS_CRM_RECORD_DETL"].Rows) { chkbl_Detail.Items.FindByValue(dRow["ONLINE_NO"].ToString()).Selected = true; } #endregion #region 設定頁面模式 this.hid_Page_Status.Value = "VIEW"; this.txt_Page_Status.Text = "VIEW"; #endregion #region 設定各欄位模式ReadOnly this.slp_Up_CHAN_NO.ReadOnly = true; this.slp_Z_O.ReadOnly = true; this.txt_CODE.ReadOnly = true; this.txt_CODE.CssClass = "readtxtbox"; this.slp_STORE.ReadOnly = true; this.slp_Up_BUSDATE.ReadOnly = true; this.txt_ANSWER_TIME.ReadOnly = true; this.slp_SAL_ID.ReadOnly = true; this.slp_BUSUID.ReadOnly = true; this.txt_ROUTD_ID.ReadOnly = true; this.txt_ROUTD_ID.CssClass = "readtxtbox"; this.txt_ROUTD_STEP.ReadOnly = true; this.txt_ROUTD_STEP.CssClass = "readtxtbox"; this.txt_STORE_TEL_AREA.ReadOnly = true; this.txt_STORE_TEL_AREA.CssClass = "readtxtbox"; this.txt_STORE_TEL_NO.ReadOnly = true; this.txt_STORE_TEL_NO.CssClass = "readtxtbox"; this.txt_STORE_FAX_AREA.ReadOnly = true; this.txt_STORE_FAX_AREA.CssClass = "readtxtbox"; this.txt_STORE_FAX_NO.ReadOnly = true; this.txt_STORE_FAX_NO.CssClass = "readtxtbox"; this.txt_STORE_ADDRESS.ReadOnly = true; this.txt_STORE_ADDRESS.CssClass = "readtxtbox"; this.txt_DEAL_CONTENT.ReadOnly = true; this.txt_DEAL_CONTENT.CssClass = "readtxtbox"; this.chkbl_Detail.Enabled = false; #endregion } #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { GetPageDefault(); } #endregion }
/// <summary> /// BUTTON 上面的查詢鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_Up_Query_Click(object sender, EventArgs e) { //System.Threading.Thread.Sleep(2000); try { if (this.hid_Page_Status.Value == "QUERY") { // 流水編號不為空白時,需檢查必填欄位 if (this.txt_CODE.Text.Trim() == string.Empty) { #region 檢查必填欄位 if (this.slp_Up_CHAN_NO.Text.Trim() == string.Empty) { txt_STORE_Onblur(); } if (this.slp_Up_CHAN_NO.Text.Trim() == string.Empty) { System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('\"通路\"欄位不可為空白')", true); #region 設定頁面模式 this.hid_Page_Status.Value = "QUERY"; this.txt_Page_Status.Text = "QUERY"; GetPageDefault(); #endregion return; } if (GetStringLen(txt_STORE_ADDRESS.Text) > 100) { System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('\"地址\"欄位資料長度太長')", true); #region 設定頁面模式 this.hid_Page_Status.Value = "QUERY"; this.txt_Page_Status.Text = "QUERY"; GetPageDefault(); #endregion return; } if (GetStringLen(txt_DEAL_CONTENT.Text) > 600) { System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('\"處理內容\"欄位資料長度太長')", true); #region 設定頁面模式 this.hid_Page_Status.Value = "QUERY"; this.txt_Page_Status.Text = "QUERY"; GetPageDefault(); #endregion return; } #endregion } #region 查詢條件設定 ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(this.slp_Up_CHAN_NO.Text.Trim()); ParameterList.Add(this.txt_CODE.Text.Trim()); ParameterList.Add(this.slp_STORE.Text.Trim()); ParameterList.Add(this.slp_Up_BUSDATE.Text.Trim()); ParameterList.Add(this.txt_ANSWER_TIME.Text.Trim()); ParameterList.Add(this.slp_BUSUID.Text.Trim()); ParameterList.Add(this.txt_STORE_TEL_AREA.Text.Trim()); ParameterList.Add(this.txt_STORE_FAX_NO.Text.Trim()); ParameterList.Add(this.txt_DEAL_CONTENT.Text.Trim()); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); #endregion #region 取得查詢資料 DataSet ds_Return = new DataSet(); BCO.RecordCRMRecord bco = new BCO.RecordCRMRecord(ConntionDB); ds_Return = bco.QueryCRMRecordByFind2(ParameterList); if (ds_Return.Tables.Count == 0) {//沒查到資料 System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('查無資料')", true); #region 設定頁面模式 this.hid_Page_Status.Value = "QUERY"; this.txt_Page_Status.Text = "QUERY"; #endregion return; } else {//有查到資料 #region 使用XML放置到前端資料 #region 將空白的資料做處理 GetDataSetBeforeSaveXML(ref ds_Return); #endregion xml_OLDData.InnerHtml = ds_Return.GetXml(); #endregion #region 設定各個欄位 this.slp_Up_CHAN_NO.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["CHAN_NO"].ToString();//通路 this.slp_Z_O.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["Z_O"].ToString();//營業所 this.txt_CODE.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["CODE"].ToString();//流水編號 this.slp_STORE.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["STORE"].ToString();//門市 this.slp_Up_BUSDATE.Text = ((DateTime)ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["BUSDATE"]).ToShortDateString();//處理日期 this.txt_ANSWER_TIME.Text = ((DateTime)ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["ANSWER_TIME"]).ToString("HH:mm");//接聽時間 yyyy/MM/dd HH:mm:ss this.slp_SAL_ID.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["SAL_ID"].ToString();//營業人員 this.slp_BUSUID.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["BUSUID"].ToString();//處理人員 this.txt_ROUTD_ID.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["ROUTE_ID"].ToString();//路線 this.txt_ROUTD_STEP.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["ROUTE_STEP"].ToString();//路順 this.txt_STORE_TEL_AREA.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["STORE_TEL_AREA"].ToString();//電話-區域號碼 this.txt_STORE_TEL_NO.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["STORE_TEL_NO"].ToString();//電話號碼 this.txt_STORE_FAX_AREA.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["FAX_AREA"].ToString();//傳真-區域號碼 this.txt_STORE_FAX_NO.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["FAX_NO"].ToString();//傳真號碼 this.txt_STORE_ADDRESS.Text = ds_Return.Tables["VDS_STM_STORE"].Rows[0]["STORE_ADDRESS"].ToString();//地址 this.txt_DEAL_CONTENT.Text = ds_Return.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["DEAL_CONTENT"].ToString();//處理內容 foreach (DataRow dRow in ds_Return.Tables["VDS_CRM_RECORD_DETL"].Rows) { chkbl_Detail.Items.FindByValue(dRow["ONLINE_NO"].ToString()).Selected = true; } #endregion #region 設定頁面模式 this.hid_Page_Status.Value = "VIEW"; this.txt_Page_Status.Text = "VIEW"; #endregion #region 設定各欄位模式ReadOnly this.slp_Up_CHAN_NO.ReadOnly = true; this.slp_Z_O.ReadOnly = true; this.txt_CODE.ReadOnly = true; this.txt_CODE.CssClass = "readtxtbox"; this.slp_STORE.ReadOnly = true; this.slp_Up_BUSDATE.ReadOnly = true; this.txt_ANSWER_TIME.ReadOnly = true; this.slp_SAL_ID.ReadOnly = true; this.slp_BUSUID.ReadOnly = true; this.txt_ROUTD_ID.ReadOnly = true; this.txt_ROUTD_ID.CssClass = "readtxtbox"; this.txt_ROUTD_STEP.ReadOnly = true; this.txt_ROUTD_STEP.CssClass = "readtxtbox"; this.txt_STORE_TEL_AREA.ReadOnly = true; this.txt_STORE_TEL_AREA.CssClass = "readtxtbox"; this.txt_STORE_TEL_NO.ReadOnly = true; this.txt_STORE_TEL_NO.CssClass = "readtxtbox"; this.txt_STORE_FAX_AREA.ReadOnly = true; this.txt_STORE_FAX_AREA.CssClass = "readtxtbox"; this.txt_STORE_FAX_NO.ReadOnly = true; this.txt_STORE_FAX_NO.CssClass = "readtxtbox"; this.txt_STORE_ADDRESS.ReadOnly = true; this.txt_STORE_ADDRESS.CssClass = "readtxtbox"; this.txt_DEAL_CONTENT.ReadOnly = true; this.txt_DEAL_CONTENT.CssClass = "readtxtbox"; this.chkbl_Detail.Enabled = false; #endregion } #endregion } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { GetPageDefault(); } }