public void ReadAll_Create3Records_3DifferentRecords() { //Assemble EnrollmentModel enrollmentModel1 = new EnrollmentModel(); enrollmentModel1.programId = programId; enrollmentModel1.programId = programId; enrollmentModel1.clientId = clientId; enrollmentModel1.dogId = dogId; enrollmentModel1.programId = programId; EnrollmentModel enrollmentModel2 = new EnrollmentModel(); enrollmentModel2.programId = programId; enrollmentModel2.programId = programId; enrollmentModel2.clientId = clientId; enrollmentModel2.dogId = dogId; enrollmentModel2.programId = programId; EnrollmentModel enrollmentModel3 = new EnrollmentModel(); enrollmentModel3.programId = programId; enrollmentModel3.programId = programId; enrollmentModel3.clientId = clientId; enrollmentModel3.dogId = dogId; enrollmentModel3.programId = programId; EnrollmentTable enrollmentTable = new EnrollmentTable(); //Act int enrollmentID1 = enrollmentTable.create(enrollmentModel1); int enrollmentID2 = enrollmentTable.create(enrollmentModel2); int enrollmentID3 = enrollmentTable.create(enrollmentModel3); List <EnrollmentModel> actual = enrollmentTable.readAll(); //Assert Assert.AreEqual(enrollmentID1, enrollmentID1); Assert.AreEqual(enrollmentModel1.programId, actual[0].programId); Assert.AreEqual(enrollmentModel1.clientId, actual[0].clientId); Assert.AreEqual(enrollmentModel1.dogId, actual[0].dogId); Assert.AreEqual(enrollmentModel1.programId, actual[0].programId); Assert.AreEqual(enrollmentID2, enrollmentID2); Assert.AreEqual(enrollmentModel2.programId, actual[1].programId); Assert.AreEqual(enrollmentModel2.clientId, actual[1].clientId); Assert.AreEqual(enrollmentModel2.dogId, actual[1].dogId); Assert.AreEqual(enrollmentModel2.programId, actual[1].programId); Assert.AreEqual(enrollmentID3, enrollmentID3); Assert.AreEqual(enrollmentModel3.programId, actual[2].programId); Assert.AreEqual(enrollmentModel3.clientId, actual[2].clientId); Assert.AreEqual(enrollmentModel3.dogId, actual[2].dogId); Assert.AreEqual(enrollmentModel3.programId, actual[2].programId); }
public void ReadAll_Create3Records_CountIs3() { //Assemble EnrollmentModel enrollmentModel1 = new EnrollmentModel(); enrollmentModel1.programId = programId; enrollmentModel1.programId = programId; enrollmentModel1.clientId = clientId; enrollmentModel1.dogId = dogId; enrollmentModel1.programId = programId; enrollmentModel1.paymentMethod = 1; enrollmentModel1.name = "Advanced"; enrollmentModel1.joinDate = DateTime.Now; enrollmentModel1.inviteIssued = true; EnrollmentModel enrollmentModel2 = new EnrollmentModel(); enrollmentModel2.programId = programId; enrollmentModel2.programId = programId; enrollmentModel2.clientId = clientId; enrollmentModel2.dogId = dogId; enrollmentModel2.programId = programId; enrollmentModel2.paymentMethod = 2; enrollmentModel2.name = "Advanced"; enrollmentModel2.joinDate = DateTime.Now; enrollmentModel2.inviteIssued = true; EnrollmentModel enrollmentModel3 = new EnrollmentModel(); enrollmentModel3.programId = programId; enrollmentModel3.programId = programId; enrollmentModel3.clientId = clientId; enrollmentModel3.dogId = dogId; enrollmentModel3.programId = programId; enrollmentModel3.paymentMethod = 1; enrollmentModel3.name = "Regular"; enrollmentModel3.joinDate = DateTime.Now; enrollmentModel3.inviteIssued = true; EnrollmentTable enrollmentTable = new EnrollmentTable(); int expected = 3; //Act int enrollmentID1 = enrollmentTable.create(enrollmentModel1); int enrollmentID2 = enrollmentTable.create(enrollmentModel2); int enrollmentID3 = enrollmentTable.create(enrollmentModel3); List <EnrollmentModel> actual = enrollmentTable.readAll(); //Assert Assert.AreEqual(expected, actual.Count); }
public void Read_CreatedAndRead1Record_CorrectValues() { //Assemble EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.programId = programId; enrollmentModel.clientId = clientId; enrollmentModel.dogId = dogId; enrollmentModel.programId = programId; enrollmentModel.paymentMethod = 2; enrollmentModel.name = "Advanced"; enrollmentModel.joinDate = DateTime.Now; enrollmentModel.inviteIssued = true; EnrollmentTable enrollmentTable = new EnrollmentTable(); //Act int enrollmentID = enrollmentTable.create(enrollmentModel); EnrollmentModel actual = enrollmentTable.read(enrollmentID); //Assert Assert.AreEqual(enrollmentModel.programId, actual.programId); Assert.AreEqual(enrollmentModel.clientId, actual.clientId); Assert.AreEqual(enrollmentModel.dogId, actual.dogId); Assert.AreEqual(enrollmentModel.programId, actual.programId); Assert.AreEqual(enrollmentModel.name, actual.name); Assert.AreEqual(enrollmentModel.joinDate.DayOfYear, actual.joinDate.DayOfYear); Assert.AreEqual(enrollmentModel.inviteIssued, actual.inviteIssued); }
public void Update_CreatedUpdateAndRead1Record_UpdatedValues() { //Assemble EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.programId = programId; enrollmentModel.clientId = clientId; enrollmentModel.dogId = dogId; enrollmentModel.programId = programId; EnrollmentTable enrollmentTable = new EnrollmentTable(); int enrollmentID = enrollmentTable.create(enrollmentModel); enrollmentModel.id = enrollmentID; enrollmentModel.programId = programId; enrollmentModel.clientId = clientId; enrollmentModel.dogId = dogId; enrollmentModel.programId = programId; //Act enrollmentTable.update(enrollmentModel); EnrollmentModel actual = enrollmentTable.read(enrollmentID); //Assert Assert.AreEqual(enrollmentModel.programId, actual.programId); Assert.AreEqual(enrollmentModel.clientId, actual.clientId); Assert.AreEqual(enrollmentModel.dogId, actual.dogId); Assert.AreEqual(enrollmentModel.programId, actual.programId); }
private void enrollHelaRegular() { EnrollmentTable enrollmentTable = new EnrollmentTable(); PaymentTable paymentTable = new PaymentTable(); EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.name = dogModelOdin.name + " (owned by " + clientModelJames.displayName + ") in " + programModelRegular1.name; enrollmentModel.clientId = clientIdJames; enrollmentModel.dogId = dogIdHela; enrollmentModel.programId = programIdRegular1; enrollmentModel.paymentMethod = PaymentConstants.PAYMENT_PER_CLASS; enrollmentModel.joinDate = DateTime.Now.AddDays(-19); enrollmentModel.inviteIssued = true; int enrollmentId = enrollmentTable.create(enrollmentModel); PaymentModel paymentModel1 = new PaymentModel(); paymentModel1.enrollmentId = enrollmentId; paymentModel1.paymentType = PaymentTypeConstants.DEPOSIT; paymentModel1.paymentAmountDue = programVarietyModelRegular.depositAmount; paymentModel1.paymentAmountDueDate = DateTime.Now.AddDays(-19); paymentModel1.paymentRecieved = true; paymentModel1.paymentRecievedDate = DateTime.Now.AddDays(-19); paymentModel1.recieptIssued = true; paymentTable.create(paymentModel1); PaymentModel paymentModel2 = new PaymentModel(); paymentModel2.enrollmentId = enrollmentId; paymentModel2.paymentType = PaymentTypeConstants.INSTALLMENT; paymentModel2.paymentAmountDue = 39.00; paymentModel2.paymentAmountDueDate = DateTime.Now.AddDays(+14); paymentModel2.paymentRecieved = false; //paymentModel2.paymentRecievedDate = DateTime.Now.AddDays(+); paymentModel2.recieptIssued = false; paymentTable.create(paymentModel2); PaymentModel paymentModel3 = new PaymentModel(); paymentModel3.enrollmentId = enrollmentId; paymentModel3.paymentType = PaymentTypeConstants.INSTALLMENT; paymentModel3.paymentAmountDue = 39.00; paymentModel3.paymentAmountDueDate = DateTime.Now.AddDays(+28); paymentModel3.paymentRecieved = false; //paymentModel2.paymentRecievedDate = DateTime.Now.AddDays(+); paymentModel3.recieptIssued = false; paymentTable.create(paymentModel3); PaymentModel paymentModel4 = new PaymentModel(); paymentModel4.enrollmentId = enrollmentId; paymentModel4.paymentType = PaymentTypeConstants.INSTALLMENT; paymentModel4.paymentAmountDue = 39.00; paymentModel4.paymentAmountDueDate = DateTime.Now.AddDays(+42); paymentModel4.paymentRecieved = false; //paymentModel4.paymentRecievedDate = DateTime.Now.AddDays(+); paymentModel4.recieptIssued = false; paymentTable.create(paymentModel4); }
public void ReadAll_Create3Records_CountIs3() { //Assemble EnrollmentModel enrollmentModel1 = new EnrollmentModel(); enrollmentModel1.programId = programId; enrollmentModel1.programId = programId; enrollmentModel1.clientId = clientId; enrollmentModel1.dogId = dogId; enrollmentModel1.programId = programId; EnrollmentModel enrollmentModel2 = new EnrollmentModel(); enrollmentModel2.programId = programId; enrollmentModel2.programId = programId; enrollmentModel2.clientId = clientId; enrollmentModel2.dogId = dogId; enrollmentModel2.programId = programId; EnrollmentModel enrollmentModel3 = new EnrollmentModel(); enrollmentModel3.programId = programId; enrollmentModel3.programId = programId; enrollmentModel3.clientId = clientId; enrollmentModel3.dogId = dogId; enrollmentModel3.programId = programId; EnrollmentTable enrollmentTable = new EnrollmentTable(); int expected = 3; //Act int enrollmentID1 = enrollmentTable.create(enrollmentModel1); int enrollmentID2 = enrollmentTable.create(enrollmentModel2); int enrollmentID3 = enrollmentTable.create(enrollmentModel3); List <EnrollmentModel> actual = enrollmentTable.readAll(); //Assert Assert.AreEqual(expected, actual.Count); }
public void Create_ValidData_EnrollmentIDReturned() { //Assemble EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.programId = programId; enrollmentModel.clientId = clientId; enrollmentModel.dogId = dogId; enrollmentModel.programId = programId; //If created will be greater than 0, but we don't know exactly what it will be because deleting all records doesnt set the ID counter back to 0 int notCreated = 0; EnrollmentTable enrollmentTable = new EnrollmentTable(); //Act int actual = enrollmentTable.create(enrollmentModel); //Assert Assert.AreNotEqual(notCreated, actual); }
public void Count_Created1Record_1() { //Assemble EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.programId = programId; enrollmentModel.clientId = clientId; enrollmentModel.dogId = dogId; enrollmentModel.programId = programId; int expected = 1; EnrollmentTable enrollmentTable = new EnrollmentTable(); //Act int enrollmentID = enrollmentTable.create(enrollmentModel); int actual = enrollmentTable.count(); //Assert Assert.AreEqual(expected, actual); }
private void enrollHeimdallAdvanced() { EnrollmentTable enrollmentTable = new EnrollmentTable(); PaymentTable paymentTable = new PaymentTable(); EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.name = dogModelHeimdall.name + " (owned by " + clientModelMark.displayName + ") in " + programModelAdvanced1.name; enrollmentModel.clientId = clientIdJames; enrollmentModel.dogId = dogIdHeimdall; enrollmentModel.programId = programIdAdvanced1; enrollmentModel.paymentMethod = PaymentConstants.PAYMENT_PER_CLASS; enrollmentModel.joinDate = DateTime.Now.AddDays(-2); enrollmentModel.inviteIssued = true; int enrollmentId = enrollmentTable.create(enrollmentModel); PaymentModel paymentModel1 = new PaymentModel(); paymentModel1.enrollmentId = enrollmentId; paymentModel1.paymentType = PaymentTypeConstants.DEPOSIT; paymentModel1.paymentAmountDue = programVarietyModelAdvanced.depositAmount; paymentModel1.paymentAmountDueDate = DateTime.Now.AddDays(-2); paymentModel1.paymentRecieved = true; paymentModel1.paymentRecievedDate = DateTime.Now.AddDays(-2); paymentModel1.recieptIssued = true; paymentTable.create(paymentModel1); for (var i = 0; i < 8; i++) { PaymentModel paymentModelInstallment = new PaymentModel(); paymentModelInstallment.enrollmentId = enrollmentId; paymentModelInstallment.paymentType = PaymentTypeConstants.INSTALLMENT; paymentModelInstallment.paymentAmountDue = 26.25; paymentModelInstallment.paymentAmountDueDate = DateTime.Now.AddDays(50 + (i * 7)); paymentModelInstallment.paymentRecieved = false; //paymentModel1.paymentRecievedDate = DateTime.Now.AddDays(-2); paymentModelInstallment.recieptIssued = false; paymentTable.create(paymentModelInstallment); } }
private void enrollLokiAdvanced() { EnrollmentTable enrollmentTable = new EnrollmentTable(); PaymentTable paymentTable = new PaymentTable(); EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.name = dogModelLoki.name + " (owned by " + clientModelJames.displayName + ") in " + programModelAdvanced1.name; enrollmentModel.clientId = clientIdJames; enrollmentModel.dogId = dogIdLoki; enrollmentModel.programId = programIdAdvanced1; enrollmentModel.paymentMethod = PaymentConstants.PAYMENT_IN_FULL; enrollmentModel.joinDate = DateTime.Now.AddDays(-2); enrollmentModel.inviteIssued = true; int enrollmentId = enrollmentTable.create(enrollmentModel); PaymentModel paymentModel1 = new PaymentModel(); paymentModel1.enrollmentId = enrollmentId; paymentModel1.paymentType = PaymentTypeConstants.DEPOSIT; paymentModel1.paymentAmountDue = programVarietyModelAdvanced.depositAmount; paymentModel1.paymentAmountDueDate = DateTime.Now.AddDays(-2); paymentModel1.paymentRecieved = true; paymentModel1.paymentRecievedDate = DateTime.Now.AddDays(-2); paymentModel1.recieptIssued = true; paymentTable.create(paymentModel1); PaymentModel paymentModel2 = new PaymentModel(); paymentModel2.enrollmentId = enrollmentId; paymentModel2.paymentType = PaymentTypeConstants.BALANCE; paymentModel2.paymentAmountDue = 210.00; paymentModel2.paymentAmountDueDate = DateTime.Now.AddDays(-2); paymentModel2.paymentRecieved = false; //paymentModel2.paymentRecievedDate = DateTime.Now.AddDays(-19); paymentModel2.recieptIssued = false; paymentTable.create(paymentModel2); }
private void enrollHeimdallRegular() { EnrollmentTable enrollmentTable = new EnrollmentTable(); PaymentTable paymentTable = new PaymentTable(); EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.name = dogModelHeimdall.name + " (owned by " + clientModelMark.displayName + ") in " + programModelRegular1.name; enrollmentModel.clientId = clientIdMark; enrollmentModel.dogId = dogIdHeimdall; enrollmentModel.programId = programIdRegular1; enrollmentModel.paymentMethod = PaymentConstants.PAYMENT_IN_FULL; enrollmentModel.joinDate = DateTime.Now.AddDays(-19); enrollmentModel.inviteIssued = true; int enrollmentId = enrollmentTable.create(enrollmentModel); PaymentModel paymentModel1 = new PaymentModel(); paymentModel1.enrollmentId = enrollmentId; paymentModel1.paymentType = PaymentTypeConstants.DEPOSIT; paymentModel1.paymentAmountDue = programVarietyModelRegular.depositAmount; paymentModel1.paymentAmountDueDate = DateTime.Now.AddDays(-19); paymentModel1.paymentRecieved = true; paymentModel1.paymentRecievedDate = DateTime.Now.AddDays(-19); paymentModel1.recieptIssued = true; paymentTable.create(paymentModel1); PaymentModel paymentModel2 = new PaymentModel(); paymentModel2.enrollmentId = enrollmentId; paymentModel2.paymentType = PaymentTypeConstants.BALANCE; paymentModel2.paymentAmountDue = 117.00; paymentModel2.paymentAmountDueDate = DateTime.Now.AddDays(-19); paymentModel2.paymentRecieved = false; //paymentModel2.paymentRecievedDate = DateTime.Now.AddDays(-19); paymentModel2.recieptIssued = false; paymentTable.create(paymentModel2); }
public void Count_Created1Record_1() { //Assemble EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.programId = programId; enrollmentModel.clientId = clientId; enrollmentModel.dogId = dogId; enrollmentModel.programId = programId; enrollmentModel.paymentMethod = 1; enrollmentModel.name = "Advanced"; enrollmentModel.joinDate = DateTime.Now; enrollmentModel.inviteIssued = true; int expected = 1; EnrollmentTable enrollmentTable = new EnrollmentTable(); //Act int enrollmentID = enrollmentTable.create(enrollmentModel); int actual = enrollmentTable.count(); //Assert Assert.AreEqual(expected, actual); }
public void ReadAll_Create3Records_3DifferentRecords() { //Assemble EnrollmentModel enrollmentModel1 = new EnrollmentModel(); enrollmentModel1.programId = programId; enrollmentModel1.programId = programId; enrollmentModel1.clientId = clientId; enrollmentModel1.dogId = dogId; enrollmentModel1.programId = programId; enrollmentModel1.paymentMethod = 1; enrollmentModel1.name = "Advanced"; enrollmentModel1.joinDate = DateTime.Now; enrollmentModel1.inviteIssued = true; EnrollmentModel enrollmentModel2 = new EnrollmentModel(); enrollmentModel2.programId = programId; enrollmentModel2.programId = programId; enrollmentModel2.clientId = clientId; enrollmentModel2.dogId = dogId; enrollmentModel2.programId = programId; enrollmentModel2.paymentMethod = 2; enrollmentModel2.name = "Advanced"; enrollmentModel2.joinDate = DateTime.Now; enrollmentModel2.inviteIssued = true; EnrollmentModel enrollmentModel3 = new EnrollmentModel(); enrollmentModel3.programId = programId; enrollmentModel3.programId = programId; enrollmentModel3.clientId = clientId; enrollmentModel3.dogId = dogId; enrollmentModel3.programId = programId; enrollmentModel3.paymentMethod = 1; enrollmentModel3.name = "Regular"; enrollmentModel3.joinDate = DateTime.Now; enrollmentModel3.inviteIssued = true; EnrollmentTable enrollmentTable = new EnrollmentTable(); //Act int enrollmentID1 = enrollmentTable.create(enrollmentModel1); int enrollmentID2 = enrollmentTable.create(enrollmentModel2); int enrollmentID3 = enrollmentTable.create(enrollmentModel3); List <EnrollmentModel> actual = enrollmentTable.readAll(); //Assert Assert.AreEqual(enrollmentID1, enrollmentID1); Assert.AreEqual(enrollmentModel1.programId, actual[0].programId); Assert.AreEqual(enrollmentModel1.clientId, actual[0].clientId); Assert.AreEqual(enrollmentModel1.dogId, actual[0].dogId); Assert.AreEqual(enrollmentModel1.programId, actual[0].programId); Assert.AreEqual(enrollmentModel1.paymentMethod, actual[0].paymentMethod); Assert.AreEqual(enrollmentModel1.name, actual[0].name); Assert.AreEqual(enrollmentModel1.joinDate.DayOfYear, actual[0].joinDate.DayOfYear); Assert.AreEqual(enrollmentModel1.inviteIssued, actual[0].inviteIssued); Assert.AreEqual(enrollmentID2, enrollmentID2); Assert.AreEqual(enrollmentModel2.programId, actual[1].programId); Assert.AreEqual(enrollmentModel2.clientId, actual[1].clientId); Assert.AreEqual(enrollmentModel2.dogId, actual[1].dogId); Assert.AreEqual(enrollmentModel2.programId, actual[1].programId); Assert.AreEqual(enrollmentModel2.paymentMethod, actual[1].paymentMethod); Assert.AreEqual(enrollmentModel2.name, actual[1].name); Assert.AreEqual(enrollmentModel2.joinDate.DayOfYear, actual[1].joinDate.DayOfYear); Assert.AreEqual(enrollmentModel2.inviteIssued, actual[1].inviteIssued); Assert.AreEqual(enrollmentID3, enrollmentID3); Assert.AreEqual(enrollmentModel3.programId, actual[2].programId); Assert.AreEqual(enrollmentModel3.clientId, actual[2].clientId); Assert.AreEqual(enrollmentModel3.dogId, actual[2].dogId); Assert.AreEqual(enrollmentModel3.programId, actual[2].programId); Assert.AreEqual(enrollmentModel3.paymentMethod, actual[2].paymentMethod); Assert.AreEqual(enrollmentModel3.name, actual[2].name); Assert.AreEqual(enrollmentModel3.joinDate.DayOfYear, actual[2].joinDate.DayOfYear); Assert.AreEqual(enrollmentModel3.inviteIssued, actual[2].inviteIssued); }
public void Setup() { new DataStoreTableHelper().clearAllTables(); ClientModel clientModel = new ClientModel(); clientModel.name = "Bob"; clientModel.phone = "1234567890"; clientModel.email = "*****@*****.**"; ClientTable clientTable = new ClientTable(); clientId = clientTable.create(clientModel); DogModel dogModel = new DogModel(); dogModel.clientID = clientId; dogModel.name = "Dog"; dogModel.age = 6; dogModel.breed = "Terrier"; dogModel.experienceOrQualification = false; DogTable dogTable = new DogTable(); dogId = dogTable.create(dogModel); ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = "Regular"; ProgramTypeTable programTypeTable = new ProgramTypeTable(); programTypeId = programTypeTable.create(programTypeModel); ProgramCostModel programeCostModel = new ProgramCostModel(); programeCostModel.depositAmount = 20.0; programeCostModel.sessionCost = 20.0; programeCostModel.fullPaymentPercentageDiscount = 20; ProgramCostTable programCostTable = new ProgramCostTable(); programeCostId = programCostTable.create(programeCostModel); ProgramModel programModel = new ProgramModel(); programModel.programTypeId = programTypeId; programModel.programCostId = programeCostId; programModel.dogSpacesMaximum = 50; programModel.noOfClasses = 50; ProgramTable programTable = new ProgramTable(); programId = programTable.create(programModel); EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.clientId = clientId; enrollmentModel.dogId = dogId; enrollmentModel.programId = programId; EnrollmentTable enrollmentTable = new EnrollmentTable(); enrollmentId = enrollmentTable.create(enrollmentModel); }
public void Setup() { new DataStoreTableHelper().clearAllTables(); ClientModel clientModel = new ClientModel(); clientModel.displayName = "Barry Bonds"; clientModel.phone = "1234567890"; clientModel.email = "*****@*****.**"; ClientTable clientTable = new ClientTable(); clientId = clientTable.create(clientModel); DogModel dogModel = new DogModel(); dogModel.clientID = clientId; dogModel.name = "Dog"; dogModel.age = 6; dogModel.breed = "Terrier"; dogModel.experienceOrQualification = false; DogTable dogTable = new DogTable(); dogId = dogTable.create(dogModel); ProgramVarietyModel programeVarietyModel = new ProgramVarietyModel(); programeVarietyModel.depositAmount = 20.0; programeVarietyModel.sessionCost = 20.0; programeVarietyModel.fullPaymentPercentageDiscount = 20; programeVarietyModel.name = "Regular"; programeVarietyModel.dogSpacesMaximum = 50; programeVarietyModel.noOfClasses = 50; ProgramVarietyTable programVarietyTable = new ProgramVarietyTable(); programVarietyId = programVarietyTable.create(programeVarietyModel); ProgramModel programModel = new ProgramModel(); programModel.programVarietyId = programVarietyId; ProgramTable programTable = new ProgramTable(); programId = programTable.create(programModel); EnrollmentModel enrollmentModel = new EnrollmentModel(); enrollmentModel.name = "A"; enrollmentModel.clientId = clientId; enrollmentModel.dogId = dogId; enrollmentModel.programId = programId; enrollmentModel.paymentMethod = 1; enrollmentModel.joinDate = new DateTime(2021, 01, 03); enrollmentModel.inviteIssued = true; EnrollmentTable enrollmentTable = new EnrollmentTable(); enrollmentId = enrollmentTable.create(enrollmentModel); }
private static void populateDatabase() { //clear all the records in all the tables new DataStoreTableHelper().clearAllTables(); //check the tables are empty consoleTableCounts(); //Adding some records to it will be easier to create and update the screens //add Client records ClientTable clientTable = new ClientTable(); ClientModel clientModelBob = new ClientModel(); clientModelBob.forename = "Bob"; clientModelBob.surname = "White"; clientModelBob.phone = "1234567890"; clientModelBob.email = "*****@*****.**"; clientModelBob.displayName = clientModelBob.forename + " " + clientModelBob.surname; int clientIdBob = clientTable.create(clientModelBob); ClientModel clientModelKate = new ClientModel(); clientModelKate.forename = "Kate"; clientModelKate.surname = "Black"; clientModelKate.phone = "1234567890"; clientModelKate.email = "*****@*****.**"; clientModelKate.displayName = clientModelKate.forename + " " + clientModelKate.surname; int clientIdKate = clientTable.create(clientModelKate); //add Dog records DogTable dogTable = new DogTable(); DogModel dogModelBoxer = new DogModel(); dogModelBoxer.name = "Boxer"; dogModelBoxer.clientID = clientIdBob; dogModelBoxer.age = 7; dogModelBoxer.breed = "Bulldog"; int dogIdBoxer = dogTable.create(dogModelBoxer); DogModel dogModelTed = new DogModel(); dogModelTed.name = "Ted"; dogModelTed.clientID = clientIdKate; dogModelTed.age = 7; dogModelTed.breed = "Shi Tzu"; int dogIdTed = dogTable.create(dogModelTed); //add Staff records StaffTable staffTable = new StaffTable(); StaffModel staffModelBob = new StaffModel(); staffModelBob.name = "Bob"; int staffIdBob = staffTable.create(staffModelBob); StaffModel staffModelKate = new StaffModel(); staffModelKate.name = "Kate"; int staffIdKate = staffTable.create(staffModelKate); //add ProgramVariety records ProgramVarietyTable programVarietyTable = new ProgramVarietyTable(); ProgramVarietyModel programVarietyAdvanced = new ProgramVarietyModel(); programVarietyAdvanced.name = "Advanced"; programVarietyAdvanced.depositAmount = 30.0; programVarietyAdvanced.fullPaymentPercentageDiscount = 0.0; programVarietyAdvanced.sessionCost = 30.0; programVarietyAdvanced.noOfClasses = 8; programVarietyAdvanced.dogSpacesMaximum = 8; int programCostId1 = programVarietyTable.create(programVarietyAdvanced); ProgramVarietyModel programVarietyRegular = new ProgramVarietyModel(); programVarietyRegular.name = "Regular"; programVarietyRegular.depositAmount = 20.0; programVarietyRegular.fullPaymentPercentageDiscount = 10.0; programVarietyRegular.sessionCost = 25.0; programVarietyRegular.noOfClasses = 6; programVarietyRegular.dogSpacesMaximum = 10; int programCostId2 = programVarietyTable.create(programVarietyRegular); //add Program records ProgramTable programTable = new ProgramTable(); ProgramModel programModel1 = new ProgramModel(); programModel1.name = "Regular AM"; programModel1.programVarietyId = programCostId2; int programId1 = programTable.create(programModel1); ProgramModel programModel2 = new ProgramModel(); programModel2.name = "Regular PM"; programModel2.programVarietyId = programCostId2; int programId2 = programTable.create(programModel2); ProgramModel programModel3 = new ProgramModel(); programModel3.name = "Advanced"; programModel3.programVarietyId = programCostId1; int programId3 = programTable.create(programModel3); //add Enrollment records EnrollmentTable enrollmentTable = new EnrollmentTable(); EnrollmentModel enrollmentModel1 = new EnrollmentModel(); enrollmentModel1.name = dogModelBoxer.name + " (owned by " + clientModelBob.displayName + ") in " + programModel1.name; enrollmentModel1.clientId = clientIdBob; enrollmentModel1.dogId = dogIdBoxer; enrollmentModel1.programId = programId1; enrollmentModel1.paymentMethod = PaymentConstants.PAYMENT_IN_FULL; enrollmentModel1.joinDate = DateTime.Now; enrollmentModel1.inviteIssued = false; int enrollmentId1 = enrollmentTable.create(enrollmentModel1); EnrollmentModel enrollmentModel2 = new EnrollmentModel(); enrollmentModel2.name = dogModelTed.name + " (owned by " + clientModelKate.displayName + ") in " + programModel2.name; enrollmentModel2.clientId = clientIdKate; enrollmentModel2.dogId = dogIdTed; enrollmentModel2.programId = programId2; enrollmentModel2.paymentMethod = PaymentConstants.PAYMENT_PER_CLASS; enrollmentModel2.joinDate = DateTime.Now; enrollmentModel2.inviteIssued = true; int enrollmentId2 = enrollmentTable.create(enrollmentModel2); //check the tables have records consoleTableCounts(); }