Example #1
0
        public static bool DeleteOneCategory(int categoryId)
        {
            IDbCommand cmd = DataFactory.CreateCommand(null);

            cmd.CommandText = @"Delete * from [Category] where CategoryId=@CategoryId or ParentCategoryId=@CategoryId;";

            DataFactory.AddCommandParam(cmd, "CategoryId", DbType.Int32, categoryId);

            bool result = DataFactory.ExecuteCommandNonQuery(cmd);

            return(result);
        }
        // Delete one message template.
        public static bool DeleteOneMessageTemplate(int templateId)
        {
            IDbCommand cmd = DataFactory.CreateCommand(null);

            cmd.CommandText = @"Delete * from [MessageTemplate] where TemplateId=@TemplateId;";

            DataFactory.AddCommandParam(cmd, "CategoryId", DbType.Int32, templateId);

            bool result = DataFactory.ExecuteCommandNonQuery(cmd);

            return(result);
        }
Example #3
0
        public static bool InsertOneCategory(ItemCategoryType cat)
        {
            IDbCommand cmd = DataFactory.CreateCommand(null);

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

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

            bool result = DataFactory.ExecuteCommandNonQuery(cmd);

            return(result);
        }
        public static bool UpdateOneMessageTemplateCategory(MessageTemplateCategoryType cat)
        {
            IDbCommand cmd = DataFactory.CreateCommand(null);

            cmd.CommandText = @"Update [MessageTemplateCategory] set ParentCategoryId=@ParentCategoryId, CategoryName=@CategoryName, CategoryDescription=@CategoryDescription where CategoryId=@CategoryId";

            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));
            DataFactory.AddCommandParam(cmd, "@CategoryId", DbType.Int32, StringUtil.GetSafeInt(cat.CategoryId));

            bool result = DataFactory.ExecuteCommandNonQuery(cmd);

            return(result);
        }
        public static bool ModifyOneMessageTemplate(MessageTemplateType messageTemplate)
        {
            IDbCommand cmd = DataFactory.CreateCommand(null);

            cmd.CommandText = @"Update [MessageTemplate] set TemplateCategoryId=@TemplateCategoryId, TemplateName=@TemplateName, TemplateContent=@TemplateContent where TemplateId=@TemplateId";

            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));
            DataFactory.AddCommandParam(cmd, "@TemplateId", DbType.Int32, StringUtil.GetSafeInt(messageTemplate.TemplateId));

            bool result = DataFactory.ExecuteCommandNonQuery(cmd);

            return(result);
        }