public void TestTransmissionSetCRUD() { ACATestDAL.DAL dal = new ACATestDAL.DAL(); dal.deleteAllTransmissionSets(); List<int> ids = dal.getTransmissionIDs("2015"); Assert.AreEqual(0, ids.Count); // Create Transmission Set TransmissionSet set = new TransmissionSet(); set.FiscalYear = "2015"; dal.saveTransmissionSet(set); int id = set.TransmissionSetID; Assert.IsTrue(id > 0); Assert.AreEqual("2015", set.FiscalYear); // Add Transmission Transmission t1 = Transmission.buildTest(); dal.addTransmissionToTransmissionSet(set, t1); ids = dal.getTransmissionIDs("2015"); Assert.AreEqual(1, ids.Count); // Add 2nd Transmission Set Transmission t2 = Transmission.buildTest(); dal.addTransmissionToTransmissionSet(set, t2); ids = dal.getTransmissionIDs("2015"); Assert.AreEqual(2, ids.Count); System.DateTime d1 = new System.DateTime(2001, 7, 4, 0, 0, 0); t2.ImportDate = d1; dal.saveTransmission(t2); Transmission t3 = dal.getTransmissionByID(t2.TransmissionID); Assert.AreEqual(d1, t3.ImportDate); // Delete 1st Transmission dal.deleteTransmission(t1.TransmissionID); ids = dal.getTransmissionIDs("2015"); Assert.AreEqual(1, ids.Count); dal.deleteAllTransmissionSets(); ids = dal.getTransmissionIDs("2015"); Assert.AreEqual(0, ids.Count); }
private static void CallWebServiceAllIDs() { Console.WriteLine("Press Enter to call Server"); string enteredString = Console.ReadLine(); Service1Client client = new Service1Client(); ACATestDAL.DAL dal = new ACATestDAL.DAL(); IEnumerable<int> ids = dal.getTransmissionIDs("2015"); foreach (int id in ids) { Transmission trans = dal.getTransmissionByID(id); Console.WriteLine(string.Format("Processing transmission ID {0}.", trans.TransmissionIdentifier)); Submission s = trans.Submissions.FirstOrDefault(); Record1094C record = s.Record1094C.translate(); string receiptID = client.SubmitData(record); trans.ReceiptID = receiptID; dal.saveTransmissionReceiptID(trans); Console.WriteLine(String.Format(">>> Received Receipt ID {0}.", receiptID)); } Console.ReadLine(); }