Inserita formview condizionale x pagina dettaglio batch

This commit is contained in:
Samuele E. Locatelli
2019-08-21 18:22:34 +02:00
parent 98ec789fd0
commit c00d7cee44
8 changed files with 224 additions and 5 deletions
+47 -1
View File
@@ -1022,11 +1022,23 @@ SELECT BatchID, DueDate, NestingReq, NestingResp, Status, TotalTime, ApprovDate,
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[3];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT *\r\nFROM dbo.BatchList";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[1].Connection = this.Connection;
this._commandCollection[1].CommandText = "dbo.stp_Batch_getByKey";
this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure;
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@BatchID", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[2].Connection = this.Connection;
this._commandCollection[2].CommandText = "dbo.stp_Batch_getByStatus";
this._commandCollection[2].CommandType = global::System.Data.CommandType.StoredProcedure;
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Status", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1053,6 +1065,40 @@ SELECT BatchID, DueDate, NestingReq, NestingResp, Status, TotalTime, ApprovDate,
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
public virtual DS_App.BatchListDataTable getByKey(global::System.Nullable<int> BatchID) {
this.Adapter.SelectCommand = this.CommandCollection[1];
if ((BatchID.HasValue == true)) {
this.Adapter.SelectCommand.Parameters[1].Value = ((int)(BatchID.Value));
}
else {
this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
}
DS_App.BatchListDataTable dataTable = new DS_App.BatchListDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
public virtual DS_App.BatchListDataTable getByStatus(global::System.Nullable<int> Status) {
this.Adapter.SelectCommand = this.CommandCollection[2];
if ((Status.HasValue == true)) {
this.Adapter.SelectCommand.Parameters[1].Value = ((int)(Status.Value));
}
else {
this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
}
DS_App.BatchListDataTable dataTable = new DS_App.BatchListDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
+25 -2
View File
@@ -89,7 +89,30 @@ SELECT BatchID, DueDate, NestingReq, NestingResp, Status, TotalTime, ApprovDate,
<Mapping SourceColumn="ApprovDate" DataSetColumn="ApprovDate" />
<Mapping SourceColumn="ApprovUser" DataSetColumn="ApprovUser" />
</Mappings>
<Sources />
<Sources>
<DbSource ConnectionRef="Sauder_NKCConnectionString (Settings)" DbObjectName="Sauder_NKC.dbo.stp_Batch_getByKey" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getByKey" GetMethodModifier="Public" GetMethodName="getByKey" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getByKey" UserSourceName="getByKey">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_Batch_getByKey</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@BatchID" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
<DbSource ConnectionRef="Sauder_NKCConnectionString (Settings)" DbObjectName="Sauder_NKC.dbo.stp_Batch_getByStatus" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getByStatus" GetMethodModifier="Public" GetMethodName="getByStatus" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getByStatus" UserSourceName="getByStatus">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_Batch_getByStatus</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@Status" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</Sources>
</TableAdapter>
</Tables>
<Sources />
@@ -99,7 +122,7 @@ SELECT BatchID, DueDate, NestingReq, NestingResp, Status, TotalTime, ApprovDate,
<xs:element name="DS_App" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DS_App" msprop:Generator_UserDSName="DS_App">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="BatchList" msprop:Generator_TableClassName="BatchListDataTable" msprop:Generator_TableVarName="tableBatchList" msprop:Generator_TablePropName="BatchList" msprop:Generator_RowDeletingName="BatchListRowDeleting" msprop:Generator_RowChangingName="BatchListRowChanging" msprop:Generator_RowEvHandlerName="BatchListRowChangeEventHandler" msprop:Generator_RowDeletedName="BatchListRowDeleted" msprop:Generator_UserTableName="BatchList" msprop:Generator_RowChangedName="BatchListRowChanged" msprop:Generator_RowEvArgName="BatchListRowChangeEvent" msprop:Generator_RowClassName="BatchListRow">
<xs:element name="BatchList" msprop:Generator_TableClassName="BatchListDataTable" msprop:Generator_TableVarName="tableBatchList" msprop:Generator_RowChangedName="BatchListRowChanged" msprop:Generator_TablePropName="BatchList" msprop:Generator_RowDeletingName="BatchListRowDeleting" msprop:Generator_RowChangingName="BatchListRowChanging" msprop:Generator_RowEvHandlerName="BatchListRowChangeEventHandler" msprop:Generator_RowDeletedName="BatchListRowDeleted" msprop:Generator_RowClassName="BatchListRow" msprop:Generator_UserTableName="BatchList" msprop:Generator_RowEvArgName="BatchListRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="BatchID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnBatchID" msprop:Generator_ColumnPropNameInRow="BatchID" msprop:Generator_ColumnPropNameInTable="BatchIDColumn" msprop:Generator_UserColumnName="BatchID" type="xs:int" />
+49 -1
View File
@@ -1,4 +1,52 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_batchDetail.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_batchDetail" %>
Dettaglio Batch
<h3>Batch Detail</h3>
<asp:FormView ID="frmView" runat="server" DataKeyNames="BatchID" DataSourceID="ods" Width="100%">
<ItemTemplate>
<div class="row">
<div class="col-9">
BatchID:
<asp:Label ID="BatchIDLabel" runat="server" Text='<%# Eval("BatchID") %>' />
<br />
DueDate:
<asp:Label ID="DueDateLabel" runat="server" Text='<%# Bind("DueDate") %>' />
<br />
NestingReq:
<asp:Label ID="NestingReqLabel" runat="server" Text='<%# Bind("NestingReq") %>' />
<br />
NestingResp:
<asp:Label ID="NestingRespLabel" runat="server" Text='<%# Bind("NestingResp") %>' />
<br />
Status:
<asp:Label ID="StatusLabel" runat="server" Text='<%# Bind("Status") %>' />
<br />
TotalTime:
<asp:Label ID="TotalTimeLabel" runat="server" Text='<%# Bind("TotalTime") %>' />
<br />
ApprovDate:
<asp:Label ID="ApprovDateLabel" runat="server" Text='<%# Bind("ApprovDate") %>' />
<br />
ApprovUser:
<asp:Label ID="ApprovUserLabel" runat="server" Text='<%# Bind("ApprovUser") %>' />
</div>
<div class="col-3" runat="server" id="divNesting" visible='<%# !isNested(Eval("Status")) %>'>
<asp:LinkButton runat="server" ID="lbtSendNesting" CssClass="btn btn-sm btn-block btn-warning">Send to Nesting</asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtStopNesting" CssClass="btn btn-sm btn-block btn-dark">Stop Nesting</asp:LinkButton>
</div>
<div class="col-3" runat="server" id="divNested" visible='<%# isNested(Eval("Status")) %>'>
<asp:LinkButton runat="server" ID="lbtAccept" CssClass="btn btn-sm btn-block btn-success">Accept Nesting</asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtRefuse" CssClass="btn btn-sm btn-block btn-danger">Refuse Nesting</asp:LinkButton>
</div>
</ItemTemplate>
</asp:FormView>
<asp:HiddenField ID="hfBatchId" runat="server" />
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByKey" TypeName="AppData.DS_AppTableAdapters.BatchListTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="hfBatchId" DefaultValue="0" Name="BatchID" PropertyName="Value" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
@@ -13,5 +13,55 @@ namespace NKC_WF.WebUserControls
{
}
public int BatchId
{
set
{
hfBatchId.Value = value.ToString();
frmView.DataBind();
}
}
public bool isNested(object _status)
{
bool answ = true;
int status = -1;
int.TryParse(_status.ToString(), out status);
switch (status)
{
case 0:
case 1:
answ = false;
break;
default:
break;
}
return answ;
}
#if false
/// <summary>
/// Status del batch da cui deriva cosa visualizzare
/// </summary>
public int batchStatus
{
set
{
bool showNested = true;
switch (value)
{
case 0:
case 1:
showNested = false;
break;
default:
break;
}
divNesting.Visible = !showNested;
divNested.Visible = showNested;
}
}
#endif
}
}
+27
View File
@@ -11,5 +11,32 @@ namespace NKC_WF.WebUserControls {
public partial class cmp_batchDetail {
/// <summary>
/// Controllo frmView.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.FormView frmView;
/// <summary>
/// Controllo hfBatchId.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfBatchId;
/// <summary>
/// Controllo ods.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
}
}
@@ -1,7 +1,10 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_batchList.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_batchList" %>
<%@ Register Src="~/WebUserControls/cmp_batchDetail.ascx" TagPrefix="uc1" TagName="cmp_batchDetail" %>
<div class="row">
<div class="col-12" runat="server" id="divDetail">
<uc1:cmp_batchDetail runat="server" ID="cmp_batchDetail" />
</div>
<div class="col-12">
<asp:GridView ID="grView" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="BatchID" DataSourceID="ods" CssClass="table table-sm table-striped" AllowSorting="True" OnSelectedIndexChanged="grView_SelectedIndexChanged">
+14 -1
View File
@@ -45,10 +45,23 @@ namespace NKC_WF.WebUserControls
grView.DataBind();
divDetail.Visible = false;
}
/// <summary>
/// BatchId selezionato
/// </summary>
protected int BatchIdSel
{
get
{
int answ = 0;
int.TryParse(grView.SelectedValue.ToString(), out answ);
return answ;
}
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
divDetail.Visible = true;
// recupero BatchId selezionato
cmp_batchDetail.BatchId = BatchIdSel;
}
}
}
+9
View File
@@ -21,6 +21,15 @@ namespace NKC_WF.WebUserControls {
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divDetail;
/// <summary>
/// Controllo cmp_batchDetail.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::NKC_WF.WebUserControls.cmp_batchDetail cmp_batchDetail;
/// <summary>
/// Controllo grView.
/// </summary>