/// <summary>
        /// Agrega un accessLevel a la organizacion
        /// </summary>
        /// <param name="orgID"></param>
        /// <param name="LNLpanelID"></param>
        /// <param name="accessLevelID"></param>
        /// <param name="TZReaderData"></param>
        public static void addAccessLevel(int orgID, int LNLpanelID, int accessLevelID, string TZReaderData)
        {
            LENELAccessLevels LNLACC;
            if (!ListaAccessLevels.ContainsKey(orgID))
            {
                LNLACC = new LENELAccessLevels(orgID);
                ListaAccessLevels.Add(orgID, LNLACC);
            }
            LNLACC = ListaAccessLevels[orgID];
            LNLACC.createAccessLevel(LNLpanelID, accessLevelID, TZReaderData);

            // Alta en la BD
            mainApp.DataManager.addLenelAccesLevel(LNLACC, LNLpanelID, accessLevelID, orgID);
        }
        /// <summary>
        /// Da de alta la definicion del accessLevel  v_accessLevelID correspondiente al PanelID
        /// Es una definicion completa, por lo que se da de baja antes de hacer el add.
        /// </summary>
        /// <param name="v_LNLACC"></param>
        /// <param name="v_PanelID"></param>
        /// <param name="v_accessLevelID"></param>
        public void addLenelAccesLevel(LENELAccessLevels v_LNLACC, int v_PanelID, int v_accessLevelID, int v_idOrganizacion)
        {
            SqlConnection cnn = new SqlConnection(conexion);
            try
            {
                cnn.Open();

                SqlCommand cmd = cnn.CreateCommand();
                cmd.CommandText = "delete from AccessLevels where idOrganizacion =" + v_idOrganizacion.ToString() + " and LNLPanelID = " + v_PanelID.ToString() + " and idAccess = " + v_accessLevelID.ToString();

                cmd.CommandType = CommandType.Text;
                cmd.ExecuteNonQuery();

                AccessLevelData ACCData = v_LNLACC.getAccessLevel(v_PanelID);

                if (ACCData != null)
                {

                    Dictionary<int,int> ReaderTZDef = ACCData.ReaderTZ[v_accessLevelID];

                    foreach (KeyValuePair<int, int> pair in ReaderTZDef)
                    {
                        cmd = cnn.CreateCommand();

                        cmd.CommandText = "insert into AccessLevels (idOrganizacion,LNLPanelID,idAccess,ReaderID,TZNum) values (" + v_idOrganizacion.ToString() + "," + v_PanelID.ToString() + "," + v_accessLevelID + "," + pair.Key.ToString() + "," + pair.Value.ToString() + ")";
                        cmd.CommandType = CommandType.Text;
                        cmd.ExecuteNonQuery();
                    }
                }

            }
            catch (Exception ex)
            {
                loguearString("Excepcion en addLenelAccessLevel: " + ex.Message, TiposLOG.HH);
            }
            finally
            {
                cnn.Close();
            }
        }
        // Carga todos los datos de los AccessLevels de todas las organizaciones
        public Dictionary<int, LENELAccessLevels> LoadListaAccessLevels()
        {
            Dictionary<int, LENELAccessLevels> listaResultado = new Dictionary<int, LENELAccessLevels>();

            SqlConnection cnn = new SqlConnection(conexion);
            //try
            //{
                cnn.Open();
                SqlCommand cmd = cnn.CreateCommand();

                cmd.CommandText = "select * from AccessLevels";
                cmd.CommandType = CommandType.Text;
                SqlDataReader lector = cmd.ExecuteReader();
                while (lector.Read())
                {
                    int idOrg = int.Parse(lector["idOrganizacion"].ToString());

                    if (!listaResultado.ContainsKey(idOrg))
                    {
                        LENELAccessLevels nuevoAccessLevels = new LENELAccessLevels(idOrg);
                        listaResultado.Add(idOrg, nuevoAccessLevels);
                    }

                    LENELAccessLevels accessLevels = listaResultado[idOrg];

                    int LNLPanelID = int.Parse(lector["LNLPanelID"].ToString());
                    int idAccessLevel = int.Parse(lector["idAccess"].ToString());
                    int readerID = int.Parse(lector["ReaderID"].ToString());
                    int TZNum = int.Parse(lector["TZNum"].ToString());

                    AccessLevelData ALD = accessLevels.obtenerAccessLevelsFromPanel(LNLPanelID);

                    string datosAccessLevel = readerID.ToString() + "," + TZNum.ToString();

                    ALD.addReaderTZData(idAccessLevel, datosAccessLevel);
                }
                lector.Close();
            //}
            //catch (Exception ex)
            //{
            //    loguearString("Excepcion en LoadListaAccessLevels: " + ex.Message, TiposLOG.ALUTRACK);
            //}
            //finally
            //{
                cnn.Close();
            //}
            return listaResultado;
        }