public ReportItemBase(int id,
     string name,
     string groupName,
     ConnectionItem connection,
     FormItem form,
     TemplateItem template)
 {
     this.ID = id;
     this.Name = name;
     this.GroupName = groupName;
     this.ConnectionItem = connection;
     this.FormItem = form;
     this.TemplateItem = template;
 }
        protected override ApplyResult ProcessApplyItem(ref object obj, out string errormessage, out string successMessage, out bool edited)
        {
            errormessage = "";
            successMessage = "";
            edited = false;
            string action = this.Request.Form.action.Value.ToLower();
            int objectID = -1;
            if (this.Request.Form.objectID != null)
            {
                objectID = int.Parse(this.Request.Form.objectID.Value.ToString());
            }

            string html = this.Request.Form.HTML.Value;
            TemplateItem item = new TemplateItem(objectID,
                                                this.Request.Form.Name.Value,
                                                html);
            obj = item;

            switch (action)
            {
                case BaseWebModule.PostSave:
                    List<SWBaseTag> tags = SWBaseTag.GetTags(html, SWBaseTag.BaseTagTypes.Template);
                    foreach (SWBaseTag t1 in tags)
                    {
                        foreach (SWBaseTag t2 in tags)
                        {
                            if (!t1.Equals(t2) &&
                                t1.Name.Equals(t2.Name))
                            {
                                errormessage = String.Format("There are one or more tags with the same name {0}.", t1.Name);
                                return ApplyResult.Message;
                            }
                        }
                    }
                    bool result = false;
                    result = new DBContent().SaveTemplate(item, out errormessage);
                    edited = item.ID > 0;

                    if (result)
                    {
                        return ApplyResult.Save;
                    }
                    break;
                case BaseWebModule.PostCancel:
                    return ApplyResult.Cancel;
            }
            return ApplyResult.Message;
        }