Esempio n. 1
0
 /// <summary>
 /// 删除指定数据
 /// </summary>
 /// <param name="ID">要删除的对象  (通过主键)</param>
 /// <returns></returns>
 public int Delete(BU_PayType3 _bU_PayType3)
 {
     return(db.ExecuteNonQuery(deleteByKeyText, CommandType.Text,
                               new SqlParameter[] {
         new SqlParameter("@ID", SqlDbType.BigInt, 19)
         {
             Value = _bU_PayType3.ID
         }
     }));
 }
Esempio n. 2
0
        /// <summary>
        /// 将表转换为对象集合
        /// </summary>
        /// <param name="dt">要转换的表</param>
        /// <returns></returns>
        public List <BU_PayType3> DataTableToList(DataTable dt)
        {
            List <BU_PayType3>   bu_paytype3s = new List <BU_PayType3>();
            BU_PayType3          _bu_paytype3 = null;
            object               _temp        = null;
            DataColumnCollection dcs          = dt.Columns;

            foreach (DataRow item in dt.Rows)
            {
                _bu_paytype3 = new BU_PayType3();
                if (dcs.Contains("id"))
                {
                    _bu_paytype3.ID = Convert.ToInt64(item["ID"]);
                }
                if (dcs.Contains("pid"))
                {
                    _bu_paytype3.PID = Convert.ToInt64(item["PID"]);
                }
                if (dcs.Contains("userid"))
                {
                    _bu_paytype3.UserID = Convert.ToInt64(item["UserID"]);
                }
                if (dcs.Contains("name"))
                {
                    _bu_paytype3.Name = item["Name"].ToString();
                }
                if (dcs.Contains("state"))
                {
                    _bu_paytype3.State = Convert.ToInt32(item["State"]);
                }
                if (dcs.Contains("sort"))
                {
                    _bu_paytype3.Sort = Convert.ToInt64(item["Sort"]);
                }
                if (dcs.Contains("isbreak"))
                {
                    _bu_paytype3.IsBreak = Convert.ToBoolean(item["IsBreak"]);
                }
                if (dcs.Contains("adddate"))
                {
                    _bu_paytype3.AddDate = Convert.ToDateTime(item["AddDate"]);
                }
                bu_paytype3s.Add(_bu_paytype3);
            }
            return(bu_paytype3s);
        }
Esempio n. 3
0
        /// <summary>
        /// 将数据行转换为对象
        /// </summary>
        /// <param name="dt">要转换的数据行</param>
        /// <returns></returns>
        public BU_PayType3 DataRowToModel(DataRow dr)
        {
            BU_PayType3          _bu_paytype3 = null;
            object               _temp        = null;
            DataColumnCollection dcs          = dr.Table.Columns;

            _bu_paytype3 = new BU_PayType3();
            if (dcs.Contains("id"))
            {
                _bu_paytype3.ID = Convert.ToInt64(dr["ID"]);
            }
            if (dcs.Contains("pid"))
            {
                _bu_paytype3.PID = Convert.ToInt64(dr["PID"]);
            }
            if (dcs.Contains("userid"))
            {
                _bu_paytype3.UserID = Convert.ToInt64(dr["UserID"]);
            }
            if (dcs.Contains("name"))
            {
                _bu_paytype3.Name = dr["Name"].ToString();
            }
            if (dcs.Contains("state"))
            {
                _bu_paytype3.State = Convert.ToInt32(dr["State"]);
            }
            if (dcs.Contains("sort"))
            {
                _bu_paytype3.Sort = Convert.ToInt64(dr["Sort"]);
            }
            if (dcs.Contains("isbreak"))
            {
                _bu_paytype3.IsBreak = Convert.ToBoolean(dr["IsBreak"]);
            }
            if (dcs.Contains("adddate"))
            {
                _bu_paytype3.AddDate = Convert.ToDateTime(dr["AddDate"]);
            }
            return(_bu_paytype3);
        }
