Exemplo n.º 1
0
 public ActivityDocument Create(CostCentre hub, CostCentre clerk, CostCentre supplier, CommodityProducer commodityProducer, ActivityType activityType, Route route, Centre centre, Season season, string documentReference, Guid documentIssueCostCentreApplicationId, DateTime documentDate, DateTime activityDate, string description = "", string note = "")
 {
     Guid id = Guid.NewGuid();
     ActivityDocument doc = DocumentPrivateConstruct<ActivityDocument>(id);
    
     doc.DocumentDate = documentDate;
     doc.DocumentDateIssued = activityDate;
     doc.Description = description;
     doc.Hub = hub;
     doc.FieldClerk = clerk;
     doc.Supplier = supplier;
     doc.Producer = commodityProducer;
     doc.ActivityType = activityType;
     doc.Route = route;
     doc.Centre = centre;
     doc.DocumentReference = documentReference;
     doc.DocumentIssuerCostCentreApplicationId = documentIssueCostCentreApplicationId;
     doc.Hub = hub;
     doc.FieldClerk = clerk;
     doc.Supplier = supplier;
     doc.DocumentReference = documentReference;
     doc.ActivityDate = activityDate;
     doc.DocumentDateIssued = DateTime.Now;
     doc.Season = season;
     SetDefaultDates(doc);
     doc.EnableAddCommands();
     return doc;
 }
Exemplo n.º 2
0
 private bool HasRouteChanged(Route route)
 {
     var item = _repository.GetById(route.Id);
     if (item == null) return true;
     return item.Code.ToLower() != route.Code.ToLower() || item.Name.ToLower() != route.Name.ToLower() ||
            item.Region.Id != route.Region.Id;
 }
Exemplo n.º 3
0
 public Route CreateRoute(Region region, string name, string code, Guid id)
 {
     if (region == null || region.Id == Guid.Empty)
         throw new ArgumentException("Invalid region assigned to route.");
     Route route = new Route(id)
                       {
                           Code = code,
                           Name = name,
                           Region = region,
                       };
     return route;
 }
Exemplo n.º 4
0
        public Route CreateRoute(CostCentre costCenter,string name,string code, Guid id)
        {
          //throw new ArgumentException("in else5");

            if (costCenter.CostCentreType != CostCentreType.Distributor)
            {
                if (costCenter.CostCentreType != CostCentreType.Hub)
                    throw new ArgumentException("Invalid CostCenter" + costCenter.CostCentreType);
            }
            if(costCenter.Id==Guid.Empty)
                throw new ArgumentException("CostCenter must exist in the system");
            Route route = new Route(id)
                              {
                                  //Distributor = new CostCentreRef {Id = costCenter.Id},
                                  Name = name,
                                  Code = code
                              };          
            
            return route;
        }
Exemplo n.º 5
0
 public RouteDTO Map(Route route)
 {
     if (route == null) return null;
     return Mapper.Map<Route, RouteDTO>(route);
 }
 public void LoadRoutes()
 {
     using (StructureMap.IContainer c = NestedContainer)
     {
         Routes.Clear();
         var route = new Route(Guid.Empty)
             {
                 Name = GetLocalText("sl.target.defaultroute")
                 /*"-- Please Select A Route --"*/
             };
         Routes.Add(route);
         Using<IRouteRepository>(c).GetAll().ToList().OrderBy(n => n.Name).ToList().ForEach(n => Routes.Add(n));
         SelectedRoute = route;
     }
 }
Exemplo n.º 7
0
        public SelectList GetRouteList(Guid hubId = new Guid())
        {
            var @default = new Route(Guid.Empty) { Name = "---Select route---" };
            List<SelectListItem> selectList = new List<SelectListItem>();
            selectList.Add(new SelectListItem { Value = @default.Id.ToString(), Text = @default.Name, Selected = true });

            IEnumerable<Route> routes ;
            if (hubId == Guid.Empty)
                routes = _routeRepository.GetAll();
            else
                routes = _routeRepository.GetAll().Where(n => n.Region.Id == ((Hub)_costCentreRepository.GetById(hubId)).Region.Id);

            routes.ToList().OrderBy(r => r.Name).ToList()
                .ForEach(n => selectList.Add(new SelectListItem
                                                 {
                                                     Value = n.Id.ToString(),
                                                     Text = n.Name,
                                                 }));

            return new SelectList(selectList,"Value", "Text");

        }
 public DistributorSalesman ShowPopUp(Route route)
 {
     _vm.LoadCommand.Execute(route);
     ShowDialog();
     return _vm.GetSalesman();
 }
