public override void OnPageLoaded() { string industryName = string.Empty, industryAbstract = string.Empty; string id = Request.QueryString["ID"]; if (!string.IsNullOrEmpty(id)) { int pid = int.Parse(GlobalSettings.Decrypt(id)); ProductIndustry pi = ProductIndustries.GetProductIndustry(pid); if (null != pi) { industryName = pi.IndustryName; industryAbstract = pi.IndustryAbstract; } } if (string.IsNullOrEmpty(industryName)) { industryName = "所有行业"; this.AddKeywords(industryName); this.AddDescription("分组显示所有行业列表,选择行业导航到对应行业的产品列表。"); this.ShortTitle = industryName; } else { this.AddKeywords(industryName); this.AddDescription(string.Format("显示{0}行业的产品列表。{1}{2}", industryName, industryAbstract, string.Format(" 关键字: {0}", industryName))); this.ShortTitle = industryName; } this.SetTitle(); this.AddJavaScriptInclude("scripts/pages/sortby.aspx.js", false, false); }
protected void egvIndustries_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ProductIndustry industry = e.Row.DataItem as ProductIndustry; Image industryLogo = e.Row.FindControl("IndustryLogo") as Image; if (industryLogo != null) { if (industry.File != null) { industryLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(industry.File, (int)industryLogo.Width.Value, (int)industryLogo.Height.Value); } else { industryLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)industryLogo.Width.Value, (int)industryLogo.Height.Value); } } HyperLink hyName = e.Row.FindControl("hlIndustryName") as HyperLink; if (hyName != null) { hyName.Text = industry.IndustryName; hyName.NavigateUrl = GlobalSettings.RelativeWebRoot + "controlpanel/controlpanel.aspx?product-product&ii=" + industry.IndustryID; } } }
string RenderHTML() { if (_Cache.ContainsKey(_IndustryID)) { return(_Cache[_IndustryID]); } List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0); StringBuilder sb = new StringBuilder(); if (_IndustryID == 0) { return("<div class=\"" + _CssClass + "\"><span>暂无相关行业信息!</span></div>"); } else { ProductIndustry pi = ProductIndustries.GetProductIndustry(_IndustryID); if (pi.ParentID == 0) { return("<div class=\"" + _CssClass + "\"><span>此行业为顶级行业分类!</span></div>"); } List <ProductIndustry> pis = ProductIndustries.GetChildIndustries(pi.ParentID); if (pis == null || pis.Count == 0 || (pis.Count == 1 && pis[0].IndustryID == _IndustryID)) { return("<div class=\"" + _CssClass + "\"><span>暂无相关行业信息!</span></div>"); } sb.Append("<div class=\"" + _CssClass + "\">"); ProductQuery query; int count = 0; PagingDataSet <Product> __ps = null; foreach (ProductIndustry p in pis) { if (p.IndustryID != _IndustryID) { count = 0; query = new ProductQuery(); query.IndustryID = p.IndustryID; __ps = Products.GetProducts(query); if (__ps != null && __ps.Records != null) { count = Products.GetProducts(query).Records.Count; } sb.AppendFormat(_href, GlobalSettings.Encrypt(p.IndustryID.ToString()), p.IndustryName + "(" + count + ")"); } } sb.Append("</div>"); if (!_Cache.ContainsKey(_IndustryID)) { lock (_lock) if (!_Cache.ContainsKey(_IndustryID)) { _Cache.Add(_IndustryID, sb.ToString()); } } return(sb.ToString()); } }
string RenderHTML() { List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0); string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry"; if (inds == null || inds.Count == 0) { return("<div><span>没有显示的行业信息!</span></div>"); } List <ProductIndustry> pis = null; ProductIndustry pi = null; StringBuilder sb = new StringBuilder(); string indId = null; int curCount = inds.Count; inds = inds.GetRange(0, Math.Min(_Max, curCount)); sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">"); for (int i = 0; i < inds.Count; i++) { pi = inds[i]; indId = GlobalSettings.Encrypt(pi.IndustryID.ToString()); if (i % _Columns == 0) { sb.AppendLine("<tr>"); } sb.AppendLine("<td>"); sb.AppendLine("<div><div><a href=\"" + nav + "&ID=" + indId + "\" target=\"_blank\">" + pi.IndustryName + "</a></div></div>"); pis = ProductIndustries.GetChildIndustries(pi.IndustryID); for (int j = 0; j < pis.Count; j++) { pi = pis[j]; indId = GlobalSettings.Encrypt(pi.IndustryID.ToString()); sb.AppendLine("<a href=\"" + nav + "&ID=" + indId + "\" target=\"_blank\">" + pi.IndustryName + "</a>"); if (j != pis.Count - 1) { sb.Append(" | "); } } sb.AppendLine("</td>"); if (i % _Columns == _Columns - 1) { sb.AppendLine("</tr>"); } } sb.AppendLine("</table>"); if (curCount > _Max) { sb.Append("<div class=\"list-more\"><a href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry\" title=\"查看全部。。。\"></a></div>"); } return(sb.ToString()); }
string RenderHTML() { if (_Cache.ContainsKey(_IndustryID)) { return(_Cache[_IndustryID]); } List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0); StringBuilder sb = new StringBuilder(); if (_IndustryID == 0) { return("<div class=\"" + _CssClass + "\"><span>暂无子行业信息!</span></div>"); } else { string _indId = string.Empty; ProductIndustry pi = null; List <ProductIndustry> pis = ProductIndustries.GetChildIndustries(_IndustryID); if (pis == null || pis.Count == 0) { return("<div class=\"" + _CssClass + "\"><span>暂无子行业信息!</span></div>"); } sb.Append("<div class=\"" + _CssClass + "\">"); ProductQuery query; int count = 0; PagingDataSet <Product> __ps = null; for (int i = 0; i < pis.Count; i++) { pi = pis[i]; count = 0; query = new ProductQuery(); query.IndustryID = pi.IndustryID; __ps = Products.GetProducts(query); if (__ps != null && __ps.Records != null) { count = Products.GetProducts(query).Records.Count; } sb.AppendFormat(_href, GlobalSettings.Encrypt(pi.IndustryID.ToString()), pi.IndustryName + "(" + count + ")"); } sb.Append("</div>"); if (!_Cache.ContainsKey(_IndustryID)) { lock (_lock) if (!_Cache.ContainsKey(_IndustryID)) { _Cache.Add(_IndustryID, sb.ToString()); } } } return(sb.ToString()); }
string GetNavigations(int pId) { List <ProductIndustry> _inds = new List <ProductIndustry>(); if (pId != 0) { ProductIndustry pi = ProductIndustries.GetProductIndustry(pId); _inds.Add(pi); while (pi.ParentID != 0) { pi = ProductIndustries.GetProductIndustry(pi.ParentID); _inds.Add(pi); } } return(Newtonsoft.Json.JavaScriptConvert.SerializeObject(_inds)); }
public ProductIndustry PopulateIndustryFromIDataReader(IDataReader dr) { ProductIndustry industry = new ProductIndustry(); industry.IndustryID = DataRecordHelper.GetInt32(dr, "IndustryID"); industry.IndustryName = DataRecordHelper.GetString(dr, "IndustryName"); industry.IndustryLogo = DataRecordHelper.GetString(dr, "IndustryLogo"); industry.IndustryTitle = DataRecordHelper.GetString(dr, "IndustryTitle"); industry.IndustryAbstract = DataRecordHelper.GetString(dr, "IndustryAbstract"); industry.IndustryContent = DataRecordHelper.GetString(dr, "IndustryContent"); industry.ParentID = DataRecordHelper.GetInt32(dr, "ParentID"); industry.DisplayOrder = DataRecordHelper.GetInt32(dr, "DisplayOrder"); industry.IndustryStatus = (ComponentStatus)DataRecordHelper.GetInt32(dr, "IndustryStatus"); industry.CreateTime = DataRecordHelper.GetDateTime(dr, "CreateTime"); industry.CreateUser = DataRecordHelper.GetInt32(dr, "CreateUser"); industry.UpdateTime = DataRecordHelper.GetDateTime(dr, "UpdateTime"); industry.UpdateUser = DataRecordHelper.GetInt32(dr, "UpdateUser"); industry.SetSerializerData(CommonDataProvider.PopulateSerializerDataIDataRecord(dr)); return(industry); }
string RenderIndustryHTML() { string ck = prefixInd + _FirstLetter; if (_Cache.ContainsKey(ck)) { return(_Cache[ck]); } List <ProductIndustry> inds = ProductIndustries.GetIndustriesByPY(_FirstLetter); string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry"; if (inds == null || inds.Count == 0) { return("<div><span>没有可显示的行业信息!</span></div>"); } StringBuilder sb = new StringBuilder(); ProductIndustry pb = null; int curCount = inds.Count; string catId = string.Empty; sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">"); for (int i = 0; i < curCount; i++) { pb = inds[i]; sb.Append("<tr><td>"); catId = GlobalSettings.Encrypt(pb.IndustryID.ToString()); sb.AppendLine("<div><a href=\"" + nav + "&ID=" + catId + "\" target=\"_blank\">" + pb.IndustryName + "</a></div>"); sb.AppendLine("</td></tr>"); } sb.AppendLine("</table>"); if (!_Cache.ContainsKey(ck)) { lock (_lock) if (!_Cache.ContainsKey(ck)) { _Cache.Add(ck, sb.ToString()); } } return(sb.ToString()); }
void BindData() { ProductIndustry industry = null; if (action == OperateType.Add) { industry = new ProductIndustry(); industry.ParentID = parentID; } else { industry = ProductIndustries.GetProductIndustry(industryID); btnPost.Text = "更新"; } if (industry.ParentID == 0) { parentRow.Visible = false; } else { parentRow.Visible = true; lblParentName.Text = ProductIndustries.GetProductIndustry(industry.ParentID).IndustryName; } this.txtIndustryAbstract.Text = industry.IndustryAbstract; this.txtIndustryContent.Text = industry.IndustryContent; this.txtIndustryName.Text = industry.IndustryName; this.txtIndustryTitle.Text = industry.IndustryTitle; this.txtDisplayOrder.Text = industry.DisplayOrder.ToString(); this.csIndustry.SelectedValue = industry.IndustryStatus; if (industry.File != null) { this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(industry.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } else { this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } }
string RenderHTML() { if (_Cache.ContainsKey(_IndustryID)) { return(_Cache[_IndustryID]); } List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0); StringBuilder sb = new StringBuilder(); if (_IndustryID == 0) { sb.Append("您的位置:<b>所有行业</b>"); } else { ProductIndustry pi = ProductIndustries.GetProductIndustry(_IndustryID); sb.Append("<b>" + pi.IndustryName + "</b>"); int parId = pi.ParentID; while (parId != 0) { pi = ProductIndustries.GetProductIndustry(parId); if (pi == null) { break; } sb.Insert(0, string.Format(_href, "&ID=" + GlobalSettings.Encrypt(pi.IndustryID.ToString()), pi.IndustryName) + ">>"); parId = pi.ParentID; } sb.Insert(0, "您的位置:" + string.Format(_href, "", "所有行业") + ">>"); if (!_Cache.ContainsKey(_IndustryID)) { lock (_lock) if (!_Cache.ContainsKey(_IndustryID)) { _Cache.Add(_IndustryID, sb.ToString()); } } } return(sb.ToString()); }
protected void Button34_Click(object sender, EventArgs e) { ProductIndustry industry = new ProductIndustry(); //industry.IndustryLogo }
public void btnPost_Click(object sender, EventArgs e) { ProductIndustry industry = null; if (action == OperateType.Add) { industry = new ProductIndustry(); industry.ParentID = parentID; } else { industry = ProductIndustries.GetProductIndustry(industryID); } industry.IndustryAbstract = this.txtIndustryAbstract.Text.Trim(); industry.IndustryContent = this.txtIndustryContent.Text.Trim(); industry.IndustryName = this.txtIndustryName.Text.Trim(); industry.IndustryTitle = this.txtIndustryTitle.Text.Trim(); industry.DisplayOrder = Convert.ToInt32(this.txtDisplayOrder.Text); industry.IndustryStatus = this.csIndustry.SelectedValue; if (fuLogo.PostedFile != null && fuLogo.PostedFile.ContentLength > 0) { industry.IndustryLogo = Path.GetFileName(fuLogo.PostedFile.FileName); } DataActionStatus status; if (action == OperateType.Add) { status = ProductIndustries.Create(industry, fuLogo.PostedFile.InputStream); switch (status) { case DataActionStatus.DuplicateName: mbMessage.ShowMsg("新增行业信息失败,存在同名行业信息!", Color.Red); break; case DataActionStatus.UnknownFailure: mbMessage.ShowMsg("新增行业信息失败,请联系管理员!", Color.Red); break; case DataActionStatus.Success: default: mbMessage.ShowMsg("新增行业信息成功,可继续填写新行业信息,若完成请返回!", Color.Navy); break; } } else { status = ProductIndustries.Update(industry, fuLogo.PostedFile.InputStream); switch (status) { case DataActionStatus.DuplicateName: mbMessage.ShowMsg("修改行业信息失败,存在同名行业信息!", Color.Red); break; case DataActionStatus.UnknownFailure: mbMessage.ShowMsg("修改行业信息失败,请联系管理员!", Color.Red); break; case DataActionStatus.Success: default: mbMessage.ShowMsg("修改行业信息成功,可继续修改行业信息,若完成请返回!", Color.Navy); break; } } if (status == DataActionStatus.Success) { BindData(); } }
public abstract ProductIndustry CreateUpdateIndustry(ProductIndustry industry, DataProviderAction action, out DataActionStatus status);