/// <summary> /// 更新一条数据 /// </summary> public bool Update(university.Model.CCOM.Reply_commission model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Reply_commission set "); strSql.Append("Group_id=@Group_id,"); strSql.Append("User_id=@User_id"); strSql.Append(" where Rc_id=@Rc_id"); SqlParameter[] parameters = { new SqlParameter("@Group_id", SqlDbType.BigInt, 8), new SqlParameter("@User_id", SqlDbType.BigInt, 8), new SqlParameter("@Rc_id", SqlDbType.BigInt, 8) }; parameters[0].Value = model.Group_id; parameters[1].Value = model.User_id; parameters[2].Value = model.Rc_id; int rows = DBSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public long Add(university.Model.CCOM.Reply_commission model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Reply_commission("); strSql.Append("Group_id,User_id)"); strSql.Append(" values ("); strSql.Append("@Group_id,@User_id)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Group_id", SqlDbType.BigInt, 8), new SqlParameter("@User_id", SqlDbType.BigInt, 8) }; parameters[0].Value = model.Group_id; parameters[1].Value = model.User_id; object obj = DBSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt64(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public university.Model.CCOM.Reply_commission GetModel(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Rc_id,Group_id,User_id from Reply_commission "); strSql.Append(" where " + strWhere); university.Model.CCOM.Reply_commission model = new university.Model.CCOM.Reply_commission(); DataSet ds = DBSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Rc_id"] != null && ds.Tables[0].Rows[0]["Rc_id"].ToString() != "") { model.Rc_id = long.Parse(ds.Tables[0].Rows[0]["Rc_id"].ToString()); } if (ds.Tables[0].Rows[0]["Group_id"] != null && ds.Tables[0].Rows[0]["Group_id"].ToString() != "") { model.Group_id = long.Parse(ds.Tables[0].Rows[0]["Group_id"].ToString()); } if (ds.Tables[0].Rows[0]["User_id"] != null && ds.Tables[0].Rows[0]["User_id"].ToString() != "") { model.User_id = long.Parse(ds.Tables[0].Rows[0]["User_id"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public university.Model.CCOM.Reply_commission DataRowToModel(DataRow row) { university.Model.CCOM.Reply_commission model = new university.Model.CCOM.Reply_commission(); if (row != null) { if (row["Rc_id"] != null && row["Rc_id"].ToString() != "") { model.Rc_id = long.Parse(row["Rc_id"].ToString()); } if (row["Group_id"] != null && row["Group_id"].ToString() != "") { model.Group_id = long.Parse(row["Group_id"].ToString()); } if (row["User_id"] != null && row["User_id"].ToString() != "") { model.User_id = long.Parse(row["User_id"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public university.Model.CCOM.Reply_commission GetModel(long Rc_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Rc_id,Group_id,User_id from Reply_commission "); strSql.Append(" where Rc_id=@Rc_id"); SqlParameter[] parameters = { new SqlParameter("@Rc_id", SqlDbType.BigInt) }; parameters[0].Value = Rc_id; university.Model.CCOM.Reply_commission model = new university.Model.CCOM.Reply_commission(); DataSet ds = DBSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }