@@ -40,7 +40,7 @@ public InstallationLocalizationService(IHttpContextAccessor httpContextAccessor,
40
40
}
41
41
42
42
#endregion
43
-
43
+
44
44
#region Methods
45
45
46
46
/// <summary>
@@ -214,25 +214,22 @@ public virtual IList<InstallationLanguage> GetAvailableLanguages()
214
214
/// <summary>
215
215
/// Get a list of available data provider types
216
216
/// </summary>
217
- /// <returns>Available installation data provider types</returns>
218
- public IList < SelectListItem > GetAvailableProviderTypes ( )
217
+ /// <param name="valuesToExclude">Values to exclude</param>
218
+ /// <param name="useLocalization">Localize</param>
219
+ /// <returns>SelectList</returns>
220
+ public SelectList GetAvailableProviderTypes ( int [ ] valuesToExclude = null , bool useLocalization = true )
219
221
{
220
- //TODO 239 must be implemented
221
- return new List < SelectListItem >
222
- {
223
- new SelectListItem ( )
222
+ var values =
223
+ from DataProviderType enumValue in Enum . GetValues ( typeof ( DataProviderType ) )
224
+ where enumValue != DataProviderType . Unknown && ( valuesToExclude == null || ! valuesToExclude . Contains ( Convert . ToInt32 ( enumValue ) ) )
225
+ select new
224
226
{
225
- Value = DataProviderType . SqlServer . ToString ( ) ,
226
- Text = GetResource ( DataProviderType . SqlServer . ToString ( ) ) ,
227
- Selected = true
228
- } ,
229
- new SelectListItem ( )
230
- {
231
- Value = DataProviderType . MySql . ToString ( ) ,
232
- Text = GetResource ( DataProviderType . MySql . ToString ( ) ) ,
233
- Selected = true
234
- }
235
- } ;
227
+ ID = Convert . ToInt32 ( enumValue ) ,
228
+ Name = useLocalization ? GetResource ( enumValue . ToString ( ) ) :
229
+ CommonHelper . ConvertEnum ( enumValue . ToString ( ) )
230
+ } ;
231
+
232
+ return new SelectList ( values . OrderBy ( v => v . Name ) , "ID" , "Name" , null ) ;
236
233
}
237
234
238
235
#endregion
0 commit comments