コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CardCenter.Entity.SaleBinding model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SaleBinding set ");
            strSql.Append("JobID=@JobID,");
            strSql.Append("SaleID=@SaleID");
            strSql.Append(" where Guid=@Guid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@JobID",  SqlDbType.NVarChar, -1),
                new SqlParameter("@SaleID", SqlDbType.NVarChar, 64),
                new SqlParameter("@Guid",   SqlDbType.NVarChar, 64)
            };
            parameters[0].Value = model.JobID;
            parameters[1].Value = model.SaleID;
            parameters[2].Value = model.Guid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(CardCenter.Entity.SaleBinding model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SaleBinding(");
            strSql.Append("Guid,JobID,SaleID)");
            strSql.Append(" values (");
            strSql.Append("@Guid,@JobID,@SaleID)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Guid",   SqlDbType.NVarChar, 64),
                new SqlParameter("@JobID",  SqlDbType.NVarChar, -1),
                new SqlParameter("@SaleID", SqlDbType.NVarChar, 64)
            };
            parameters[0].Value = model.Guid;
            parameters[1].Value = model.JobID;
            parameters[2].Value = model.SaleID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public CardCenter.Entity.SaleBinding DataRowToEntity(DataRow row)
 {
     CardCenter.Entity.SaleBinding model = new CardCenter.Entity.SaleBinding();
     if (row != null)
     {
         if (row["Guid"] != null)
         {
             model.Guid = row["Guid"].ToString();
         }
         if (row["JobID"] != null)
         {
             model.JobID = row["JobID"].ToString();
         }
         if (row["SaleID"] != null)
         {
             model.SaleID = row["SaleID"].ToString();
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CardCenter.Entity.SaleBinding GetEntity(string Guid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Guid,JobID,SaleID from SaleBinding ");
            strSql.Append(" where Guid=@Guid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Guid", SqlDbType.NVarChar, 64)
            };
            parameters[0].Value = Guid;

            CardCenter.Entity.SaleBinding model = new CardCenter.Entity.SaleBinding();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToEntity(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }