public List <Budget_Product> SelectAll() { List <Budget_Product> ProductList = null; try { string sSQL = "SELECT * FROM Product"; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL); if (ds.Tables[0].Rows.Count > 0) { ProductList = new List <Budget_Product>(); Budget_Product product = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { product = new Budget_Product(); product.ProductOID = new Guid(ds.Tables[0].Rows[i]["ProductOID"].ToString()); product.Enable = Convert.ToBoolean(ds.Tables[0].Rows[i]["Enable"].ToString()); product.Seq = Convert.ToInt32(ds.Tables[0].Rows[i]["Seq"].ToString()); product.FileName = ds.Tables[0].Rows[i]["FileName"].ToString(); product.BannerFileName = ds.Tables[0].Rows[i]["BannerFileName"].ToString(); product.Title = ds.Tables[0].Rows[i]["Title"].ToString(); product.ShortDes = ds.Tables[0].Rows[i]["ShortDes"].ToString(); product.Descriptions = ds.Tables[0].Rows[i]["Descriptions"].ToString(); product.imageFileName1 = ds.Tables[0].Rows[i]["imageFileName1"].ToString(); product.imageFileName2 = ds.Tables[0].Rows[i]["imageFileName2"].ToString(); product.imageFileName3 = ds.Tables[0].Rows[i]["imageFileName3"].ToString(); product.imageFileName4 = ds.Tables[0].Rows[i]["imageFileName4"].ToString(); product.imageFileName5 = ds.Tables[0].Rows[i]["imageFileName5"].ToString(); product.imageFileName6 = ds.Tables[0].Rows[i]["imageFileName6"].ToString(); product.imageFileName7 = ds.Tables[0].Rows[i]["imageFileName7"].ToString(); product.imageFileName8 = ds.Tables[0].Rows[i]["imageFileName8"].ToString(); product.imageFileName9 = ds.Tables[0].Rows[i]["imageFileName9"].ToString(); product.imageFileName10 = ds.Tables[0].Rows[i]["imageFileName10"].ToString(); product.imageFileName11 = ds.Tables[0].Rows[i]["imageFileName11"].ToString(); product.imageFileName12 = ds.Tables[0].Rows[i]["imageFileName12"].ToString(); product.imageFileName13 = ds.Tables[0].Rows[i]["imageFileName13"].ToString(); product.imageFileName14 = ds.Tables[0].Rows[i]["imageFileName14"].ToString(); product.imageFileName15 = ds.Tables[0].Rows[i]["imageFileName15"].ToString(); product.PricePerUnit = ds.Tables[0].Rows[i]["PricePerUnit"].Equals(DBNull.Value) == false?Convert.ToDouble(ds.Tables[0].Rows[i]["PricePerUnit"].ToString()) : 0; ProductList.Add(product); } } } catch (Exception ex) { } return(ProductList); }
public Budget_Product SelectByOID(Guid guidProductOID) { Budget_Product product = null; try { string sSQL = "SELECT * FROM Product WHERE ProductOID=@ProductOID"; SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter("@ProductOID", SqlDbType.UniqueIdentifier); sqlParam[0].Value = guidProductOID; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL, sqlParam); if (ds.Tables[0].Rows.Count > 0) { product = new Budget_Product(); product.ProductOID = new Guid(ds.Tables[0].Rows[0]["ProductOID"].ToString()); product.Enable = Convert.ToBoolean(ds.Tables[0].Rows[0]["Enable"].ToString()); product.Seq = Convert.ToInt32(ds.Tables[0].Rows[0]["Seq"].ToString()); product.FileName = ds.Tables[0].Rows[0]["FileName"].ToString(); product.BannerFileName = ds.Tables[0].Rows[0]["BannerFileName"].ToString(); product.Title = ds.Tables[0].Rows[0]["Title"].ToString(); product.ShortDes = ds.Tables[0].Rows[0]["ShortDes"].ToString(); product.Descriptions = ds.Tables[0].Rows[0]["Descriptions"].ToString(); product.imageFileName1 = ds.Tables[0].Rows[0]["imageFileName1"].ToString(); product.imageFileName2 = ds.Tables[0].Rows[0]["imageFileName2"].ToString(); product.imageFileName3 = ds.Tables[0].Rows[0]["imageFileName3"].ToString(); product.imageFileName4 = ds.Tables[0].Rows[0]["imageFileName4"].ToString(); product.imageFileName5 = ds.Tables[0].Rows[0]["imageFileName5"].ToString(); product.imageFileName6 = ds.Tables[0].Rows[0]["imageFileName6"].ToString(); product.imageFileName7 = ds.Tables[0].Rows[0]["imageFileName7"].ToString(); product.imageFileName8 = ds.Tables[0].Rows[0]["imageFileName8"].ToString(); product.imageFileName9 = ds.Tables[0].Rows[0]["imageFileName9"].ToString(); product.imageFileName10 = ds.Tables[0].Rows[0]["imageFileName10"].ToString(); product.imageFileName11 = ds.Tables[0].Rows[0]["imageFileName11"].ToString(); product.imageFileName12 = ds.Tables[0].Rows[0]["imageFileName12"].ToString(); product.imageFileName13 = ds.Tables[0].Rows[0]["imageFileName13"].ToString(); product.imageFileName14 = ds.Tables[0].Rows[0]["imageFileName14"].ToString(); product.imageFileName15 = ds.Tables[0].Rows[0]["imageFileName15"].ToString(); product.PricePerUnit = ds.Tables[0].Rows[0]["PricePerUnit"].Equals(DBNull.Value) == false?Convert.ToDouble(ds.Tables[0].Rows[0]["PricePerUnit"].ToString()) : 0; } } catch (Exception ex) { } return(product); }