/// <summary> /// 更新一条数据 /// </summary> public bool Update(university.Model.CCOM.Examination_arrangement_detail model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Examination_arrangement_detail set "); strSql.Append(" Ea_id = @Ea_id , "); strSql.Append(" User_id = @User_id "); strSql.Append(" where Ead_id=@Ead_id "); SqlParameter[] parameters = { new SqlParameter("@Ead_id", SqlDbType.BigInt, 8), new SqlParameter("@Ea_id", SqlDbType.Int, 4), new SqlParameter("@User_id", SqlDbType.BigInt, 8) }; parameters[0].Value = model.Ead_id; parameters[1].Value = model.Ea_id; parameters[2].Value = model.User_id; int rows = DBSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public university.Model.CCOM.Examination_arrangement_detail GetModel(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Ead_id, Ea_id, User_id "); strSql.Append(" from Examination_arrangement_detail "); strSql.Append(" where " + strWhere); university.Model.CCOM.Examination_arrangement_detail model = new university.Model.CCOM.Examination_arrangement_detail(); DataSet ds = DBSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Ead_id"].ToString() != "") { model.Ead_id = long.Parse(ds.Tables[0].Rows[0]["Ead_id"].ToString()); } if (ds.Tables[0].Rows[0]["Ea_id"].ToString() != "") { model.Ea_id = int.Parse(ds.Tables[0].Rows[0]["Ea_id"].ToString()); } if (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 long Add(university.Model.CCOM.Examination_arrangement_detail model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Examination_arrangement_detail("); strSql.Append("Ea_id,User_id"); strSql.Append(") values ("); strSql.Append("@Ea_id,@User_id"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Ea_id", SqlDbType.Int, 4), new SqlParameter("@User_id", SqlDbType.BigInt, 8) }; parameters[0].Value = model.Ea_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.Examination_arrangement_detail GetModel(long Ead_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Ead_id, Ea_id, User_id "); strSql.Append(" from Examination_arrangement_detail "); strSql.Append(" where Ead_id=@Ead_id"); SqlParameter[] parameters = { new SqlParameter("@Ead_id", SqlDbType.BigInt) }; parameters[0].Value = Ead_id; university.Model.CCOM.Examination_arrangement_detail model = new university.Model.CCOM.Examination_arrangement_detail(); DataSet ds = DBSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Ead_id"].ToString() != "") { model.Ead_id = long.Parse(ds.Tables[0].Rows[0]["Ead_id"].ToString()); } if (ds.Tables[0].Rows[0]["Ea_id"].ToString() != "") { model.Ea_id = int.Parse(ds.Tables[0].Rows[0]["Ea_id"].ToString()); } if (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); } }