コード例 #1
0
        private void tsPoblarBaseDatos_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show(this, "¿Seguro que quiere poblar la base de datos?", "Insercion de datos", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    // service.removeAllData();
                    service.RegisterUser(DateTime.Now.AddYears(-20), "1562738A", "*****@*****.**", "Andrea Villalba", 671299400, 344, DateTime.Now.AddYears(2), "andrea", 12345678, "hola");
                    service.RegisterUser(DateTime.Now.AddYears(-20), "1562338A", "*****@*****.**", "Ana Villalba", 67123400, 544, DateTime.Now.AddYears(3), "ana", 12345638, "hola");
                    service.RegisterEmployee(DateTime.Now.AddYears(-25), "12341234A", "*****@*****.**", "Juan Gonzalez", 635289102, "ES6621000418401234567891", 1234, "manager", 1200);
                    service.RegisterEmployee(DateTime.Now.AddYears(-25), "11111111A", "*****@*****.**", "Joaquin Gonzalez", 625289102, "ES6621033418401234567891", 1234, "manager", 1200);

                    MessageBox.Show(this, "Base de datos poblada con exito", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show(this, "Ya has poblado anteriormente la base de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }