Example #1
0
        public void CargarDatos()
        {
            string ambito = string.Empty;

            if (this._uge.GetType() == typeof(BaseOrg))
            {
                ambito = AdministradorPreferencias.Read(PrefsGlobal.OrgName);
            }
            else if (this._uge.GetType() == typeof(Zona))
            {
                ambito = (this._uge as Zona).Denominacion;
            }
            else if (this._uge.GetType() == typeof(Edificio))
            {
                ambito = (this._uge as Edificio).Denominacion;
            }
            else if (this._uge.GetType() == typeof(PlantaBase))
            {
                ambito = string.Format("{0} en {1}", (this._uge as PlantaBase).Planta.ToString(),
                                       AdministradorPreferencias.Read(PrefsGlobal.OrgName));
            }
            else if (this._uge.GetType() == typeof(PlantaZona))
            {
                ambito = (this._uge as PlantaZona).Planta.ToString() + " en " + (this._uge as PlantaZona).Zona.Denominacion;
            }
            else if (this._uge.GetType() == typeof(PlantaEdificio))
            {
                ambito = (this._uge as PlantaEdificio).Denominacion;
            }

            this.Text = string.Format("SIGUANETDesktop TreeDATA ({0}) - {1}", ambito, this._tituloForm);

            this.nodoBaseOrg.Tag = new BaseOrg();
            int i = 0;

            if (this._consulta != null)
            {
                if (this._consulta is List <Estancia> )
                {
                    EventoInicioModulo((this._consulta as List <Estancia>).Count);
                    foreach (Estancia e in (List <Estancia>) this._consulta)
                    {
                        TreeNode NodoPlanta   = GUIUtils.obtenerNodoPlanta(e, nodoBaseOrg);
                        TreeNode nodoEstancia = new TreeNode(e.Codigo);
                        nodoEstancia.Tag = e;
                        NodoPlanta.Nodes.Add(nodoEstancia);
                        EventoPasoModulo(++i);
                    }
                }
                else if (this._consulta is List <Ubicacion> )
                {
                    EventoInicioModulo((this._consulta as List <Ubicacion>).Count);
                    foreach (Ubicacion u in (List <Ubicacion>) this._consulta)
                    {
                        TreeNode NodoPlanta    = GUIUtils.obtenerNodoPlanta(u.Estancia, nodoBaseOrg);
                        TreeNode nodoUbicacion = new TreeNode(u.Persona.ToString());
                        nodoUbicacion.Tag = u;
                        NodoPlanta.Nodes.Add(nodoUbicacion);
                        EventoPasoModulo(++i);
                    }
                }
            }

            this.twNavegador.Nodes.Add(this.nodoBaseOrg);
            if (this._ds != null)
            {
                if (this._ds.Tables.Count > 0)
                {
                    this.dg.DataSource    = this._ds.Tables[0];
                    this.tslNumFilas.Text = string.Format("{0} registros", this._ds.Tables[0].Rows.Count);
                }
            }
        }