Esempio n. 1
0
        public IEnumerable <TeamList> Get()
        {
            DBtools dbt = new DBtools();

            return(dbt.GetDataTeamList());
            //return new string[] { "value1", "value2" };
        }
        protected void changeSelection(object sender, EventArgs e)
        {
            DBtools db = new DBtools();

            dgvItems.DataSource = db.caricaTables(cmbTables.SelectedItem.ToString());
            dgvItems.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     // lo fa eseguire sempre TRANNE la prima volta, perchè al primo giro è false, poi diventa true
     // ispostback è sempre falsa la prima volta
     if (!Page.IsPostBack)
     {
         // inizializzazioni che vengono eseguite solo la prima volta che carico la pagina
         // lblMessaggio.Text = "Digita username e password, poi clicca sul pulsante INVIA";
         //lblMessaggio.Text = "Premi il pulsante INVIA, apparirà la lista delle nazioni gestite.";
         DBtools db = new DBtools();
         cmbTables.DataSource = db.getTableName();
         cmbTables.DataBind();
         cmbTables.SelectedIndex = 0;
         dgvItems.DataSource     = db.getTable(cmbTables.SelectedItem.ToString());
         dgvItems.DataBind();
     }
     else
     {
         // elaborazioni da eseguire tutte le volte che la pagina viene ricaricata
         // lblMessaggio.Text = "Benvenuto al signor " + txtUserName.Text;
         // riempire la lista nazioni
         //DBtools db=new DBtools();
         //dgvItems.DataSource = db.getTable(cmbTables.SelectedIndex.ToString());
         //dgvItems.DataBind();
         Getcountry("");
     }
 }
        private void btnLoad_Click(object sender, System.EventArgs e)
        {
            string sql;

            org.swyn.foundation.utils.DBtools db = new DBtools(tdb.User.Uhelper, tdb.User.Udbcon);
            this.objProfileDS.Clear();
            sql = String.Format("Select * from tdbadmin.mp_profil");
            db.FillDs(this.objProfileDS, sql, new string[] { "mp_profil" });
        }
Esempio n. 5
0
        public static void callCreateTable(string table)
        {
            DBtools d   = new DBtools();
            bool    err = d.createTable(table + ".sql");

            if (!err)
            {
                Console.WriteLine("\nCreate " + table + " - SUCCESS\n");
            }
            else
            {
                Console.WriteLine("\n" + table + " Not Created \n");
            }
        }
Esempio n. 6
0
        private static void restoreDatabase()
        {
            DBtools d   = new DBtools();
            bool    err = d.restore();

            if (!err)
            {
                Console.WriteLine("\nRestore Database - SUCCESS\n");
            }
            else
            {
                Console.WriteLine("\nRestore Database - FAILURE\n");
            }
        }
Esempio n. 7
0
        private static void backupDatabase()
        {
            DBtools d   = new DBtools();
            bool    err = d.backup();

            if (!err)
            {
                Console.WriteLine("\nBackup Database - SUCCESS\n");
            }
            else
            {
                Console.WriteLine("\nBackup Database - FAILURE\n");
            }
        }
        private void btnUpdate_Click(object sender, System.EventArgs e)
        {
            org.swyn.foundation.utils.DBtools db = new DBtools(tdb.User.Uhelper, tdb.User.Udbcon);
            db.UpdDs(this.objProfileDS, "tdbadmin.tdb_insprof",
                     new string[] { "MPID", "MPUSER", "BCHST", "SECLEVEL", "S_ID", "LAND_ID", "DLTT_ID", "DLT_ID", "KAT_ID", "DLAT_ID", "DLNT_ID", "SAI_ID", "PRG_ID", "A_ZEIT", "E_ZEIT", "P_RANGE" },
                     "tdbadmin.tdb_updprof",
                     new string[] { "MPID", "MPUSER", "BCHST", "SECLEVEL", "S_ID", "LAND_ID", "DLTT_ID", "DLT_ID", "KAT_ID", "DLAT_ID", "DLNT_ID", "SAI_ID", "PRG_ID", "A_ZEIT", "E_ZEIT", "P_RANGE" },
                     "tdbadmin.tdb_delprof",
                     new string[] { "MPID" }, "mp_profil");
//			IDbCommand inscmd = tdb.User.Uhelper.CreateCommand(dbc, "tdbadmin.tdb_insprof",
//				"MPID", "MPUSER", "BCHST", "SECLEVEL", "S_ID", "LAND_ID", "DLTT_ID", "DLT_ID", "KAT_ID", "DLAT_ID", "DLNT_ID", "SAI_ID", "PRG_ID", "A_ZEIT", "E_ZEIT", "P_RANGE");
//			IDbCommand updcmd = tdb.User.Uhelper.CreateCommand(dbc, "tdbadmin.tdb_updprof",
//				"MPID", "MPUSER", "BCHST", "SECLEVEL", "S_ID", "LAND_ID", "DLTT_ID", "DLT_ID", "KAT_ID", "DLAT_ID", "DLNT_ID", "SAI_ID", "PRG_ID", "A_ZEIT", "E_ZEIT", "P_RANGE");
//			IDbCommand delcmd = tdb.User.Uhelper.CreateCommand(dbc, "tdbadmin.tdb_delprof", "MPID");
//			tdb.User.Uhelper.UpdateDataset(inscmd, delcmd, updcmd, this.objProfileDS, "mp_profil");
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            db = new DBtools();
            if (!IsPostBack)
            {
                tb1.DataSource = db.GetTableList();
                tb1.DataBind();

                tb2.DataSource = db.GetHeaders("Country");
                tb2.DataBind();

                tb3.Items.Insert(0, "ASC");
                tb3.Items.Insert(1, "DESC");
            }
            GetCountry();
        }
