Files
MoonPro.net/MP-ADM/WebUserControls/mod_planCreate.ascx.cs
T

141 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MP_ADM.WebUserControls
{
public partial class mod_planCreate : SteamWare.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string CodGruppo
{
get
{
return hfCodGruppo.Value;
}
set
{
hfCodGruppo.Value = value;
}
}
public string CodArticolo
{
get
{
return hfCodArticolo.Value;
}
set
{
hfCodArticolo.Value = value;
}
}
public string IdxMacchina
{
get
{
return hfIdxMacchina.Value;
}
set
{
hfIdxMacchina.Value = value;
}
}
public void doUpdate()
{
grView.DataBind();
calcTotali();
}
/// <summary>
/// seleziona/deseleziona le righe indicate...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSelAll_Click(object sender, EventArgs e)
{
// seleziono tutti i valori visibili nel datagrid
CheckBox chkbox = ((CheckBox)sender);
bool isChecked = chkbox.Checked;
if (!isChecked)
{
chkbox.ToolTip = traduci("btnSelAll");
}
else
{
chkbox.ToolTip = traduci("btnDeselAll");
}
foreach (GridViewRow riga in grView.Rows)
{
((CheckBox)riga.FindControl("chkSelect")).Checked = isChecked;
}
calcTotali();
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtReset_Click(object sender, EventArgs e)
{
doReset();
}
private void doReset()
{
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent(SteamWare.ucEvType.Reset);
}
protected void lbtToggle_Click(object sender, EventArgs e)
{
divDetail.Visible = !divDetail.Visible;
tgIcon.Attributes["class"] = divDetail.Visible ? "fa fa-chevron-up" : "fa fa-chevron-down";
}
protected void chkSelect_CheckedChanged(object sender, EventArgs e)
{
calcTotali();
}
private void calcTotali()
{
// update valori calcolati in base a selezione...
int numPzOrd = 0;
decimal tempoMinOrd = 0;
int numPzTot = 0;
decimal tempoMinTot = 0;
int idxPromessa = 0;
foreach (GridViewRow riga in grView.Rows)
{
numPzOrd = 0;
tempoMinOrd = 0;
DateTime DataRif = DateTime.Now.Date;
if (((CheckBox)riga.FindControl("chkSelect")).Checked && ((CheckBox)riga.FindControl("chkSelect")).Visible)
{
try
{
// idxPromessa = Convert.ToInt32(((Label)riga.FindControl("lblIdxODL")).Text);
int.TryParse(((Label)riga.FindControl("lblNumPezzi")).Text.Replace(".", ""), out numPzOrd);
decimal.TryParse(((Label)riga.FindControl("lblTotMinuti")).Text, out tempoMinOrd);
}
catch
{ }
numPzTot += numPzOrd;
tempoMinTot += tempoMinOrd;
//MapoDb.DataLayer.obj.taAs400.insProdAs400(IdxODL, DataRif);
}
}
//grView.DataBind();
lblNumPzTot.Text = $"{numPzTot:N0}";
lblOreTot.Text = $"{tempoMinTot / 60:N2}";
}
}
}