/// <summary> /// 增加一条数据 /// </summary> public void Add(thesis.model.Web_Node model) { model.INDEX_ = GetMaxID() + 1; StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TREE_WEB("); strSql.Append("NAME,INDEX_,PINDEX,SPECIES,SPECIES_ID,CS,BH,CREATETIME,"); if (!model.BH.Equals("")) { strSql.Append("CLICKTIMES,LASTCLICKTIME,"); } strSql.Append("UPDATETIME)"); strSql.Append(" values ("); strSql.Append("'" + model.NAME + "',"); strSql.Append("" + model.INDEX_ + ","); strSql.Append("" + model.PINDEX + ","); strSql.Append("" + model.SPECIES + ","); strSql.Append("" + model.SPECIES_ID + ","); strSql.Append("" + model.CS + ","); strSql.Append("'" + model.BH + "',"); strSql.Append(DbHelperSQL.GetDbTimeFunctionName() + ","); if (!model.BH.Equals("")) { strSql.Append("'0',"); strSql.Append("'" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',"); } strSql.Append(DbHelperSQL.GetDbTimeFunctionName()); strSql.Append(")"); DbHelperSQL.ExecuteSql(strSql.ToString()); }
/// <summary> /// 得到一个对象实体 /// </summary> private thesis.model.Web_Node GetModel(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select NAME,INDEX_,PINDEX,SPECIES,SPECIES_ID,CS,BH,CREATETIME,UPDATETIME,CLICKTIMES,LASTCLICKTIME "); strSql.Append(" FROM TREE_WEB "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } strSql.Append(" order by CS,SPECIES,NAME"); thesis.model.Web_Node model = new thesis.model.Web_Node(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { model.NAME = ds.Tables[0].Rows[0]["NAME"].ToString(); if (ds.Tables[0].Rows[0]["INDEX_"].ToString() != "") { model.INDEX_ = int.Parse(ds.Tables[0].Rows[0]["INDEX_"].ToString()); } if (ds.Tables[0].Rows[0]["PINDEX"].ToString() != "") { model.PINDEX = int.Parse(ds.Tables[0].Rows[0]["PINDEX"].ToString()); } if (ds.Tables[0].Rows[0]["SPECIES"].ToString() != "") { model.SPECIES = int.Parse(ds.Tables[0].Rows[0]["SPECIES"].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]["CS"].ToString() != "") { model.CS = int.Parse(ds.Tables[0].Rows[0]["CS"].ToString()); } model.BH = ds.Tables[0].Rows[0]["BH"].ToString(); if (ds.Tables[0].Rows[0]["CREATETIME"].ToString() != "") { model.CREATETIME = DateTime.Parse(ds.Tables[0].Rows[0]["CREATETIME"].ToString()); } if (ds.Tables[0].Rows[0]["UPDATETIME"].ToString() != "") { model.UPDATETIME = DateTime.Parse(ds.Tables[0].Rows[0]["UPDATETIME"].ToString()); } model.CLICKTIMES = ds.Tables[0].Rows[0]["CLICKTIMES"].ToString(); model.LASTCLICKTIME = ds.Tables[0].Rows[0]["LASTCLICKTIME"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 获得数据列表 /// </summary> public List <Web_Node> GetList(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select NAME,INDEX_,PINDEX,SPECIES,SPECIES_ID,CS,BH,CREATETIME,UPDATETIME,CLICKTIMES,LASTCLICKTIME "); strSql.Append(" FROM TREE_WEB "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } strSql.Append(" order by CS,SPECIES,SPECIES_ID "); DataSet ds = DbHelperSQL.Query(strSql.ToString()); List <Web_Node> list = new List <Web_Node>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { thesis.model.Web_Node model = new thesis.model.Web_Node(); model.NAME = ds.Tables[0].Rows[i]["NAME"].ToString(); if (ds.Tables[0].Rows[i]["INDEX_"].ToString() != "") { model.INDEX_ = int.Parse(ds.Tables[0].Rows[i]["INDEX_"].ToString()); } if (ds.Tables[0].Rows[i]["PINDEX"].ToString() != "") { model.PINDEX = int.Parse(ds.Tables[0].Rows[i]["PINDEX"].ToString()); } if (ds.Tables[0].Rows[i]["SPECIES"].ToString() != "") { model.SPECIES = int.Parse(ds.Tables[0].Rows[i]["SPECIES"].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]["CS"].ToString() != "") { model.CS = int.Parse(ds.Tables[0].Rows[i]["CS"].ToString()); } model.BH = ds.Tables[0].Rows[i]["BH"].ToString(); if (ds.Tables[0].Rows[i]["CREATETIME"].ToString() != "") { model.CREATETIME = DateTime.Parse(ds.Tables[0].Rows[i]["CREATETIME"].ToString()); } if (ds.Tables[0].Rows[i]["UPDATETIME"].ToString() != "") { model.UPDATETIME = DateTime.Parse(ds.Tables[0].Rows[i]["UPDATETIME"].ToString()); } model.CLICKTIMES = ds.Tables[0].Rows[i]["CLICKTIMES"].ToString(); model.LASTCLICKTIME = ds.Tables[0].Rows[i]["LASTCLICKTIME"].ToString(); list.Add(model); } return(list); }
public List <thesis.model.Web_Node> GetUserRootNodes(int UserID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select NAME,INDEX_,PINDEX,SPECIES,a.SPECIES_ID,CS,BH,CREATETIME,UPDATETIME "); strSql.Append(" FROM TREE_WEB a,OBQX_WEB b "); strSql.Append(" where SPECIES=LX and a.SPECIES_ID=b.SPECIES_ID and YHLX=" + Web_Node.SPECIES_ROLE + " and YHID in ( select distinct ROLE_ID from ROLEGL where YHID =" + UserID + ")"); strSql.Append(" order by CS,SPECIES,NAME "); DataSet ds = DbHelperSQL.Query(strSql.ToString()); List <thesis.model.Web_Node> list = new List <thesis.model.Web_Node>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { thesis.model.Web_Node model = new thesis.model.Web_Node(); model.NAME = ds.Tables[0].Rows[i]["NAME"].ToString(); if (ds.Tables[0].Rows[i]["INDEX_"].ToString() != "") { model.INDEX_ = int.Parse(ds.Tables[0].Rows[i]["INDEX_"].ToString()); } if (ds.Tables[0].Rows[i]["PINDEX"].ToString() != "") { model.PINDEX = int.Parse(ds.Tables[0].Rows[i]["PINDEX"].ToString()); } if (ds.Tables[0].Rows[i]["SPECIES"].ToString() != "") { model.SPECIES = int.Parse(ds.Tables[0].Rows[i]["SPECIES"].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]["CS"].ToString() != "") { model.CS = int.Parse(ds.Tables[0].Rows[i]["CS"].ToString()); } model.BH = ds.Tables[0].Rows[i]["BH"].ToString(); if (ds.Tables[0].Rows[i]["CREATETIME"].ToString() != "") { model.CREATETIME = DateTime.Parse(ds.Tables[0].Rows[i]["CREATETIME"].ToString()); } if (ds.Tables[0].Rows[i]["UPDATETIME"].ToString() != "") { model.UPDATETIME = DateTime.Parse(ds.Tables[0].Rows[i]["UPDATETIME"].ToString()); } list.Add(model); } return(list); }
public List <Web_Node> GetNodesByPlan(int PlanID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select NAME,INDEX_,PINDEX,SPECIES,SPECIES_ID,CS,BH,CREATETIME,UPDATETIME "); strSql.Append(" FROM TREE_WEB , CJJHLB"); strSql.Append(" where SPECIES=LX and SPECIES_ID= SPECIES34_ID and SPECIES7_ID=" + PlanID); strSql.Append(" order by CS,SPECIES,SPECIES_ID "); DataSet ds = DbHelperSQL.Query(strSql.ToString()); List <Web_Node> list = new List <Web_Node>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { thesis.model.Web_Node model = new thesis.model.Web_Node(); model.NAME = ds.Tables[0].Rows[i]["NAME"].ToString(); if (ds.Tables[0].Rows[i]["INDEX_"].ToString() != "") { model.INDEX_ = int.Parse(ds.Tables[0].Rows[i]["INDEX_"].ToString()); } if (ds.Tables[0].Rows[i]["PINDEX"].ToString() != "") { model.PINDEX = int.Parse(ds.Tables[0].Rows[i]["PINDEX"].ToString()); } if (ds.Tables[0].Rows[i]["SPECIES"].ToString() != "") { model.SPECIES = int.Parse(ds.Tables[0].Rows[i]["SPECIES"].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]["CS"].ToString() != "") { model.CS = int.Parse(ds.Tables[0].Rows[i]["CS"].ToString()); } model.BH = ds.Tables[0].Rows[i]["BH"].ToString(); if (ds.Tables[0].Rows[i]["CREATETIME"].ToString() != "") { model.CREATETIME = DateTime.Parse(ds.Tables[0].Rows[i]["CREATETIME"].ToString()); } if (ds.Tables[0].Rows[i]["UPDATETIME"].ToString() != "") { model.UPDATETIME = DateTime.Parse(ds.Tables[0].Rows[i]["UPDATETIME"].ToString()); } list.Add(model); } return(list); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(thesis.model.Web_Node model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TREE_WEB set "); strSql.Append("NAME='" + model.NAME + "',"); strSql.Append("PINDEX=" + model.PINDEX + ","); strSql.Append("SPECIES=" + model.SPECIES + ","); strSql.Append("SPECIES_ID=" + model.SPECIES_ID + ","); strSql.Append("CS=" + model.CS + ","); strSql.Append("BH='" + model.BH + "',"); strSql.Append("CREATETIME=" + DbHelperSQL.GetDateTimeSQL(model.CREATETIME) + ","); strSql.Append("UPDATETIME=" + DbHelperSQL.GetDbTimeFunctionName() + " "); strSql.Append(" where INDEX_=" + model.INDEX_ + " "); DbHelperSQL.ExecuteSql(strSql.ToString()); }
public void Update2(thesis.model.Web_Node model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TREE_WEB set "); int clicktime = 1; if (!model.CLICKTIMES.Equals("")) { clicktime = int.Parse(model.CLICKTIMES) + 1; } strSql.Append("CLICKTIMES='" + clicktime + "',"); strSql.Append("LASTCLICKTIME='" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"); strSql.Append(" where INDEX_=" + model.INDEX_ + " "); DbHelperSQL.ExecuteSql(strSql.ToString()); }
public void Update2(thesis.model.Web_Node model) { dal.Update2(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(thesis.model.Web_Node model) { dal.Add(model); }