protected override void Validate(HRPaidTimeOffDataContext db, ref ENTValidationErrors validationErrors) { if (OwnerGroupName.Trim() == "") { validationErrors.Add("The name is required."); } else { //The name must be unique within a workflow. if (new ENTWFOwnerGroupData().IsNameUnique(db, OwnerGroupName, ENTWorkflowId, ID) == false) { validationErrors.Add("The name must be unique."); } } }
///////////////////////////////////////////////////////////////////////////////////////////////////// #region Serialization ///////////////////////////////////////////////////////////////////////////////////////////////////// public override XElement ToXML(bool internalPurpose = true) { XDocument res = Utilities.CreateXMLDoc("Snippet", false); res.Root.Add( new XElement(ConfigReader.S2CNS + "ID", ID), new XElement(ConfigReader.S2CNS + "CreatorName", CreatorName.FixXML()), new XElement(ConfigReader.S2CNS + "OwnerGroupName", OwnerGroupName.FixXML()), new XElement(ConfigReader.S2CNS + "Title", Title.FixXML()), new XElement(ConfigReader.S2CNS + "Description", Description.FixXML()), new XElement(ConfigReader.S2CNS + "Code", Code.FixXML()), new XElement(ConfigReader.S2CNS + "Created", Created), new XElement(ConfigReader.S2CNS + "Modified", Modified), new XElement(ConfigReader.S2CNS + "Visibility", Visibility) ); res.Root.Add(ToPropertiesXML()); res.Root.Add(ToTagsXML()); return(res.Root); }