Example #1
0
        private void CarregarConfiguracoes(ConfigConnectionFirebird config)
        {
            Conexao conexao = _ConfigConnectionsController.ObterConexao(
                config.NomeConexao);

            if (conexao != null)
            {
                //config.Dialeto = conexao.PROPRIEDADES["Dialect"];
                //config.Usuario = conexao.PROPRIEDADES["uid"];
                //config.Senha = conexao.PROPRIEDADES["pwd"];
                config.CaminhoBase = conexao.PROPRIEDADES["dbname"];

                if (conexao.bCOMPLETO)
                {
                    config.Visible      = true;
                    ckbCompleto.Checked = true;
                    configConnectionFirebirdSpedContabil.Visible = true;
                    configConnectionContmatic.Visible            = true;
                }
            }
        }
Example #2
0
        private void CarregaMenus()
        {
            tsBasico.Visible     = false;
            tsContabil.Visible   = false;
            tsContimatic.Visible = false;
            tsFull1.Visible      = false;
            tsFull2.Visible      = false;
            tsLorenzon1.Visible  = false;
            tsLorenzon2.Visible  = false;
            Conexao      cx   = null;
            ModelConexao conn = _ConfigConnectionsController.ConexoesService.GetConfigConexoes();

            if (conn != null)
            {
                if (conn.CONEXOES.Count > 0)
                {
                    if (conn.CONEXOES.Where(c => c.NAME == "DBArquivoSpedContmatic").Count() > 0)
                    {
                        cx = _ConfigConnectionsController.ObterConexao("DBArquivoSpedContmatic");
                        if (cx.bCOMPLETO)
                        {
                            tsContimatic.Visible = true;
                        }
                    }
                    if (conn.CONEXOES.Where(c => c.NAME == "DBArquivoSpedContabil").Count() > 0)
                    {
                        cx = _ConfigConnectionsController.ObterConexao("DBArquivoSpedContabil");
                        if (cx.bCOMPLETO)
                        {
                            tsContabil.Visible = true;
                        }
                    }

                    if (conn.CONEXOES.Where(c => c.NAME == "DBArquivoSpedFiscal").Count() > 0)
                    {
                        tsBasico.Visible = true;

                        if (conn.bCOMPLETO)
                        {
                            tsFull1.Visible = true;
                            tsFull2.Visible = true;
                        }

                        cx = _ConfigConnectionsController.ObterConexao("DBArquivoSpedFiscal");


                        if (cx.sNM_EMPRESA.ToUpper().Equals("LORENZON"))
                        {
                            tsLorenzon1.Visible = true;
                            tsLorenzon2.Visible = true;
                        }
                    }
                }
            }
            cx = null;
            cx = _ConfigConnectionsController.ConexoesService.Obter("DBArquivoSpedFiscal");
            if (cx != null)
            {
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                config.ConnectionStrings.ConnectionStrings["DBArquivoSpedFiscal"].ConnectionString = _ConfigConnectionsController.ConexoesService.GetConnectionString(cx);
                config.Save(ConfigurationSaveMode.Modified, false);
                ConfigurationManager.RefreshSection("connectionStrings");
                cx = null;
            }
            cx = _ConfigConnectionsController.ConexoesService.Obter("DBArquivoSpedContabil");
            if (cx != null)
            {
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                config.ConnectionStrings.ConnectionStrings["DBArquivoSpedContabil"].ConnectionString = _ConfigConnectionsController.ConexoesService.GetConnectionString(cx);
                config.Save(ConfigurationSaveMode.Modified, false);
                ConfigurationManager.RefreshSection("connectionStrings");
                cx = null;
            }
            cx = _ConfigConnectionsController.ConexoesService.Obter("DBArquivoSpedContmatic");
            if (cx != null)
            {
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                config.ConnectionStrings.ConnectionStrings["DBArquivoSpedContmatic"].ConnectionString = _ConfigConnectionsController.ConexoesService.GetConnectionString(cx);
                config.Save(ConfigurationSaveMode.Modified, false);
                ConfigurationManager.RefreshSection("connectionStrings");
                cx = null;
            }
        }