public List <TravelBlog> SelectAll(string PrefixTable) { List <TravelBlog> TravelBlogList = null; try { string sSQL = "SELECT * FROM ##TravelBlog"; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL.Replace("##", PrefixTable)); if (ds.Tables[0].Rows.Count > 0) { TravelBlogList = new List <TravelBlog>(); TravelBlog blog = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { blog = new TravelBlog(); blog.TravelBlogOID = new Guid(ds.Tables[0].Rows[i]["TravelBlogOID"].ToString()); blog.Enable = Convert.ToBoolean(ds.Tables[0].Rows[i]["Enable"].ToString()); blog.Seq = Convert.ToInt32(ds.Tables[0].Rows[i]["Seq"].ToString()); blog.FileName = ds.Tables[0].Rows[i]["FileName"].ToString(); blog.BannerFileName = ds.Tables[0].Rows[i]["BannerFileName"].ToString(); blog.Title = ds.Tables[0].Rows[i]["Title"].ToString(); blog.ShortDes = ds.Tables[0].Rows[i]["ShortDes"].ToString(); blog.Descriptions = ds.Tables[0].Rows[i]["Descriptions"].ToString(); blog.imageFileName1 = ds.Tables[0].Rows[i]["imageFileName1"].ToString(); blog.imageFileName2 = ds.Tables[0].Rows[i]["imageFileName2"].ToString(); blog.imageFileName3 = ds.Tables[0].Rows[i]["imageFileName3"].ToString(); blog.imageFileName4 = ds.Tables[0].Rows[i]["imageFileName4"].ToString(); blog.imageFileName5 = ds.Tables[0].Rows[i]["imageFileName5"].ToString(); blog.imageFileName6 = ds.Tables[0].Rows[i]["imageFileName6"].ToString(); blog.imageFileName7 = ds.Tables[0].Rows[i]["imageFileName7"].ToString(); blog.imageFileName8 = ds.Tables[0].Rows[i]["imageFileName8"].ToString(); blog.imageFileName9 = ds.Tables[0].Rows[i]["imageFileName9"].ToString(); blog.imageFileName10 = ds.Tables[0].Rows[i]["imageFileName10"].ToString(); blog.imageFileName11 = ds.Tables[0].Rows[i]["imageFileName11"].ToString(); blog.imageFileName12 = ds.Tables[0].Rows[i]["imageFileName12"].ToString(); blog.imageFileName13 = ds.Tables[0].Rows[i]["imageFileName13"].ToString(); blog.imageFileName14 = ds.Tables[0].Rows[i]["imageFileName14"].ToString(); blog.imageFileName15 = ds.Tables[0].Rows[i]["imageFileName15"].ToString(); blog.Latitude_From = ds.Tables[0].Rows[i]["Latitude_From"].ToString(); blog.Latitude_To = ds.Tables[0].Rows[i]["Latitude_To"].ToString(); blog.Longitude_From = ds.Tables[0].Rows[i]["Longitude_From"].ToString(); blog.Longitude_To = ds.Tables[0].Rows[i]["Longitude_To"].ToString(); TravelBlogList.Add(blog); } } } catch (Exception ex) { } return(TravelBlogList); }
public TravelBlog SelectByOID(string PrefixTable, Guid guidTravelBlogOID) { TravelBlog blog = null; try { string sSQL = "SELECT * FROM ##TravelBlog WHERE TravelBlogOID=@TravelBlogOID"; SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter("@TravelBlogOID", SqlDbType.UniqueIdentifier); sqlParam[0].Value = guidTravelBlogOID; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL.Replace("##", PrefixTable), sqlParam); if (ds.Tables[0].Rows.Count > 0) { blog = new TravelBlog(); blog.TravelBlogOID = new Guid(ds.Tables[0].Rows[0]["TravelBlogOID"].ToString()); blog.Enable = Convert.ToBoolean(ds.Tables[0].Rows[0]["Enable"].ToString()); blog.Seq = Convert.ToInt32(ds.Tables[0].Rows[0]["Seq"].ToString()); blog.FileName = ds.Tables[0].Rows[0]["FileName"].ToString(); blog.BannerFileName = ds.Tables[0].Rows[0]["BannerFileName"].ToString(); blog.Title = ds.Tables[0].Rows[0]["Title"].ToString(); blog.ShortDes = ds.Tables[0].Rows[0]["ShortDes"].ToString(); blog.Descriptions = ds.Tables[0].Rows[0]["Descriptions"].ToString(); blog.imageFileName1 = ds.Tables[0].Rows[0]["imageFileName1"].ToString(); blog.imageFileName2 = ds.Tables[0].Rows[0]["imageFileName2"].ToString(); blog.imageFileName3 = ds.Tables[0].Rows[0]["imageFileName3"].ToString(); blog.imageFileName4 = ds.Tables[0].Rows[0]["imageFileName4"].ToString(); blog.imageFileName5 = ds.Tables[0].Rows[0]["imageFileName5"].ToString(); blog.imageFileName6 = ds.Tables[0].Rows[0]["imageFileName6"].ToString(); blog.imageFileName7 = ds.Tables[0].Rows[0]["imageFileName7"].ToString(); blog.imageFileName8 = ds.Tables[0].Rows[0]["imageFileName8"].ToString(); blog.imageFileName9 = ds.Tables[0].Rows[0]["imageFileName9"].ToString(); blog.imageFileName10 = ds.Tables[0].Rows[0]["imageFileName10"].ToString(); blog.imageFileName11 = ds.Tables[0].Rows[0]["imageFileName11"].ToString(); blog.imageFileName12 = ds.Tables[0].Rows[0]["imageFileName12"].ToString(); blog.imageFileName13 = ds.Tables[0].Rows[0]["imageFileName13"].ToString(); blog.imageFileName14 = ds.Tables[0].Rows[0]["imageFileName14"].ToString(); blog.imageFileName15 = ds.Tables[0].Rows[0]["imageFileName15"].ToString(); blog.Latitude_From = ds.Tables[0].Rows[0]["Latitude_From"].ToString(); blog.Latitude_To = ds.Tables[0].Rows[0]["Latitude_To"].ToString(); blog.Longitude_From = ds.Tables[0].Rows[0]["Longitude_From"].ToString(); blog.Longitude_To = ds.Tables[0].Rows[0]["Longitude_To"].ToString(); } } catch (Exception ex) { } return(blog); }