Exemple #1
0
        /// <summary>
        /// 得到  t_repairzd 数据实体
        /// </summary>
        /// <param name="dr">dr</param>
        /// <returns>t_repairzd 数据实体</returns>
        public T_RepairZDEntity Populate_T_RepairZDEntity_FromDr(IDataReader dr)
        {
            T_RepairZDEntity Obj = new T_RepairZDEntity();

            Obj.ID         = ((dr["ID"]) == DBNull.Value)?0:Convert.ToInt32(dr["ID"]);
            Obj.DocumentID = ((dr["DocumentID"]) == DBNull.Value)?0:Convert.ToInt32(dr["DocumentID"]);
            Obj.ItemName   = dr["ItemName"].ToString();
            Obj.Money      = ((dr["Money"]) == DBNull.Value)?0:Convert.ToDecimal(dr["Money"]);
            Obj.Remark     = dr["Remark"].ToString();
            Obj.RepairMan  = dr["RepairMan"].ToString();

            return(Obj);
        }
Exemple #2
0
        /// <summary>
        /// 得到  t_repairzd 数据实体
        /// </summary>
        /// <param name="row">row</param>
        /// <returns>t_repairzd 数据实体</returns>
        public T_RepairZDEntity Populate_T_RepairZDEntity_FromDr(DataRow row)
        {
            T_RepairZDEntity Obj = new T_RepairZDEntity();

            if (row != null)
            {
                Obj.ID         = ((row["ID"]) == DBNull.Value)?0:Convert.ToInt32(row["ID"]);
                Obj.DocumentID = ((row["DocumentID"]) == DBNull.Value)?0:Convert.ToInt32(row["DocumentID"]);
                Obj.ItemName   = row["ItemName"].ToString();
                Obj.Money      = ((row["Money"]) == DBNull.Value)?0:Convert.ToDecimal(row["Money"]);
                Obj.Remark     = row["Remark"].ToString();
                Obj.RepairMan  = row["RepairMan"].ToString();
            }
            else
            {
                return(null);
            }
            return(Obj);
        }
Exemple #3
0
        /// <summary>
        /// 根据ID,返回一个T_RepairZD对象
        /// </summary>
        /// <param name="iD">iD</param>
        /// <returns>T_RepairZD对象</returns>
        public T_RepairZDEntity Get_T_RepairZDEntity(int iD)
        {
            T_RepairZDEntity _obj = null;

            SqlParameter[] _param =
            {
                new SqlParameter("@ID", SqlDbType.Int)
            };
            _param[0].Value = iD;
            string sqlStr = "select * from T_RepairZD with(nolock) where ID=@ID";

            using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.AutoRepairRW, CommandType.Text, sqlStr, _param))
            {
                while (dr.Read())
                {
                    _obj = Populate_T_RepairZDEntity_FromDr(dr);
                }
            }
            return(_obj);
        }
Exemple #4
0
        /// <summary>
        /// 向数据表T_RepairZD更新一条记录。带事务
        /// </summary>
        /// <param name="sp">事务对象</param>
        /// <param name="_T_RepairZDModel">_T_RepairZDModel</param>
        /// <returns>影响的行数</returns>
        public int Update(SqlTransaction sp, T_RepairZDEntity _T_RepairZDModel)
        {
            string sqlStr = "update T_RepairZD set [DocumentID]=@DocumentID,[ItemName]=@ItemName,[Money]=@Money,[Remark]=@Remark,[RepairMan]=@RepairMan where ID=@ID";

            SqlParameter[] _param =
            {
                new SqlParameter("@ID",         SqlDbType.Int),
                new SqlParameter("@DocumentID", SqlDbType.Int),
                new SqlParameter("@ItemName",   SqlDbType.VarChar),
                new SqlParameter("@Money",      SqlDbType.Decimal),
                new SqlParameter("@Remark",     SqlDbType.VarChar),
                new SqlParameter("@RepairMan",  SqlDbType.VarChar)
            };
            _param[0].Value = _T_RepairZDModel.ID;
            _param[1].Value = _T_RepairZDModel.DocumentID;
            _param[2].Value = _T_RepairZDModel.ItemName;
            _param[3].Value = _T_RepairZDModel.Money;
            _param[4].Value = _T_RepairZDModel.Remark;
            _param[5].Value = _T_RepairZDModel.RepairMan;
            return(SqlHelper.ExecuteNonQuery(sp, CommandType.Text, sqlStr, _param));
        }
Exemple #5
0
        /// <summary>
        /// 向数据库中插入一条新记录。带事务
        /// </summary>
        /// <param name="sp">事务对象</param>
        /// <param name="_T_RepairZDModel">T_RepairZD实体</param>
        /// <returns>新插入记录的编号</returns>
        public int Insert(SqlTransaction sp, T_RepairZDEntity _T_RepairZDModel)
        {
            string sqlStr = "insert into T_RepairZD([ID],[DocumentID],[ItemName],[Money],[Remark],[RepairMan]) values(@ID,@DocumentID,@ItemName,@Money,@Remark,@RepairMan) select @ID";
            int    res;

            SqlParameter[] _param =
            {
                new SqlParameter("@ID",         SqlDbType.Int),
                new SqlParameter("@DocumentID", SqlDbType.Int),
                new SqlParameter("@ItemName",   SqlDbType.VarChar),
                new SqlParameter("@Money",      SqlDbType.Decimal),
                new SqlParameter("@Remark",     SqlDbType.VarChar),
                new SqlParameter("@RepairMan",  SqlDbType.VarChar)
            };
            _param[0].Value = _T_RepairZDModel.ID;
            _param[1].Value = _T_RepairZDModel.DocumentID;
            _param[2].Value = _T_RepairZDModel.ItemName;
            _param[3].Value = _T_RepairZDModel.Money;
            _param[4].Value = _T_RepairZDModel.Remark;
            _param[5].Value = _T_RepairZDModel.RepairMan;
            res             = Convert.ToInt32(SqlHelper.ExecuteScalar(sp, CommandType.Text, sqlStr, _param));
            return(res);
        }
Exemple #6
0
 public void Update(T_RepairZDEntity t_RepairZDEntity)
 {
     t_RepairZDdal.Update(t_RepairZDEntity);
 }
Exemple #7
0
 public int Insert(T_RepairZDEntity t_RepairZDEntity)
 {
     return(t_RepairZDdal.Insert(t_RepairZDEntity));
 }