Esempio n. 10
0
File: User.cs Progetto: oeli/yafra
        public void LoadProfile(string Auser)
        {
            dbt = new DBtools(tdb.User.Uhelper, tdb.User.Udbcon);
            tdb.Season   sai  = new tdb.Season();
            tdb.Language lang = new tdb.Language();
            tdb.Customer pers = new tdb.Customer();
            ProfileDS    prof;
            string       sql;

            // load profile from DB by user name
            prof = new ProfileDS();
            sql  = String.Format("Select * from tdbadmin.mp_profil where mpuser like '{0}'", Auser);
            dbt.FillDS(prof, sql, new string[] { "mp_profil" });
            ProfileDS.mp_profilRow Rprof = prof.mp_profil[0];

            // set now the user profile data
            // Console.WriteLine("Prof Id {0}", Rprof.MPID);
            Useclevel = Rprof.SECLEVEL;
            Ulangid   = Rprof.S_ID;
            if (Ulangid > 0)
            {
                Ulang = lang.GetBez(Ulangid);
            }
            else
            {
                Ulang = "";
            }
            Uofficeid = Rprof.BCHST;
            if (Uofficeid > 0)
            {
                Uoffice = pers.GetBez(Uofficeid);
            }
            else
            {
                Ulang = "";
            }
            Udlatid = Rprof.DLAT_ID;
            Usaiid  = Rprof.SAI_ID;
            if (Usaiid > 0)
            {
                Usai = sai.GetBez(Usaiid);
            }
            else
            {
                Usai = "";
            }
        }
        protected void changeIndex(object sender, EventArgs e)
        {
            DBtools d = new DBtools();

            if (lstTabelle.SelectedValue == "country")
            {
                dg.DataSource = d.getCountries();
            }
            else if (lstTabelle.SelectedValue == "Teams")
            {
                dg.DataSource = d.getTeams();
            }
            else
            {
                dg.DataSource = d.getPilot();
            }
            dg.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         //inizializzazioni che vengono eseguite sonlo la prima volta che load la page
         //lblMessaggio.Text = "Digita Username e Password e premi invia";
         DBtools       d    = new DBtools();
         DataTable     dt   = d.nameTable();
         List <string> list = new List <string>();
         foreach (DataRow item in dt.Rows)
         {
             list.Add((item["TABLE_NAME"]).ToString());
         }
         lstTabelle.DataSource = list;
         lstTabelle.DataBind();
     }
     else
     {
     }
 }
