feat: fmBcus GridView 改用 ObjectDataSource
- 新增 BcusDAC(SelectPage/SelectCount/SelectBCNUMIndex) - dsBCUSGrid 改 ObjectDataSource(EnablePaging) - Search/Selected/DataBound 調整;跳回選取列改用 SelectBCNUMIndex - 計畫文檔更新盤點與待辦
This commit is contained in:
@@ -20,10 +20,6 @@ public partial class forms_customer_fmBcus : Wellan.Web.UI.WUserControlBase
|
||||
private string _BCNUM = "";
|
||||
private string _BCNAM = "";
|
||||
private string _OLD_BCNUM = "";
|
||||
private string select = "SELECT * ";
|
||||
private string from = " FROM BCUS ";
|
||||
private string where = " WHERE 1=1 ";
|
||||
private string order = " ORDER BY BCNUM";
|
||||
private string _bcusCls = "";
|
||||
private string _bcusZon = "";
|
||||
|
||||
@@ -40,7 +36,6 @@ public partial class forms_customer_fmBcus : Wellan.Web.UI.WUserControlBase
|
||||
{
|
||||
base.OnInit(e);
|
||||
dsBCUSForm.ConnectionString = ConnectionString;
|
||||
dsBCUSGrid.ConnectionString = ConnectionString;
|
||||
|
||||
GetGridViewRowColor(gvBCUS);
|
||||
|
||||
@@ -95,15 +90,23 @@ public partial class forms_customer_fmBcus : Wellan.Web.UI.WUserControlBase
|
||||
// 查詢動作
|
||||
private new void Search()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(select);
|
||||
sql.Append(from);
|
||||
sql.Append(where);
|
||||
dsBCUSGrid.SelectParameters.Clear();
|
||||
AddSearch(sql, dsBCUSGrid, "BCNUM", _BCNUM, "", true);
|
||||
AddSearch(sql, dsBCUSGrid, "BCNAM", _BCNAM, "", true);
|
||||
sql.Append(order);
|
||||
dsBCUSGrid.SelectCommand = sql.ToString();
|
||||
dsBCUSGrid.SelectParameters["BCNUM"].DefaultValue = _BCNUM;
|
||||
dsBCUSGrid.SelectParameters["BCNAM"].DefaultValue = _BCNAM;
|
||||
|
||||
// 返回時,回到之前選擇的那一筆
|
||||
if (ParamList != null && ParamList.ContainsKey("BCNUM"))
|
||||
{
|
||||
string bcnum = WDAC.GetStringValue(ParamList["BCNUM"]);
|
||||
|
||||
int rowIndex = new BcusDAC(Query).SelectBCNUMIndex(bcnum, _BCNUM, _BCNAM);
|
||||
if (rowIndex >= 0)
|
||||
{
|
||||
gvBCUS.PageIndex = rowIndex / gvBCUS.PageSize;
|
||||
gvBCUS.SelectedIndex = rowIndex - gvBCUS.PageIndex * gvBCUS.PageSize;
|
||||
}
|
||||
|
||||
ParamList.Remove("BCNUM");
|
||||
}
|
||||
}
|
||||
|
||||
private new void CalcFields(SqlDataSourceCommandEventArgs e)
|
||||
@@ -130,23 +133,6 @@ public partial class forms_customer_fmBcus : Wellan.Web.UI.WUserControlBase
|
||||
if (gvBCUS.SelectedIndex == -1)
|
||||
gvBCUS.SelectedIndex = 0;
|
||||
|
||||
// 返回時,回到之前選擇的那一筆
|
||||
if (ParamList.ContainsKey("BCNUM"))
|
||||
{
|
||||
string bcnum = WDAC.GetStringValue(ParamList["BCNUM"]);
|
||||
|
||||
DataView dv = dsBCUSGrid.Select(new DataSourceSelectArguments()) as DataView;
|
||||
dv.RowFilter = String.Format("BCNUM='{0}'", bcnum);
|
||||
if (dv.Count > 0)
|
||||
{
|
||||
int rowIndex = dv.Table.Rows.IndexOf(dv[0].Row);
|
||||
gvBCUS.PageIndex = (rowIndex / gvBCUS.PageSize);
|
||||
gvBCUS.SelectedIndex = rowIndex - gvBCUS.PageIndex * gvBCUS.PageSize;
|
||||
}
|
||||
|
||||
ParamList.Remove("BCNUM");
|
||||
}
|
||||
|
||||
fvBCUS.DataBind();
|
||||
}
|
||||
|
||||
@@ -157,9 +143,9 @@ public partial class forms_customer_fmBcus : Wellan.Web.UI.WUserControlBase
|
||||
gvBCUS.DataBind();
|
||||
}
|
||||
|
||||
protected void dsBCUSGrid_Selected(object sender, SqlDataSourceStatusEventArgs e)
|
||||
protected void dsBCUSGrid_Selected(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
if (e.AffectedRows == 0)
|
||||
if (e.ReturnValue is Int32 && WDAC.GetInt32Value(e.ReturnValue) == 0)
|
||||
{
|
||||
if (MultiView1.ActiveViewIndex == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user