Exemplo n.º 9
0
       private Outlet[] ContsructEntities(IEnumerable<OutletImport> entities)
        {
           
                var temp = new List<Outlet>();
                var defaultDistributr =ObjectFactory.GetInstance<ICostCentreRepository>()
                    .GetByCode("PZ Cussons EA", CostCentreType.Distributor);
                   
                var allRoutes = ObjectFactory.GetInstance<IRouteRepository>().GetAll().ToList();
                var outletCategories = ObjectFactory.GetInstance<IOutletCategoryRepository>().GetAll().ToList();
                foreach (var importentity in entities)
                {
                    var domainEntity =
                        ObjectFactory.GetInstance<ICostCentreRepository>().GetByCode(importentity.OutletCode,
                                                                                     CostCentreType.Outlet, true) as
                        Outlet;

                    bool IsNew = false;
                    if(domainEntity==null)
                    {
                        domainEntity = new Outlet(Guid.NewGuid());
                        IsNew = true;
                    }
                    #region Routes

                    if (domainEntity != null && domainEntity.Route == null)
                    {
                        domainEntity.Route = allRoutes.FirstOrDefault(
                           p =>
                           p.Name != null &&
                           p.Name.ToLower().Trim() == importentity.RouteName.Trim().ToLower());

                    }
                   
                    if (domainEntity.Route != null && !string.IsNullOrEmpty(importentity.RouteName))
                    {
                       var newRoute = allRoutes.FirstOrDefault(p => p.Name.Trim().ToLower() == importentity.RouteName.Trim().ToLower());
                        if (newRoute != null)
                            domainEntity.Route = newRoute;
                    }
                   
                    if (domainEntity.Route == null && importentity.RouteName.StartsWith("SALES VA"))
                        domainEntity.Route =
                            allRoutes.FirstOrDefault(p => p.Name.Contains("SALES VA"));

                    if (domainEntity.Route == null && !string.IsNullOrEmpty(importentity.RouteName))
                    {
                        var region = ObjectFactory.GetInstance<IRegionRepository>().GetAll(true).FirstOrDefault(p => p.Name == "Region A");
                        if (region == null)
                        {
                            region = new Region(Guid.NewGuid())
                            {
                                Country = ObjectFactory.GetInstance<ICountryRepository>().GetAll(true).FirstOrDefault(p => p.Name == "Kenya"),
                                Name = "",
                                Description = ""
                            };
                            try
                            {
                                ObjectFactory.GetInstance<IRegionRepository>().Save(region);
                            }
                            catch
                            {

                            }

                        }
                        var route = new Route(Guid.NewGuid())
                        {
                            Name = importentity.RouteName,
                            Code = importentity.RouteName,
                            Region = region
                        };
                        try
                        {
                            ObjectFactory.GetInstance<IRouteRepository>().Save(route);
                        }
                        catch
                        {

                        }
                        domainEntity.Route = route;
                    }
                   
                    try
                    {
                        ObjectFactory.GetInstance<IRouteRepository>().Save(domainEntity.Route);
                    }
                    catch
                    {
                    } 
                    
                    #endregion

                    if (defaultDistributr == null) throw new ArgumentNullException("distributor");
                    domainEntity.ParentCostCentre = new CostCentreRef() { Id = defaultDistributr.Id };
                   

                    if (domainEntity.OutletCategory == null)
                    {

                        OutletCategory category = outletCategories
                            .FirstOrDefault(
                                s => s.Name != null &&
                                     s.Name == "defaultoutletcategory");
                        if (category == null)
                        {
                            category = new OutletCategory(Guid.NewGuid())
                            {
                                Name =
                                    string.IsNullOrEmpty(importentity.Name)
                                        ? "defaultoutletcategory"
                                        : importentity.Name,
                                Code =
                                    string.IsNullOrEmpty(importentity.Name)
                                        ? "defaultoutletcategory"
                                        : importentity.Name
                            };
                            try
                            {
                                ObjectFactory.GetInstance<IOutletCategoryRepository>().Save(category,true);
                            }
                            catch
                            {
                            }
                        }
                        domainEntity.OutletCategory = category;
                    }
                    
                    if (domainEntity.OutletType == null)
                    {
                        OutletType type =ObjectFactory.GetInstance<IOutletTypeRepository>().GetAll(true).FirstOrDefault(
                                p =>
                                p.Name != null &&
                                p.Name == "defaultoutlettype");

                        if (type == null)
                        {
                            type = new OutletType(Guid.NewGuid())
                            {
                                Name =
                                    string.IsNullOrEmpty(importentity.Name)
                                        ? "defaultoutlettype"
                                        : importentity.Name,
                                Code =
                                    string.IsNullOrEmpty(importentity.Name)
                                        ? "defaultoutlettype"
                                        : importentity.Name
                            };
                            try
                            {
                                ObjectFactory.GetInstance<IOutletTypeRepository>().Save(type);
                            }
                            catch
                            {
                            }
                        }
                        domainEntity.OutletType = type;
                    }
                   
                    if (domainEntity.OutletProductPricingTier == null)
                    {
                        ProductPricingTier tire =ObjectFactory.GetInstance<IProductPricingTierRepository>()
                            .GetAll(true).FirstOrDefault(
                                p => p.Code != null && p.Code.Trim() == importentity.Currency.Trim());

                        if (tire == null)
                        {
                            tire = new ProductPricingTier(Guid.NewGuid())
                            {
                                Name = importentity.Currency.Trim(),
                                Code = importentity.Currency.Trim(),
                                Description = importentity.Currency.Trim(),
                            };
                            try
                            {
                                ObjectFactory.GetInstance<IProductPricingTierRepository>().Save(tire);
                            }
                            catch
                            {
                            }
                        }

                        domainEntity.OutletProductPricingTier = tire;
                    }
                    if (domainEntity.VatClass == null)
                    {
                        VATClass productVat = ObjectFactory.GetInstance<IVATClassRepository>().GetAll(true).
                            FirstOrDefault(
                                p => p.Name != null &&
                                     p.Name == "defaultVAT");
                        if (productVat == null)
                        {
                            var viatItem = new VATClass.VATClassItem(Guid.NewGuid())
                            {
                                EffectiveDate = DateTime.Now,
                                Rate = 0,
                            };
                            productVat = new VATClass(Guid.NewGuid())
                            {
                                Name = "defaultVAT",
                                VatClass = "defaultVAT",
                            };
                            productVat.VATClassItems.Add(viatItem);
                            try
                            {
                                ObjectFactory.GetInstance<IVATClassRepository>().Save(productVat);
                            }
                            catch
                            {
                            }
                        }
                        domainEntity.VatClass = productVat;
                    }
                    domainEntity._Status =EntityStatus.Active; //GetStatus(importentity.Status);
                    domainEntity.Name = importentity.Name.Trim();
                    domainEntity.CostCentreCode = importentity.OutletCode.Trim();
                        temp.Add(domainEntity);

                }
                return temp.ToArray();
           
        }
