//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        int IDL.addTest(Test testToAdd)
        {
            //to do: make a running code for tests
            int testCode   = int.Parse(ConfigRoot.Element("BeginningSerialTestNumber").Element("Value").Value);
            int testNumber = (from test in TestRoot.Elements()
                              where (int.Parse(test.Element("TestNumber").Value) == testToAdd.TestNumber)
                              select(int.Parse(test.Element("TestNumber").Value))).FirstOrDefault();

            if (testNumber != 0)
            {
                throw new TestNumberAlreadyExistsException(testNumber);
            }

            testToAdd.TestNumber = testCode;
            TestRoot.Add(testToAdd.ToXmlTest());
            TestRoot.Save(TestPath);
            ConfigRoot.Element("BeginningSerialTestNumber").Element("Value").Value = (testCode + 1).ToString();
            ConfigRoot.Save(ConfigPath);
            return(testCode);
        }
Exemplo n.º 2
0
        internal imp_XML_Dal()
        {
            //DownloadBankXml();



            /// config file
            if (!File.Exists(configPath))
            {
                SaveConfigToXml();
            }
            else
            {
                ConfigRoot = XElement.Load(configPath);
                configurition.GuestRequestKey   = Convert.ToInt32(ConfigRoot.Element("GuestRequestKey").Value);
                configurition.HostingUnitKey    = Convert.ToInt32(ConfigRoot.Element("HostingUnitKey").Value);
                configurition.OrderKey          = Convert.ToInt32(ConfigRoot.Element("OrderKey").Value);
                configurition.commission        = Convert.ToInt32(ConfigRoot.Element("commission").Value);
                configurition.commissionAll     = Convert.ToInt32(ConfigRoot.Element("commissionAll").Value);
                configurition.LastApdateMonthly = Convert.ToDateTime(ConfigRoot.Element("LastApdateMonthly").Value);
                configurition.LastApdateDaily   = Convert.ToDateTime(ConfigRoot.Element("LastApdateDaily").Value);
            }

            if (!File.Exists(OrderPath))
            {
                OrderRoot = new XElement("Orders");
                OrderRoot.Save(OrderPath);
            }
            if (!File.Exists(GuestPath))
            {
                SaveToXML(new List <Guest>(), GuestPath);
            }
            if (!File.Exists(HostingUnitPath))
            {
                SaveToXML(new List <HostingUnit>(), HostingUnitPath);
            }

            OrderRoot    = XElement.Load(OrderPath);
            guests       = LoadFromXML <List <Guest> >(GuestPath);
            hostingUnits = LoadFromXML <List <HostingUnit> >(HostingUnitPath);
        }
Exemplo n.º 3
0
 /// <summary>
 /// adds to the next code number of the messages
 /// </summary>
 public void AddToMessageCode()
 {
     ConfigRoot.Element("MessageCode").Value = (GetMessageCode() + 1).ToString();
     ConfigRoot.Save(ConfigPath);
 }
Exemplo n.º 4
0
 /// <summary>
 /// returns the code for the next message to be added
 /// </summary>
 /// <returns></returns>
 public int GetMessageCode()
 {
     return(int.Parse(ConfigRoot.Element("MessageCode").Value));
 }
Exemplo n.º 5
0
 /// <summary>
 /// adds 1 to the code of the Config test code
 /// </summary>
 public void AddToTestCode()
 {
     ConfigRoot.Element("TestCode").Value = (GetTestCode() + 1).ToString();
     ConfigRoot.Save(ConfigPath);
 }
Exemplo n.º 6
0
 /// <summary>
 /// returns the code for the next test to be added
 /// </summary>
 /// <returns></returns>
 public int GetTestCode()
 {
     return(int.Parse(ConfigRoot.Element("TestCode").Value));
 }