/// <summary> /// 增加一条数据 /// </summary> public void Add(university.Model.CCOM.View_TotalScore model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into View_TotalScore("); strSql.Append("UP_CCOM_number,Period_id,Agency_id,User_id,User_realname,UP_calculation_status,Transcript_id,Transcript_AEE_score,Transcript_AEE_sequence,Transcript_AEE_ranking,Transcript_CEE_score,Transcript_CEE_convert_score,Transcript_passline,Transcript_type,Transcript_score,UP_province"); strSql.Append(") values ("); strSql.Append("@UP_CCOM_number,@Period_id,@Agency_id,@User_id,@User_realname,@UP_calculation_status,@Transcript_id,@Transcript_AEE_score,@Transcript_AEE_sequence,@Transcript_AEE_ranking,@Transcript_CEE_score,@Transcript_CEE_convert_score,@Transcript_passline,@Transcript_type,@Transcript_score,@UP_province"); strSql.Append(") "); SqlParameter[] parameters = { new SqlParameter("@UP_CCOM_number", SqlDbType.VarChar, 16), new SqlParameter("@Period_id", SqlDbType.Int, 4), new SqlParameter("@Agency_id", SqlDbType.Int, 4), new SqlParameter("@User_id", SqlDbType.BigInt, 8), new SqlParameter("@User_realname", SqlDbType.VarChar, 128), new SqlParameter("@UP_calculation_status", SqlDbType.Int, 4), new SqlParameter("@Transcript_id", SqlDbType.Int, 4), new SqlParameter("@Transcript_AEE_score", SqlDbType.Float, 8), new SqlParameter("@Transcript_AEE_sequence", SqlDbType.Float, 8), new SqlParameter("@Transcript_AEE_ranking", SqlDbType.Int, 4), new SqlParameter("@Transcript_CEE_score", SqlDbType.Float, 8), new SqlParameter("@Transcript_CEE_convert_score", SqlDbType.Float, 8), new SqlParameter("@Transcript_passline", SqlDbType.Bit, 1), new SqlParameter("@Transcript_type", SqlDbType.TinyInt, 1), new SqlParameter("@Transcript_score", SqlDbType.Float, 8), new SqlParameter("@UP_province", SqlDbType.Int, 4) }; parameters[0].Value = model.UP_CCOM_number; parameters[1].Value = model.Period_id; parameters[2].Value = model.Agency_id; parameters[3].Value = model.User_id; parameters[4].Value = model.User_realname; parameters[5].Value = model.UP_calculation_status; parameters[6].Value = model.Transcript_id; parameters[7].Value = model.Transcript_AEE_score; parameters[8].Value = model.Transcript_AEE_sequence; parameters[9].Value = model.Transcript_AEE_ranking; parameters[10].Value = model.Transcript_CEE_score; parameters[11].Value = model.Transcript_CEE_convert_score; parameters[12].Value = model.Transcript_passline; parameters[13].Value = model.Transcript_type; parameters[14].Value = model.Transcript_score; parameters[15].Value = model.UP_province; DBSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(university.Model.CCOM.View_TotalScore model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update View_TotalScore set "); strSql.Append(" UP_CCOM_number = @UP_CCOM_number , "); strSql.Append(" Period_id = @Period_id , "); strSql.Append(" Agency_id = @Agency_id , "); strSql.Append(" User_id = @User_id , "); strSql.Append(" User_realname = @User_realname , "); strSql.Append(" UP_calculation_status = @UP_calculation_status , "); strSql.Append(" Transcript_id = @Transcript_id , "); strSql.Append(" Transcript_AEE_score = @Transcript_AEE_score , "); strSql.Append(" Transcript_AEE_sequence = @Transcript_AEE_sequence , "); strSql.Append(" Transcript_AEE_ranking = @Transcript_AEE_ranking , "); strSql.Append(" Transcript_CEE_score = @Transcript_CEE_score , "); strSql.Append(" Transcript_CEE_convert_score = @Transcript_CEE_convert_score , "); strSql.Append(" Transcript_passline = @Transcript_passline , "); strSql.Append(" Transcript_type = @Transcript_type , "); strSql.Append(" Transcript_score = @Transcript_score , "); strSql.Append(" UP_province = @UP_province "); strSql.Append(" where "); SqlParameter[] parameters = { new SqlParameter("@UP_CCOM_number", SqlDbType.VarChar, 16), new SqlParameter("@Period_id", SqlDbType.Int, 4), new SqlParameter("@Agency_id", SqlDbType.Int, 4), new SqlParameter("@User_id", SqlDbType.BigInt, 8), new SqlParameter("@User_realname", SqlDbType.VarChar, 128), new SqlParameter("@UP_calculation_status", SqlDbType.Int, 4), new SqlParameter("@Transcript_id", SqlDbType.Int, 4), new SqlParameter("@Transcript_AEE_score", SqlDbType.Float, 8), new SqlParameter("@Transcript_AEE_sequence", SqlDbType.Float, 8), new SqlParameter("@Transcript_AEE_ranking", SqlDbType.Int, 4), new SqlParameter("@Transcript_CEE_score", SqlDbType.Float, 8), new SqlParameter("@Transcript_CEE_convert_score", SqlDbType.Float, 8), new SqlParameter("@Transcript_passline", SqlDbType.Bit, 1), new SqlParameter("@Transcript_type", SqlDbType.TinyInt, 1), new SqlParameter("@Transcript_score", SqlDbType.Float, 8), new SqlParameter("@UP_province", SqlDbType.Int, 4) }; parameters[0].Value = model.UP_CCOM_number; parameters[1].Value = model.Period_id; parameters[2].Value = model.Agency_id; parameters[3].Value = model.User_id; parameters[4].Value = model.User_realname; parameters[5].Value = model.UP_calculation_status; parameters[6].Value = model.Transcript_id; parameters[7].Value = model.Transcript_AEE_score; parameters[8].Value = model.Transcript_AEE_sequence; parameters[9].Value = model.Transcript_AEE_ranking; parameters[10].Value = model.Transcript_CEE_score; parameters[11].Value = model.Transcript_CEE_convert_score; parameters[12].Value = model.Transcript_passline; parameters[13].Value = model.Transcript_type; parameters[14].Value = model.Transcript_score; parameters[15].Value = model.UP_province; int rows = DBSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public university.Model.CCOM.View_TotalScore GetModel(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select UP_CCOM_number, Period_id, Agency_id, User_id, User_realname, UP_calculation_status, Transcript_id, Transcript_AEE_score, Transcript_AEE_sequence, Transcript_AEE_ranking, Transcript_CEE_score, Transcript_CEE_convert_score, Transcript_passline, Transcript_type, Transcript_score, UP_province "); strSql.Append(" from View_TotalScore "); strSql.Append(" where " + strWhere); university.Model.CCOM.View_TotalScore model = new university.Model.CCOM.View_TotalScore(); DataSet ds = DBSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { model.UP_CCOM_number = ds.Tables[0].Rows[0]["UP_CCOM_number"].ToString(); if (ds.Tables[0].Rows[0]["Period_id"].ToString() != "") { model.Period_id = int.Parse(ds.Tables[0].Rows[0]["Period_id"].ToString()); } if (ds.Tables[0].Rows[0]["Agency_id"].ToString() != "") { model.Agency_id = int.Parse(ds.Tables[0].Rows[0]["Agency_id"].ToString()); } if (ds.Tables[0].Rows[0]["User_id"].ToString() != "") { model.User_id = long.Parse(ds.Tables[0].Rows[0]["User_id"].ToString()); } model.User_realname = ds.Tables[0].Rows[0]["User_realname"].ToString(); if (ds.Tables[0].Rows[0]["UP_calculation_status"].ToString() != "") { model.UP_calculation_status = int.Parse(ds.Tables[0].Rows[0]["UP_calculation_status"].ToString()); } if (ds.Tables[0].Rows[0]["Transcript_id"].ToString() != "") { model.Transcript_id = int.Parse(ds.Tables[0].Rows[0]["Transcript_id"].ToString()); } if (ds.Tables[0].Rows[0]["Transcript_AEE_score"].ToString() != "") { model.Transcript_AEE_score = decimal.Parse(ds.Tables[0].Rows[0]["Transcript_AEE_score"].ToString()); } if (ds.Tables[0].Rows[0]["Transcript_AEE_sequence"].ToString() != "") { model.Transcript_AEE_sequence = decimal.Parse(ds.Tables[0].Rows[0]["Transcript_AEE_sequence"].ToString()); } if (ds.Tables[0].Rows[0]["Transcript_AEE_ranking"].ToString() != "") { model.Transcript_AEE_ranking = int.Parse(ds.Tables[0].Rows[0]["Transcript_AEE_ranking"].ToString()); } if (ds.Tables[0].Rows[0]["Transcript_CEE_score"].ToString() != "") { model.Transcript_CEE_score = decimal.Parse(ds.Tables[0].Rows[0]["Transcript_CEE_score"].ToString()); } if (ds.Tables[0].Rows[0]["Transcript_CEE_convert_score"].ToString() != "") { model.Transcript_CEE_convert_score = decimal.Parse(ds.Tables[0].Rows[0]["Transcript_CEE_convert_score"].ToString()); } if (ds.Tables[0].Rows[0]["Transcript_passline"].ToString() != "") { if ((ds.Tables[0].Rows[0]["Transcript_passline"].ToString() == "1") || (ds.Tables[0].Rows[0]["Transcript_passline"].ToString().ToLower() == "true")) { model.Transcript_passline = true; } else { model.Transcript_passline = false; } } if (ds.Tables[0].Rows[0]["Transcript_type"].ToString() != "") { model.Transcript_type = int.Parse(ds.Tables[0].Rows[0]["Transcript_type"].ToString()); } if (ds.Tables[0].Rows[0]["Transcript_score"].ToString() != "") { model.Transcript_score = decimal.Parse(ds.Tables[0].Rows[0]["Transcript_score"].ToString()); } if (ds.Tables[0].Rows[0]["UP_province"].ToString() != "") { model.UP_province = int.Parse(ds.Tables[0].Rows[0]["UP_province"].ToString()); } return(model); } else { return(null); } }