public void Tables_CustomerRegisterTables_RelationshipTest() { BaseTableAdapter tableAdapter = new GenderTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; Tables tables = new Tables(); tableAdapter.Fill(tables.GenderDataTable); tableAdapter = new ApppTprTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.ApppDataTable); tableAdapter = new CustomerTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.CustomerDataTable); tableAdapter = new RegisterTypeTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.RegisterTypeDataTable); tableAdapter = new LandTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.LandDataTable); tableAdapter = new WhyDeRegisterTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.WhyDeRegisterDataTable); tableAdapter = new RegisterTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.RegisterDataTable); Assert.IsTrue(tables.RegisterDataTable.Rows.Count > 1); }
public void Tables_CustomerRegisterTables_Relationship_DeleteCascadTest() { ConnectionManager.SetConnection("Supervisor", "admin"); BaseTableAdapter tableAdapter = new GenderTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; Tables tables = new Tables(); tableAdapter.Fill(tables.GenderDataTable); tableAdapter = new ApppTprTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.ApppDataTable); tableAdapter = new CustomerTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.CustomerDataTable); tableAdapter = new RegisterTypeTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.RegisterTypeDataTable); tableAdapter = new LandTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.LandDataTable); tableAdapter = new WhyDeRegisterTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.WhyDeRegisterDataTable); tableAdapter = new RegisterTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.RegisterDataTable); int countRows = tables.RegisterDataTable.Rows.Count; int customerId = Int32.Parse(tables.RegisterDataTable.Rows[tables.RegisterDataTable.Rows.Count - 1]["CustomerID"].ToString()); for (int i = 0; i < tables.CustomerDataTable.Rows.Count; i++) { if (Int32.Parse(tables.CustomerDataTable.Rows[i][0].ToString()) == customerId) { tables.CustomerDataTable.Rows[i].Delete(); break; } } tableAdapter = new CustomerTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; ((UpdateBaseTableAdapter)tableAdapter).Update(tables.CustomerDataTable); tableAdapter = new RegisterTableAdapter(); tableAdapter.Connection = ConnectionManager.Connection; tableAdapter.Fill(tables.RegisterDataTable); Assert.IsTrue(countRows - tables.RegisterDataTable.Rows.Count >= 1); }
protected BaseTableAdapter GetGlossary(string name) { BaseTableAdapter table = null; switch (name) { case "AdminDivision": table = new AdminDivisionTableAdapter() { Connection = _conn }; break; case "Gender": table = new GenderTableAdapter() { Connection = _conn }; break; case "ApppTpr": table = new ApppTprTableAdapter() { Connection = _conn }; break; case "Benefits": table = new BenefitsCategoryTableAdapter() { Connection = _conn }; break; case "ChiperRecept": table = new ChiperReceptTableAdapter() { Connection = _conn }; break; case "Disability": table = new DisabilityGroupTableAdapter() { Connection = _conn }; break; case "Land": table = new LandTableAdapter() { Connection = _conn }; break; case "Register": table = new RegisterTypeTableAdapter() { Connection = _conn }; break; case "TypeStreet": table = new TypeStreetTableAdapter() { Connection = _conn }; break; case "WhyDeReg": table = new WhyDeRegisterTableAdapter() { Connection = _conn }; break; } return(table); }