public HomeController(IRoadsService roadsService, IImageService imageService, IRoadsIndexService roadsIndexService, IUsersService usersService, ICommentsService commentsService, IMapper mapper)
 {
     this.roadsService      = roadsService;
     this.imageService      = imageService;
     this.roadsIndexService = roadsIndexService;
     this.usersService      = usersService;
     this.commentsService   = commentsService;
     this.mapper            = mapper;
 }
Esempio n. 2
0
 public UsersController(IUsersService usersService, IRoadsService roadsService,
                        IRoadsIndexService roadsIndexService, IOrdersService ordersService, IMapper mapper)
 {
     this.usersService      = usersService;
     this.roadsService      = roadsService;
     this.roadsIndexService = roadsIndexService;
     this.ordersService     = ordersService;
     this.mapper            = mapper;
 }
Esempio n. 3
0
 /// <summary>
 /// Adds the new feedback item.
 /// </summary>
 /// <param name="feedbackItemFromView">The feedback item from view.</param>
 public static void AddNewFeedbackItem(IRoadsService client, FeedbackItemSettings feedbackItemFromView)
 {
     var feedbackItemForDelete = new FeedbackItemData
     {
         FeedbackItemId = feedbackItemFromView.feedbackItemId,
         NameTranslationKey = feedbackItemFromView.settingName,
         SortNumber = feedbackItemFromView.sortNumber,
         DescriptionTranslationKey = feedbackItemFromView.description,
         IsNumeric = feedbackItemFromView.isNumeric,
         Mandatory = feedbackItemFromView.isMandatory,
         FeedbackModelId = feedbackItemFromView.feedbackModelId
     };
     client.AddNewFeedbackItem(feedbackItemForDelete);
 }
