public static void TestDeletev3order(SqlMapper_v3.IDataMapper orderMapper) { Console.WriteLine("------------------> Inseri um registo"); Customer newcust = new Customer("C0001", "Company1", "Contact1", "Mr", "Rua xxx", "Porto", " North", "4950 ", " Portugal", " 91123456", "2151421 "); Employee newempl = new Employee(1, "Rodrigues", "Tatiana", "Ms", "Ms", DateTime.Now, DateTime.Now, "Rua xxx", "Porto", "North", "3521", "Portugal", "12387643", "521", null, " ", 1, " "); Order neworder = new Order(newcust, newempl, DateTime.Now, DateTime.Now, DateTime.Now, 4, 4, "Barco do amor", "miami", "miami", "miami", "333222", "miami"); orderMapper.Insert(neworder); SqlMapper_v3.DataMapper <Order> orderMapper2 = (SqlMapper_v3.DataMapper <Order>)orderMapper; int lastRecord = orderMapper2.GetLastInsertedRecord(); Console.WriteLine("------------------> Inseri um registo"); newcust = new Customer("C0002", "Company2", "Contact2", "Mrs", "Rua yy", "Porto", " North", "4950 ", " Portugal", " 91123456", "2151421 "); newempl = new Employee(5, "Domingos", "Diana", "Ms", "Ms", DateTime.Now, DateTime.Now, "Rua eee", "Porto", "North", "3521", "Portugal", "12387643", "521", null, " ", 1, " "); neworder = new Order(newcust, newempl, DateTime.Now, DateTime.Now, DateTime.Now, 4, 4, "Barco do amor", "miami", "miami", "miami", "333222", "miami"); orderMapper.Insert(neworder); Console.ReadKey();//vejo estado actual Order newremorder = new Order(lastRecord, newcust, newempl, DateTime.Now, DateTime.Now, DateTime.Now, 0, 0, "", "", "", "", "", ""); orderMapper.Delete(newremorder); Console.WriteLine("------------------> Removi um registo"); newremorder = new Order(lastRecord + 1, newcust, newempl, DateTime.Now, DateTime.Now, DateTime.Now, 0, 0, "", "", "", "", "", ""); orderMapper.Delete(newremorder); Console.WriteLine("------------------> Removi um registo"); Console.ReadKey();//vejo estado actual }
public static void TestInsertv3employee(SqlMapper_v3.IDataMapper mapper) { Console.WriteLine("------------------> Inseri um registo"); Employee newempl = new Employee("Ermenegilda", "Escarlate", "Ms", "Ms", DateTime.Now, DateTime.Now, "Rua xxx", "Porto", "North", "3521", "Portugal", "12387643", "521", null, " ", 1, " "); mapper.Insert(newempl); UnitTest.TestGetAllv3(mapper);//vejo estado actual Console.WriteLine("------------------> Inseri um registo"); newempl = new Employee("Ermenegilda", "Escarlate", "Ms", "Ms", DateTime.Now, DateTime.Now, "Rua xxx", "Porto", "North", "3521", "Portugal", "12387643", "521", null, " ", 1, " "); mapper.Insert(newempl); UnitTest.TestGetAllv3(mapper);//vejo estado actual }
public static void TestDeletev3employee(SqlMapper_v3.IDataMapper mapper) { Console.WriteLine("------------------> Inseri um registo"); Employee newempl = new Employee("Ermenegilda", "Escarlate", "Ms", "Ms", DateTime.Now, DateTime.Now, "Rua xxx", "Porto", "North", "3521", "Portugal", "12387643", "521", null, " ", 1, " "); mapper.Insert(newempl); SqlMapper_v3.DataMapper <Employee> newempl2 = (SqlMapper_v3.DataMapper <Employee>)mapper; int lastRecord = newempl2.GetLastInsertedRecord(); UnitTest.TestGetAllv3(mapper);//vejo estado actual Console.WriteLine("------------------> Inseri um registo"); newempl = new Employee("Ermenegilda", "Escarlate", "Ms", "Ms", DateTime.Now, DateTime.Now, "Rua xxx", "Porto", "North", "3521", "Portugal", "12387643", "521", null, " ", 1, " "); mapper.Insert(newempl); UnitTest.TestGetAllv3(mapper);//vejo estado actual newempl = new Employee(lastRecord, "Ermenegilda", "Escarlate", "Ms", "Ms", DateTime.Now, DateTime.Now, "Rua xxx", "Porto", "North", "3521", "Portugal", "12387643", "521", null, " ", 1, " "); mapper.Delete(newempl); Console.WriteLine("------------------> Removi um registo"); newempl = new Employee(lastRecord + 1, "Ermenegilda", "Escarlate", "Ms", "Ms", DateTime.Now, DateTime.Now, "Rua xxx", "Porto", "North", "3521", "Portugal", "12387643", "521", null, " ", 1, " "); mapper.Delete(newempl); Console.WriteLine("------------------> Removi um registo"); UnitTest.TestGetAllv3(mapper);//vejo estado actual }