Beispiel #1
0
 internal Dal_XML_imp()
 {
     finishBankLoad = false;
     worker.DoWork += worker_DoWork;
     worker.RunWorkerAsync();
     if (!File.Exists(confPath))
     {
         DataSource_XML.saveConf();
     }
     else
     {
         confRoot = XElement.Load(confPath);
         Configuration.GuestRequestKey = Int32.Parse(confRoot.Element("GuestRequestKey").Value);
         Configuration.HostingUnitKey  = Int32.Parse(confRoot.Element("HostingUnitKey").Value);
         Configuration.OrderKey        = Int32.Parse(confRoot.Element("OrderKey").Value);
         Configuration.Commission      = Int32.Parse(confRoot.Element("Commission").Value);
         Configuration.Mail            = new MailAddress(confRoot.Element("Email").Value);
         Configuration.Password        = confRoot.Element("Password").Value;
     }
     if (!File.Exists(guestRequestPath))
     {
         DataSource_XML.SaveToXML(new List <GuestRequest>(), guestRequestPath);
     }
     DataSource.guestRequests = DataSource_XML.LoadFromXML <List <GuestRequest> >(guestRequestPath);
     if (!File.Exists(hostPath))
     {
         DataSource_XML.SaveToXML(new List <Host>(), hostPath);
     }
     DataSource.hosts = DataSource_XML.LoadFromXML <List <Host> >(hostPath);
     if (!File.Exists(hostingUnitPath))
     {
         DataSource_XML.SaveToXML(new List <HostingUnit>(), hostingUnitPath);
     }
     DataSource.hostingUnits = DataSource_XML.LoadFromXML <List <HostingUnit> >(hostingUnitPath);
     if (!File.Exists(orderPath))
     {
         orderRoot = new XElement("order");
         orderRoot.Save(orderPath);
     }
     orderRoot = XElement.Load(orderPath);
 }