// ***************************** ***************************** *****************************
        // constructor
        public PuntoMedicionModViewModel(PuntoMedicionModel p)
        {
            this._PuntoMedicionRepository = new Protell.DAL.Repository.PuntoMedicionRepository();
            this._UnidadMedidaRepository = new Protell.DAL.Repository.UnidadMedidaRepository();
            this._TipoPuntoMedicion = new Protell.DAL.Repository.TipoPuntoMedicionRepository();
            this._EstPuntoMedRepository = new Protell.DAL.Repository.EstPuntoMedRepository();
            this.LoadInfoGrid();

            this._PuntoMedicion = new PuntoMedicionModel()
            {
                IdPuntoMedicion = p.IdPuntoMedicion,
                PuntoMedicionName = p.PuntoMedicionName,
                ValorReferencia = p.ValorReferencia,
                ParametroReferencia = p.ParametroReferencia,
                IsActive = p.IsActive,
                UNIDADMEDIDA = new UnidadMedidaModel()
                {
                    IdUnidadMedida = p.UNIDADMEDIDA.IdUnidadMedida,
                    UnidadMedidaName = p.UNIDADMEDIDA.UnidadMedidaName
                },
                TIPOPUNTOMEDICION = new TipoPuntoMedicionModel()
                {
                    IdTipoPuntoMedicion = p.TIPOPUNTOMEDICION.IdTipoPuntoMedicion,
                    TipoPuntoMedicionName = p.TIPOPUNTOMEDICION.TipoPuntoMedicionName
                }
            };

            var i = 0;
            foreach (UnidadMedidaModel v in this.UnidadMedidas)
            {
                i++;
                if (v.IdUnidadMedida == this._PuntoMedicion.UNIDADMEDIDA.IdUnidadMedida)
                {
                    this._PuntoMedicion.UNIDADMEDIDA = this.UnidadMedidas[i - 1];
                    break;
                }
            }

            var j = 0;
            foreach (TipoPuntoMedicionModel v in this.TipoPuntoMedicions)
            {
                j++;
                if (v.IdTipoPuntoMedicion == this._PuntoMedicion.TIPOPUNTOMEDICION.IdTipoPuntoMedicion)
                {
                    this._PuntoMedicion.TIPOPUNTOMEDICION = this.TipoPuntoMedicions[j - 1];
                    break;
                }
            }

            this.LoadPuntoMedicionEstructuras();
        }
        // ***************************** ***************************** *****************************
        // constructor
        public EstPuntoMedAddViewModel()
        {
            this._EstPuntoMedRepository = new Protell.DAL.Repository.EstPuntoMedRepository();
            this._PuntoMedicionRepository = new Protell.DAL.Repository.PuntoMedicionRepository();
            this._EstructuraRepository = new Protell.DAL.Repository.EstructuraRepository();

            this._EstPuntoMed = new EstPuntoMedModel()
            {
                IdEstPuntoMed = new UNID().getNewUNID(),
                IsActive = true
            };

            this.LoadInfoGrid();
        }
        // ***************************** ***************************** *****************************
        // constructor
        public PuntoMedicionAddViewModel()
        {
            this._PuntoMedicionRepository = new Protell.DAL.Repository.PuntoMedicionRepository();
            this._UnidadMedidaRepository = new Protell.DAL.Repository.UnidadMedidaRepository();
            this._TipoPuntoMedicion = new Protell.DAL.Repository.TipoPuntoMedicionRepository();
            this._EstPuntoMedRepository = new Protell.DAL.Repository.EstPuntoMedRepository();
            this._PuntoMedicion = new PuntoMedicionModel()
            {
                IdPuntoMedicion = new UNID().getNewUNID(),
                IsActive = true
            };

            this.LoadInfoGrid();
        }
        // ***************************** ***************************** *****************************
        // constructor
        public EstPuntoMedModViewModel(EstPuntoMedModel p)
        {
            this._EstPuntoMedRepository = new Protell.DAL.Repository.EstPuntoMedRepository();
            this._EstructuraRepository = new Protell.DAL.Repository.EstructuraRepository();
            this._PuntoMedicionRepository = new Protell.DAL.Repository.PuntoMedicionRepository();

            this._EstPuntoMed = new EstPuntoMedModel() {
            IdEstPuntoMed = p.IdEstPuntoMed,
            ESTRUCTURA = new EstructuraModel()
            {
                IdEstructura = p.IdEstructura,
                EstructuraName = p.ESTRUCTURA.EstructuraName
            },
            PUNTOMEDICION = new PuntoMedicionModel()
            {
                IdPuntoMedicion = p.IdPuntoMedicion,
                PuntoMedicionName = p.PUNTOMEDICION.PuntoMedicionName
            },
            IsActive = true
            };
            this.LoadInfoGrid();

            var i = 0;
            foreach (PuntoMedicionModel v in this.PuntoMedicions)
            {
                i++;
                if (v.IdPuntoMedicion == this.EstPuntoMed.PUNTOMEDICION.IdPuntoMedicion)
                {
                    this.EstPuntoMed.PUNTOMEDICION = this.PuntoMedicions[i - 1];
                    break;
                }
            }

            var j = 0;
            foreach (EstructuraModel v in this.Estructuras)
            {
                j++;
                if (v.IdEstructura == this.EstPuntoMed.ESTRUCTURA.IdEstructura)
                {
                    this.EstPuntoMed.ESTRUCTURA = this.Estructuras[j - 1];
                    break;
                }
            }
        }
 private void LoadPropiedades()
 {
     syncLogRepository = new SyncLogRepository();
     _SistemaRepository = new SistemaRepository();
     _RegistroRepository = new RegistroRepository();
     _ServerLastDataRepository = new ServerLastDataRepository();
     _UploadLogRepository = new UploadLogRepository();
     _EvidenceSyncRepository = new EvidenceSyncRepository();
     _SyncRepository = new SyncRepository();
     _CondProRepository = new CondProRepository();
     _DependenciaRepository = new DependenciaRepository();
     _EstPuntoMedRepository = new EstPuntoMedRepository();
     _EstructuraRepository = new EstructuraRepository();
     _EstructuraDependenciaRepository = new EstructuraDependenciaRepository();
     _PuntoMedicionRepository = new PuntoMedicionRepository();
     _TipoPuntoMedicionRepository = new TipoPuntoMedicionRepository();
     _UnidadMedidaRepository = new UnidadMedidaRepository();
     //_ConsideracionRepository = new ConsideracionRepository();
     //_AccionProtocoloRepository = new AccionProtocoloRepository();
     _CnfSettingRepository = new CnfSettingRepository();
     routeService = ConfigurationManager.AppSettings["RutaServicioSubida"].ToString();
     routeDownload = ConfigurationManager.AppSettings["RutaServicioDescarga"].ToString();
     basicAuthUser = ConfigurationManager.AppSettings["basicAuthUser"].ToString();
     basicAuthPass = ConfigurationManager.AppSettings["basicAuthPass"].ToString();
     contador = int.Parse(ConfigurationManager.AppSettings["ContSettings"].ToString());
     TopLog = int.Parse(ConfigurationManager.AppSettings["TopLog"].ToString());
 }