/// <summary> /// Saves the job /// </summary> public virtual void Save() { // verify paramterers before sending them to the database if (string.IsNullOrEmpty(Name)) { throw new ArgumentException("Name cannot be null or empty"); } if (Name.Length > 255) { throw new ArgumentException("Name cannot be more then 255 characters"); } if (string.IsNullOrEmpty(Description) == false) { if (Description.Length > 2000) { throw new ArgumentException("Description cannot be more then 2000 characters"); } } RecipientData dataUtil = GetWorker(); if (Id == 0) { // New list // Verify that we do not have a list with same name RecipientList existing = Load(_name); if (existing != null) { throw new ArgumentException("A recipient list with the same name already exists."); } int newId = dataUtil.RecipientListCreate(_type, _name, _description); _id = newId; } else { // Edit existing dataUtil.RecipientListEdit(_id, _type, _name, _description); } }