public TRN_CodeFile() { co_main = new TRNModel.VDS_TRN11_BCO(ConntionDB); }
}//Initiziatoin_Component private DataTable Linedata() { ParameterList.Clear(); TRNModel.VDS_TRN11_BCO BCO = new TRNModel.VDS_TRN11_BCO(ConntionDB); ParameterList.Add(Category); ParameterList.Add(_Code); DataTable Dt = BCO.QUERYFORSLP(ParameterList); return Dt; }
}//btn_Save_Click protected void btn_Delete_Click(object sender, EventArgs e) { #region try { #region if (txt_CATEGORY.Text != "" && txt_SCODE.Text != "") { #region TRNModel.VDS_TRN11_BCO BCO = new TRNModel.VDS_TRN11_BCO(ConnectionDB); BCO.DEL_TRN_CODE_DETL(GetQueryParams(), null); ErrorMsgLabel.Text = "刪除成功"; txt_CATEGORY.Text = ""; txt_SCODE.Text = ""; txt_EXPLAIN.Text = ""; string strJS = string.Format("alert('刪除成功');location.replace('TRN111.aspx?Code=TRN11&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
protected void btn_Save_Click(object sender, EventArgs e) { #region try { #region if (txt_CATEGORY.Text != "") { if (CurrentPageMode == PageCurrentMode.Insert) { #region TRNModel.VDS_TRN11_BCO BCO = new TRNModel.VDS_TRN11_BCO(ConnectionDB); string strID = "", strErrMsg = ""; bool bResult = false; bResult = BCO.ADD_TRN_CODE_DETL(GetQueryParams(), null, out strID, out strErrMsg); if (bResult && strErrMsg == "") { ArrayList aryTmp = new ArrayList(); aryTmp.Clear(); aryTmp.Add(strID); aryParamsPKey = aryTmp; s_ID = strID; CurrentPageMode = PageCurrentMode.Readonly; SetControlsByCurrentPageMode(); ErrorMsgLabel.Text = "新增成功"; } else { ErrorMsgLabel.Text = strErrMsg; } #endregion } else if (CurrentPageMode == PageCurrentMode.Edit) { #region TRNModel.VDS_TRN11_BCO BCO = new TRNModel.VDS_TRN11_BCO(ConnectionDB); string strID = "", strErrMsg = ""; bool bResult = false; bResult = BCO.UPDATE_TRN_CODE_DETL(GetQueryParams(), null, out strErrMsg); if (bResult && strErrMsg == "") { 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 try { txt_CATEGORY.Text = ""; txt_SCODE.Text = ""; txt_EXPLAIN.Text = ""; TRNModel.VDS_TRN11_BCO BCO = new TRNModel.VDS_TRN11_BCO(ConnectionDB); DataTable dt = null; ArrayList ParameterList = new ArrayList(); ParameterList.Add(s_ID); dt = BCO.QUERY_TRN_CODE_DETL_BY_ID(ParameterList); if (dt != null && dt.Rows.Count > 0) { txt_CATEGORY.Text = dt.Rows[0]["CATEGORY"].ToString().Trim(); txt_CATEGORY_NAME.Text = dt.Rows[0]["NAME"].ToString().Trim(); txt_SCODE.Text = dt.Rows[0]["SCODE"].ToString().Trim(); txt_EXPLAIN.Text = dt.Rows[0]["EXPLAIN"].ToString().Trim(); } else { ErrorMsgLabel.Text = "查無資料或原始資料已被刪除"; } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } #endregion }
/// <summary> /// 繫結資料到控制項 /// </summary> /// <param name="vdb"></param> private void QueryData() { #region string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); TRNModel.VDS_TRN11_BCO BCO = new TRNModel.VDS_TRN11_BCO(ConnectionDB); DataTable dt = null; dt = BCO.QUERY_TRN_CODE_DETL(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 }