public Budget_Deals SelectByOID(Guid guidDealOID) { Budget_Deals deal = null; try { string sSQL = "SELECT * FROM Deals WHERE DealOID=@DealOID"; SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter("@DealOID", SqlDbType.UniqueIdentifier); sqlParam[0].Value = guidDealOID; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL, sqlParam); if (ds.Tables[0].Rows.Count > 0) { deal = new Budget_Deals(); deal.DealOID = new Guid(ds.Tables[0].Rows[0]["DealOID"].ToString()); deal.Enable = Convert.ToBoolean(ds.Tables[0].Rows[0]["Enable"].ToString()); deal.Seq = Convert.ToInt32(ds.Tables[0].Rows[0]["Seq"].ToString()); deal.FileName = ds.Tables[0].Rows[0]["FileName"].ToString(); deal.Title = ds.Tables[0].Rows[0]["Title"].ToString(); deal.ShortDes = ds.Tables[0].Rows[0]["ShortDes"].ToString(); deal.TextInButton = ds.Tables[0].Rows[0]["TextInButton"].ToString(); deal.ButtonURL = ds.Tables[0].Rows[0]["ButtonURL"].ToString(); deal.Descriptions = ds.Tables[0].Rows[0]["Descriptions"].ToString(); deal.BannerFileName = ds.Tables[0].Rows[0]["BannerFileName"].ToString(); } } catch (Exception ex) { } return(deal); }
public List <Budget_Deals> SelectAll() { List <Budget_Deals> DealsList = null; try { string sSQL = "SELECT * FROM Deals ORDER BY Seq"; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL); if (ds.Tables[0].Rows.Count > 0) { DealsList = new List <Budget_Deals>(); Budget_Deals deal = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { deal = new Budget_Deals(); deal.DealOID = new Guid(ds.Tables[0].Rows[i]["DealOID"].ToString()); deal.Enable = Convert.ToBoolean(ds.Tables[0].Rows[i]["Enable"].ToString()); deal.Seq = Convert.ToInt32(ds.Tables[0].Rows[i]["Seq"].ToString()); deal.FileName = ds.Tables[0].Rows[i]["FileName"].ToString(); deal.Title = ds.Tables[0].Rows[i]["Title"].ToString(); deal.ShortDes = ds.Tables[0].Rows[i]["ShortDes"].ToString(); deal.TextInButton = ds.Tables[0].Rows[i]["TextInButton"].ToString(); deal.ButtonURL = ds.Tables[0].Rows[i]["ButtonURL"].ToString(); deal.Descriptions = ds.Tables[0].Rows[i]["Descriptions"].ToString(); deal.BannerFileName = ds.Tables[0].Rows[i]["BannerFileName"].ToString(); DealsList.Add(deal); } } } catch (Exception ex) { } return(DealsList); }