Esempio n. 4
0
 /// <summary>
 /// 更新数据库的一条记录
 /// </summary>
 /// <param name="_bU_PayType3">需要更新的对象</param>
 /// <returns></returns>
 public int Update(BU_PayType3 _bU_PayType3)
 {
     return(db.ExecuteNonQuery(updateByKeyText, CommandType.Text,
                               new SqlParameter[] {
         new SqlParameter("@PID", SqlDbType.BigInt, 19)
         {
             Value = _bU_PayType3.PID
         }
         , new SqlParameter("@UserID", SqlDbType.BigInt, 19)
         {
             Value = _bU_PayType3.UserID
         }
         , new SqlParameter("@Name", SqlDbType.NVarChar, 50)
         {
             Value = _bU_PayType3.Name
         }
         , new SqlParameter("@State", SqlDbType.Int, 10)
         {
             Value = _bU_PayType3.State
         }
         , new SqlParameter("@Sort", SqlDbType.BigInt, 19)
         {
             Value = _bU_PayType3.Sort
         }
         , new SqlParameter("@IsBreak", SqlDbType.Bit, 1)
         {
             Value = _bU_PayType3.IsBreak
         }
         , new SqlParameter("@AddDate", SqlDbType.DateTime, 23)
         {
             Value = _bU_PayType3.AddDate
         }
         , new SqlParameter("@ID1", SqlDbType.BigInt, 19)
         {
             Value = _bU_PayType3.ID
         }
     }));
 }
Esempio n. 5
0
        /// <summary>
        /// 向数据库插入一条新数据 返回插入的自增长值
        /// </summary>
        /// <param name="_bU_PayType3">需要插入的对象</param>
        /// <returns></returns>
        public long Add(BU_PayType3 _bU_PayType3)
        {
            object obj = db.ExecuteScalar(insertText, CommandType.Text,
                                          new SqlParameter[] {
                new SqlParameter("@PID", SqlDbType.BigInt, 19)
                {
                    Value = _bU_PayType3.PID
                }
                , new SqlParameter("@UserID", SqlDbType.BigInt, 19)
                {
                    Value = _bU_PayType3.UserID
                }
                , new SqlParameter("@Name", SqlDbType.NVarChar, 50)
                {
                    Value = _bU_PayType3.Name
                }
                , new SqlParameter("@State", SqlDbType.Int, 10)
                {
                    Value = _bU_PayType3.State
                }
                , new SqlParameter("@Sort", SqlDbType.BigInt, 19)
                {
                    Value = _bU_PayType3.Sort
                }
                , new SqlParameter("@IsBreak", SqlDbType.Bit, 1)
                {
                    Value = _bU_PayType3.IsBreak
                }
                , new SqlParameter("@AddDate", SqlDbType.DateTime, 23)
                {
                    Value = _bU_PayType3.AddDate
                }
            });

            return(obj is DBNull ? 0 : Convert.ToInt64(obj));
        }
Esempio n. 6
0
 /// <summary>
 /// 删除指定数据
 /// </summary>
 /// <param name="ID">要删除的对象  (通过主键)</param>
 /// <returns></returns>
 public int Delete(BU_PayType3 _bU_PayType3)
 {
     return(_dal.Delete(_bU_PayType3));
 }
Esempio n. 7
0
 /// <summary>
 /// 更新数据库的一条记录
 /// </summary>
 /// <param name="_bU_PayType3">需要更新的对象</param>
 /// <returns></returns>
 public int Update(BU_PayType3 _bU_PayType3)
 {
     return(_dal.Update(_bU_PayType3));
 }
Esempio n. 8
0
 /// <summary>
 /// 向数据库插入一条新数据 返回插入的自增长值
 /// </summary>
 /// <param name="_bU_PayType3">需要插入的对象</param>
 /// <returns></returns>
 public long Add(BU_PayType3 _bU_PayType3)
 {
     return(_dal.Add(_bU_PayType3));
 }