Exemplo n.º 10
0
 public bool CheckAgriRouteIsUsed(Route route, EntityStatus intendedStatus)
 {
     if (intendedStatus == EntityStatus.Inactive)
     {
         if (_ctx.tblCentre.Any(n => n.RouteId == route.Id && n.IM_Status == (int)EntityStatus.Active))
             return true;
         if (_ctx.tblOutletPriority.Any(n => n.RouteId == route.Id && n.IM_Status == (int)EntityStatus.Active))
             return true;
         if (_ctx.tblCostCentre.Any(n => n.RouteId == route.Id && n.IM_Status == (int)EntityStatus.Active))
             return true;
     }
     if (_ctx.tblCentre.Any(n => n.RouteId == route.Id && n.IM_Status != (int)EntityStatus.Deleted))
         return true;
     if (_ctx.tblOutletPriority.Any(n => n.RouteId == route.Id && n.IM_Status != (int)EntityStatus.Deleted))
         return true;
     if (_ctx.tblCostCentre.Any(n => n.RouteId == route.Id && n.IM_Status != (int)EntityStatus.Deleted))
         return true;
     return false;
 }
Exemplo n.º 11
0
 protected ValidationResultInfo Validate(Route route)
 {
     return _routeRepository.Validate(route);
 }
Exemplo n.º 12
0
        protected Route Map(RouteImport routeImport, List<string> mappingvalidationList)
        {
            var exists = Queryable.FirstOrDefault(_context.tblRoutes, p => p.Code == routeImport.Code);
            Guid id = exists != null ? exists.RouteID : Guid.NewGuid();

             var regionId = Queryable.Where(_context.tblRegion, p => p.Name == routeImport.RegionCode).Select(p=>p.id).FirstOrDefault();

            var region = _regionRepository.GetById(regionId);
            if(region==null)
            {
                mappingvalidationList.Add(string.Format((string) "Invalid Region Code {0}", (object) routeImport.RegionCode)); 
            }

            var route = new Route(id);
            route.Name = routeImport.Name;
            route.Code = routeImport.Code;
            route.Region = region;
            
            return route;

        }