Esempio n. 4
0
        /// <summary>
        /// Creates the export data string.
        /// </summary>
        /// <param name="client">IRoadsService client object(WCF).</param>
        /// <param name="exportDataType">Type of the export data.</param>
        /// <returns>Specific output string.</returns>
        public string CreateExportData(IRoadsService client, ExportDataType exportDataType)
        {
            switch (exportDataType)
            {
                case ExportDataType.Dynamic:

                    _dynamicTranslations = new List<DynamicTranslationExport>();
                    var dynamicTranslationsData = client.GetAllDynamicTranslationsData().ToList();

                    foreach (var data in dynamicTranslationsData)
                    {
                        _dynamicTranslations.Add(new DynamicTranslationExport()
                        {
                            DynamicKey = data.DynamicKey,
                            Value = data.Value,
                            DescriptionValue = data.DescriptionValue,
                            LanguageName = data.Lenguage.Name,
                            LanguageId = data.LanguageId
                        });
                    }
                    return _exportStringBuilder.GetExportString(_dynamicTranslations);

                case ExportDataType.Static:

                    _staticTranslations = new List<StaticTranslationExport>();
                    var staticTranslationsData = client.GetAllStaticTranslations().ToList();

                    foreach (var data in staticTranslationsData)
                    {
                        _staticTranslations.Add(new StaticTranslationExport()
                        {
                            EnumKey = data.EnumKey,
                            Value = data.Value,
                            LanguageName = data.Language.Name,
                            LanguageId = data.LanguageId
                        });
                    }
                    return _exportStringBuilder.GetExportString(_staticTranslations);

                case ExportDataType.MapObject:

                    return MapObjectsExportData(client);

                default:
                    return String.Empty;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Adds the dynamic translations.
        /// </summary>
        /// <param name="newDynamicTranslationsList">The new dynamic translations list.</param>
        public static void AddDynamicTranslations(IRoadsService client, List<DynamicTranslation> newDynamicTranslationsList)
        {
            List<DynamicTranslationsData> dynamicTraslationListForWcf = new List<DynamicTranslationsData>();

            foreach (var dynamicTraslation in newDynamicTranslationsList)
            {
                dynamicTraslationListForWcf.Add(new DynamicTranslationsData
                {
                    DynamicObjectId = dynamicTraslation.DynamicObjectId,
                    Value = dynamicTraslation.Value,
                    DescriptionValue = dynamicTraslation.DescriptionValue,
                    LanguageId = dynamicTraslation.LanguageId,
                    DynamicKey = dynamicTraslation.DynamicKey
                });
            }
            client.AddDynamicTranslations(dynamicTraslationListForWcf.ToArray());
        }
Esempio n. 6
0
 /// <summary>
 /// Deletes the dynamic translations.
 /// </summary>
 /// <param name="dynamicKeysForDelete">The dynamic keys for delete.</param>
 public static void DeleteDynamicTranslations(IRoadsService client, List<string> dynamicKeysForDelete)
 {
     client.DeleteDynamicTranslations(dynamicKeysForDelete.ToArray());
 }
Esempio n. 7
0
        /// <summary>
        /// Adds the new feedbacks or route if not exist.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="routeFeedbacksModel">The route feedbacks model.</param>
        public static string AddNewFeedbacksOrRouteIfNotExist(IRoadsService client, AddRoadModelForStepTwo routeFeedbacksModel)
        {
            List<RouteNodeWithFeedbacksData> routeNodeWithFeedbacks = new List<RouteNodeWithFeedbacksData>();

            int userId = client.GetUserIdOrCreateNewIfNotExist(routeFeedbacksModel.UserName, routeFeedbacksModel.UserName, "TestUserRole");

            routeFeedbacksModel.Feedbacks.ForEach(feedback =>
            {
                routeNodeWithFeedbacks.Add(new RouteNodeWithFeedbacksData()
                {
                    DestinationCityNodeId = int.Parse(feedback.DestinationCityNodeId),
                    OriginCityNodeId = int.Parse(feedback.OriginCityNodeId),
                    OriginCityNode = feedback.OriginCityName,
                    DestinationCityNode = feedback.DestinationCityName,
                    SubmitTime = DateTime.Now,
                    UserId = userId,
                    FeedbackValues = feedback.FeedbackValues.Select(feedbackValue => new FeedbackValueData()
                    {
                        FeedbackItemId = feedbackValue.FeedbackItemId.Value,
                        Value = feedbackValue.Value == "undefined" ? "" : feedbackValue.Value
                    }).ToArray()
                });
            });

            return client.AddFeedbacksToNewOrExistingRoutes(routeNodeWithFeedbacks.ToArray());
        }
Esempio n. 8
0
 /// <summary>
 /// Updates the map objects translations.
 /// </summary>
 /// <param name="translations">The translations.</param>
 public static void UpdateMapObjectsTranslations(IRoadsService client, List<TranslationViewModel> translations)
 {
     client.UpdateMapObjectTranslation(translations.Select(s => new MapObjectTranslationData
         {
             LanguageId = s.LanguageId,
             LanguageKey = s.LanguageKey,
             Value = s.Value,
             MapObjectId = s.ObjectId
         }).ToArray());
 }
Esempio n. 9
0
        /// <summary>
        /// Sets the feedback items.
        /// </summary>
        /// <param name="feedbacksItemsListFromView">The feedbacks items list from view.</param>
        public static void SetFeedbackItems(IRoadsService client, List<FeedbackItemSettings> feedbacksItemsListFromView)
        {
            var feedbacksItemsListForWCF = new List<FeedbackItemData>();

            foreach (var feedbackItemsFromView in feedbacksItemsListFromView)
            {
                feedbacksItemsListForWCF.Add(new FeedbackItemData
                {
                    FeedbackItemId = feedbackItemsFromView.feedbackItemId,
                    NameTranslationKey = feedbackItemsFromView.settingName,
                    SortNumber = feedbackItemsFromView.sortNumber,
                    DescriptionTranslationKey = feedbackItemsFromView.description,
                    IsNumeric = feedbackItemsFromView.isNumeric,
                    Mandatory = feedbackItemsFromView.isMandatory,
                    FeedbackModelId = feedbackItemsFromView.feedbackModelId
                });
            }
            client.SetFeedbackItemsData(feedbacksItemsListForWCF.ToArray());
        }
Esempio n. 10
0
        /// <summary>
        /// Gets the suggestions by search string.
        /// </summary>
        /// <param name="client">IRoadsService instance. </param>
        /// <param name="searchString">The search string.</param>
        /// <param name="language">The language of user.</param>
        /// <returns><see cref="SuggestionsModel"/> which contains search results.</returns>
        public static SuggestionsModel GetSuggestions(IRoadsService client, string searchString, string language)
        {
            var suggestionsModel = new SuggestionsModel();
            Suggestion[] suggestions = client.GetSuggestions(searchString, language);

            if (suggestions != null && suggestions.Length != 0)
            {
                foreach (Suggestion suggestion in suggestions)
                {
                    suggestionsModel.suggestions.Add(new Models.Suggestion
                    {
                        data = suggestion.CityNodeId.ToString(CultureInfo.InvariantCulture),
                        value = String.Format("{0}{1}", suggestion.SuggestionCityName, suggestion.SuggestionRegionName)
                    });
                }
            }
            return suggestionsModel;
        }
Esempio n. 11
0
        /// <summary>
        /// Gets all dynamic translations.
        /// </summary>
        /// <returns>The List of <see cref="DynamicTranslation"/>.</returns>
        public static List<DynamicTranslation> GetAllDynamicTranslations(IRoadsService client)
        {
            var dynamicTranslationsListFromWcf = client.GetAllDynamicTranslationsData();
            var dynamicTranslationsForModel = new List<DynamicTranslation>();

            foreach (var dynamicTraslation in dynamicTranslationsListFromWcf)
            {
                dynamicTranslationsForModel.Add(new DynamicTranslation
                {
                    DynamicObjectId = dynamicTraslation.DynamicObjectId,
                    Value = dynamicTraslation.Value,
                    DescriptionValue = dynamicTraslation.DescriptionValue,
                    LanguageId = dynamicTraslation.LanguageId,
                    DynamicKey = dynamicTraslation.DynamicKey
                });

            }
            return dynamicTranslationsForModel;
        }
Esempio n. 12
0
        /// <summary>
        /// Gets all available languages.
        /// </summary>
        /// <returns>The List of <see cref="Language"/>.</returns>
        public static List<Language> GetAllAvailableLanguage(IRoadsService client)
        {
            var langListFromWcf = client.GetAllLanguages();

            return langListFromWcf.Select(lang => new Language
                {
                    LanguageId = lang.LanguageId,
                    Name = lang.Name,
                    IsDefault = lang.IsDefault
                }).ToList();
        }
Esempio n. 13
0
 /// <summary>
 /// Fills the feedback item model.
 /// </summary>
 /// <returns>The <see cref="FeedbackItemModel"/>.</returns>
 public static FeedbackItemModel FillFeedbackItemModel(IRoadsService client)
 {
     var feedbacksItemsListForView = RoadHelper.GetFeedbackItems(client);
     feedbacksItemsListForView.modelsNames = GetFeedbackModels(client);
     feedbacksItemsListForView.availableLanguages = GetAllAvailableLanguage(client);
     feedbacksItemsListForView.dynamicTranslations = GetAllDynamicTranslations(client);
     return feedbacksItemsListForView;
 }
Esempio n. 14
0
        /// <summary>
        /// Fills the create translation view model.
        /// </summary>
        /// <param name="model">The model.</param>
        public static void FillCreateTranslationViewModel(IRoadsService client, CreateTranslationViewModel model)
        {
            var leng = GetLanguages(client);

            var lenguages = new SelectList(leng.Select(s =>
                new SelectListItem
                {
                    Value = s.LanguageId.ToString(CultureInfo.InvariantCulture),
                    Text = s.Name,
                    Selected = s.IsDefault
                }), "Value", "Text", leng.First(e => e.IsDefault).LanguageId);

            foreach (var l in lenguages)
            {
                model.Translations.Add(new TranslationViewModel { Languages = lenguages });
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Fills the create map object model.
        /// </summary>
        /// <param name="model">The model.</param>
        public static void FillCreateMapObjectModel(IRoadsService client, CreateMapObjectViewModel model)
        {
            var lang = GetLanguages(client);

                var languages = new SelectList(lang.Select(s =>
                    new SelectListItem
                    {
                        Value = s.LanguageId.ToString(CultureInfo.InvariantCulture),
                        Text = s.Name,
                        Selected = s.IsDefault
                    }), "Value", "Text", lang.First(e => e.IsDefault).LanguageId);

                if (model.Translations.Any())
                {
                    foreach (var t in model.Translations)
                    {
                        t.LanguageKey = "null";
                        t.Languages = languages;
                    }
                }
                else
                {
                    foreach (var l in languages)
                    {
                        model.Translations.Add(new TranslationViewModel
                        {
                            Languages = languages,
                            LanguageKey = "null",
                            LanguageId = int.Parse(l.Value)
                        });
                    }
                }

                string selectedLanguage = CultureHelper.GetCulture(Thread.CurrentThread.CurrentUICulture.Name);

                var regions = client.GetRegionsListForLanguage(selectedLanguage);

                model.Regions = new SelectList(regions.Select(s => new SelectListItem
                {
                    Value = s.Id.ToString(CultureInfo.InvariantCulture),
                    Text = s.Name,
                    Selected = false
                }), "Value", "Text", 1);
        }
Esempio n. 16
0
        /// <summary>
        /// Fills the add road model for step two.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="cities">The cities.</param>
        /// <returns>
        /// The <see cref="AddRoadModelForStepTwo"/> for Add Road Step 2.
        /// </returns>
        public static AddRoadModelForStepTwo FillAddRoadModelForStepTwo(IRoadsService client, List<KeyValuePair<City, City>> cities)
        {
            var addRoadModelForStepTwo = new AddRoadModelForStepTwo();

            client.GetFeedbackControlsListForNewFeedback()
                .ForEach(x => addRoadModelForStepTwo.FeedbackControls.Add(new FeedbackControl()
                {
                    JSCode = x.FeedbackModel.JavascriptCode,
                    HTMLCode = x.FeedbackModel.HtmlCode,
                    SortNumber = x.FeedbackItem.SortNumber,
                    IsMandatory = x.FeedbackItem.Mandatory,
                    DescriptionTranslationKey = x.FeedbackItem.DescriptionTranslationKey,
                    NameTranslationKey = x.FeedbackItem.NameTranslationKey,
                    FeedBackItemId = x.FeedbackItem.FeedbackItemId
                }));

            addRoadModelForStepTwo.FeedbackControls = addRoadModelForStepTwo
                .FeedbackControls
                .OrderBy(x => x.SortNumber).ToList();

            byte fakekId = 0;
            cities.ForEach(x =>
            {
                addRoadModelForStepTwo.Feedbacks.Add(new FeedbackToRouteNode()
            {
                OriginCityName = x.Key.CityName,
                OriginCityNodeId = x.Key.CityId,
                DestinationCityName = x.Value.CityName,
                DestinationCityNodeId = x.Value.CityId,
                FeedbackId = fakekId,
                FeedbackValues = new List<FeedbackValue>()
            });
                fakekId++;
            });

            fakekId = 0;
            addRoadModelForStepTwo.FeedbackControls.
                ForEach(
                    x => addRoadModelForStepTwo.Feedbacks.ForEach(
                        y =>
                        {
                            y.FeedbackValues.Add(new FeedbackValue()
                            {
                                FeedbackItemId = x.FeedBackItemId,
                                FeedbackId = y.FeedbackId,
                                FeedbackValueId = fakekId,
                                Value = string.Empty
                            });
                            fakekId++;
                        }));
            return addRoadModelForStepTwo;
        }
Esempio n. 17
0
 /// <summary>
 /// Fills the AddRoadModel.
 /// </summary>
 /// <param name="manager">The ITranslationManager manager.</param>
 /// <param name="userLanguages">The user languages string.</param>
 /// <returns>The <see cref="AddRoadModel"/> with default placeholders.</returns>
 public static AddRoadModel FillAddRoadModel(IRoadsService client, AddRoadModel model, ITranslationManager manager, string userLanguages)
 {
     int searchingDepth = client.GetSearchingDepth();
     model.SearchingDepth = searchingDepth;
     model.CityPoints = new List<City>
     {
         new City
         {
             Placeholder =
                 manager.GetLabelTranslation("ARS1_Placeholder_From",
                     CultureHelper.GetCulture(userLanguages))
         },
         new City
         {
             Placeholder =
                 manager.GetLabelTranslation("ARS1_Placeholder_To",
                     CultureHelper.GetCulture(userLanguages))
         }
     };
     return model;
 }
Esempio n. 18
0
        /// <summary>
        /// Gets the settings from WCF Service.
        /// </summary>
        /// <returns>
        /// The <see cref="SiteSettingsModel"/>.
        /// </returns>
        public static SiteSettingsModel GetSettings(IRoadsService client)
        {
            var siteSettings = new SiteSettingsModel();
            List<SettingData> settings = client.GetSettings().ToList();

            foreach (SettingData setting in settings)
            {
                if (String.CompareOrdinal(setting.SettingName, numberOfRecordPerPage) == 0)
                {
                    siteSettings.numberOfRecordsPerPage = Convert.ToInt32(setting.SettingValue);
                }
                else if (String.CompareOrdinal(setting.SettingName, searchDepth) == 0)
                {
                    siteSettings.searchDepth = Convert.ToInt32(setting.SettingValue);
                }
            }
            return siteSettings;
        }
Esempio n. 19
0
        /// <summary>
        /// Gets the static translation for.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns>The List of <see cref="Mvc.RoadsServiceClient.StaticTranslationData"/>.</returns>
        public static List<StaticTranslationData> GetStaticTranslationFor(IRoadsService client, string key)
        {
            var languages = client.GetAllLanguages();

                return client.GetStaticTranslationData(key).Select(s => new StaticTranslationData
                    {
                        EnumKey = s.EnumKey,
                        LanguageId = s.LanguageId,
                        Value = s.Value,
                        StaticTranslationId = s.StaticTranslationId,
                        Language = languages.FirstOrDefault(l => l.LanguageId == s.LanguageId)
                    })
                    .ToList();
        }
Esempio n. 20
0
        /// <summary>
        /// Dynamics the translation for.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns>The List of <see cref="Mvc.RoadsServiceClient.DynamicTranslationsData"/>.</returns>
        public static List<DynamicTranslationsData> GetDynamicTranslationFor(IRoadsService client, string key)
        {
            var languages = client.GetAllLanguages();

                return client.GetDynamicTranslationData(key).Select(s => new DynamicTranslationsData
                    {
                        DynamicKey = s.DynamicKey,
                        LanguageId = s.LanguageId,
                        Value = s.Value,
                        DynamicObjectId = s.DynamicObjectId,
                        Lenguage = languages.FirstOrDefault(l => l.LanguageId == s.LanguageId)
                    }).ToList();
        }
Esempio n. 21
0
        /// <summary>
        /// Gets the translation data for.
        /// </summary>
        /// <param name="cityNodeId">The city node identifier.</param>
        /// <returns>The list of <see cref="TranslationViewModel"/>.</returns>
        public static List<TranslationViewModel> GetTranslationDatasFor(IRoadsService client, long cityNodeId)
        {
            var leng = GetLanguages(client);

                var lenguages = new SelectList(leng.Select(s =>
                new SelectListItem
                {
                    Value = s.LanguageId.ToString(CultureInfo.InvariantCulture),
                    Text = s.Name,
                    Selected = s.IsDefault
                }), "Value", "Text", leng.First(e => e.IsDefault).LanguageId);

                return client.GetMapObjectTranslationDataFor(cityNodeId).Select(s => new TranslationViewModel
                {
                    ObjectId = s.MapObjectId,
                    LanguageKey = s.LanguageKey,
                    Value = s.Value,
                    LanguageId = s.LanguageId,
                    Languages = lenguages

                }).ToList();
        }
Esempio n. 22
0
        /// <summary>
        /// Gets the feedback items.
        /// </summary>
        /// <returns>The <see cref="FeedbackItemModel"/>.</returns>
        public static FeedbackItemModel GetFeedbackItems(IRoadsService client)
        {
            var feedbacksItemsListFromWcf = client.GetFeedbackItemsData().OrderBy(x => x.SortNumber).ToList();
            var feedbacksItemsListForView = new FeedbackItemModel();

            foreach (var feedbackItemData in feedbacksItemsListFromWcf)
            {
                feedbacksItemsListForView.feedbackItemSettings.Add(new FeedbackItemSettings
                {
                    feedbackItemId = feedbackItemData.FeedbackItemId,
                    settingName = feedbackItemData.NameTranslationKey,
                    sortNumber = feedbackItemData.SortNumber,
                    description = feedbackItemData.DescriptionTranslationKey,
                    isNumeric = feedbackItemData.IsNumeric,
                    isMandatory = feedbackItemData.Mandatory,
                    feedbackModelId = feedbackItemData.FeedbackModelId
                });
            }
            return feedbacksItemsListForView;
        }
Esempio n. 23
0
        /// <summary>
        /// Sets the settings.
        /// </summary>
        /// <param name="siteSettings">The site settings.</param>
        public static void SetSettings(IRoadsService client, SiteSettingsModel siteSettings)
        {
            List<SettingData> settings = client.GetSettings().ToList();

            foreach (SettingData setting in settings)
            {
                if (String.Compare(setting.SettingName, numberOfRecordPerPage, false) == 0)
                {
                    setting.SettingValue = siteSettings.numberOfRecordsPerPage.ToString();
                }
                else if (String.Compare(setting.SettingName, searchDepth, false) == 0)
                {
                    setting.SettingValue = siteSettings.searchDepth.ToString();
                }
            }
            client.SetSettings(settings.ToArray());
        }
Esempio n. 24
0
        /// <summary>
        /// Gets the feedback models.
        /// </summary>
        /// <returns>The specific dictionary.</returns>
        public static Dictionary<Int64, string> GetFeedbackModels(IRoadsService client)
        {
            var feedbacksModels = client.GetFeedbackControlsList();

            var result = new Dictionary<long, string>();

            foreach (var model in feedbacksModels)
            {
                result.Add(model.FeedbackModelId, model.FeedBackModalName);
            }

            return result;
        }
Esempio n. 25
0
 /// <summary>
 /// Translates the cities.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="lang">The language.</param>
 /// <param name="cities">The cities.</param>
 public static void TranslateCities(IRoadsService client, string lang, ref List<KeyValuePair<City, City>> cities)
 {
     cities.ForEach(cityPair =>
     {
         cityPair.Key.CityName = client.GetFullTranslationForCityById(int.Parse(cityPair.Key.CityId), lang);
         cityPair.Value.CityName = client.GetFullTranslationForCityById(int.Parse(cityPair.Value.CityId), lang);
     });
 }
Esempio n. 26
0
        /// <summary>
        /// Gets the find route details model.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="urlId">The URL identifier.</param>
        /// <param name="language">The language.</param>
        /// <returns>Return view model for Find Route Details page.</returns>
        public static FindRoadDatailsModel GetFindRouteDetailsModel(IRoadsService client, string urlId, string language)
        {
            var model = new FindRoadDatailsModel();

            string hash = GetHashFromUrl(urlId);

            var rdControls = new List<FeedbackControl>();

            HolisticFeedback[] feedmackModel = client.GetFeedbackControlsListForNewFeedback();
            rdControls.AddRange(feedmackModel.Select(holisticFeedback => new FeedbackControl
            {
                DescriptionTranslationKey = holisticFeedback.FeedbackItem.DescriptionTranslationKey,
                SortNumber = holisticFeedback.FeedbackItem.SortNumber,
                NameTranslationKey = holisticFeedback.FeedbackItem.NameTranslationKey,
                HTMLCode = holisticFeedback.FeedbackModel.HtmlCode,
                JSCode = holisticFeedback.FeedbackModel.JavascriptCode,
                FeedBackItemId = holisticFeedback.FeedbackItem.FeedbackItemId,
                IsMandatory = holisticFeedback.FeedbackItem.Mandatory
            }));

            model.MandatoryControlsId =
                rdControls.Where(item => item.IsMandatory == true).Select(it => it.FeedBackItemId).ToArray();

            RouteDetailsData routeDetails = GetRouteDetails(client, hash, CultureHelper.GetCulture(language));

            model.RDNodesData = FillRDNodesData(routeDetails.RouteDetailsItems, rdControls);

            model.CityPointsNames = FillCityPList(model.RDNodesData);

            model.RouteSummary = FillRouteSummary(model.RDNodesData);

            return model;
        }
Esempio n. 27
0
 /// <summary>
 /// Updates the static translations.
 /// </summary>
 /// <param name="translations">The List of <see cref="StaticTranslationData"/>.</param>
 public static void UpdateStaticTranslations(IRoadsService client, List<StaticTranslationData> translations)
 {
     client.UpdateStaticTranslation(translations.ToArray());
 }
Esempio n. 28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdminZoneController"/> class.
 /// </summary>
 /// <param name="client">The client.</param>
 public AdminZoneController(IRoadsService client)
 {
     this.client = client;
 }
Esempio n. 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AjaxController"/> class.
 /// </summary>
 public AjaxController()
 {
     this.client = new RoadsServiceClient.RoadsServiceClient();
 }
Esempio n. 30
0
        /// <summary>
        /// Creates the new feedback.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="leaveFeedback">The leave feedback.</param>
        public static void CreateNewFeedback(IRoadsService client, RDLeaveFeedbackModel leaveFeedback)
        {
            var valueList = new List<FeedbackValueData>();

            leaveFeedback.RDLeaveFeedbackValues.ForEach(m =>
            {
                int feedbackItemId;
                if (int.TryParse(m.FeedbackItemId, out feedbackItemId))
                {
                    valueList.Add(new FeedbackValueData
                    {
                        FeedbackItemId = feedbackItemId,
                        Value = m.Value
                    });
                }
            });

            var newFeedback = new RouteNodeWithFeedbacksData
            {
                DestinationCityNodeId = leaveFeedback.DestinationCityId,
                OriginCityNodeId = leaveFeedback.OriginCityId,
                SubmitTime = leaveFeedback.SubmitTime,
                UserId = leaveFeedback.UserId,
                FeedbackValues = valueList.ToArray()
            };

            client.CreateFeedback(newFeedback);
        }
Esempio n. 31
0
 public CommentsService(IRoadsService roadsService, ApplicationDbContext context)
 {
     this.roadsService = roadsService;
     this.context      = context;
 }
Esempio n. 32
0
 /// <summary>
 /// Gets the languages.
 /// </summary>
 /// <returns>The list for <see cref="Mvc.RoadsServiceClient.LanguageData"/>.</returns>
 public static List<LanguageData> GetLanguages(IRoadsService client)
 {
     return client.GetAllLanguages().ToList();
 }
 public CategoriesController(IImageService imageService, IRoadsService roadsService, IMapper mapper)
 {
     this.imageService = imageService;
     this.roadsService = roadsService;
     this.mapper       = mapper;
 }
Esempio n. 34
0
        /// <summary>
        /// Gets the search result for.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>The <see cref="ListRoadsViewModel"/>.</returns>
        public static ListRoadsViewModel GetSearchResultFor(IRoadsService client, FindRoadModel model, bool isRouteValidation)
        {
            var responce = new ListRoadsViewModel();
            string currentLang = CultureHelper.GetNeutralCulture(CultureHelper.GetCurrentCulture());
                var data = client.GetRoadsFor(model.OriginCityNodeId, model.DestinationCityNodeId,
                    model.SearchResult.PageNumber, currentLang, isRouteValidation );

                responce.ActualRange = data.ActualRange;

                responce.NumberOfFound = data.Count;

                responce.RecordsPerPage = data.RecordsPerPage;

                responce.PageNumber = model.SearchResult.PageNumber;

                responce.RoadsList =
                    data.Treks.Select(s => new RoadSearchingResultViewModel
                    {
                        OriginCityName = s.OriginCityNodeName,
                        DestinationCityName = s.DesinationCityNodeName,
                        RouteHash = s.Hash,
                        Trek = s.Track,
                        InterimCities = s.Track.Split('-').Count() - 2,
                        FeedbacksCount = s.FeedbackCount

                    }).ToList();

            return responce;
        }