public static object Deserialize(string SerializedValue, string type) { var xmlTextReader = new XmlTextReader(new StringReader(SerializedValue)); object obj = null; while (xmlTextReader.Read()) { if (type != null) { if (type != auditorContext) { if (type != "Hashtable") { if (type == "protocolport") { obj = new Hashtable(); if (xmlTextReader.NodeType == XmlNodeType.Element && xmlTextReader.LocalName == "protocolport") { ((Hashtable)obj)["HTTP"] = xmlTextReader.GetAttribute("HTTP"); ((Hashtable)obj)["TCP"] = xmlTextReader.GetAttribute("TCP"); ((Hashtable)obj)["RePr"] = xmlTextReader.GetAttribute("repr"); ((Hashtable)obj)["RePt"] = xmlTextReader.GetAttribute("rept"); } } } else { obj = new Hashtable(); if (xmlTextReader.NodeType == XmlNodeType.Element && xmlTextReader.LocalName == "secondconnstring") { ((Hashtable)obj)["DAC"] = xmlTextReader.GetAttribute("DAC"); ((Hashtable)obj)["META"] = xmlTextReader.GetAttribute("META"); ((Hashtable)obj)["WF"] = xmlTextReader.GetAttribute("WF"); } } } else { obj = new AuditorContext(); if (xmlTextReader.NodeType == XmlNodeType.Element && xmlTextReader.LocalName == "auditor") { ((AuditorContext)obj).AuditorId = xmlTextReader.GetAttribute("id"); ((AuditorContext)obj).AuditorName = xmlTextReader.GetAttribute("name"); } } } } return(obj); }
public MainWindow() { InitializeComponent(); if (devicesList == null) { devicesList = new List <Device>(); } Devices.ItemsSource = devicesList; using (var context = new AuditorContext()) { var techType = new TechType { Name = "ПЭВМ (системный блок, монитор, клавиатура, мышь)" }; context.TechTypes.Add(techType); context.SaveChanges(); } }
public AuditorResultMessageHandler(AuditorContext context) : base(context) { }
public AuditorController(AuditorContext context) { _context = context; }