Exemplo n.º 13
0
        void DoLoad()
        {
            using (StructureMap.IContainer c = NestedContainer)
            {
                Config config = GetConfigParams();
                DistributorRoutes.Clear();
                var route = new Route(Guid.Empty)
                    {
                        Name = GetLocalText("sl.outlet.edit.route.default")
                        /* "--Please Select A Route --"*/
                    };
                SelectedRoute = route;
                DistributorRoutes.Add(route);
                //should only get for current distributor
                Region region =null;
                if(config.AppId == Core.VirtualCityApp.Agrimanagr)
                    region =
                        ((Hub) Using<ICostCentreRepository>(c).GetById(Using<IConfigService>(c).Load().CostCentreId)).
                            Region;
                else if(config.AppId == Core.VirtualCityApp.Ditributr)
                    region =
                        ((Distributor)
                         Using<ICostCentreRepository>(c).GetById(Using<IConfigService>(c).Load().CostCentreId)).
                            Region;

                Using<IRouteRepository>(c).GetAll().Where(q => q.Region.Id == region.Id)
                             .OrderBy(n => n.Name)
                             .ToList()
                             .ForEach(n => DistributorRoutes.Add(n));

                DistributorOutletCategories.Clear();
                var outletCategory = new OutletCategory(Guid.Empty)
                    {
                        Name = GetLocalText("sl.outlet.edit.category.default") /*"--Please Select an Outlet--"*/
                    };
                SelectedOutletCategory = outletCategory;
                DistributorOutletCategories.Add(outletCategory);
                Using<IOutletCategoryRepository>(c).GetAll()
                                      .OrderBy(n => n.Name)
                                      .ToList()
                                      .ForEach(n => DistributorOutletCategories.Add(n));

                DistributorOutletType.Clear();
                var outletType = new OutletType(Guid.Empty)
                    {
                        Name = GetLocalText("sl.outlet.edit.type.default")
                        /*"--Please Select an Outlet Type--"*/
                    };
                SelectedOutletType = outletType;
                DistributorOutletType.Add(outletType);
                Using<IOutletTypeRepository>(c).GetAll().OrderBy(n => n.Name).ToList().ForEach(n => DistributorOutletType.Add(n));

                DistributorProductPricingTier.Clear();
                var ppt = new ProductPricingTier(Guid.Empty)
                    {
                        Name = GetLocalText("sl.outlet.edit.tier.default")
                        /* "--Please Select Product Pricing Tier--"*/
                    };
                SelectedProductPricingTier = ppt;
                DistributorProductPricingTier.Add(ppt);
                Using<IProductPricingTierRepository>(c).GetAll()
                                          .OrderBy(n => n.Name)
                                          .ToList()
                                          .ForEach(n => DistributorProductPricingTier.Add(n));

                VATClasses.Clear();
                var vatClass = new VATClass(Guid.Empty)
                    {
                        VatClass = GetLocalText("sl.outlet.edit.vatclass.default")
                        /*"--NONE--"*/
                    };
                SelectedVATRate = vatClass;
                VATClasses.Add(vatClass);
                Using<IVATClassRepository>(c).GetAll().OrderBy(n => n.VatClass).ToList().ForEach(n => VATClasses.Add(n));

                DiscountGroups.Clear();
                var discountGroup = new DiscountGroup(Guid.Empty)
                    {
                        Name = GetLocalText("sl.outlet.edit.discgp")
                        /*"--NONE--"*/
                    };
                SelectedDiscountGroup = discountGroup;
                DiscountGroups.Add(discountGroup);
                Using<IDiscountGroupRepository>(c).GetAll().OrderBy(n => n.Name).ToList().ForEach(n => DiscountGroups.Add(n));
                ShippingAddresses.Clear();
                DeletedAddresses.Clear();
            }
        }
