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

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

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