Ok taggle enable tra blocchi

This commit is contained in:
Samuele Locatelli
2023-08-04 18:45:43 +02:00
parent f1c6246c91
commit 9cc93b8d75
6 changed files with 161 additions and 19 deletions
-1
View File
@@ -261,7 +261,6 @@ namespace NKC_WF
/// </summary>
public void raiseReset()
{
// se qualcuno ascolta sollevo evento nuovo valore...
if (eh_doReset != null)
{
eh_doReset(this, new EventArgs());
@@ -9,6 +9,9 @@
<asp:HiddenField runat="server" ID="hfLastRatio01" />
<asp:HiddenField runat="server" ID="hfLastRatio02" />
<asp:HiddenField runat="server" ID="hfLastRatio03" />
<asp:HiddenField runat="server" ID="hfEnabled01" />
<asp:HiddenField runat="server" ID="hfEnabled02" />
<asp:HiddenField runat="server" ID="hfEnabled03" />
<div class="card">
<div class="card-header text-center">
<div class="row">
@@ -20,17 +23,6 @@
</div>
<div class="col-4"></div>
</div>
<%--<div class="row">
<div class="col-1 font-weight-bold">
<asp:Label runat="server" ID="lblRatio01" />
</div>
<div class="col-10">
<asp:TextBox runat="server" ID="txtRatio" TextMode="Range" CssClass="form-control-range" AutoPostBack="true" OnTextChanged="txtRatio_TextChanged" />
</div>
<div class="col-1 font-weight-bold">
<asp:Label runat="server" ID="lblRatio02" />
</div>
</div>--%>
</div>
<div class="card-body p-1">
<div class="row small text-center">
@@ -44,10 +36,12 @@
<asp:Label runat="server" ID="lblNumOrd01" />
</div>
<div class="col-4">
<asp:LinkButton runat="server" ID="lbtToggle01" CssClass="btn btn-dark" OnClick="lbtToggle01_Click">
<b>NE01</b>
</asp:LinkButton>
</div>
<div class="col-4">
<asp:TextBox runat="server" ID="txtRatio01" TextMode="Number" Width="80"></asp:TextBox>
<asp:TextBox runat="server" ID="txtRatio01" TextMode="Number" Width="80" CssClass="text-right"></asp:TextBox>
</div>
</div>
</div>
@@ -67,10 +61,12 @@
<asp:Label runat="server" ID="lblNumOrd02" />
</div>
<div class="col-4">
<asp:LinkButton runat="server" ID="lbtToggle02" CssClass="btn btn-dark" OnClick="lbtToggle02_Click">
<b>NE02</b>
</asp:LinkButton>
</div>
<div class="col-4">
<asp:TextBox runat="server" ID="txtRatio02" TextMode="Number" Width="80"></asp:TextBox>
<asp:TextBox runat="server" ID="txtRatio02" TextMode="Number" Width="80" CssClass="text-right"></asp:TextBox>
</div>
</div>
</div>
@@ -90,10 +86,12 @@
<asp:Label runat="server" ID="lblNumOrd03" />
</div>
<div class="col-4">
<asp:LinkButton runat="server" ID="lbtToggle03" CssClass="btn btn-dark" OnClick="lbtToggle03_Click">
<b>NE03</b>
</asp:LinkButton>
</div>
<div class="col-4">
<asp:TextBox runat="server" ID="txtRatio03" TextMode="Number" Width="80"></asp:TextBox>
<asp:TextBox runat="server" ID="txtRatio03" TextMode="Number" Width="80" CssClass="text-right"></asp:TextBox>
</div>
</div>
</div>
@@ -57,6 +57,7 @@ namespace NKC_WF.WebUserControls
fixChildBatch();
fixRatio();
checkDisplayMode();
fixEnabled();
raiseReset();
}
@@ -395,6 +396,84 @@ namespace NKC_WF.WebUserControls
lastRatio03 = 0;
doUpdate();
}
protected void lbtToggle01_Click(object sender, EventArgs e)
{
enable01 = !enable01;
fixEnabled();
}
private void fixEnabled()
{
lbtToggle01.CssClass = enable01 ? "btn btn-dark" : "btn btn-secondary";
lbtToggle02.CssClass = enable02 ? "btn btn-dark" : "btn btn-secondary";
lbtToggle03.CssClass = enable03 ? "btn btn-dark" : "btn btn-secondary";
cmp_orderExtListNE01.enableMove = enable01 && movEnabled;
cmp_orderExtListNE02.enableMove = enable02&& movEnabled;
cmp_orderExtListNE03.enableMove = enable03&& movEnabled;
}
protected void lbtToggle02_Click(object sender, EventArgs e)
{
enable02 = !enable02;
fixEnabled();
}
protected void lbtToggle03_Click(object sender, EventArgs e)
{
enable03 = !enable03;
fixEnabled();
}
private bool movEnabled
{
get
{
int numEnab = 0;
numEnab += enable01 ? 1 : 0;
numEnab += enable02 ? 1 : 0;
numEnab += enable03 ? 1 : 0;
return numEnab == 2;
}
}
private bool enable01
{
get
{
bool answ = false;
bool.TryParse(hfEnabled01.Value, out answ);
return answ;
}
set
{
hfEnabled01.Value = $"{value}";
}
}
private bool enable02
{
get
{
bool answ = false;
bool.TryParse(hfEnabled02.Value, out answ);
return answ;
}
set
{
hfEnabled02.Value = $"{value}";
}
}
private bool enable03
{
get
{
bool answ = false;
bool.TryParse(hfEnabled03.Value, out answ);
return answ;
}
set
{
hfEnabled03.Value = $"{value}";
}
}
protected void Page_Load(object sender, EventArgs e)
{
@@ -404,6 +483,7 @@ namespace NKC_WF.WebUserControls
fixChildBatch();
fixRatio();
checkDisplayMode();
fixEnabled();
}
cmp_orderExtListNE01.eh_doRefresh += Cmp_orderExtListNE01_eh_doRefresh;
cmp_orderExtListNE02.eh_doRefresh += Cmp_orderExtListNE02_eh_doRefresh;
@@ -414,7 +494,6 @@ namespace NKC_WF.WebUserControls
#region Private Fields
private int numMach = 3;
#endregion Private Fields
@@ -609,7 +688,15 @@ namespace NKC_WF.WebUserControls
stopWatch.Stop();
Log.Instance.Info($"Rebalance executed | R01: {Ratio01} | R02: {Ratio02} | R03: {Ratio03} | maxDepth: {maxDepth} | elapsed ms: {stopWatch.ElapsedMilliseconds}");
}
fixRatio();
//fixRatio();
// calcolo min/max..
var actMax = totTime01 > totTime02 ? totTime01 : totTime02;
var actMin = totTime01 < totTime02 ? totTime01 : totTime02;
actMax = totTime03 > actMax ? totTime03 : actMax;
actMin = totTime03 < actMin ? totTime03 : actMin;
enable01 = (totTime01 == actMin || totTime01 == actMax);
enable02 = (totTime02 == actMin || totTime02 == actMax);
enable03 = (totTime03 == actMin || totTime03 == actMax);
}
#endregion Private Methods
@@ -77,6 +77,33 @@ namespace NKC_WF.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfLastRatio03;
/// <summary>
/// hfEnabled01 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfEnabled01;
/// <summary>
/// hfEnabled02 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfEnabled02;
/// <summary>
/// hfEnabled03 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfEnabled03;
/// <summary>
/// lbtBalance control.
/// </summary>
@@ -104,6 +131,15 @@ namespace NKC_WF.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumOrd01;
/// <summary>
/// lbtToggle01 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtToggle01;
/// <summary>
/// txtRatio01 control.
/// </summary>
@@ -149,6 +185,15 @@ namespace NKC_WF.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumOrd02;
/// <summary>
/// lbtToggle02 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtToggle02;
/// <summary>
/// txtRatio02 control.
/// </summary>
@@ -194,6 +239,15 @@ namespace NKC_WF.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumOrd03;
/// <summary>
/// lbtToggle03 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtToggle03;
/// <summary>
/// txtRatio03 control.
/// </summary>
+1 -1
View File
@@ -12,7 +12,7 @@
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="lbtSel1" runat="server" CausesValidation="False" CommandName="Select" CssClass='<%# moveCss %>' ToolTip='<%# traduci("ExchangeOrder") %>'><i class="fa fa-arrow-right" aria-hidden="true"></i></asp:LinkButton>
<asp:LinkButton ID="lbtSel1" runat="server" CausesValidation="False" CommandName="Select" CssClass='<%# moveCss %>' ToolTip='<%# traduci("ExchangeOrder") %>'><i class="fa fa-arrows-h" aria-hidden="true"></i></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="OrderExtCode" HeaderText="Ord.Code" SortExpression="OrderExtCode" />
@@ -40,7 +40,11 @@ namespace NKC_WF.WebUserControls
}
set
{
hfMoveEnab.Value = $"{value}";
if (hfMoveEnab.Value != $"{value}")
{
hfMoveEnab.Value = $"{value}";
grView.DataBind();
}
}
}