Exemplo n.º 14
0
        public void LoadById(Guid id)
        {
            if (id == Guid.Empty)
            {
                InitializeBlank();
            }
            else
            {
                 using (StructureMap.IContainer c = NestedContainer)
            {

                outlet = Using<ICostCentreRepository>(c).GetById(id) as Outlet;
                if (outlet == null)
                {
                    InitializeBlank();
                }
                else
                {
                        PageTitle = GetLocalText("sl.outlet.edit.editing.title"); // "Edit Outlet";
                        Id = outlet.Id;
                        Name = outlet.Name;
                        OutletCode = outlet.CostCentreCode;
                        Latitude = outlet.Latitude;
                        Longitude = outlet.Longitude;
                        IsApproved = outlet._Status ==EntityStatus.Active;
                        CanApprove = !IsApproved;

                        //load all items to combos
                        DistributorRoutes.Clear();
                        var route = new Route(Guid.Empty)
                            {
                                Name = GetLocalText("sl.outlet.edit.route.default")
                                /* "--Please Select A Route --"*/
                            };
                        DistributorRoutes.Add(route);
                        Using<IRouteRepository>(c).GetAll()
                                     .ToList()
                                     .OrderBy(n => n.Name)
                                     .ToList()
                                     .ForEach(n => DistributorRoutes.Add(n));

                        try
                        {
                            SelectedRoute = DistributorRoutes.FirstOrDefault(n => n.Id == outlet.Route.Id);
                        }
                        catch
                        {
//route deactivated!
                            SelectedRoute = route;
                        }

                        DistributorOutletCategories.Clear();
                        Using<IOutletCategoryRepository>(c).GetAll()
                                              .OrderBy(n => n.Name)
                                              .ToList()
                                              .ForEach(n => DistributorOutletCategories.Add(n));
                        SelectedOutletCategory =
                            DistributorOutletCategories.FirstOrDefault(n => n.Id == outlet.OutletCategory.Id);

                        DistributorOutletType.Clear();
                        Using<IOutletTypeRepository>(c).GetAll()
                                          .OrderBy(n => n.Name)
                                          .ToList()
                                          .ForEach(n => DistributorOutletType.Add(n));
                        SelectedOutletType = DistributorOutletType.FirstOrDefault(n => n.Id == outlet.OutletType.Id);

                        DistributorProductPricingTier.Clear();
                        Using<IProductPricingTierRepository>(c).GetAll()
                                                  .OrderBy(n => n.Name)
                                                  .ToList()
                                                  .ForEach(n => DistributorProductPricingTier.Add(n));
                        var ppt = new ProductPricingTier(Guid.Empty)
                            {
                                Name = GetLocalText("sl.outlet.edit.tier.default")
                                /* "--Please Select Product Pricing Tier--"*/
                            };
                        DistributorProductPricingTier.Add(ppt);
                        try
                        {
                            SelectedProductPricingTier =
                                DistributorProductPricingTier.FirstOrDefault(
                                    n => n.Id == outlet.OutletProductPricingTier.Id);
                        }
                        catch
                        {
                            SelectedProductPricingTier = ppt;
                        }

                        VATClasses.Clear();
                        var vatClass = new VATClass(Guid.Empty)
                            {
                                VatClass = GetLocalText("sl.outlet.edit.vatclass.default") /*"--NONE--"*/
                            };
                        VATClasses.Add(vatClass);
                        Using<IVATClassRepository>(c).GetAll().OrderBy(n => n.VatClass).ToList().ForEach(n => VATClasses.Add(n));
                        try
                        {
                            SelectedVATRate = VATClasses.First(n => n.Id == outlet.VatClass.Id);
                        }
                        catch
                        {
                            SelectedVATRate = vatClass;
                        }

                        DiscountGroups.Clear();
                        var discountGroup = new DiscountGroup(Guid.Empty)
                            {
                                Name = GetLocalText("sl.outlet.edit.discgp") /*"--NONE--"*/
                            };
                        SelectedDiscountGroup = discountGroup;
                        DiscountGroups.Add(discountGroup);
                        Using<IDiscountGroupRepository>(c).GetAll().OrderBy(n => n.Name).ToList().ForEach(n => DiscountGroups.Add(n));
                        try
                        {
                            SelectedDiscountGroup = DiscountGroups.First(n => n.Id == outlet.DiscountGroup.Id);
                        }
                        catch
                        {
                            SelectedDiscountGroup = discountGroup;
                        }
                       
                       LoadShipToAddress();

                }
                }
            }
        }
 private void SalesManChanged()
 {
     using (StructureMap.IContainer container = NestedContainer)
     {
         if (FireSalesmanChangedCmd)
         {
             DistributorRoutes.Clear();
             var route = new Route(Guid.Empty)
                             {
                                 Name = GetLocalText("sl.pos.selectroute")
                                 /*"--Please Select a Route--"*/
                             };
             DistributorRoutes.Add(route);
             SelectedRoute = route;
             if (SelectedSalesman == null)
                 return;
             List<SalesmanRoute> sroutes = Using<ISalesmanRouteRepository>(container).GetAll().ToList();
             sroutes =
                 sroutes.Where(n => n.Route != null && n.DistributorSalesmanRef.Id == SelectedSalesman.CostCentre)
                        .OrderBy(n => n.Route.Name).ToList();
             sroutes.ForEach(n => DistributorRoutes.Add(n.Route));
             //_routeService.GetAll().ForEach(n => DistributorRoutes.Add(n));
             //RouteChanged();
         }
     }
 }
