/// <summary> /// 推荐线路 /// </summary> public void Bindtjxl(string types) { if (Request.QueryString["ids"] != null && Request.QueryString["ids"].ToString() != "") { strategymodel = strategybll.GetModel(Convert.ToInt32(Request.QueryString["ids"])); if (strategymodel != null) { contentstr = strategymodel.StrategyContent; headname = strategymodel.Title; if (strategymodel.PhotoUrl.ToString() != "") { string[] strlist = strategymodel.PhotoUrl.ToString().Split(','); if (strlist.Length > 0) { picimageurl1 = geturl(strlist[0].Trim(), types); if (strlist.Length > 1) { picimageurl2 = geturl(strlist[1].Trim(), types); } if (strlist.Length > 2) { picimageurl3 = geturl(strlist[2].Trim(), types); } } } } } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(HeqiaoDaoshiCore.Model.Strategy model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Strategy("); strSql.Append("StrategyUuid,Isdelete,Staues,SystemUserUUID,Title,StrategyContent,PhotoUrl,AddPeople,AddTime,AuditStaues,ThroughStaues,TipsType,Count,ytype,PlayType)"); strSql.Append(" values ("); strSql.Append("@StrategyUuid,@Isdelete,@Staues,@SystemUserUUID,@Title,@StrategyContent,@PhotoUrl,@AddPeople,@AddTime,@AuditStaues,@ThroughStaues,@TipsType,@Count,@ytype,@PlayType)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@StrategyUuid", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@Isdelete", SqlDbType.Int, 4), new SqlParameter("@Staues", SqlDbType.NVarChar, 255), new SqlParameter("@SystemUserUUID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@Title", SqlDbType.NVarChar, 255), new SqlParameter("@StrategyContent", SqlDbType.NVarChar, -1), new SqlParameter("@PhotoUrl", SqlDbType.NVarChar, -1), new SqlParameter("@AddPeople", SqlDbType.NVarChar, 255), new SqlParameter("@AddTime", SqlDbType.NVarChar, 255), new SqlParameter("@AuditStaues", SqlDbType.Int, 4), new SqlParameter("@ThroughStaues", SqlDbType.Int, 4), new SqlParameter("@TipsType", SqlDbType.Int, 4), new SqlParameter("@Count", SqlDbType.Int, 4), new SqlParameter("@ytype", SqlDbType.NVarChar, 255), new SqlParameter("@PlayType", SqlDbType.NVarChar, 255) }; parameters[0].Value = Guid.NewGuid(); parameters[1].Value = model.Isdelete; parameters[2].Value = model.Staues; parameters[3].Value = Guid.NewGuid(); parameters[4].Value = model.Title; parameters[5].Value = model.StrategyContent; parameters[6].Value = model.PhotoUrl; parameters[7].Value = model.AddPeople; parameters[8].Value = model.AddTime; parameters[9].Value = model.AuditStaues; parameters[10].Value = model.ThroughStaues; parameters[11].Value = model.TipsType; parameters[12].Value = model.Count; parameters[13].Value = model.ytype; parameters[14].Value = model.PlayType; object obj = DbHelperSql.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public HeqiaoDaoshiCore.Model.Strategy GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 StrategyUuid,ID,Isdelete,Staues,SystemUserUUID,Title,StrategyContent,PhotoUrl,AddPeople,AddTime,AuditStaues,ThroughStaues,TipsType,Count,ytype,PlayType from Strategy "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; HeqiaoDaoshiCore.Model.Strategy model = new HeqiaoDaoshiCore.Model.Strategy(); DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(HeqiaoDaoshiCore.Model.Strategy model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Strategy set "); strSql.Append("Isdelete=@Isdelete,"); strSql.Append("Staues=@Staues,"); strSql.Append("SystemUserUUID=@SystemUserUUID,"); strSql.Append("Title=@Title,"); strSql.Append("StrategyContent=@StrategyContent,"); strSql.Append("PhotoUrl=@PhotoUrl,"); strSql.Append("AddPeople=@AddPeople,"); strSql.Append("AddTime=@AddTime,"); strSql.Append("AuditStaues=@AuditStaues,"); strSql.Append("ThroughStaues=@ThroughStaues,"); strSql.Append("TipsType=@TipsType,"); strSql.Append("Count=@Count,"); strSql.Append("ytype=@ytype,"); strSql.Append("PlayType=@PlayType"); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@Isdelete", SqlDbType.Int, 4), new SqlParameter("@Staues", SqlDbType.NVarChar, 255), new SqlParameter("@SystemUserUUID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@Title", SqlDbType.NVarChar, 255), new SqlParameter("@StrategyContent", SqlDbType.NVarChar, -1), new SqlParameter("@PhotoUrl", SqlDbType.NVarChar, -1), new SqlParameter("@AddPeople", SqlDbType.NVarChar, 255), new SqlParameter("@AddTime", SqlDbType.NVarChar, 255), new SqlParameter("@AuditStaues", SqlDbType.Int, 4), new SqlParameter("@ThroughStaues", SqlDbType.Int, 4), new SqlParameter("@TipsType", SqlDbType.Int, 4), new SqlParameter("@Count", SqlDbType.Int, 4), new SqlParameter("@ytype", SqlDbType.NVarChar, 255), new SqlParameter("@PlayType", SqlDbType.NVarChar, 255), new SqlParameter("@StrategyUuid", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = model.Isdelete; parameters[1].Value = model.Staues; parameters[2].Value = model.SystemUserUUID; parameters[3].Value = model.Title; parameters[4].Value = model.StrategyContent; parameters[5].Value = model.PhotoUrl; parameters[6].Value = model.AddPeople; parameters[7].Value = model.AddTime; parameters[8].Value = model.AuditStaues; parameters[9].Value = model.ThroughStaues; parameters[10].Value = model.TipsType; parameters[11].Value = model.Count; parameters[12].Value = model.ytype; parameters[13].Value = model.PlayType; parameters[14].Value = model.StrategyUuid; parameters[15].Value = model.ID; int rows = DbHelperSql.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public HeqiaoDaoshiCore.Model.Strategy DataRowToModel(DataRow row) { HeqiaoDaoshiCore.Model.Strategy model = new HeqiaoDaoshiCore.Model.Strategy(); if (row != null) { if (row["StrategyUuid"] != null && row["StrategyUuid"].ToString() != "") { model.StrategyUuid = new Guid(row["StrategyUuid"].ToString()); } if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["Isdelete"] != null && row["Isdelete"].ToString() != "") { model.Isdelete = int.Parse(row["Isdelete"].ToString()); } if (row["Staues"] != null) { model.Staues = row["Staues"].ToString(); } if (row["SystemUserUUID"] != null && row["SystemUserUUID"].ToString() != "") { model.SystemUserUUID = new Guid(row["SystemUserUUID"].ToString()); } if (row["Title"] != null) { model.Title = row["Title"].ToString(); } if (row["StrategyContent"] != null) { model.StrategyContent = row["StrategyContent"].ToString(); } if (row["PhotoUrl"] != null) { model.PhotoUrl = row["PhotoUrl"].ToString(); } if (row["AddPeople"] != null) { model.AddPeople = row["AddPeople"].ToString(); } if (row["AddTime"] != null) { model.AddTime = row["AddTime"].ToString(); } if (row["AuditStaues"] != null && row["AuditStaues"].ToString() != "") { model.AuditStaues = int.Parse(row["AuditStaues"].ToString()); } if (row["ThroughStaues"] != null && row["ThroughStaues"].ToString() != "") { model.ThroughStaues = int.Parse(row["ThroughStaues"].ToString()); } if (row["TipsType"] != null && row["TipsType"].ToString() != "") { model.TipsType = int.Parse(row["TipsType"].ToString()); } if (row["Count"] != null && row["Count"].ToString() != "") { model.Count = int.Parse(row["Count"].ToString()); } if (row["ytype"] != null) { model.ytype = row["ytype"].ToString(); } if (row["PlayType"] != null) { model.PlayType = row["PlayType"].ToString(); } } return(model); }