public List <travelProductInfo> GetSimpleProductList(string sql) { List <travelProductInfo> lp = new List <travelProductInfo>(); using (DataTable dt = helper.GetDataTable(sql)) { if (dt != null && dt.Rows.Count > 0) { Dictionary <int, int> Dic = new _Class().getClassDicID(); foreach (DataRow r in dt.Rows) { travelProductInfo b = new travelProductInfo { id = Convert.ToInt16(r["id"]), cId = Convert.ToInt16(r["cId"]), pId = Convert.ToInt16(r["cId"]), title = r["title"].ToString(), isTj = Convert.ToInt16(r["isTj"]), isHref = Convert.ToInt16(r["isHref"]), hrefUrl = r["hrefUrl"].ToString(), imgUrl = r["imgUrl"].ToString(), imgUrlHb = r["imgUrlHb"].ToString(), price = Convert.ToInt32(r["price"].ToString()), desp = r["desp"].ToString() }; if (Dic.ContainsKey(b.cId)) { b.pId = Dic[b.cId]; } lp.Add(b); } } } return(lp); }
public List <content> GetContentList(string sql) { List <content> lp = new List <content>(); using (DataTable dt = helper.GetDataTable(sql)) { if (dt != null && dt.Rows.Count > 0) { Dictionary <int, tClass> Dic = new _Class().getClassDicFObj(); foreach (DataRow r in dt.Rows) { content b = new content { id = Convert.ToInt16(r["id"]), cId = Convert.ToInt16(r["cId"]), cType = Convert.ToInt16(r["cType"]), title = r["title"].ToString(), contents = r["contents"].ToString(), isHot = Convert.ToInt16(r["isHot"]), isCheck = Convert.ToInt16(r["isCheck"]), adminId = Convert.ToInt16(r["adminId"]), checkId = Convert.ToInt16(r["checkId"]), cDate = Convert.ToDateTime(r["cDate"]), imgUrl = r["imgUrl"].ToString(), isHref = Convert.ToInt16(r["isHref"]), hrefUrl = r["hrefUrl"].ToString(), source = r["source"].ToString(), enable = Convert.ToInt16(r["enable"]), wp_tel = r["wp_tel"].ToString(), wp_addr = r["wp_addr"].ToString(), wp_contact = r["wp_contact"].ToString(), addOn = Convert.ToDateTime(r["AddOn"]) }; b.contents = StripHTML(b.contents); if (b.contents.Length > 30) { b.contents = b.contents.Substring(0, 30); } if (b.imgUrl.Length == 0) { if (Dic.ContainsKey(b.cId)) { b.imgUrl = Dic[b.cId].defaultUrl; } } lp.Add(b); } } } return(lp); }
public travelProductInfo GetInfo(int id) { travelProductInfo c = null; using (DataTable dt = helper.GetDataTable("select * from t_travel_product where id = " + id + " and enable = 0")) { if (dt != null && dt.Rows.Count > 0) { Dictionary <int, int> Dic = new _Class().getClassDicID(); DataRow r = dt.Rows[0]; { c = new travelProductInfo { id = Convert.ToInt16(r["id"]), cId = Convert.ToInt16(r["cId"]), title = r["title"].ToString(), contents = r["contents"].ToString(), content_fy = r["content_fy"].ToString(), content_xc = r["content_xc"].ToString(), content_xz = r["content_xz"].ToString(), isHot = Convert.ToInt16(r["isHot"]), isTj = Convert.ToInt16(r["isTj"]), isHref = Convert.ToInt16(r["isHref"]), hrefUrl = r["hrefUrl"].ToString(), adminId = Convert.ToInt16(r["adminId"]), imgUrl = r["imgUrl"].ToString(), imgUrlHb = r["imgUrlHb"].ToString(), desp = r["desp"].ToString(), enable = Convert.ToInt16(r["enable"]), price = Convert.ToInt32(r["price"].ToString()), addOn = Convert.ToDateTime(r["AddOn"]) }; if (Dic.ContainsKey(c.cId)) { c.pId = Dic[c.cId]; } } } } return(c); }