Exemplo n.º 16
0
 ListRouteItem Map(Route route, int count)
 {
     return new ListRouteItem()
                                   {
                                       RowNumber = count + 1,
                                       Id = route.Id,
                                       Name = route.Name,
                                       Code = route.Code,
                                       EntityStatus = (int) route._Status
                                   };
 }
        void LoadRoutesSalesmen(Route route, User user)
        {
            using (var container = NestedContainer)
            {
                ISalesmanRouteRepository _salesmanRouteService = Using<ISalesmanRouteRepository>(container);

                if (route != null)
                {
                    string[] salesmenwarehouses =
                        _salesmanRouteService.GetAll().Where(n => n.Route != null && n.Route.Id == route.Id).Select(
                            c => c.DistributorSalesmanRef.Id.ToString()).ToArray();
                    var orderRouteSalesmen =
                        _allSalesmen.Where(u => salesmenwarehouses.Contains(u.CostCentre.ToString())).ToList();
                    if (orderRouteSalesmen != null)
                    {
                        if (orderRouteSalesmen.Count > 0)
                        {
                            orderRouteSalesmen.Where(n => (!Salesmen.Select(x => x.Id).Contains(n.Id))).ToList().ForEach
                                (
                                    n => Salesmen.Add(new Salesman {Id = n.Id, Username = n.Username}));
                        }
                        else
                        {
                            if (!Salesmen.Any(n => n.Id == user.Id))
                            {
                                Salesmen.Add(new Salesman {Id = user.Id, Username = user.Username});
                            }
                        }
                    }
                }
                else
                {
                    throw new Exception("Order route is null.");
                }
                Salesmen.Where(n => n.Id != Guid.Empty);
            }
        }
        public HttpResponseMessage RouteAdd(RouteItem routeItem)
        {
            var response = new ResponseBool { Success = false };
            Route route = null;
            try
            {
                route = new Route(Guid.NewGuid());
                route.Code = routeItem.Code;
                route.Name = routeItem.Name;
                route.Region = _regionRepository.GetById(routeItem.RegionId);
                // route.Distributor = new CostCentreRef { Id = routeItem.MasterId };
                _routeRepository.Save(route);

                response.Success = true;
                response.ErrorInfo = "Route successfully added.";
            }
            catch (DomainValidationException dve)
            {
                string errorMsg = dve.ValidationResults.Results.Aggregate("Error: Invalid route fields.\n",
                                                                          (current, msg) =>
                                                                          current + ("\t- " + msg.ErrorMessage + "\n"));
                response.ErrorInfo = errorMsg;
                _log.Error(errorMsg, dve);
            }
            catch (Exception ex) //any other
            {
                response.ErrorInfo = "Error: An error occurred when saving the route.\n" + ex.ToString();
                _log.Error("Error: An error occurred when saving the route.", ex);
            }
            return Request.CreateResponse(HttpStatusCode.OK, response);
        }