Ejemplo n.º 1
0
        public ProductInfo(string id)
        {
            _id = id;
            DataFactory df = new DataFactory();
            DataSet ds = new DataSet();
            try
            {
                string sql = "select * from productinfo where productId=" + id;
                ds = df.DataBind(sql);
            }
            catch (Exception ex)
            {
                LogEntry entry = new LogEntry();
                entry.Severity = System.Diagnostics.TraceEventType.Error;
                entry.Message = string.Format("Exception:{0}, Inner Exception:{1}", ex.Message, ex.InnerException.Message);
                entry.Categories.Add(Category.Exception);
                entry.Priority = Priority.High;
                logwrite.Write(entry);
                throw;
            }

            DataRow row = ds.Tables[0].Rows[0];
            _name = row["productName"].ToString().Trim();
            _mainInfo =NoHTML(row["maininfo"].ToString().Trim());
            _picURL = HttpContext.Current.Request.Url.Host.ToString().TrimEnd('/') +"/productPic/" + row["pic"].ToString().Trim();
            _pdfURL =string.IsNullOrEmpty(row["pdf"].ToString().Trim())==true? "" : HttpContext.Current.Request.Url.Host.ToString().TrimEnd('/')+ "/productPdf/" + row["pdf"].ToString().Trim();
            _price = row["price"].ToString().Trim() == "0" ? "" : row["price"].ToString().Trim();
            _isNew = row["isNew"].ToString().Trim();
            _isPromotion = row["isPromotion"].ToString().Trim();
        }