/// <summary> /// 得到 wx_fenxiao 数据实体 /// </summary> /// <param name="dr">dr</param> /// <returns>wx_fenxiao 数据实体</returns> public wx_FenxiaoEntity Populate_wx_FenxiaoEntity_FromDr(IDataReader dr) { wx_FenxiaoEntity Obj = new wx_FenxiaoEntity(); Obj.Id = ((dr["Id"]) == DBNull.Value)?0:Convert.ToInt32(dr["Id"]); Obj.ShopId = ((dr["ShopId"]) == DBNull.Value)?0:Convert.ToInt32(dr["ShopId"]); Obj.RoleId = ((dr["RoleId"]) == DBNull.Value)?0:Convert.ToInt32(dr["RoleId"]); Obj.OneFenxiao = ((dr["OneFenxiao"]) == DBNull.Value)?0:Convert.ToInt32(dr["OneFenxiao"]); Obj.TwoFenxiao = ((dr["TwoFenxiao"]) == DBNull.Value)?0:Convert.ToInt32(dr["TwoFenxiao"]); Obj.ThreeFenxiao = ((dr["ThreeFenxiao"]) == DBNull.Value)?0:Convert.ToInt32(dr["ThreeFenxiao"]); Obj.QuDao = ((dr["QuDao"]) == DBNull.Value)?0:Convert.ToInt32(dr["QuDao"]); return(Obj); }
/// <summary> /// 根据ID,返回一个wx_Fenxiao对象 /// </summary> /// <param name="id">id</param> /// <returns>wx_Fenxiao对象</returns> public wx_FenxiaoEntity Get_wx_FenxiaoEntity(int id) { wx_FenxiaoEntity _obj = null; SqlParameter[] _param = { new SqlParameter("@Id", SqlDbType.Int) }; _param[0].Value = id; string sqlStr = "select * from wx_Fenxiao with(nolock) where Id=@Id"; using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.WfxRW, CommandType.Text, sqlStr, _param)) { while (dr.Read()) { _obj = Populate_wx_FenxiaoEntity_FromDr(dr); } } return(_obj); }
/// <summary> /// 得到 wx_fenxiao 数据实体 /// </summary> /// <param name="row">row</param> /// <returns>wx_fenxiao 数据实体</returns> public wx_FenxiaoEntity Populate_wx_FenxiaoEntity_FromDr(DataRow row) { wx_FenxiaoEntity Obj = new wx_FenxiaoEntity(); if (row != null) { Obj.Id = ((row["Id"]) == DBNull.Value)?0:Convert.ToInt32(row["Id"]); Obj.ShopId = ((row["ShopId"]) == DBNull.Value)?0:Convert.ToInt32(row["ShopId"]); Obj.RoleId = ((row["RoleId"]) == DBNull.Value)?0:Convert.ToInt32(row["RoleId"]); Obj.OneFenxiao = ((row["OneFenxiao"]) == DBNull.Value)?0:Convert.ToInt32(row["OneFenxiao"]); Obj.TwoFenxiao = ((row["TwoFenxiao"]) == DBNull.Value)?0:Convert.ToInt32(row["TwoFenxiao"]); Obj.ThreeFenxiao = ((row["ThreeFenxiao"]) == DBNull.Value)?0:Convert.ToInt32(row["ThreeFenxiao"]); Obj.QuDao = ((row["QuDao"]) == DBNull.Value)?0:Convert.ToInt32(row["QuDao"]); } else { return(null); } return(Obj); }
/// <summary> /// 向数据库中插入一条新记录。带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="_wx_FenxiaoModel">wx_Fenxiao实体</param> /// <returns>新插入记录的编号</returns> public int Insert(SqlTransaction sp, wx_FenxiaoEntity _wx_FenxiaoModel) { string sqlStr = "insert into wx_Fenxiao([ShopId],[RoleId],[OneFenxiao],[TwoFenxiao],[ThreeFenxiao],[QuDao]) values(@ShopId,@RoleId,@OneFenxiao,@TwoFenxiao,@ThreeFenxiao,@QuDao) select @@identity"; int res; SqlParameter[] _param = { new SqlParameter("@ShopId", SqlDbType.Int), new SqlParameter("@RoleId", SqlDbType.Int), new SqlParameter("@OneFenxiao", SqlDbType.Int), new SqlParameter("@TwoFenxiao", SqlDbType.Int), new SqlParameter("@ThreeFenxiao", SqlDbType.Int), new SqlParameter("@QuDao", SqlDbType.Int) }; _param[0].Value = _wx_FenxiaoModel.ShopId; _param[1].Value = _wx_FenxiaoModel.RoleId; _param[2].Value = _wx_FenxiaoModel.OneFenxiao; _param[3].Value = _wx_FenxiaoModel.TwoFenxiao; _param[4].Value = _wx_FenxiaoModel.ThreeFenxiao; _param[5].Value = _wx_FenxiaoModel.QuDao; res = Convert.ToInt32(SqlHelper.ExecuteScalar(sp, CommandType.Text, sqlStr, _param)); return(res); }
/// <summary> /// 向数据表wx_Fenxiao更新一条记录。带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="_wx_FenxiaoModel">_wx_FenxiaoModel</param> /// <returns>影响的行数</returns> public int Update(SqlTransaction sp, wx_FenxiaoEntity _wx_FenxiaoModel) { string sqlStr = "update wx_Fenxiao set [ShopId]=@ShopId,[RoleId]=@RoleId,[OneFenxiao]=@OneFenxiao,[TwoFenxiao]=@TwoFenxiao,[ThreeFenxiao]=@ThreeFenxiao,[QuDao]=@QuDao where Id=@Id"; SqlParameter[] _param = { new SqlParameter("@Id", SqlDbType.Int), new SqlParameter("@ShopId", SqlDbType.Int), new SqlParameter("@RoleId", SqlDbType.Int), new SqlParameter("@OneFenxiao", SqlDbType.Int), new SqlParameter("@TwoFenxiao", SqlDbType.Int), new SqlParameter("@ThreeFenxiao", SqlDbType.Int), new SqlParameter("@QuDao", SqlDbType.Int) }; _param[0].Value = _wx_FenxiaoModel.Id; _param[1].Value = _wx_FenxiaoModel.ShopId; _param[2].Value = _wx_FenxiaoModel.RoleId; _param[3].Value = _wx_FenxiaoModel.OneFenxiao; _param[4].Value = _wx_FenxiaoModel.TwoFenxiao; _param[5].Value = _wx_FenxiaoModel.ThreeFenxiao; _param[6].Value = _wx_FenxiaoModel.QuDao; return(SqlHelper.ExecuteNonQuery(sp, CommandType.Text, sqlStr, _param)); }
public void Update(wx_FenxiaoEntity wx_FenxiaoEntity) { wx_Fenxiaodal.Update(wx_FenxiaoEntity); }
public int Insert(wx_FenxiaoEntity wx_FenxiaoEntity) { return(wx_Fenxiaodal.Insert(wx_FenxiaoEntity)); }