SuLei.DAL/sl_article_goods.cs
(开头部分) 15KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Text;
using SuLei.DBUtility;
using SuLei.Common;
namespace SuLei.DAL
{
/// <summary>
/// 数据访问类:商品价格
/// </summary>
public partial class sl_article_goods
{
private string databaseprefix;//数据库表名前缀
public sl_article_goods(string _databaseprefix)
{
databaseprefix = _databaseprefix;
}
#region 基本方法================================
/// <summary>
/// 是否存在该记录
/// </summary>
public bool Exists(int channel_id, int article_id, int id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select count(1) from " + databaseprefix + "article_goods");
strSql.Append(" where channel_id=@channel_id and article_id=@article_id and id=@id");
SqlParameter[] parameters = {
new SqlParameter("@channel_id", SqlDbType.Int,4),
new SqlParameter("@article_id", SqlDbType.Int,4),
new SqlParameter("@id", SqlDbType.Int,4)};
parameters[0].Value = channel_id;
parameters[1].Value = article_id;
parameters[2].Value = id;
return DbHelperSQL.Exists(strSql.ToString(), parameters);
}
/// <summary>
/// 增加一条数据
/// </summary>
public void Add(SqlConnection conn, SqlTransaction trans, Model.sl_article_goods model, int channel_id, int article_id)
{
#region 主表信息==========================
StringBuilder strSql = new StringBuilder();
StringBuilder str1 = new StringBuilder();//数据字段
StringBuilder str2 = new StringBuilder();//数据参数
//利用反射获得属性的所有公共属性
PropertyInfo[] pros = model.GetType().GetProperties();
List<SqlParameter> paras = new List<SqlParameter>();
strSql.Append("insert into " + databaseprefix + "article_goods(");
foreach (PropertyInfo pi in pros)
{
//如果不是主键则追加sql字符串
if (!pi.Name.Equals("id") && !pi.Name.Equals("group_prices"))
{
后面还有 276 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
