feat: fmBpjb GridView 改用 ObjectDataSource
- 新增 BpjbDAC(SelectPage/SelectCount) - dsBPJBGrid 改 ObjectDataSource;Search/Selected 調整
This commit is contained in:
@@ -9,13 +9,15 @@
|
||||
<asp:MultiView ID="MultiView1"
|
||||
runat="server" ActiveViewIndex="0">
|
||||
<asp:View ID="EditView" runat="server">
|
||||
<asp:SqlDataSource ID="dsBPJBGrid"
|
||||
runat="server" ConflictDetection="CompareAllValues"
|
||||
SelectCommand="SELECT * FROM BPJB WHERE (1 = 0)"
|
||||
ConnectionString="Data Source=(local);Initial Catalog=THINKYU_WEB;Persist Security Info=True;User ID=sa"
|
||||
ProviderName="System.Data.SqlClient"
|
||||
OnSelected="dsBPJBGrid_Selected">
|
||||
</asp:SqlDataSource>
|
||||
<asp:ObjectDataSource ID="dsBPJBGrid"
|
||||
runat="server" TypeName="BpjbDAC"
|
||||
SelectMethod="SelectPage" SelectCountMethod="SelectCount"
|
||||
EnablePaging="true" OnSelected="dsBPJBGrid_Selected">
|
||||
<SelectParameters>
|
||||
<asp:Parameter Name="BPPYN" Type="String" />
|
||||
<asp:Parameter Name="BPJNO" Type="String" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
<asp:SqlDataSource ID="dsBPJBForm"
|
||||
runat="server" InsertCommand="INSERT INTO BPJB
|
||||
(BPPYN, BPJNO, BPCNO, BPCME, BPSRM, BPSRD, BPP01, BPP02, BPP03, BPP04, BPP05, APPNO, TRDAT, TRMOD, TRUSR)
|
||||
|
||||
@@ -24,10 +24,6 @@ public partial class forms_customer_fmBpjb : Wellan.Web.UI.WUserControlBase
|
||||
protected string _BPPYN = "";
|
||||
protected string _BPJNO = "";
|
||||
protected string _BPJME = "";
|
||||
private string select = "SELECT * ";
|
||||
private string from = " FROM BPJB ";
|
||||
private string where = " WHERE 1=1 ";
|
||||
private string order = " ORDER BY BPPYN, BPJNO, BPCNO";
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -39,7 +35,6 @@ public partial class forms_customer_fmBpjb : Wellan.Web.UI.WUserControlBase
|
||||
{
|
||||
base.OnInit(e);
|
||||
dsBPJBForm.ConnectionString = ConnectionString;
|
||||
dsBPJBGrid.ConnectionString = ConnectionString;
|
||||
|
||||
_BPNUM = GetStringParam("BPNUM");
|
||||
_BPPYN = GetStringParam("BPPYN");
|
||||
@@ -54,15 +49,8 @@ public partial class forms_customer_fmBpjb : Wellan.Web.UI.WUserControlBase
|
||||
// 查詢動作
|
||||
private new void Search()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(select);
|
||||
sql.Append(from);
|
||||
sql.Append(where);
|
||||
dsBPJBGrid.SelectParameters.Clear();
|
||||
AddSearch(sql, dsBPJBGrid, "BPPYN", _BPPYN, "", true);
|
||||
AddSearch(sql, dsBPJBGrid, "BPJNO", _BPJNO, "", true);
|
||||
sql.Append(order);
|
||||
dsBPJBGrid.SelectCommand = sql.ToString();
|
||||
dsBPJBGrid.SelectParameters["BPPYN"].DefaultValue = _BPPYN;
|
||||
dsBPJBGrid.SelectParameters["BPJNO"].DefaultValue = _BPJNO;
|
||||
}
|
||||
|
||||
private new void CalcFields(SqlDataSourceCommandEventArgs e)
|
||||
@@ -115,9 +103,9 @@ public partial class forms_customer_fmBpjb : Wellan.Web.UI.WUserControlBase
|
||||
gvBPJB.DataBind();
|
||||
}
|
||||
|
||||
protected void dsBPJBGrid_Selected(object sender, SqlDataSourceStatusEventArgs e)
|
||||
protected void dsBPJBGrid_Selected(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
if (e.AffectedRows == 0)
|
||||
if (e.ReturnValue is Int32 && WDAC.GetInt32Value(e.ReturnValue) == 0)
|
||||
{
|
||||
fvBPJB.ChangeMode(FormViewMode.Insert);
|
||||
fvBPJB_ModeChanged(sender, e);
|
||||
|
||||
Reference in New Issue
Block a user