Exemplo n.º 1
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;
            }
        }