Exemplo n.º 1
0
        public static Organization chooseCodeOrganization(string organizationId)
        {
            Config m_config = ManageXMLConfig.Deserialize();
            Dictionary <int, Organization> m_organizations = new Dictionary <int, Organization>();

            bool isHaveOrganization = m_config.Organization != null && m_config.Organization.Count > 0;

            if (isHaveOrganization)
            {
                ConsoleHelper.WriteQuestionLine(Constants.LANG_CHOOSECODEPACKAGEMANIFESTINCONFIG);
                String rowTitle = getRowForScreen(Constants.propertiesOrganization);
                ConsoleHelper.WriteDocLine(rowTitle);
                foreach (var item in m_config.Organization)
                {
                    m_organizations.Add(item.Id, item);
                    String nameOrganization = viewBarInConsoleForScreen(item.Id.ToString());
                    String Username         = viewBarInConsoleForScreen(item.Username);
                    String Password         = viewBarInConsoleForScreen(getRowPassword(item.Password, '*'));
                    String SecurityToken    = String.Concat(getRowPassword(item.SecurityToken, '*'), " ");
                    String production       = String.Concat(getEnvironment(item.Production), " ");
                    String api = String.Concat(item.Api, " ");
                    Console.WriteLine(String.Concat(nameOrganization, Username, Password, SecurityToken, production, api));
                }
            }

            try
            {
                ConsoleHelper.WriteQuestionLine(">>> Code Organization:Please enter for new Environment:");
                ConsoleHelper.WriteDocLine(organizationId);

                Organization enviroment = new Organization();

                foreach (KeyValuePair <int, Organization> item in m_organizations)
                {
                    if (item.Value.Nick == organizationId)
                    {
                        enviroment = item.Value;
                    }
                }

                if (enviroment != null && enviroment.Nick != "")
                {
                    return(enviroment);
                }
                else
                {
                    ConsoleHelper.WriteWarningLine("Not Found Organization");
                    return(new Organization());
                }
            }
            catch (System.Exception)
            {
                ConsoleHelper.WriteErrorLine("Not Found Organization");
                return(generateOrganizationManifest());
            }
        }
Exemplo n.º 2
0
        public static Organization chooseCodeOrganization()
        {
            Config m_config = ManageXMLConfig.Deserialize();
            Dictionary <int, Organization> m_organizations = new Dictionary <int, Organization>();

            bool isHaveOrganization = m_config.Organization != null && m_config.Organization.Count > 0;

            if (isHaveOrganization)
            {
                ConsoleHelper.WriteQuestionLine(Constants.LANG_CHOOSECODEPACKAGEMANIFESTINCONFIG);
                String rowTitle = getRowForScreen(Constants.propertiesOrganization);
                ConsoleHelper.WriteDocLine(rowTitle);
                foreach (var item in m_config.Organization)
                {
                    m_organizations.Add(item.Id, item);
                    String idOrganization   = viewBarInConsoleForScreen(item.Id.ToString());
                    String NickOrganization = viewBarInConsoleForScreen(item.Nick);
                    String Username         = viewBarInConsoleForScreen(item.Username);
                    String Password         = viewBarInConsoleForScreen(getRowPassword(item.Password, '*'));
                    String SecurityToken    = String.Concat(getRowPassword(item.SecurityToken, '*'), " ");
                    String production       = String.Concat(getEnvironment(item.Production), " ");
                    String api = String.Concat(item.Api, " ");
                    Console.WriteLine(String.Concat(idOrganization, NickOrganization, Username, Password, SecurityToken, production, api));
                }
            }

            try
            {
                int id;
                if (isHaveOrganization)
                {
                    ConsoleHelper.WriteQuestionLine(">>> Code Organization:Please enter for new Environment:");
                    id = Int32.Parse(Console.ReadLine());
                }
                else
                {
                    return(generateOrganizationManifest());
                }

                if (m_organizations.ContainsKey(id))
                {
                    return(m_organizations[id]);
                }
                else
                {
                    ConsoleHelper.WriteWarningLine("Not Found Organization");
                    return(new Organization());
                }
            }
            catch (System.Exception)
            {
                ConsoleHelper.WriteErrorLine("Not Found Organization");
                return(generateOrganizationManifest());
            }
        }
Exemplo n.º 3
0
 private static Config ReadConfig()
 {
     return(ManageXMLConfig.Deserialize());
 }