Exemplo n.º 1
0
        private async Task <IList <TaxTypeModel> > GetTaxTypesAsync()
        {
            try
            {
                using (var dataService = DataServiceFactory.CreateDataService())
                {
                    var items = await dataService.GetTaxTypesAsync();

                    return(items.Select(r => new TaxTypeModel
                    {
                        TaxTypeID = r.tax_type,
                        Name = r.name,
                        Rate = r.rate
                    })
                           .ToList());
                }
            }
            catch (Exception ex)
            {
                LogException("LookupTables", "Load TaxTypes", ex);
            }
            return(new List <TaxTypeModel>());
        }
Exemplo n.º 2
0
        private async Task <IList <ShipperModel> > GetShippersAsync()
        {
            try
            {
                using (var dataService = DataServiceFactory.CreateDataService())
                {
                    var items = await dataService.GetShippersAsync();

                    return(items.Select(r => new ShipperModel
                    {
                        ShipperID = r.shipper_id,
                        Name = r.name,
                        Phone = r.phone_no
                    })
                           .ToList());
                }
            }
            catch (Exception ex)
            {
                LogException("LookupTables", "Load Shippers", ex);
            }
            return(new List <ShipperModel>());
        }
Exemplo n.º 3
0
        public async Task <PlaceModel> CreateNewPlaceAsync(long customerID)
        {
            var model = new PlaceModel
            {
                CustomerID = customerID,
                CreatedOn  = DateTime.UtcNow,
                //Status = 0
            };

            if (customerID > 0)
            {
                using (var dataService = DataServiceFactory.CreateDataService())
                {
                    var parent = await dataService.GetCustomerAsync(customerID);

                    if (parent != null)
                    {
                        model.CustomerID = customerID;
                        model.Customer   = await CustomerService.CreateCustomerModelAsync(parent, includeAllFields : true);
                    }
                }
            }
            return(model);
        }