Esempio n. 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         // Inizializzazioni che vengono eseguite solo la prima volta che carico la pagina
         // lblMessaggio.Text = "DIGITA USERNAME E PASSWORD, POI PREMI IL PULSANTE INVIA";
         lbxNazioni.Visible = false;
         lblMessaggio.Text  = "Premi il pulsante INVIA, apparirà la griglia dei team e la lista delle nazioni gestite.";
         GetCountry();
     }
     else
     {
         // Elaborazioni da eseguire tutte le volte che la pagina viene ricaricata
         // lblMessaggio.Text = "Benvenuto al sig. " + txtUserName.Text;
         // Riempio la lista nazioni
         DBtools myTools = new DBtools();
         dgvTabella.DataSource = myTools.GetDataTable("Team");
         dgvTabella.DataBind();
         lbxNazioni.DataSource = myTools.GetCountries();
         lbxNazioni.DataBind();
         lbxNazioni.Visible = true;
     }
 }
        public IEnumerable <TeamDtO> GetTeamsList()
        {
            DBtools d = new DBtools();

            return(d.GetTeamsList());
        }
        [HttpGet("id/{id}")] // GET /api/TCDtO/id/1
        public TeamDtOSpecifics GetTeamSpecifics(int id)
        {
            DBtools d = new DBtools();

            return(d.GetTeamSpecifics(id));
        }
        static void Main(string[] args)
        {
            DBTools = new DBtools();
            char scelta = ' ';

            do
            {
                Console.WriteLine("\n*** FORMULA ONE - CONSOLE ***\n");
                Console.WriteLine("1 - Create Countries");
                Console.WriteLine("2 - Create Teams");
                Console.WriteLine("3 - Create Drivers");
                Console.WriteLine("4 - Create Circuits");
                Console.WriteLine("5 - Create Races");
                Console.WriteLine("6 - Create RacesPoints");
                Console.WriteLine("7 - Create Scorse");
                Console.WriteLine("------------------");
                Console.WriteLine("B - Backup");
                Console.WriteLine("T - Restore");
                Console.WriteLine("R - Reset");
                Console.WriteLine("------------------");
                Console.WriteLine("X - EXIT\n");
                scelta = Console.ReadKey(true).KeyChar;
                switch (scelta)
                {
                case '1':
                    DBTools.ExecuteSqlScript("Countries.sql");
                    break;

                case '2':
                    DBTools.ExecuteSqlScript("Teams.sql");
                    break;

                case '3':
                    DBTools.ExecuteSqlScript("Drivers.sql");
                    break;

                case '4':
                    DBTools.ExecuteSqlScript("Circuits.sql");
                    break;

                case '5':
                    DBTools.ExecuteSqlScript("Races.sql");
                    break;

                case '6':
                    DBTools.ExecuteSqlScript("RacesPoints.sql");
                    break;

                case '7':
                    DBTools.ExecuteSqlScript("Scores.sql");
                    break;

                case 'B':
                    Thread.Sleep(1050);
                    DBTools.DBBackup();
                    break;

                case 'T':
                    Thread.Sleep(1050);
                    DBTools.DBRestore();
                    break;

                case 'R':
                    Thread.Sleep(1050);
                    DBTools.DBBackup();
                    bool OK;

                    OK = DBTools.callDropTable("Country");
                    if (OK)
                    {
                        OK = DBTools.callDropTable("Team");
                    }
                    if (OK)
                    {
                        OK = DBTools.callDropTable("Driver");
                    }

                    //script file
                    if (OK)
                    {
                        OK = DBTools.callExecuteSqlScript("countries");
                    }
                    if (OK)
                    {
                        OK = DBTools.callExecuteSqlScript("teams");
                    }
                    if (OK)
                    {
                        OK = DBTools.callExecuteSqlScript("drivers");
                    }
                    if (OK)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("RESET DB OK");
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    else
                    {
                        DBTools.DBRestore();
                    }

                    break;

                default:
                    if (scelta != 'X' && scelta != 'x')
                    {
                        Console.WriteLine("\nUncorrect Choice - Try Again\n");
                    }
                    break;
                }
            } while (scelta != 'X' && scelta != 'x');
        }
Esempio n. 17
0
        public Country Get(string isoCode)
        {
            DBtools db = new DBtools();

            return(db.GetCountry(isoCode));
        }
        public IEnumerable <RaceResults> Get()
        {
            DBtools dt = new DBtools();

            return(dt.GetRaceResult());
        }
        public IEnumerable <RaceResults> Get(string raceId)
        {
            DBtools dt = new DBtools();

            return(dt.GetRaceResult(raceId));
        }
Esempio n. 20
0
        public Country Get(string id)
        {
            DBtools db = new DBtools();

            return(db.GetCountryById(id));
        }
Esempio n. 21
0
        public IEnumerable <Country> Get()
        {
            DBtools db = new DBtools();

            return(db.GetListCountry());
        }
Esempio n. 22
0
        [HttpGet("number/{number}")] // GET /api/driver/number/10
        public Driver GetDriverFromNumber(int number)
        {
            DBtools d = new DBtools();

            return(d.GetDriver_number(number));
        }
Esempio n. 23
0
        [HttpGet("name/{name}")] // GET /api/driver/name/Lewis Hamilton
        public Driver GetDriverFromName(string name)
        {
            DBtools d = new DBtools();

            return(d.GetDriver_name(name));
        }
Esempio n. 24
0
        public IEnumerable <Driver> get_driver()
        {
            DBtools db = new DBtools();

            return(db.GetDriversObj());
        }
Esempio n. 25
0
        public Team Get(int id)
        {
            DBtools db = new DBtools();

            return(db.GetTeamById(id));
        }
Esempio n. 26
0
        public List <Driver> Get()
        {
            DBtools d = new DBtools();

            return(d.getDriversObj());
        }
Esempio n. 27
0
        public List <Teams> Get()
        {
            DBtools d = new DBtools();

            return(d.getTeamsObj());
        }
Esempio n. 28
0
        public Driver Get(string id)
        {
            DBtools d = new DBtools();

            return(d.getDriver(id));
        }
Esempio n. 29
0
        public Teams Get(string id)
        {
            DBtools d = new DBtools();

            return(d.getTeam(id));
        }
Esempio n. 30
0
        public IEnumerable <Team> Get()
        {
            DBtools db = new DBtools();

            return(db.GetListTeam());
        }