Example #1
0
        public ActionResult AddFeedback(FeedbackItemSettings newFeedbackItemSettings, List<DynamicTranslation> newDynamicTranslations)
        {
            var languages = RoadHelper.GetAllAvailableLanguage(client);
                foreach (var newDynamicTraslation in newDynamicTranslations)
                {
                    newDynamicTraslation.DescriptionValue = String.Format("{0} translation for {1} dynamic record.",
                        languages.FirstOrDefault(x => x.LanguageId == newDynamicTraslation.LanguageId).Name.ToUpper(),
                        newDynamicTraslation.Value);
                }

                RoadHelper.AddNewFeedbackItem(client, newFeedbackItemSettings);
                RoadHelper.AddDynamicTranslations(client, newDynamicTranslations);
            return new JsonResult();
        }
Example #2
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);
 }
Example #3
0
        public ActionResult FeedbackSettings(FeedbackItemSettings itemForSave, List<DynamicTranslation> dynamicTranslationsList)
        {
            var feedbacksItemsListFromRoadHelper = RoadHelper.GetFeedbackItems(client).feedbackItemSettings;
                foreach (var feedbackItem in feedbacksItemsListFromRoadHelper)
                {
                    if (feedbackItem.feedbackItemId == itemForSave.feedbackItemId)
                    {
                        feedbackItem.settingName = itemForSave.settingName;
                        feedbackItem.sortNumber = itemForSave.sortNumber;
                        feedbackItem.description = itemForSave.description;
                        feedbackItem.isNumeric = itemForSave.isNumeric;
                        feedbackItem.isMandatory = itemForSave.isMandatory;
                        feedbackItem.feedbackModelId = itemForSave.feedbackModelId;
                    }
                }

                List<DynamicTranslation> listForUpdate = new List<DynamicTranslation>();
                foreach (var translationInModel in RoadHelper.FillFeedbackItemModel(client).dynamicTranslations)
                {
                    foreach (var dynamicNameTranslation in dynamicTranslationsList)
                    {
                        if (translationInModel.DynamicKey == dynamicNameTranslation.DynamicKey &&
                            translationInModel.LanguageId == dynamicNameTranslation.LanguageId)
                        {
                            translationInModel.Value = dynamicNameTranslation.Value;
                            listForUpdate.Add(translationInModel);
                        }
                    }
                }

                RoadHelper.UpdateDynamicTranslations(client, listForUpdate);
                RoadHelper.SetFeedbackItems(client, feedbacksItemsListFromRoadHelper);

            return new JsonResult() { Data = true, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }
Example #4
0
        public ActionResult DeleteFeedback(FeedbackItemSettings itemForDelete)
        {
            List<string> dynamicKeysForDelete = new List<string>();
            dynamicKeysForDelete.Add(itemForDelete.settingName);
            dynamicKeysForDelete.Add(itemForDelete.description);

            RoadHelper.DeleteFeedbackItem(client, itemForDelete);
            RoadHelper.DeleteDynamicTranslations(client, dynamicKeysForDelete);
            return new JsonResult();
        }