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(); }
protected void Page_Load(object sender, System.EventArgs e) { // �ڴ˴������û������Գ�ʼ��ҳ�� if (Session["loginUser"] == null || Session["loginUser"].ToString().Trim() == "") { Response.Redirect("login.aspx"); } else { HyperLink1.NavigateUrl = "editaadmin.aspx?aId=" + Session["loginUser"].ToString().Trim(); } if(!IsPostBack) { string uId = Page.User.Identity.Name.ToString(); string name = new DataFactory().getAData("select [username] from [managerinfo] where [manageId]=" + uId, "username"); HyperLink1.NavigateUrl = "editaadmin.aspx?aId=" + uId; showLoginer.InnerHtml = name; } }