Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static MarketCommentary GetAllMarketCommentaryForToday()
        {
            //DB Connection goes here

            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "UI_GetAllMarketCommentaryForToday";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            // Retrieve products from the specified category.
            //db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, Category);

            // DataSet that will hold the returned results
            DataSet commentaryDataSet = null;

            commentaryDataSet = db.ExecuteDataSet(dbCommand);

            // Note: connection was closed by ExecuteDataSet method call

            MarketCommentary _marketCommentary = new MarketCommentary();

            foreach (DataRow dr in commentaryDataSet.Tables[0].Rows)
            {
                _marketCommentary.MarketCommentaryId = Int32.Parse(dr["MarketCommentaryId"].ToString());
                _marketCommentary.MarketCommentaryTitle = dr["MarketCommentaryTitle"].ToString();
                _marketCommentary.MarketCommentaryDecription = dr["MarketCommentaryDesc"].ToString();
                _marketCommentary.MarketCommentaryDateTime = DateTime.Parse(dr["MarketCommentaryDateTime"].ToString());
            }
            return _marketCommentary;
        }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        txtEmailAddress.Attributes.Add("onClick", "this.value = ( this.value == this.defaultValue ) ? '' : this.value;return true;");
        txtEmailAddress.Attributes.Add("onfocus", "this.value = ( this.value == this.defaultValue ) ? '' : this.value;return true;");

        MarketCommentary _commentary = new MarketCommentary();
        _commentary = _commentary.GetLatestMarketCommentary();
        if (!string.IsNullOrEmpty(_commentary.MarketCommentaryTitle))
        {
            commentaryDateTime.Text = _commentary.MarketCommentaryDateTime.ToLongDateString();
            commentaryTitle.Text = _commentary.MarketCommentaryTitle;
            //commentaryDesc.Text = _commentary.MarketCommentaryDecription;
            if (_commentary.MarketCommentaryDecription.Length > 370)
                commentaryDesc.Text = _commentary.MarketCommentaryDecription.Substring(0, 370).Trim().Replace("<br />", "").Replace("</p>", "").Replace("<p>", "");
            else
                commentaryDesc.Text = _commentary.MarketCommentaryDecription.Substring(0, _commentary.MarketCommentaryDecription.Length).Trim();

        }
    }