Exemplo n.º 1
0
        public void ChangeProperty_Group_File()
        {
            String strErrorResut = String.Empty;
            String providerName  = "localFile";

            Fwk.Configuration.Common.Group g = new Fwk.Configuration.Common.Group();
            g.Name = "Test01_ChangeProperty";
            Fwk.Configuration.Common.Key k;

            k            = new Fwk.Configuration.Common.Key();
            k.Name       = "K01_ChangeProperty";
            k.Value.Text = "Value_Key_01";


            g.Keys.Add(k);


            try
            {
                Fwk.Configuration.Common.ConfigurationFile wConfigurationFile = Fwk.Configuration.ConfigurationManager.GetConfigurationFile(providerName);
                Fwk.Configuration.ConfigurationManager_CRUD.AddGroup(providerName, g);


                Fwk.Configuration.ConfigurationManager_CRUD.ChangeGroupName(providerName, g.Name, string.Concat("NEW" + g.Name));
                k            = new Fwk.Configuration.Common.Key();
                k.Name       = "Value_Key_01_Updated";
                k.Value.Text = "Value_Key_01";
                Fwk.Configuration.ConfigurationManager_CRUD.ChangeProperty(providerName, string.Concat("NEW" + g.Name), k, "K01_ChangeProperty");
                Fwk.Configuration.ConfigurationManager_CRUD.RemoveGroup(providerName, string.Concat("NEW" + g.Name));
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }
        }
Exemplo n.º 2
0
        public bool LoadAuthenticationModes()
        {
            Boolean           wOutBool = false;
            ImageComboBoxItem wImageComboBoxItem;
            string            wDescription;

            //Obtenemos una lista de las Keys en el grupo "AuthenticationMode" del Configuration Manager
            Fwk.Configuration.Common.Group wGroup = Fwk.Configuration.ConfigurationManager.GetGroup("AuthenticationMode");

            List <Fwk.Configuration.Common.Key> wKeyList = null;

            if (wGroup != null)
            {
                wKeyList = wGroup.Keys.Where(p => (!String.IsNullOrEmpty(p.Value.Text) && Boolean.TryParse(p.Value.Text, out wOutBool) && wOutBool == true)).ToList();
            }

            if (wKeyList.Count <= 0)
            {
                MessageViewer.Show("No se encuentran modos de autenticación configurados con Value = true en el archivo de configuración. Por favor verifique.");
                return(false);
            }

            cmdAuthMode.Properties.Items.Clear();

            //Por cada Key obtenida la agregamos al Combo de modos de autenticación
            foreach (Fwk.Configuration.Common.Key wItem in wKeyList)
            {
                wDescription       = Fwk.UI.Common.HelperFunctions.Enumerations.GetDescription(Enum.Parse(typeof(AuthenticationModeEnum), wItem.Name));
                wImageComboBoxItem = new ImageComboBoxItem(wDescription, wItem.Name);
                cmdAuthMode.Properties.Items.Add(wImageComboBoxItem);

                if (Enum.Parse(typeof(AuthenticationModeEnum), wItem.Name).Equals(AuthenticationModeEnum.WindowsIntegrated))
                {
                    _HasWindowsAuthenticationMode = true;
                }
            }

            //Validamos si el combo tiene Modo de autenticación de Windows y cargamos los Dominios
            if (_HasWindowsAuthenticationMode)
            {
                cmdAuthMode.EditValue = Convert.ToInt32(AuthenticationModeEnum.WindowsIntegrated).ToString();
                LoadDomains();
            }
            else
            {
                cmdAuthMode.SelectedIndex = 0;
                cmbDominios.ItemIndex     = 0;
            }

            return(true);
        }
