using SteamWare;
using System;

namespace GMW
{
  public partial class confLinee : UserPage
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!Page.IsPostBack)
      {
        mod_righePag.numRowPag = 3;
        mod_anagTipoLinee.numRows = mod_righePag.numRowPag;
        mod_righePag1.numRowPag = 5;
        mod_anagLinee.numRows = mod_righePag1.numRowPag;
      }
      mod_anagTipoLinee.eh_ucev += Mod_anagTipoLinee_eh_ucev;
      mod_righePag.eh_newNum += Mod_righePag_eh_newNum;
      mod_righePag1.eh_newNum += Mod_righePag1_eh_newNum;
      mod_anagLinee.eh_ucev += Mod_anagLinee_eh_ucev;
    }

    private void Mod_anagLinee_eh_ucev(object sender, EventArgs e)
    {// se trovo evento select/reset mostro/nascondo dettagli...
      ucEvent evento = (ucEvent)e;
      switch (evento.tipoEvento)
      {
        case ucEvType.Delete:
          break;
        case ucEvType.Edit:
          break;
        case ucEvType.New:
          break;
        case ucEvType.Reset:
          divDx.Visible = false;
          divSx.Attributes.Remove("class");
          divSx.Attributes.Add("class", "col-12");
          break;
        case ucEvType.ReqUpdateParent:
          break;
        case ucEvType.Selected:
          divDx.Visible = true;
          divSx.Attributes.Remove("class");
          divSx.Attributes.Add("class", "col-8");
          divDx.Attributes.Remove("class");
          divDx.Attributes.Add("class", "col-4");
          mod_confLinea.codLinea = mod_anagLinee.codLineaSel;
          break;
        default:
          break;
      }
      //throw new NotImplementedException();
    }

    private void Mod_righePag1_eh_newNum(object sender, EventArgs e)
    {
      mod_anagLinee.numRows = mod_righePag1.numRowPag;
    }
    private void Mod_righePag_eh_newNum(object sender, EventArgs e)
    {
      mod_anagTipoLinee.numRows = mod_righePag.numRowPag;
    }

    private void Mod_anagTipoLinee_eh_ucev(object sender, EventArgs e)
    {
      // se trovo evento select/reset mostro/nascondo dettagli...
      ucEvent evento = (ucEvent)e;
      switch (evento.tipoEvento)
      {
        case ucEvType.Delete:
          break;
        case ucEvType.Edit:
          break;
        case ucEvType.New:
          break;
        case ucEvType.Reset:
          divDetail.Visible = false;
          break;
        case ucEvType.ReqUpdateParent:
          break;
        case ucEvType.Selected:
          mod_anagLinee.CodBlocco = mod_anagTipoLinee.CodBloccoSel;
          divDetail.Visible = true;
          mod_anagLinee.resetSelezione();
          break;
        default:
          break;
      }
    }
  }
}