Example #1
0
        private void LoadXmlConfig(string path)
        {
            try
            {
                configXml = PrincipalTO.LoadConfig(path);
                if (fluxo == UtilDTO.NAVIGATION.SM)
                {
                    bool hasSharedSm = false;
                    foreach (var partner in configXml.Partners)
                    {
                        if (partner.Contracts.Any(contract => contract.Name == UtilDTO.CONTRACTS.SM_MEDIA.ToString()))
                        {
                            hasSharedSm = true;
                        }
                    }

                    if (!hasSharedSm)
                    {
                        txbResult.Text = "Psiu, olha aqui!\n\nVocê não possui nenhum contrato de SM que receba pela média de times.\n\nSerá que este é o menu que queria entrar mesmo ou falta algo em sua configuração?";
                        BlockFields(true);
                    }
                }
            }
            catch (FileNotFoundException ex)
            {
                txbResult.Text = ex.Message;
                BlockFields(true);
            }
            catch (Exception ex)
            {
                txbResult.Text = ex.Message;
            }
        }
Example #2
0
        private void LoadConfig()
        {
            try
            {
                config = PrincipalTO.LoadConfig(rootFolder);

                txbAuthorName.Text = config.AuthorName;
                txbAreaName.Text   = config.AreaName;
                txbTeamName.Text   = config.TeamName;

                foreach (var partner in config.Partners)
                {
                    lsbPartners.Items.Add(partner.Name);
                }

                btnNextForm.Enabled = true;

                ShowLog("Parece que você tem um arquivo preconfigurado. Legal! Vamos editá-lo\n=]");
            }
            catch (FileNotFoundException)
            {
                txbResult.Text = $"Não encontrei um arquivo de configuração na pasta {rootFolder}. Espero que este seja o início de uma nova amizade\n;)";
            }
            catch (Exception ex)
            {
                txbResult.Text = ex.Message;
            }
        }
        private void BtnLoad_Click(object sender, EventArgs e)
        {
            string filePath;

            try
            {
                using (OpenFileDialog openFileDialog = new OpenFileDialog())
                {
                    openFileDialog.Filter           = "XML (*.XML)|*.XML";
                    openFileDialog.FilterIndex      = 1;
                    openFileDialog.RestoreDirectory = true;

                    if (openFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        filePath = openFileDialog.FileName;
                        config   = PrincipalTO.LoadConfig(filePath);
                        UpdatePartnersCombo();
                        UpdateContractsCombo();
                        txbAuthor.Text   = config.AuthorName;
                        txbTeamName.Text = config.TeamName;
                        PrintUserLog("Arquivo de configuração carregado.");
                    }
                }
            }
            catch (Exception ex)
            {
                txbResult.Text = $"ERRO\n\n{ex.Message}\n\n{ex.InnerException.Message}";
            }
        }
Example #4
0
        private void LoadConfig()
        {
            try
            {
                //load config
                configXml = PrincipalTO.LoadConfig(outputDocPath);

                //set partners
                foreach (var partner in configXml.Partners)
                {
                    cbbPartners.Items.Add(partner.Name);
                }
                cbbPartners.SelectedIndex = 0;

                lsbSprints.SelectedIndex = 0;
                ShowLog("Por favor forneça os dados de desempenho do(s) plantonista(s).");
            }
            catch (Exception ex)
            {
                txbResult.Text = ex.Message;
            }
        }