/// <summary> /// DAL_XML_imp ctor /// </summary> public Dal_XML_imp() { backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork); backgroundWorker1.WorkerReportsProgress = true; if (!File.Exists(configPath)) { SaveConfigToXml(); } else { configRoot = XElement.Load(configPath); BE.Configuration.GuestRequestKeySt = Convert.ToInt32(configRoot.Element("GuestRequestKeySt").Value); BE.Configuration.OrderKeySt = Convert.ToInt32(configRoot.Element("OrderKeySt").Value); BE.Configuration.HostingUnitKeySt = Convert.ToInt32(configRoot.Element("HostingUnitKeySt").Value); BE.Configuration.Commission = Convert.ToDouble(configRoot.Element("Commission").Value); BE.Configuration.DaysExpireOrder = Convert.ToInt32(configRoot.Element("DaysExpireOrder").Value); BE.Configuration.DaysExpireGuestRequest = Convert.ToInt32(configRoot.Element("DaysExpireGuestRequest").Value); BE.Configuration.LinkCenterAttractions = configRoot.Element("LinkCenterAttractions").Value; BE.Configuration.LinkJerusalemAttractions = configRoot.Element("LinkJerusalemAttractions").Value; BE.Configuration.LinkNorthAttractions = configRoot.Element("LinkNorthAttractions").Value; BE.Configuration.LinkSouthAttractions = configRoot.Element("LinkSouthAttractions").Value; BE.Configuration.FromMail = configRoot.Element("FromMail").Value; BE.Configuration.PasswordMail = configRoot.Element("PasswordMail").Value; BE.Configuration.CurrentProfit = Convert.ToInt32(configRoot.Element("CurrentProfit").Value); BE.SiteOwner.profit = BE.Configuration.CurrentProfit; } if (!File.Exists(OrdersPath)) { OrdersRoot = new XElement("Orders"); OrdersRoot.Save(OrdersPath); } if (!File.Exists(GuestRequestsPath)) { SaveToXML <List <GuestRequest> >(new List <BE.GuestRequest>(), GuestRequestsPath); } if (!File.Exists(HostingUnitsPath)) { SaveToXML <List <HostingUnit> >(new List <BE.HostingUnit>(), HostingUnitsPath); } //DownloadBankBranches(); backgroundWorker1.RunWorkerAsync(); OrdersRoot = XElement.Load(OrdersPath); BankBranchesRoot = XElement.Load(xmlLocalPathBB); OrdersList = (from Order in OrdersRoot.Elements() select new Order() { OrderKey = Convert.ToInt32(Order.Element("OrderKey").Value), GuestRequestKey = Convert.ToInt32(Order.Element("GuestRequestKey").Value), HostingUnitKey = Convert.ToInt32(Order.Element("HostingUnitKey").Value), Status = (BE.ORDERSTATUS)Enum.Parse(typeof(BE.ORDERSTATUS), Order.Element("Status").Value, true), CreateDate = DateTime.Parse(Order.Element("CreateDate").Value), OrderDate = DateTime.Parse(Order.Element("OrderDate").Value) }).ToList(); HostingUnitsList = LoadFromXML <List <BE.HostingUnit> >(HostingUnitsPath); GuestRequestsList = LoadFromXML <List <BE.GuestRequest> >(GuestRequestsPath); }