/// <summary> /// 更新一条数据 /// </summary> public void Update(thesis.model.ObjectRange_Web model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update OBQX_WEB set "); strSql.Append("LX=" + model.LX + ","); strSql.Append("SPECIES_ID=" + model.SPECIES_ID + ","); strSql.Append("YHLX=" + model.YHLX + ","); strSql.Append("YHID=" + model.YHID + ""); strSql.Append(" where ID=" + model.ID + " "); DbHelperSQL.ExecuteSql(strSql.ToString()); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(thesis.model.ObjectRange_Web model) { model.ID = GetMaxID() + 1; StringBuilder strSql = new StringBuilder(); strSql.Append("insert into OBQX_WEB("); strSql.Append("ID,LX,SPECIES_ID,YHLX,YHID"); strSql.Append(")"); strSql.Append(" values ("); strSql.Append("" + model.ID + ","); strSql.Append("" + model.LX + ","); strSql.Append("" + model.SPECIES_ID + ","); strSql.Append("" + model.YHLX + ","); strSql.Append("" + model.YHID + ""); strSql.Append(")"); DbHelperSQL.ExecuteSql(strSql.ToString()); }
/// <summary> /// 获得数据列表 /// </summary> private List <ObjectRange_Web> GetList(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ID,LX,SPECIES_ID,YHLX,YHID "); strSql.Append(" FROM OBQX_WEB "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } strSql.Append(" order by LX"); DataSet ds = DbHelperSQL.Query(strSql.ToString()); List <ObjectRange_Web> list = new List <ObjectRange_Web>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { thesis.model.ObjectRange_Web model = new thesis.model.ObjectRange_Web(); if (ds.Tables[0].Rows[i]["ID"].ToString() != "") { model.ID = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()); } if (ds.Tables[0].Rows[i]["LX"].ToString() != "") { model.LX = int.Parse(ds.Tables[0].Rows[i]["LX"].ToString()); } if (ds.Tables[0].Rows[i]["SPECIES_ID"].ToString() != "") { model.SPECIES_ID = int.Parse(ds.Tables[0].Rows[i]["SPECIES_ID"].ToString()); } if (ds.Tables[0].Rows[i]["YHLX"].ToString() != "") { model.YHLX = int.Parse(ds.Tables[0].Rows[i]["YHLX"].ToString()); } if (ds.Tables[0].Rows[i]["YHID"].ToString() != "") { model.YHID = int.Parse(ds.Tables[0].Rows[i]["YHID"].ToString()); } list.Add(model); } return(list); }
/// <summary> /// 得到一个对象实体 /// </summary> public thesis.model.ObjectRange_Web GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select "); strSql.Append(" ID,LX,SPECIES_ID,YHLX,YHID "); strSql.Append(" from OBQX_WEB "); strSql.Append(" where ID=" + ID + " "); thesis.model.ObjectRange_Web model = new thesis.model.ObjectRange_Web(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ID"].ToString() != "") { model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } if (ds.Tables[0].Rows[0]["LX"].ToString() != "") { model.LX = int.Parse(ds.Tables[0].Rows[0]["LX"].ToString()); } if (ds.Tables[0].Rows[0]["SPECIES_ID"].ToString() != "") { model.SPECIES_ID = int.Parse(ds.Tables[0].Rows[0]["SPECIES_ID"].ToString()); } if (ds.Tables[0].Rows[0]["YHLX"].ToString() != "") { model.YHLX = int.Parse(ds.Tables[0].Rows[0]["YHLX"].ToString()); } if (ds.Tables[0].Rows[0]["YHID"].ToString() != "") { model.YHID = int.Parse(ds.Tables[0].Rows[0]["YHID"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(thesis.model.ObjectRange_Web model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(thesis.model.ObjectRange_Web model) { dal.Add(model); }