feat: fmRsaj GridView 改用 ObjectDataSource
- RsajDAC 新增 SelectPage/SelectCount - dsRSAJGrid 改 ObjectDataSource;Search/Selected 調整
This commit is contained in:
@@ -6,10 +6,14 @@
|
||||
TextMessageId="FMRSAJ.NAME"></cc1:WLabel>
|
||||
<asp:CustomValidator ID="cvMessage" runat="server"
|
||||
Display="None"></asp:CustomValidator>
|
||||
<asp:SqlDataSource ID="dsRSAJGrid" runat="server"
|
||||
ConflictDetection="CompareAllValues" SelectCommand="SELECT * FROM RSAJ WHERE (1 = 0)"
|
||||
ConnectionString="Data Source=(local);Initial Catalog=THINKYU_WEB;Persist Security Info=True;User ID=sa"
|
||||
ProviderName="System.Data.SqlClient" OnSelected="dsRSAJGrid_Selected"></asp:SqlDataSource>
|
||||
<asp:ObjectDataSource ID="dsRSAJGrid" runat="server"
|
||||
TypeName="RsajDAC" SelectMethod="SelectPage" SelectCountMethod="SelectCount"
|
||||
EnablePaging="true" OnSelected="dsRSAJGrid_Selected">
|
||||
<SelectParameters>
|
||||
<asp:Parameter Name="RSENO" Type="String" />
|
||||
<asp:Parameter Name="RSPYN" Type="String" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
<asp:SqlDataSource ID="dsRSAJForm" runat="server"
|
||||
ConflictDetection="CompareAllValues" SelectCommand="SELECT * FROM RSAJ WHERE RSREN = @RSREN"
|
||||
DeleteCommand="DELETE RSAJ WHERE RSREN = @OLD_RSREN AND APPNO = @OLD_APPNO"
|
||||
|
||||
@@ -23,11 +23,6 @@ public partial class forms_worker_fmRsaj : Wellan.Web.UI.WUserControlBase
|
||||
protected DateTime _YYMM;
|
||||
protected string _RSENO = "";
|
||||
protected string _RSPYN = "";
|
||||
private string select = "SELECT * ";
|
||||
private string from = " FROM RSAJ ";
|
||||
private string where = " WHERE 1=1 ";
|
||||
// private string order = " ORDER BY RSPYN, RSREN";
|
||||
private string order = " ORDER BY RSYMM DESC, RSREN DESC";
|
||||
private TextBox[] RSYMMs = new TextBox[10];
|
||||
private DropDownList[] RSENOs = new DropDownList[10];
|
||||
private TextBox[] RSAMTs = new TextBox[10];
|
||||
@@ -48,7 +43,6 @@ public partial class forms_worker_fmRsaj : Wellan.Web.UI.WUserControlBase
|
||||
{
|
||||
base.OnInit(e);
|
||||
dsRSAJForm.ConnectionString = ConnectionString;
|
||||
dsRSAJGrid.ConnectionString = ConnectionString;
|
||||
dsRSAJ_RSENO.ConnectionString = ConnectionString;
|
||||
dsRSAJ_RSENO.SelectCommand =
|
||||
@"IF @RSPYN = '-ALL-'
|
||||
@@ -201,15 +195,8 @@ public partial class forms_worker_fmRsaj : Wellan.Web.UI.WUserControlBase
|
||||
// 查詢動作
|
||||
private new void Search()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(select);
|
||||
sql.Append(from);
|
||||
sql.Append(where);
|
||||
dsRSAJGrid.SelectParameters.Clear();
|
||||
AddSearch(sql, dsRSAJGrid, "RSENO", _RSENO, "", true);
|
||||
AddSearch(sql, dsRSAJGrid, "RSPYN", _RSPYN, "", true);
|
||||
sql.Append(order);
|
||||
dsRSAJGrid.SelectCommand = sql.ToString();
|
||||
dsRSAJGrid.SelectParameters["RSENO"].DefaultValue = _RSENO;
|
||||
dsRSAJGrid.SelectParameters["RSPYN"].DefaultValue = _RSPYN;
|
||||
}
|
||||
|
||||
// 存檔前的計算動作
|
||||
@@ -254,9 +241,9 @@ public partial class forms_worker_fmRsaj : Wellan.Web.UI.WUserControlBase
|
||||
RSAJGrid.DataBind();
|
||||
}
|
||||
|
||||
protected void dsRSAJGrid_Selected(object sender, SqlDataSourceStatusEventArgs e)
|
||||
protected void dsRSAJGrid_Selected(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
if (e.AffectedRows == 0)
|
||||
if (e.ReturnValue is Int32 && WDAC.GetInt32Value(e.ReturnValue) == 0)
|
||||
{
|
||||
/*
|
||||
if (ForwardSource != "")
|
||||
|
||||
Reference in New Issue
Block a user