protected void cmdUpdate_Click(object sender, EventArgs e) { lngFeatureListItems.UpdateLangs(); switch (EditState) { case "new": FeatureListItemInfo fliNew = new FeatureListItemInfo(); fliNew.FeatureListId = FeatureListId; fliNew.Image = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url); fliNew.ViewOrder = Convert.ToInt32(txtViewOrder.Text); int featureListItemId = Controller.NewFeatureListItem(fliNew); foreach (FeatureListItemLangInfo featureListItemLang in lngFeatureListItems.Langs) { featureListItemLang.FeatureListItemId = featureListItemId; Controller.NewFeatureListItemLang(featureListItemLang); } FeatureListItemId = featureListItemId; EditState = "update"; break; case "update": FeatureListItemInfo fliUpdate = Controller.GetFeatureListItemById(FeatureListItemId); fliUpdate.Image = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url); fliUpdate.ViewOrder = Convert.ToInt32(txtViewOrder.Text); Controller.UpdateFeatureListItem(fliUpdate); Controller.DeleteFeatureListItemLangs(FeatureListItemId); foreach (FeatureListItemLangInfo featureListItemLang in lngFeatureListItems.Langs) { featureListItemLang.FeatureListItemId = FeatureListItemId; Controller.NewFeatureListItemLang(featureListItemLang); } break; default: break; } if (Request.QueryString["adminmode"] != null) { Response.Redirect(Globals.NavigateURL(TabId, "", "adminmode=featurelistitem", "featurelist=" + FeatureListId.ToString()), true); } else { Response.Redirect(EditUrl(), true); } }
public void rotFeatures_ItemClick(object sender, RadRotatorEventArgs e) { FeatureListItemInfo feature = Features[e.Item.Index]; int TabId = Convert.ToInt32(Settings["ProductListModulePage"]); int featureListItemId = feature.FeatureListItemId; Controller.DeleteProductFilter(PortalId, FilterSessionId, "FeatureList"); ProductFilterInfo pf = new ProductFilterInfo(); pf.FilterSessionId = FilterSessionId; pf.FilterSource = "FeatureList"; pf.FilterValue = FeatureListId.ToString() + "|" + featureListItemId.ToString(); pf.PortalId = PortalId; Controller.NewProductFilter(pf); Response.Redirect(Globals.NavigateURL(TabId)); }
public void SaveFeatureListItem(string PortalId, string strStoreGuid, FeatureListItemInfo featureListItem, string Token) { int portalId = -1; Int32.TryParse(PortalId, out portalId); if (portalId < 0) { throw new Exception("PortalId must be zero or greater"); } if (featureListItem == null) { throw new Exception("FeatureListItem must not be null"); } Guid storeGuid = new Guid(strStoreGuid); if (storeGuid == Guid.Empty) { throw new Exception("StoreGuid must be valid!"); } ImportController.SaveFeatureListItem(portalId, featureListItem, storeGuid); }
protected void rotFeatures_DataBound(object sender, RadRotatorEventArgs e) { if (IsConfigured) { string template; int imageWidth = 200; RadRotator rot = sender as RadRotator; RadRotatorItem item = e.Item as RadRotatorItem; FeatureListItemInfo featureListItem = item.DataItem as FeatureListItemInfo; if (featureListItem != null) { PlaceHolder ph = e.Item.FindControl("featurePlaceHolder") as PlaceHolder; template = Template; template = template.Replace("[TITLE]", "<asp:Label ID=\"lblTitle\" runat=\"server\" />"); if (template.IndexOf("[IMAGE") > -1) { if (template.IndexOf("[IMAGE:") > -1) { string width = template.Substring(template.IndexOf("[IMAGE:") + 7); width = width.Substring(0, width.IndexOf("]")); if (Int32.TryParse(width, out imageWidth) == false) { imageWidth = 200; } template = template.Replace("[IMAGE:" + width + "]", "<asp:PlaceHolder ID=\"phimgFeature\" runat=\"server\" />"); } else { template = template.Replace("[IMAGE]", "<asp:PlaceHolder ID=\"phimgFeature\" runat=\"server\" />"); } } Control ctrl = ParseControl(template); Label lblTitle = FindControlRecursive(ctrl, "lblTitle") as Label; if (lblTitle != null) { lblTitle.Text = featureListItem.FeatureListItem; } PlaceHolder phimgFeature = FindControlRecursive(ctrl, "phimgFeature") as PlaceHolder; if (phimgFeature != null && featureListItem.Image != null) { string fileName = PortalSettings.HomeDirectoryMapPath.Replace(HttpContext.Current.Request.PhysicalApplicationPath, "") + featureListItem.Image.Replace('/', '\\'); GeneratedImage imgFeature = new GeneratedImage(); imgFeature.ImageHandlerUrl = "~/BBImageHandler.ashx"; if (imageWidth > 0) { imgFeature.Parameters.Add(new ImageParameter() { Name = "Width", Value = imageWidth.ToString() }); } imgFeature.Parameters.Add(new ImageParameter() { Name = "File", Value = fileName }); // TODO: Watermark //if (false) //{ // imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkText", Value = Localization.GetString("Sold.Text", this.LocalResourceFile) }); // imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkFontFamily", Value = "Verdana" }); // imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkFontColor", Value = "Red" }); // imgProduct.Parameters.Add(new ImageParameter() { Name = "WatermarkFontSize", Value = "20" }); //} phimgFeature.Controls.Add(imgFeature); } ph.Controls.Add(ctrl); } } else { rotFeatures.Visible = false; } }
public abstract void UpdateFeatureListItem(FeatureListItemInfo FeatureListItem);
public abstract int NewFeatureListItem(FeatureListItemInfo FeatureListItem);
protected void lstFeatureListItems_SelectedIndexChanged(object sender, EventArgs e) { lstFeatureListItems.Attributes.Add("onClick", "javascript:alert('" + Localization.GetString("LstDisabled.Text", this.LocalResourceFile) + "');"); // Determine new ProductId FeatureListItemId = Convert.ToInt32(lstFeatureListItems.SelectedValue); if (FeatureListItemId == -1) { EditState = "new"; lngFeatureListItems.Langs = new List <ILanguageEditorInfo>(); pnlFeatureListItemDetails.Visible = true; lblFLIDetails.Text = Localization.GetString("NewFeatureListItem.Text", this.LocalResourceFile); } // Enabling / Disabling Edit Controls pnlFeatureListsItems.Visible = false; bool pnlVisible = (FeatureListItemId > -1 || EditState == "new"); pnlFeatureListItemDetails.Visible = pnlVisible; cmdUpdate.Visible = pnlVisible; cmdCancel.Visible = true; cmdDelete.Visible = (EditState != "new"); if (FeatureListItemId > 0) { FeatureListItem = Controller.GetFeatureListItemById(FeatureListItemId, CurrentLanguage); } if (FeatureListItem != null) { // Set Image Info int imageFileId = -1; if (!String.IsNullOrEmpty(FeatureListItem.Image)) { IFileInfo file = FileManager.Instance.GetFile(PortalId, FeatureListItem.Image); if (file != null) { imageFileId = file.FileId; } } string imageUrl = ""; if (imageFileId > -1) { imageUrl = "FileID=" + imageFileId.ToString(); } else { imageUrl = _imageDir + "This_fileName-Should_not_3xist"; } ImageSelector.Url = imageUrl; imgImage.ImageUrl = BBStoreHelper.FileNameToImgSrc(imageUrl, PortalSettings); txtViewOrder.Text = FeatureListItem.ViewOrder.ToString(); // Fill in the Language information List <ILanguageEditorInfo> dbLangs = new List <ILanguageEditorInfo>(); foreach (FeatureListItemLangInfo featureListItemLang in Controller.GetFeatureListItemLangs(FeatureListItem.FeatureListItemId)) { dbLangs.Add(featureListItemLang); } lngFeatureListItems.Langs = dbLangs; } lblFLIDetails.Text = String.Format("{0} (ID:{1})", lstFeatureListItems.SelectedItem.Text, FeatureListItemId); lblFLIDetails.Visible = true; lblFLIDetailsCaption.Visible = true; }