public bool addEmployer(Employer e) { if (ElementIfExists(XML_Source.employerRoot, e.ID) != null) { throw new Exception(e.ID + " already exists in file"); } XML_Source.employerRoot.Add(createEmployerXElement(e)); XML_Source.SaveXML <Employer>(); return(true); }
public bool addSpecilization(Specialization spec) { if (ElementIfExists(XML_Source.specializationRoot, spec.ID) != null) { throw new Exception(spec.ID + " already exists in file"); } XML_Source.specializationRoot.Add(createSpecXElement(spec)); XML_Source.SaveXML <Specialization>(); nextSpecID++; return(true); }
bool removeElementFromXML(XElement XRoot, uint ID) { XElement foundElement = ElementIfExists(XRoot, ID); if (foundElement != null) // element found { foundElement.Remove(); XML_Source.SaveXML <Specialization>(); return(true); } else { throw new Exception("element " + ID + " not found in XML"); } }
public bool addContract(Contract contract, bool autoAssignID = true) { if (ElementIfExists(XML_Source.contractRoot, contract.contractID) != null) { throw new Exception(contract.contractID + " already exists in file"); } if (autoAssignID) { contract.contractID = nextContractID++; } XML_Source.contractRoot.Add(createContractXElement(contract)); XML_Source.SaveXML <Contract>(); return(true); }