}//btn_Save_Click protected void btn_Delete_Click(object sender, EventArgs e) { #region try { #region if (SLP_RootNo1.Text != "" && SLP_PMA1.Text != "") { #region 存檔前檢查分類正確性 ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(SLP_RootNo1.Text.Trim()); ParameterList.Add(SLP_PMA1.Text.Trim()); ParameterList.Add(null);//category ParameterList.Add(null);//sort_out ParameterList.Add(null);//pattern ParameterList.Add(null);//item string vLevel = "1"; ParameterList.Add(vLevel); ALOModel.QueryALOCommon alo_comm = new ALOModel.QueryALOCommon(ConnectionDB); bool bCheck = alo_comm.CheckItemClassValid(ParameterList); if (!bCheck) { throw new Exception("所輸入的群分類、大分類有誤,請確認後重新輸入"); } #endregion #region MKTModel.VDS_MKT22_BCO BCO = new MKTModel.VDS_MKT22_BCO(ConnectionDB); BCO.DEL_UN_TAG_PMA(GetQueryParams(), null); ErrorMsgLabel.Text = "刪除成功"; SLP_RootNo1.Text = ""; SLP_PMA1.Text = ""; string strJS = string.Format("alert('刪除成功');location.replace('MKT221.aspx?Code=MKT22&PageTimeStamp={0}');", PageTimeStamp.Value); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DELETE_OK", strJS, true); #endregion } else { ErrorMsgLabel.Text = "請輸入通路、門市"; } #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } #endregion }//btn_Delete_Click
/// <summary> /// 繫結資料到控制項 /// </summary> /// <param name="vdb"></param> private void QueryData() { #region try { SLP_RootNo1.Text = ""; SLP_PMA1.Text = ""; MKTModel.VDS_MKT22_BCO BCO = new MKTModel.VDS_MKT22_BCO(ConnectionDB); DataTable dt = null; ArrayList ParameterList = new ArrayList(); ParameterList.Add(s_ID); dt = BCO.QUERY_UN_TAG_PMA_BY_ID(ParameterList); if (dt != null && dt.Rows.Count > 0) { SLP_RootNo1.Text = dt.Rows[0]["ROOT_NO"].ToString().Trim(); SLP_PMA1.Text = dt.Rows[0]["PMA"].ToString().Trim(); } else { ErrorMsgLabel.Text = "查無資料或原始資料已被刪除"; } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } #endregion }
protected void btn_Save_Click(object sender, EventArgs e) { #region try { #region if (SLP_RootNo1.Text != "" && SLP_PMA1.Text != "") { #region 存檔前檢查分類正確性 ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(SLP_RootNo1.Text.Trim()); ParameterList.Add(SLP_PMA1.Text.Trim()); ParameterList.Add(null);//category ParameterList.Add(null);//sort_out ParameterList.Add(null);//pattern ParameterList.Add(null);//item string vLevel = "1"; ParameterList.Add(vLevel); ALOModel.QueryALOCommon alo_comm = new ALOModel.QueryALOCommon(ConnectionDB); bool bCheck = alo_comm.CheckItemClassValid(ParameterList); if (!bCheck) { throw new Exception("所輸入的群分類、大分類有誤,請確認後重新輸入"); } #endregion #region MKTModel.VDS_MKT22_BCO BCO = new MKTModel.VDS_MKT22_BCO(ConnectionDB); string strID = "", strErrMsg = ""; bool bResult = false; bResult = BCO.ADD_UN_TAG_PMA(GetQueryParams(), null, out strID, out strErrMsg); if (bResult && strErrMsg == "") { ArrayList aryTmp = new ArrayList(); aryTmp.Clear(); aryTmp.Add(strID); aryParamsPKey = aryTmp; CurrentPageMode = PageCurrentMode.Readonly; SetControlsByCurrentPageMode(); ErrorMsgLabel.Text = "新增成功"; } else { ErrorMsgLabel.Text = strErrMsg; } #endregion } else { ErrorMsgLabel.Text = "請輸入通路、門市"; } #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; UpdatePanel1.Update(); } #endregion }//btn_Save_Click
/// <summary> /// 繫結資料到控制項 /// </summary> /// <param name="vdb"></param> private void QueryData() { #region string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); MKTModel.VDS_MKT22_BCO BCO = new MKTModel.VDS_MKT22_BCO(ConnectionDB); DataTable dt = null; dt = BCO.QUERY_UN_TAG_PMA(GetQueryParams()); Session[SessionIDName] = dt; Int32 iRowCount = 0; aryParamsPKey.Clear(); GridView1.DataSource = dt; GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); if (dt != null && dt.Rows.Count > 0) { iRowCount = dt.Rows.Count; foreach (DataRow dr in dt.Rows) { #region aryParamsPKey.Add(dr["ID"].ToString()); #endregion } } else { ErrorMsgLabel.Text = "查無資料"; } Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)] = aryParamsPKey; LabelQueryRecordCount.Text = string.Format(" {0} Rows ", iRowCount); #endregion }