public List<ProductSynonym> GetUpdatedSynonyms() { List<ProductSynonym> synonymList = new List<ProductSynonym>(); int i = 0; if (product != null) { if (product.SynonymList.Count > 0) { foreach (RepeaterItem item in rptSynonym.Items) { CheckBox chkBox = item.FindControl("chkRemove") as CheckBox; TextBox txtAlternativePhrase = (TextBox)item.FindControl("txtAlternativePhrase"); if (!chkBox.Checked) { ProductSynonym ps = new ProductSynonym(); ps.ProductID = product.ProductID; ps.AlternativePhrase = txtAlternativePhrase.Text; synonymList.Add(ps); ps = null; } } } } i = 0; if (synonyms > 0) { while (i < synonyms) { ProductSynonym synonym = new ProductSynonym(); TextBox txtAlternativePhrase = (TextBox)plhSynonymAdditions.FindControl("txtAlternativePhrase" + i); if (txtAlternativePhrase.Text != "") { synonym.AlternativePhrase = txtAlternativePhrase.Text; if (product != null) { synonym.ProductID = product.ProductID; } synonymList.Add(synonym); synonym = null; } i++; } } return synonymList; }
private SearchContent CreateSearchContentSynonym(string category, IProductSummary product, ProductSynonym ps, CatalogueUrlHelper urlHelper) { SearchContent sc = new SearchContent(); sc.Title = product.ItemCode + "-" + product.Name; sc.Contents = ps.AlternativePhrase; sc.Author = "simon"; sc.ModuleType = this.Section.ModuleType.Name; sc.Path = urlHelper.GetProductUrl(product); sc.Category = category; sc.Site = (this.Section.Node != null ? this.Section.Node.Site.Name : String.Empty); sc.DateCreated = DateTime.Now; sc.DateModified = DateTime.Now; sc.SectionId = this.Section.Id; if (sc.Title == null || sc.Title.Length == 0) { sc.Title = product.Name; } if (sc.Contents == null || sc.Contents.Length == 0) { sc.Contents = "Item " + (sc.Title); } sc.Summary = sc.Contents; return sc; }
public bool DeleteProductSynonym(int storeID, string cultureCode, ProductSynonym ps) { try { this._sessionManager.OpenSession().Delete(ps); this._sessionManager.OpenSession().Flush(); } catch (Exception e) { LogManager.GetLogger(GetType()).Error(e); return false; } return true; }