private void FillFromLocal()
        {
            DatasourceConfiguration conf = MDFeNetConfig.ReadFromLocal();

            cbTipoBanco.SelectedValue = conf.DataProvider;
            txServidor.Text           = conf.Datasource;
            txUsuario.Text            = conf.UserId;
            txSenha.Password          = conf.Password;
            txNomeBanco.Text          = conf.InitialCatalog;
        }
Exemplo n.º 2
0
 private void btExecutar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DatasourceConfiguration conf = MDFeNetConfig.ReadFromLocal();
         DataTable dt = conf.RetrieveDataFromSql(txSQL.Text);
         dataGrid.ItemsSource = dt.DefaultView;
     }
     catch (Exception ex)
     {
         MsgBox.SimpleText(ex.Message);
     }
 }
        private DatasourceConfiguration GetConfig()
        {
            DatasourceConfiguration conf = new DatasourceConfiguration();

            conf.DataProvider = (DatasourceConfiguration.Provider)cbTipoBanco.SelectedValue;
            conf.Datasource   = (txServidor.Text.Contains(":")
                ? txServidor.Text.Split(':')[0]
                : txServidor.Text);
            conf.Port = (txServidor.Text.Contains(":")
                ? int.Parse(txServidor.Text.Split(':')[1])
                : 0);
            conf.UserId         = txUsuario.Text;
            conf.Password       = txSenha.Password;
            conf.InitialCatalog = txNomeBanco.Text;

            return(conf);
        }
 public Datasource(DatasourceConfiguration datasourceConfiguration)
 {
     Mapper.CreateMap<DatasourceConfiguration, Datasource>();
     Mapper.Map(datasourceConfiguration, this);
 }
        private void Testar()
        {
            DatasourceConfiguration conf = GetConfig();

            conf.TestConnection();
        }