// Insert one message template category.
        public static bool InsertOneMessageTemplateCategory(MessageTemplateCategoryType cat, out int newCatId)
        {
            newCatId = 0;

            IDbCommand cmd = DataFactory.CreateCommand(null);

            cmd.CommandText = @"Insert into [MessageTemplateCategory] (ParentCategoryId, CategoryName, CategoryDescription) values (@ParentCategoryId, @CategoryName, @CategoryDescription)";

            DataFactory.AddCommandParam(cmd, "@ParentCategoryId", DbType.Int32, cat.ParentCategoryId);
            DataFactory.AddCommandParam(cmd, "@CategoryName", DbType.String, StringUtil.GetSafeString(cat.CategoryName));
            DataFactory.AddCommandParam(cmd, "@CategoryDescription", DbType.String, StringUtil.GetSafeString(cat.CategoryDescription));

            bool result = DataFactory.ExecuteInsertCommand(cmd, out newCatId);

            return(result);
        }
예제 #2
0
        // Insert one message template.
        public static bool InsertOneMessageTemplate(MessageTemplateType messageTemplate, out int newTemplateId)
        {
            newTemplateId = 0;

            IDbCommand cmd = DataFactory.CreateCommand(null);

            cmd.CommandText = @"Insert into [MessageTemplate] (TemplateCategoryId, TemplateName, TemplateContent) values (@TemplateCategoryId, @TemplateName, @TemplateContent)";

            DataFactory.AddCommandParam(cmd, "@TemplateCategoryId", DbType.Int32, messageTemplate.TemplateCategoryId);
            DataFactory.AddCommandParam(cmd, "@TemplateName", DbType.String, StringUtil.GetSafeString(messageTemplate.TemplateName));
            DataFactory.AddCommandParam(cmd, "@TemplateContent", DbType.String, StringUtil.GetSafeString(messageTemplate.TemplateContent));

            bool result = DataFactory.ExecuteInsertCommand(cmd, out newTemplateId);

            return(result);
        }