using System;
using System.Web.UI;

namespace NKC_WF
{
    public partial class StackManager : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ((SiteMaster)this.Master).showSearch = false;
                checkVisibility();
            }
            cmp_taktList.eh_doRefresh += Cmp_taktList_eh_doRefresh;
            cmp_taktList.eh_doReset += Cmp_taktList_eh_doReset;
            cmp_stackList.eh_doRefresh += Cmp_stackList_eh_doRefresh;
        }

        private void Cmp_stackList_eh_doRefresh(object sender, EventArgs e)
        {
            checkVisibility();
            // imposto Stack!
            cmp_stackBuilding.StackId = cmp_stackList.StackIdSel;
        }

        private void Cmp_taktList_eh_doReset(object sender, EventArgs e)
        {
            checkVisibility();
            cmp_stackList.BatchId = 0;
            cmp_stackList.resetSelezione();
        }

        private void Cmp_taktList_eh_doRefresh(object sender, EventArgs e)
        {
            checkVisibility();
            // imposto batch!
            cmp_stackList.BatchId = cmp_taktList.BatchIdSel;
            cmp_stackBuilding.StackId = cmp_stackList.StackIdSel;
        }

        private void checkVisibility()
        {
            // Di default nascondo i dettagli...
            cmp_stackList.Visible = (cmp_taktList.BatchIdSel > 0);
            cmp_stackBuilding.Visible = (cmp_taktList.BatchIdSel > 0) && (cmp_stackList.StackIdSel > 0);
        }

    }
}