Esempio n. 1
0
        private async Task <LocationAddressView> MapToLocationAddressView(LocationAddress inputObject)
        {
            Mapper mapper = new Mapper();
            LocationAddressView outObject = mapper.Map <LocationAddressView>(inputObject);
            await Task.Yield();

            return(outObject);
        }
Esempio n. 2
0
        public async Task <IActionResult> GetLocationAddressView(long locationAddressId)
        {
            LocationAddressModule invMod = new LocationAddressModule();

            LocationAddressView view = await invMod.LocationAddress.Query().GetViewById(locationAddressId);

            return(Ok(view));
        }
Esempio n. 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);
        }
Esempio n. 4
0
        public async Task <IActionResult> DeleteLocationAddress([FromBody] LocationAddressView view)
        {
            LocationAddressModule invMod          = new LocationAddressModule();
            LocationAddress       locationAddress = await invMod.LocationAddress.Query().MapToEntity(view);

            invMod.LocationAddress.DeleteLocationAddress(locationAddress).Apply();

            return(Ok(view));
        }
Esempio n. 5
0
        public async Task <IActionResult> UpdateLocationAddress([FromBody] LocationAddressView view)
        {
            LocationAddressModule invMod = new LocationAddressModule();

            LocationAddress locationAddress = await invMod.LocationAddress.Query().MapToEntity(view);


            invMod.LocationAddress.UpdateLocationAddress(locationAddress).Apply();

            LocationAddressView retView = await invMod.LocationAddress.Query().GetViewById(locationAddress.LocationAddressId);


            return(Ok(retView));
        }
Esempio n. 6
0
        public async Task <IActionResult> AddLocationAddress([FromBody] LocationAddressView view)
        {
            LocationAddressModule invMod = new LocationAddressModule();

            NextNumber nnLocationAddress = await invMod.LocationAddress.Query().GetNextNumber();

            view.LocationAddressNumber = nnLocationAddress.NextNumberValue;

            LocationAddress locationAddress = await invMod.LocationAddress.Query().MapToEntity(view);

            invMod.LocationAddress.AddLocationAddress(locationAddress).Apply();

            LocationAddressView newView = await invMod.LocationAddress.Query().GetViewByNumber(view.LocationAddressNumber);


            return(Ok(newView));
        }
Esempio n. 7
0
        public async Task TestAddUpdatDelete()
        {
            LocationAddressModule LocationAddressMod = new LocationAddressModule();
            AddressBook           addressBook        = await LocationAddressMod.AddressBook.Query().GetEntityById(1);

            Udc udc = await LocationAddressMod.Udc.Query().GetEntityById(60);

            LocationAddressView view = new LocationAddressView()
            {
                AddressLine1 = "123 abc",
                City         = "Boise",
                Zipcode      = "83709",
                TypeXrefId   = udc.XrefId,
                Type         = udc.Value,
                AddressId    = addressBook.AddressId,
                Name         = addressBook.Name,
                State        = "ID",
                Country      = "USA"
            };
            NextNumber nnNextNumber = await LocationAddressMod.LocationAddress.Query().GetNextNumber();

            view.LocationAddressNumber = nnNextNumber.NextNumberValue;

            LocationAddress locationAddress = await LocationAddressMod.LocationAddress.Query().MapToEntity(view);

            LocationAddressMod.LocationAddress.AddLocationAddress(locationAddress).Apply();

            LocationAddress newLocationAddress = await LocationAddressMod.LocationAddress.Query().GetEntityByNumber(view.LocationAddressNumber);

            Assert.NotNull(newLocationAddress);

            newLocationAddress.Type = "Residence Update";

            LocationAddressMod.LocationAddress.UpdateLocationAddress(newLocationAddress).Apply();

            LocationAddressView updateView = await LocationAddressMod.LocationAddress.Query().GetViewById(newLocationAddress.LocationAddressId);

            Assert.Same(updateView.Type, "Residence Update");
            LocationAddressMod.LocationAddress.DeleteLocationAddress(newLocationAddress).Apply();
            LocationAddress lookupLocationAddress = await LocationAddressMod.LocationAddress.Query().GetEntityById(view.LocationAddressId);

            Assert.Null(lookupLocationAddress);
        }
Esempio n. 8
0
 public override void MapLocationAddressEntity(ref LocationAddress locationAddress, LocationAddressView view)
 {
     locationAddress.AddressId      = view.AddressId;
     locationAddress.Address_Line_1 = view.Address_Line1;
     locationAddress.City           = view.City;
     locationAddress.State          = view.State;
     locationAddress.Country        = view.Country;
     locationAddress.Zipcode        = view.Zipcode;
     locationAddress.TypeXRefId     = view.TypeXRefId;
 }