using System; using System.Data; using System.Configuration; using System.Collections.Generic; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Text; /// /// 外部人員帳號設定 /// public partial class forms_basedata_fmBPAP : Wellan.Web.UI.WUserControlBase { private BpapDAC bpabDao; protected void Page_Load(object sender, EventArgs e) { //if (IsPostBack) // GridView1.DataBind(); } protected override void OnInit(EventArgs e) { base.OnInit(e); bpabDao = new BpapDAC(Query); dsBPZON.ConnectionString = ConnectionString; dsBPBRH.ConnectionString = ConnectionString; dsBPZON.SelectCommand = GetListSql("BCLSEDIT", "BSPAR='BCUSZON'"); dsBPBRH.SelectCommand = GetListSql("BCLSEDIT", "BSPAR='BPSNBRH' AND SUBSTRING(BSCLS, LEN(BSCLS) - 1, 2) = '00'"); } protected void dsBPAP_ObjectCreating(object sender, ObjectDataSourceEventArgs e) { e.ObjectInstance = bpabDao; } protected void btnInsert_Click(object sender, EventArgs e) { if (!Page.IsValid) return; try { bpabDao.InsertOne(txtBPNME.Text, txtBPEML.Text, ddlBPZON.SelectedValue, ddlBPBRH.SelectedValue, UserId); txtBPNME.Text = ""; txtBPEML.Text = ""; ddlBPZON.SelectedValue = ""; ddlBPBRH.SelectedValue = ""; GridView1.DataBind(); } catch (Exception ex) { cvMessage.IsValid = false; cvMessage.ErrorMessage = ex.Message; } } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { //GridView_RowDataBound_Shrink_ViewState(sender, e); } }