feat: fmRpfe GridView 改用 ObjectDataSource
- 新增 RpfeDAC(SelectPage/SelectCount) - dsRPFEGrid 改 ObjectDataSource;Search/Selected 調整
This commit is contained in:
@@ -6,11 +6,13 @@
|
||||
TextMessageId="FMRPFE.NAME"></cc1:WLabel>
|
||||
<asp:CustomValidator ID="cvMessage" runat="server"
|
||||
Display="None"></asp:CustomValidator>
|
||||
<asp:SqlDataSource ID="dsRPFEGrid" runat="server"
|
||||
ConflictDetection="CompareAllValues" SelectCommand="SELECT * FROM RPFE WHERE (1 = 0)"
|
||||
ConnectionString="Data Source=(local);Initial Catalog=THINKYU_WEB;Persist Security Info=True;User ID=sa"
|
||||
ProviderName="System.Data.SqlClient" OnSelected="dsRPFEGrid_Selected">
|
||||
</asp:SqlDataSource>
|
||||
<asp:ObjectDataSource ID="dsRPFEGrid" runat="server"
|
||||
TypeName="RpfeDAC" SelectMethod="SelectPage" SelectCountMethod="SelectCount"
|
||||
EnablePaging="true" OnSelected="dsRPFEGrid_Selected">
|
||||
<SelectParameters>
|
||||
<asp:Parameter Name="RPPYN" Type="String" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
<asp:SqlDataSource ID="dsRPFEForm" runat="server"
|
||||
UpdateCommand="UPDATE RPFE SET RPENO = @RPENO, RPDAT = @RPDAT, RPACC = @RPACC, RPAMT = @RPAMT, RPDOC = @RPDOC, APPNO = APPNO + 1, TRDAT = GETDATE(), TRMOD = 'UPDATE', TRUSR = @TRUSR WHERE RPREN = @OLD_RPREN AND APPNO = @OLD_APPNO"
|
||||
DeleteCommand="DELETE FROM RPFE WHERE RPREN = @OLD_RPREN AND APPNO = @OLD_APPNO"
|
||||
|
||||
@@ -23,10 +23,6 @@ public partial class forms_customer_fmRpfe : Wellan.Web.UI.WUserControlBase
|
||||
{
|
||||
private string _RPPYN = "";
|
||||
private int _YY = 0;
|
||||
private string select = "SELECT * ";
|
||||
private string from = " FROM RPFE ";
|
||||
private string where = " WHERE 1=1 ";
|
||||
private string order = " ORDER BY RPPYN, RPREN";
|
||||
private TextBox[] RPDATs = new TextBox[10];
|
||||
private DropDownList[] RPACCs = new DropDownList[10];
|
||||
private TextBox[] RPAMTs = new TextBox[10];
|
||||
@@ -47,7 +43,6 @@ public partial class forms_customer_fmRpfe : Wellan.Web.UI.WUserControlBase
|
||||
{
|
||||
base.OnInit(e);
|
||||
dsRPFEForm.ConnectionString = ConnectionString;
|
||||
dsRPFEGrid.ConnectionString = ConnectionString;
|
||||
dsRPFE_RPACC.ConnectionString = ConnectionString;
|
||||
dsRPFE_RPENO.ConnectionString = ConnectionString;
|
||||
|
||||
@@ -152,14 +147,7 @@ public partial class forms_customer_fmRpfe : Wellan.Web.UI.WUserControlBase
|
||||
// 查詢動作
|
||||
private new void Search()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(select);
|
||||
sql.Append(from);
|
||||
sql.Append(where);
|
||||
dsRPFEGrid.SelectParameters.Clear();
|
||||
AddSearch(sql, dsRPFEGrid, "RPPYN", _RPPYN, "", true);
|
||||
sql.Append(order);
|
||||
dsRPFEGrid.SelectCommand = sql.ToString();
|
||||
dsRPFEGrid.SelectParameters["RPPYN"].DefaultValue = _RPPYN;
|
||||
}
|
||||
|
||||
private int CheckInsertInput(int index)
|
||||
@@ -229,9 +217,9 @@ public partial class forms_customer_fmRpfe : Wellan.Web.UI.WUserControlBase
|
||||
RPFEGrid.DataBind();
|
||||
}
|
||||
|
||||
protected void dsRPFEGrid_Selected(object sender, SqlDataSourceStatusEventArgs e)
|
||||
protected void dsRPFEGrid_Selected(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
if (e.AffectedRows == 0)
|
||||
if (e.ReturnValue is Int32 && WDAC.GetInt32Value(e.ReturnValue) == 0)
|
||||
{
|
||||
//RPFEForm.ChangeMode(FormViewMode.Insert);
|
||||
//RPFEForm_ModeChanged(sender, e);
|
||||
|
||||
Reference in New Issue
Block a user