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
+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>