示例#1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(VipScoreBuyLog model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Shop_VipScoreBuyLog set ");
            strSql.Append("VipId=@VipId,");
            strSql.Append("BuyScore=@BuyScore,");
            strSql.Append("Remoark=@Remoark,");
            strSql.Append("Status=@Status,");
            strSql.Append("CreateBy=@CreateBy,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("UpdateBy=@UpdateBy,");
            strSql.Append("UpdateDate=@UpdateDate");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@VipId",      SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@BuyScore",   SqlDbType.Int,                 4),
                new SqlParameter("@Remoark",    SqlDbType.VarChar,          2000),
                new SqlParameter("@Status",     SqlDbType.VarChar,            20),
                new SqlParameter("@CreateBy",   SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@UpdateBy",   SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@UpdateDate", SqlDbType.DateTime),
                new SqlParameter("@Id",         SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = model.VipId;
            parameters[1].Value = model.BuyScore;
            parameters[2].Value = model.Remoark;
            parameters[3].Value = model.Status;
            parameters[4].Value = model.CreateBy;
            parameters[5].Value = model.CreateDate;
            parameters[6].Value = model.UpdateBy;
            parameters[7].Value = model.UpdateDate;
            parameters[8].Value = model.Id;

            int rows = _db.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public VipScoreBuyLog DataRowToModel(DataRow row)
        {
            VipScoreBuyLog model = new VipScoreBuyLog();

            if (row != null)
            {
                if (row["Id"] != null && row["Id"].ToString() != "")
                {
                    model.Id = new Guid(row["Id"].ToString());
                }
                if (row["VipId"] != null && row["VipId"].ToString() != "")
                {
                    model.VipId = new Guid(row["VipId"].ToString());
                }
                if (row["BuyScore"] != null && row["BuyScore"].ToString() != "")
                {
                    model.BuyScore = int.Parse(row["BuyScore"].ToString());
                }
                if (row["Remoark"] != null)
                {
                    model.Remoark = row["Remoark"].ToString();
                }
                if (row["Status"] != null)
                {
                    model.Status = row["Status"].ToString();
                }
                if (row["CreateBy"] != null && row["CreateBy"].ToString() != "")
                {
                    model.CreateBy = new Guid(row["CreateBy"].ToString());
                }
                if (row["CreateDate"] != null && row["CreateDate"].ToString() != "")
                {
                    model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
                }
                if (row["UpdateBy"] != null && row["UpdateBy"].ToString() != "")
                {
                    model.UpdateBy = new Guid(row["UpdateBy"].ToString());
                }
                if (row["UpdateDate"] != null && row["UpdateDate"].ToString() != "")
                {
                    model.UpdateDate = DateTime.Parse(row["UpdateDate"].ToString());
                }
            }
            return(model);
        }
示例#3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(VipScoreBuyLog model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Shop_VipScoreBuyLog(");
            strSql.Append("Id,VipId,BuyScore,Remoark,Status,CreateBy,CreateDate,UpdateBy,UpdateDate)");
            strSql.Append(" values (");
            strSql.Append("@Id,@VipId,@BuyScore,@Remoark,@Status,@CreateBy,@CreateDate,@UpdateBy,@UpdateDate)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",         SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@VipId",      SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@BuyScore",   SqlDbType.Int,                 4),
                new SqlParameter("@Remoark",    SqlDbType.VarChar,          2000),
                new SqlParameter("@Status",     SqlDbType.VarChar,            20),
                new SqlParameter("@CreateBy",   SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@UpdateBy",   SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@UpdateDate", SqlDbType.DateTime)
            };
            parameters[0].Value = Guid.NewGuid();
            parameters[1].Value = Guid.NewGuid();
            parameters[2].Value = model.BuyScore;
            parameters[3].Value = model.Remoark;
            parameters[4].Value = model.Status;
            parameters[5].Value = Guid.NewGuid();
            parameters[6].Value = model.CreateDate;
            parameters[7].Value = Guid.NewGuid();
            parameters[8].Value = model.UpdateDate;

            int rows = _db.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public VipScoreBuyLog GetModel(Guid Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,VipId,BuyScore,Remoark,Status,CreateBy,CreateDate,UpdateBy,UpdateDate from Shop_VipScoreBuyLog ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = Id;

            VipScoreBuyLog model = new VipScoreBuyLog();
            DataSet        ds    = _db.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(VipScoreBuyLog model)
 {
     return(VipScoreBuyLogDAL.instance.Update(model));
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(VipScoreBuyLog model)
 {
     return(VipScoreBuyLogDAL.instance.Add(model));
 }