1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Configuration;
- namespace EMIS.ViewModel
- {
- public class FileUploadConfig : IConfigurationSectionHandler
- {
- public FileUploadConfig()
- {
- ServiceTypes = new Dictionary<string, string>();
- }
- public Dictionary<string, string> ServiceTypes { get; set; }
- public object Create(object parent, object configContext, System.Xml.XmlNode section)
- {
- FileUploadConfig config = new FileUploadConfig();
- var sectionConfigList = section.SelectNodes("add");
- for (int i = 0; i < sectionConfigList.Count; i++)
- {
- var sectionConfig = sectionConfigList.Item(i);
- if (sectionConfig != null && sectionConfig.Attributes != null)
- {
- var name = sectionConfig.Attributes["name"];
- var value = sectionConfig.Attributes["value"];
- if (name != null && value != null)
- {
- if (name.Value != null && value.Value != null)
- {
- config.ServiceTypes.Add(name.Value, value.Value);
- }
- }
- }
- }
- return config;
- }
- }
- }
|