Exemplo n.º 1
0
 public DbDataTimer(int milliseconds, Func <Database, T> funcReturnValue) :
     base(milliseconds, () =>
 {
     using (var db = ProgramBase.NewDb())
         return(funcReturnValue(db));
 })
 {
 }
Exemplo n.º 2
0
 private void btnGenerate_Click(object sender, EventArgs e)
 {
     ProgramBase.RunSafe(this, () =>
     {
         //parei aqui
         //ter que ter 3 colunas (
         //TableName;
         //BusinessClassName;
         //DataClassName;
     });
 }
Exemplo n.º 3
0
        public bool Test(bool showMessage)
        {
            Cursor = Cursors.WaitCursor;
            bool ok = false;

            try
            {
                string cs = Database.BuildConnectionString(providerType, txtServerName.Text, txtDatabase.Text, txtUserId.Text, txtPassword.Text, false, Conv.ToInt32(txtPort.Text)).ConnectionString;
                if (cs != null)
                {
                    using (var db = new Database(providerType, cs))
                    {
                        db.Open();
                        db.Close();
                    }

                    using (var reg = new RegUtil(ProgramBase.RegistrySource, ProgramBase.AppName))
                    {
                        reg.Check();
                        reg.Server   = txtServerName.Text;
                        reg.Database = txtDatabase.Text;
                        reg.UserId   = txtUserId.Text;
                        reg.Password = txtPassword.Text;
                        reg.Ok       = 1;
                    }

                    ok = true;

                    ProgramBase.ConnectionString = cs;
                }

                if (showMessage)
                {
                    ProgramBase.ShowInformation("Base de dados configurada com sucesso para '" + txtAppName.Text + "'");
                }
            }
            catch (Exception ex)
            {
                ProgramBase.ShowError(ex);
                ok = false;
            }
            Cursor = Cursors.Default;
            return(ok);
        }