public static bool UpdateTemplateDef(Template template, string templateDef) { //Note - It is assumed that the caller will update the ManagedItemAudit table, as needed. switch (template._defType) { case DefType.NotAssigned: throw new Exception(string.Format("DefType not assigned for TemplateID {0}", template.ID.ToString())); case DefType.Draft: GetNewVersion(template, ref templateDef); using (TransactionScope transScope = new TransactionScope(Data.Common.TransactionScopeOption)) { Data.Template.UpdateDraftTemplateDef(template.ID, templateDef); Data.Template.InsertTemplateAudit(template.ID, Business.SecurityHelper.GetLoggedOnPersonId(), (short)template.Status, templateDef, (int)Retro.AuditType.Saved); transScope.Complete(); } break; case DefType.Final: Data.Template.UpdateFinalTemplateDef(template.ID, templateDef); break; case DefType.ManagedItem: if (!template.IsManagedItem) throw new Exception(string.Format("Failed to cast TemplateID {0} to ManagedItem", template.ID.ToString())); ManagedItem managedItem = template as ManagedItem; Data.ManagedItem.UpdateTemplateDef(managedItem.ManagedItemID, templateDef); break; } template.DumpTemplateDef(); return true; }