Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MakeCardRecordModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update MakeCardRecord set ");
            strSql.Append("makedTime=@makedTime,");
            strSql.Append("reserve1=@reserve1,");
            strSql.Append("reserve2=@reserve2");
            strSql.Append(" where serialNo=@serialNo");
            SqlParameter[] parameters =
            {
                new SqlParameter("@makedTime", SqlDbType.DateTime),
                new SqlParameter("@reserve1",  SqlDbType.NVarChar,  50),
                new SqlParameter("@reserve2",  SqlDbType.NVarChar,  50),
                new SqlParameter("@cardID",    SqlDbType.NVarChar,  50),
                new SqlParameter("@serialNo",  SqlDbType.BigInt, 8)
            };
            parameters[0].Value = model.makedTime;
            parameters[1].Value = model.reserve1;
            parameters[2].Value = model.reserve2;
            parameters[3].Value = model.cardID;
            parameters[4].Value = model.serialNo;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(MakeCardRecordModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into MakeCardRecord(");
            strSql.Append("cardID,makedTime,reserve1,reserve2)");
            strSql.Append(" values (");
            strSql.Append("@cardID,@makedTime,@reserve1,@reserve2)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@cardID",    SqlDbType.NVarChar,  50),
                new SqlParameter("@makedTime", SqlDbType.DateTime),
                new SqlParameter("@reserve1",  SqlDbType.NVarChar,  50),
                new SqlParameter("@reserve2",  SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.cardID;
            parameters[1].Value = model.makedTime;
            parameters[2].Value = model.reserve1;
            parameters[3].Value = model.reserve2;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MakeCardRecordModel DataRowToModel(DataRow row)
        {
            MakeCardRecordModel model = new MakeCardRecordModel();

            if (row != null)
            {
                if (row["cardID"] != null)
                {
                    model.cardID = row["cardID"].ToString();
                }
                if (row["makedTime"] != null && row["makedTime"].ToString() != "")
                {
                    model.makedTime = DateTime.Parse(row["makedTime"].ToString());
                }
                if (row["serialNo"] != null && row["serialNo"].ToString() != "")
                {
                    model.serialNo = long.Parse(row["serialNo"].ToString());
                }
                if (row["reserve1"] != null)
                {
                    model.reserve1 = row["reserve1"].ToString();
                }
                if (row["reserve2"] != null)
                {
                    model.reserve2 = row["reserve2"].ToString();
                }
            }
            return(model);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MakeCardRecordModel GetModel(long serialNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 cardID,makedTime,serialNo,reserve1,reserve2 from MakeCardRecord ");
            strSql.Append(" where serialNo=@serialNo");
            SqlParameter[] parameters =
            {
                new SqlParameter("@serialNo", SqlDbType.BigInt)
            };
            parameters[0].Value = serialNo;

            MakeCardRecordModel model = new MakeCardRecordModel();
            DataSet             ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(MakeCardRecordModel model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(MakeCardRecordModel model)
 {
     return(dal.Add(model));
 }