예제 #1
0
        public async Task TestGetScheduleEvents()
        {
            ServiceInformationModule  ServiceInformationMod = new ServiceInformationModule();
            IList <ScheduleEventView> views = await ServiceInformationMod.ScheduleEvent.Query().GetViewsByServiceId(3);

            Assert.NotNull(views);
        }
예제 #2
0
        async Task TestGetInvoices()
        {
            ServiceInformationModule ServiceInformationMod = new ServiceInformationModule();
            IList <ServiceInformationInvoiceView> views    = await ServiceInformationMod.ServiceInformationInvoice.Query().GetViewsByServiceId(3);

            Assert.NotNull(views);
        }
예제 #3
0
        public async Task TestAddUpdatDelete()
        {
            ServiceInformationModule ServiceInformationMod = new ServiceInformationModule();
            LocationAddressView      locationAddressView   = await ServiceInformationMod.LocationAddress.Query().GetViewById(3);

            CustomerView customerView = await ServiceInformationMod.Customer.Query().GetViewById(3);

            AddressBook addressBook = await ServiceInformationMod.AddressBook.Query().GetEntityById(customerView.AddressId);

            ContractView contractView = await ServiceInformationMod.Contract.Query().GetViewById(1);

            Udc udc = await ServiceInformationMod.Udc.Query().GetEntityById(2);


            ServiceInformationView view = new ServiceInformationView()
            {
                ServiceDescription = " truck oil change",
                Price                 = 80.76M,
                AddOns                = "none",
                ServiceTypeXrefId     = udc.XrefId,
                ServiceType           = udc.Value,
                CreatedDate           = DateTime.Parse("12/25/2019"),
                LocationId            = locationAddressView.LocationAddressId,
                CustomerId            = customerView.CustomerId,
                ContractId            = contractView.ContractId,
                vwCustomer            = customerView,
                vwContract            = contractView,
                vwLocationAddress     = locationAddressView,
                SquareFeetOfStructure = 100,
                LocationDescription   = "Eiensten brothers on orchard",
                LocationGps           = "",
                Comments              = "",
                Status                = true
            };
            NextNumber nnNextNumber = await ServiceInformationMod.ServiceInformation.Query().GetNextNumber();

            view.ServiceInformationNumber = nnNextNumber.NextNumberValue;

            ServiceInformation serviceInformation = await ServiceInformationMod.ServiceInformation.Query().MapToEntity(view);

            ServiceInformationMod.ServiceInformation.AddServiceInformation(serviceInformation).Apply();

            ServiceInformation newServiceInformation = await ServiceInformationMod.ServiceInformation.Query().GetEntityByNumber(view.ServiceInformationNumber);

            Assert.NotNull(newServiceInformation);

            newServiceInformation.ServiceDescription = "ServiceInformation Test Update";

            ServiceInformationMod.ServiceInformation.UpdateServiceInformation(newServiceInformation).Apply();

            ServiceInformationView updateView = await ServiceInformationMod.ServiceInformation.Query().GetViewById(newServiceInformation.ServiceId);

            Assert.Same(updateView.ServiceDescription, "ServiceInformation Test Update");
            ServiceInformationMod.ServiceInformation.DeleteServiceInformation(newServiceInformation).Apply();
            ServiceInformation lookupServiceInformation = await ServiceInformationMod.ServiceInformation.Query().GetEntityById(view.ServiceId);

            Assert.Null(lookupServiceInformation);
        }