/// <summary> /// 通路資料讀取 /// </summary> private void CheckStoreInformation() { string s_GridViewName = string.Empty; string s_GridView_CheckBoxName = string.Empty; #region 從資料庫讀取通路資料,並將資料放入XML ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear();//先清空傳放參數的ArrayList CRMModel.MaintainCRMPublic BCO = new CRMModel.MaintainCRMPublic(ConnectionDB); BCO.QuerySwitch(PIC.VDS2G.BSM.CRM.CRMCommon.QueryType.CRM122_Store_Chain_All, ParameterList); DataTable dt_Store_Chain = BCO.QuerySwitch(CRMModel.MaintainChainMessage.QueryType.CRM122_Store_Chain_All, ParameterList); dt_Store_Chain.TableName = "Store_Chain"; xml_Store_Chain.InnerHtml = dt_Store_Chain.DataSet.GetXml(); #endregion int i_Edit_txt_Chk_GridView_Count = 0;//計算GrideView 中有被 Checked 的筆數 if (FormView1.CurrentMode == FormViewMode.ReadOnly) { s_GridViewName = "Item_GridView"; s_GridView_CheckBoxName = "Item_chb_Code"; } else if (FormView1.CurrentMode == FormViewMode.Insert) { s_GridViewName = "Insert_GridView"; } else if (FormView1.CurrentMode == FormViewMode.Edit) { s_GridViewName = "Edit_GridView"; s_GridView_CheckBoxName = "Edit_chb_Code"; } ((GridView)FormView1.FindControl(s_GridViewName)).DataSource = dt_Store_Chain.DefaultView; ((GridView)FormView1.FindControl(s_GridViewName)).DataBind(); //如果不是新增狀態,才必須做以下動作 if (FormView1.CurrentMode == FormViewMode.ReadOnly || FormView1.CurrentMode == FormViewMode.Edit) { #region 使用XML轉回DataSet DataSet ds_Detail = new DataSet(); System.IO.StringReader sr = new System.IO.StringReader(xml_DetailOLDData.InnerHtml); ds_Detail.ReadXml(sr); #endregion if (ds_Detail.Tables.Count != 0) { for (int i = 0; i < ds_Detail.Tables[0].Rows.Count; i++) { for (int s = 0; s < ((GridView)FormView1.FindControl(s_GridViewName)).Rows.Count; s++) { if (ds_Detail.Tables[0].Rows[i]["CHAN_NO"].ToString() == ((CheckBox)((GridView)FormView1.FindControl(s_GridViewName)).Rows[s].FindControl(s_GridView_CheckBoxName)).Text) { ((CheckBox)((GridView)FormView1.FindControl(s_GridViewName)).Rows[s].FindControl(s_GridView_CheckBoxName)).Checked = true; if (FormView1.CurrentMode == FormViewMode.Edit) { i_Edit_txt_Chk_GridView_Count += 1; } }//if }//for }//for } } }
private void txt_STORE_Onblur() { if (slp_STORE.Text.Trim().Length == 0) return; TextBox txt_Up_CHAN_NO = (TextBox)this.slp_Up_CHAN_NO.FindControl("TextBoxCode");//上方通路 TextBox txt_STORE = (TextBox)this.slp_STORE.FindControl("TextBoxCode");//上方門市 try { ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(slp_STORE.Text); ParameterList.Add(slp_Up_CHAN_NO.Text); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); BCO.MaintainCRMPublic bco = new BCO.MaintainCRMPublic(ConntionDB); DataTable dt_Return = bco.QuerySwitch(BCO.MaintainCRMPublic.QueryType.QueryStore, ParameterList); if (dt_Return.Rows.Count == 0) { if (this.hid_Page_Status.Value == "INSERT") { slp_Z_O.Text = ""; slp_SAL_ID.Text = ""; txt_ROUTD_ID.Text = ""; txt_ROUTD_STEP.Text = ""; txt_STORE_TEL_AREA.Text = ""; txt_STORE_TEL_NO.Text = ""; txt_STORE_FAX_AREA.Text = ""; txt_STORE_FAX_NO.Text = ""; txt_STORE_ADDRESS.Text = ""; } ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM011.aspx", "alert('查無資料');document.getElementById('" + txt_STORE.ClientID + "').focus();document.getElementById('" + txt_STORE.ClientID + "').select();", true); } else if (this.hid_Page_Status.Value == "INSERT") { slp_Up_CHAN_NO.Text = dt_Return.Rows[0]["CHAN_NO"].ToString(); slp_Z_O.Text = dt_Return.Rows[0]["Z_O"].ToString(); slp_SAL_ID.Text = dt_Return.Rows[0]["SAL_ID"].ToString(); txt_ROUTD_ID.Text = dt_Return.Rows[0]["ROUTE_ID"].ToString(); txt_ROUTD_STEP.Text = dt_Return.Rows[0]["ROUTE_STEP"].ToString(); txt_STORE_TEL_AREA.Text = dt_Return.Rows[0]["STORE_TEL_AREA"].ToString(); txt_STORE_TEL_NO.Text = dt_Return.Rows[0]["STORE_TEL_NO"].ToString(); txt_STORE_FAX_AREA.Text = dt_Return.Rows[0]["STORE_FAX_AREA"].ToString(); txt_STORE_FAX_NO.Text = dt_Return.Rows[0]["STORE_FAX_NO"].ToString(); txt_STORE_ADDRESS.Text = dt_Return.Rows[0]["STORE_ADDRESS"].ToString(); } else if (this.hid_Page_Status.Value == "QUERY") { slp_Up_CHAN_NO.Text = dt_Return.Rows[0]["CHAN_NO"].ToString(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM011.aspx", "alert('" + ex.Message + "');document.getElementById('" + txt_STORE.ClientID + "').focus();document.getElementById('" + txt_STORE.ClientID + "').select();", true); } }
/// <summary> /// 將變更後的內部變量this.CallBackValue返回給前台JavaScript方法ReceiveServerData(string Value)。 /// </summary> /// <returns></returns> string ICallbackEventHandler.GetCallbackResult() { if ((this.hid_Page_Status.Value == "INSERT" || this.hid_Page_Status.Value == "QUERY") && CallBackValue != string.Empty) { string s_CHAN_NO = string.Empty; string s_STORE = string.Empty; System.Text.StringBuilder sb = new System.Text.StringBuilder(); CallBackValue = CallBackValue.Trim(); string[] s_Client_String = System.Text.RegularExpressions.Regex.Split(CallBackValue, "<partition>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); ArrayList ParameterList = new ArrayList();//20091117 if (s_Client_String[0] == "門市") { #region 離開欄位[@門市]時 s_STORE = s_Client_String[1];//門市 s_CHAN_NO = s_Client_String[2];//通路 try { ParameterList.Clear(); ParameterList.Add(s_STORE); ParameterList.Add(s_CHAN_NO); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); BCO.MaintainCRMPublic bco = new BCO.MaintainCRMPublic(ConntionDB); DataTable dt_Return = bco.QuerySwitch(BCO.MaintainCRMPublic.QueryType.QueryStore, ParameterList); if (dt_Return.Rows.Count == 0) { CallBackValue = "STORE<partition>FALSE<partition>" + this.hid_Page_Status.Value + "<partition>查無資料"; } else if (this.hid_Page_Status.Value == "INSERT") { sb.Append("STORE<partition>"); sb.Append("TRUE<partition>"); sb.Append("INSERT<partition>"); sb.Append(dt_Return.Rows[0]["CHAN_NO"].ToString() + "<partition>"); sb.Append(dt_Return.Rows[0]["Z_O"].ToString() + "<partition>"); sb.Append(dt_Return.Rows[0]["SAL_ID"].ToString() + "<partition>"); sb.Append(dt_Return.Rows[0]["ROUTE_ID"].ToString() + "<partition>"); sb.Append(dt_Return.Rows[0]["ROUTE_STEP"].ToString() + "<partition>"); sb.Append(dt_Return.Rows[0]["STORE_TEL_AREA"].ToString() + "<partition>"); sb.Append(dt_Return.Rows[0]["STORE_TEL_NO"].ToString() + "<partition>"); sb.Append(dt_Return.Rows[0]["STORE_FAX_AREA"].ToString() + "<partition>"); sb.Append(dt_Return.Rows[0]["STORE_FAX_NO"].ToString() + "<partition>"); sb.Append(dt_Return.Rows[0]["STORE_ADDRESS"].ToString()); CallBackValue = sb.ToString(); } else if (this.hid_Page_Status.Value == "QUERY") { sb.Append("STORE<partition>"); sb.Append("TRUE<partition>"); sb.Append("QUERY<partition>"); sb.Append(dt_Return.Rows[0]["CHAN_NO"].ToString()); CallBackValue = sb.ToString(); } } catch (Exception ex) { CallBackValue = "STORE<partition>FALSE<partition>" + this.hid_Page_Status.Value + "<partition>" + ex.ToString(); } #endregion } else if (s_Client_String[0] == "通路") { #region 離開欄位[@通路]時 s_STORE = s_Client_String[2];//門市 s_CHAN_NO = s_Client_String[1];//通路 try { ParameterList.Clear(); ParameterList.Add(s_STORE); ParameterList.Add(s_CHAN_NO); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); BCO.MaintainCRMPublic bco = new BCO.MaintainCRMPublic(ConntionDB); DataTable dt_Return = bco.QuerySwitch(BCO.MaintainCRMPublic.QueryType.QueryStore, ParameterList); if (dt_Return.Rows.Count == 0) { CallBackValue = "CHAN_NO<partition>NOHAVE"; } else { CallBackValue = "CHAN_NO<partition>HAVE"; } } catch (Exception ex) { CallBackValue = "CHAN_NO<partition>FALSE<partition>" + ex.ToString(); } #endregion } } else { CallBackValue = string.Empty; } return CallBackValue; }
private void txt_Up_CHAN_NO_Onblur() { if ((slp_Up_CHAN_NO.Text.Trim().Length == 0) || (slp_Up_CHAN_NO.Text.Trim().Length == 2)) { return; } TextBox txt_Up_CHAN_NO = (TextBox)this.slp_Up_CHAN_NO.FindControl("TextBoxCode");//上方通路 TextBox txt_STORE = (TextBox)this.slp_STORE.FindControl("TextBoxCode");//上方門市 if (slp_STORE.Text.Trim() == string.Empty) { return; } try { ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(slp_STORE.Text); ParameterList.Add(slp_Up_CHAN_NO.Text); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); BCO.MaintainCRMPublic bco = new BCO.MaintainCRMPublic(ConntionDB); DataTable dt_Return = bco.QuerySwitch(BCO.MaintainCRMPublic.QueryType.QueryStore, ParameterList); if (dt_Return.Rows.Count == 0) { slp_STORE.Text = ""; } } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM011.aspx", "alert('" + ex.Message + "');document.getElementById('" + txt_Up_CHAN_NO.ClientID + "').focus();document.getElementById('" + txt_Up_CHAN_NO.ClientID + "').select();", true); } }
/// <summary> /// 將變更後的內部變量this.CallBackValue返回給前台JavaScript方法ReceiveServerData(string Value)。 /// </summary> /// <returns></returns> string ICallbackEventHandler.GetCallbackResult() { if (CallBackValue != string.Empty) { string s_CHAN_NO = string.Empty; string s_STORE = string.Empty; System.Text.StringBuilder sb = new System.Text.StringBuilder(); CallBackValue = CallBackValue.Trim(); #region 離開欄位[@門市]時 s_STORE = CallBackValue;//門市 s_CHAN_NO = string.Empty;//通路 try { ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(s_STORE); ParameterList.Add(s_CHAN_NO); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); BCO.MaintainCRMPublic bco = new BCO.MaintainCRMPublic(ConntionDB); DataTable dt_Return = bco.QuerySwitch(BCO.MaintainCRMPublic.QueryType.QueryStore, ParameterList); if (dt_Return.Rows.Count == 0) { CallBackValue = "STORE<partition>FALSE<partition>查無資料"; } else { sb.Append("STORE<partition>"); sb.Append("TRUE<partition>"); sb.Append(dt_Return.Rows[0]["CHAN_NO"].ToString()); CallBackValue = sb.ToString(); } } catch (Exception ex) { CallBackValue = "STORE<partition>FALSE<partition>" + ex.ToString(); } #endregion } return CallBackValue; }