Exemplo n.º 3
0
        public void ConfigurationMannager_Database()
        {
            String strErrorResut = String.Empty;
            String providerName = "database";

            Fwk.Configuration.Common.Group g = new Fwk.Configuration.Common.Group();
            g.Name = "Test01";
            Fwk.Configuration.Common.Key k;

            k = new Fwk.Configuration.Common.Key();
            k.Name = "K01";
            k.Value.Text = "Value_Key_01";
            g.Keys.Add(k);

            k = new Fwk.Configuration.Common.Key();
            k.Name = "K02";
            k.Value.Text = "Value_Key_02";
            g.Keys.Add(k);

            
            try
            {
                Fwk.Configuration.Common.ConfigurationFile wConfigurationFile = Fwk.Configuration.ConfigurationManager.GetConfigurationFile(providerName);
                Fwk.Configuration.ConfigurationManager_CRUD.AddGroup(providerName, g);
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }

            Assert.AreEqual<String>(strErrorResut, string.Empty, strErrorResut);

            if (!string.IsNullOrEmpty(strErrorResut)) return;

            k = new Fwk.Configuration.Common.Key();

            k.Name = "K03";
            k.Value.Text = "Value_Key_03";
            try
            {
                Fwk.Configuration.ConfigurationManager_CRUD.AddProperty(providerName, g.Name, k);
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }
            Assert.AreEqual<String>(strErrorResut, string.Empty, strErrorResut);

            if (!string.IsNullOrEmpty(strErrorResut)) return;
            string kvalue = Fwk.Configuration.ConfigurationManager.GetProperty(providerName,g.Name, "K03");

            if (!kvalue.Equals("Value_Key_03", StringComparison.OrdinalIgnoreCase))
                Assert.Inconclusive("No se pudo obtener correctamente la propiedad", kvalue);



            try
            {
                Fwk.Configuration.ConfigurationManager_CRUD.RemoveProperty(providerName,  g.Name,"K03");
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }

            Assert.AreEqual<String>(strErrorResut, string.Empty, strErrorResut);
            if (!string.IsNullOrEmpty(strErrorResut)) return;



            try
            {
                Fwk.Configuration.ConfigurationManager_CRUD.RemoveGroup(providerName, g.Name);
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }
            Assert.AreEqual<String>(strErrorResut, string.Empty, strErrorResut);

        }
Exemplo n.º 4
0
        public void ChangeProperty_Group_File()
        {
            String strErrorResut = String.Empty;
            String providerName = "localFile";

            Fwk.Configuration.Common.Group g = new Fwk.Configuration.Common.Group();
            g.Name = "Test01_ChangeProperty";
            Fwk.Configuration.Common.Key k;

            k = new Fwk.Configuration.Common.Key();
            k.Name = "K01_ChangeProperty";
            k.Value.Text = "Value_Key_01";


            g.Keys.Add(k);


            try
            {
                Fwk.Configuration.Common.ConfigurationFile wConfigurationFile = Fwk.Configuration.ConfigurationManager.GetConfigurationFile(providerName);
                Fwk.Configuration.ConfigurationManager_CRUD.AddGroup(providerName, g);


                Fwk.Configuration.ConfigurationManager_CRUD.ChangeGroupName(providerName, g.Name, string.Concat("NEW" + g.Name));
                k = new Fwk.Configuration.Common.Key();
                k.Name = "Value_Key_01_Updated";
                k.Value.Text = "Value_Key_01";
                Fwk.Configuration.ConfigurationManager_CRUD.ChangeProperty(providerName, string.Concat("NEW" + g.Name), k, "K01_ChangeProperty");
                Fwk.Configuration.ConfigurationManager_CRUD.RemoveGroup(providerName, string.Concat("NEW" + g.Name));

            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }


        }
Exemplo n.º 5
0
        public void ConfigurationMannager_Database()
        {
            String strErrorResut = String.Empty;
            String providerName  = "database";

            Fwk.Configuration.Common.Group g = new Fwk.Configuration.Common.Group();
            g.Name = "Test01";
            Fwk.Configuration.Common.Key k;

            k            = new Fwk.Configuration.Common.Key();
            k.Name       = "K01";
            k.Value.Text = "Value_Key_01";
            g.Keys.Add(k);

            k            = new Fwk.Configuration.Common.Key();
            k.Name       = "K02";
            k.Value.Text = "Value_Key_02";
            g.Keys.Add(k);


            try
            {
                Fwk.Configuration.Common.ConfigurationFile wConfigurationFile = Fwk.Configuration.ConfigurationManager.GetConfigurationFile(providerName);
                Fwk.Configuration.ConfigurationManager_CRUD.AddGroup(providerName, g);
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }

            Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut);

            if (!string.IsNullOrEmpty(strErrorResut))
            {
                return;
            }

            k = new Fwk.Configuration.Common.Key();

            k.Name       = "K03";
            k.Value.Text = "Value_Key_03";
            try
            {
                Fwk.Configuration.ConfigurationManager_CRUD.AddProperty(providerName, g.Name, k);
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }
            Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut);

            if (!string.IsNullOrEmpty(strErrorResut))
            {
                return;
            }
            string kvalue = Fwk.Configuration.ConfigurationManager.GetProperty(providerName, g.Name, "K03");

            if (!kvalue.Equals("Value_Key_03", StringComparison.OrdinalIgnoreCase))
            {
                Assert.Inconclusive("No se pudo obtener correctamente la propiedad", kvalue);
            }



            try
            {
                Fwk.Configuration.ConfigurationManager_CRUD.RemoveProperty(providerName, g.Name, "K03");
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }

            Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut);
            if (!string.IsNullOrEmpty(strErrorResut))
            {
                return;
            }



            try
            {
                Fwk.Configuration.ConfigurationManager_CRUD.RemoveGroup(providerName, g.Name);
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }
            Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut);
        }