Files
NKC/NKC_WF/WebUserControls/cmp_orderSched.ascx.cs
T
Samuele E. Locatelli 3031566e5d More cleanup on code
2020-07-15 18:57:57 +02:00

93 lines
2.4 KiB
C#

using AppData;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace NKC_WF.WebUserControls
{
public partial class cmp_orderSched : BaseUserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
fixSchedOrd();
}
}
protected int numRows
{
get
{
int answ = 0;
int.TryParse(hfNumRows.Value, out answ);
return answ;
}
set
{
hfNumRows.Value = value.ToString();
}
}
private void fixSchedOrd()
{
numRows = DataLayer.man.taBL.getSched().Count * 10;
DataLayer.man.taBL.fixSched();
}
protected void lbtUp_Click(object sender, EventArgs e)
{
int BatchId = 0;
LinkButton lbtBtn = (LinkButton)sender;
if (lbtBtn != null)
{
int.TryParse(lbtBtn.CommandArgument, out BatchId);
moveBatch(BatchId, -15);
}
}
protected void lbtDown_Click(object sender, EventArgs e)
{
int BatchId = 0;
LinkButton lbtBtn = (LinkButton)sender;
if (lbtBtn != null)
{
int.TryParse(lbtBtn.CommandArgument, out BatchId);
moveBatch(BatchId, 15);
}
}
private void moveBatch(int BatchId, int step)
{
// aggiorno
DataLayer.man.taBL.updateSchedPrior(BatchId, step);
// ricalcolo
fixSchedOrd();
grView.SelectedIndex = -1;
grView.DataBind();
lblTitle.Focus();
}
/// <summary>
/// Verifica visibilità da posizione
/// </summary>
/// <param name="mode">first/last</param>
/// <param name="currPrior">num priorità attuale</param>
/// <returns></returns>
public bool checkVisible(string mode, object currPrior)
{
bool answ = true;
int numPrior = 0;
int.TryParse(currPrior.ToString(), out numPrior);
if (mode == "first")
{
answ = (numPrior != 10);
}
else
{
answ = (numPrior != numRows);
}
return answ;
}
}
}