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(); } /// /// Verifica visibilità da posizione /// /// first/last /// num priorità attuale /// 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; } /// /// comando reset /// /// /// protected void lbtReset_Click(object sender, EventArgs e) { fixSchedOrd(); grView.SelectedIndex = -1; grView.DataBind(); raiseReset(); } protected void grView_SelectedIndexChanged(object sender, EventArgs e) { raiseEvent(); } /// /// BatchId selezionato /// public int selBatchId { get { int answ = 0; int.TryParse(grView.SelectedValue.ToString(), out answ); return answ; } } } }