public ActionResult CreateWebpage(Webpage page) { var manager = new BlogManager(); manager.AddWebpage(page); return RedirectToAction("Index/"+ page.Title, "Static"); }
protected void Page_Load(object sender, EventArgs e) { webpage = Webpage.Instance; if (!IsPostBack) { rptNews.DataSource = AccessArticleService.Instance.SelectArticles(Category.News, 1, 5); rptNews.DataBind(); rptMovies.DataSource = AccessArticleService.Instance.SelectArticles(Category.Movie, 1, 5); rptMovies.DataBind(); } }
/// <summary> /// Set custom targeting for the page feed URLs based on a list of labels. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="adGroupId">Ad group ID.</param> /// <param name="labelName">The label name.</param> /// <returns>The newly created webpage criterion.</returns> private static BiddableAdGroupCriterion AddDsaTargeting(AdWordsUser user, long adGroupId, string labelName) { // Get the AdGroupCriterionService. AdGroupCriterionService adGroupCriterionService = (AdGroupCriterionService)user.GetService(AdWordsService.v201705.AdGroupCriterionService); // Create a webpage criterion. Webpage webpage = new Webpage(); WebpageParameter parameter = new WebpageParameter(); parameter.criterionName = "Test criterion"; webpage.parameter = parameter; // Add a condition for label=specified_label_name. WebpageCondition condition = new WebpageCondition(); condition.operand = WebpageConditionOperand.CUSTOM_LABEL; condition.argument = labelName; parameter.conditions = new WebpageCondition[] { condition }; BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion(); criterion.adGroupId = adGroupId; criterion.criterion = webpage; // Set a custom bid for this criterion. BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration(); biddingStrategyConfiguration.bids = new Bids[] { new CpcBid() { bid = new Money() { microAmount = 1500000 } } }; criterion.biddingStrategyConfiguration = biddingStrategyConfiguration; AdGroupCriterionOperation operation = new AdGroupCriterionOperation(); operation.operand = criterion; operation.@operator = Operator.ADD; try { AdGroupCriterionReturnValue retval = adGroupCriterionService.mutate( new AdGroupCriterionOperation[] { operation }); BiddableAdGroupCriterion newCriterion = (BiddableAdGroupCriterion)retval.value[0]; Console.WriteLine("Web page criterion with ID = {0} and status = {1} was created.", newCriterion.criterion.id, newCriterion.userStatus); return(newCriterion); } catch (Exception e) { throw new System.ApplicationException("Failed to create webpage criterion for " + "custom page feed label.", e); } }
public Webpage ProcessAndValidate(Webpage instance, out List <Exception> exceptions, out bool shouldSuppressProcessing) { ProcessAndValidateCommon(instance, out exceptions, out shouldSuppressProcessing); return(instance); }
public ActionResult Sort([IoCModelBinder(typeof(NullableEntityModelBinder))] Webpage parent, List <SortItem> items) { _documentService.SetOrders(items); return(RedirectToAction("Sort", parent == null ? null : new { id = parent.Id })); }
public PartialViewResult FormProperties(Webpage webpage) { return(PartialView(webpage)); }
public static bool IsTypeCachable(this Webpage webpage) { return(webpage.GetType().GetCustomAttribute <WebpageOutputCacheableAttribute>() != null); }
public abstract void RenderTabPane(HtmlHelper <Webpage> html, Webpage webpage);
private VoteResponse RegisterAnonymousVote(VoteModel voteModel, Comment comment, Webpage webpage, bool isUpvote) { if (comment.Votes.Any(v => v.IPAddress == voteModel.IPAddress)) { return(new VoteResponse { Type = CommentResponseType.Info, Message = "Already voted", RedirectUrl = "~/" + webpage.LiveUrlSegment }); } var vote = new Vote { IsUpvote = isUpvote, Comment = comment, IPAddress = voteModel.IPAddress }; comment.Votes.Add(vote); _session.Transact(session => session.Save(vote)); return(new VoteResponse { Message = "Vote registered", RedirectUrl = "~/" + webpage.LiveUrlSegment, Type = CommentResponseType.Success }); }
public abstract void ClonePartBase(Webpage @from, Webpage to, SiteCloneContext siteCloneContext);
public OnWebpagePublishedEventArgs(Webpage document) { Webpage = document; }
public virtual ActionResult Delete(Webpage document) { _documentService.DeleteDocument(document); TempData.InfoMessages().Add(string.Format("{0} deleted", document.Name)); return(RedirectToAction("Index")); }
public ActionResult fr(int wid, Guid cc, string referer, string path, string wvri, string r, string b, int sw, int sh, int st, int sl, string occ) { Visit v = null; VisitPage vp = null; Webpage wp = null; //get the website Website w = websiteRepository.GetWebsiteByID(wid); if (w != null) { v = visitRepository.GetVisitByCC(cc); Uri u = new Uri(path); wp = webpageRepository.GetWebpage(w.ID, u.AbsolutePath.Trim(), u.Query.Trim()); if (wp == null) { wp = new Webpage() { DateCreated = DateTime.UtcNow, Path = u.AbsolutePath.Trim(), QueryString = u.Query.Trim(), Status = RecordStatus.Active, Website = w }; webpageRepository.InsertWebpage(wp); webpageRepository.Save(); } //if visit is not found than create a new visit if (v == null) { int? oldVisitID = null; Guid oldcc; if (!string.IsNullOrEmpty(occ)) { if (Guid.TryParse(occ, out oldcc)) { Visit oldVisit = visitRepository.GetVisitByCC(oldcc); if (oldVisit != null) { oldVisitID = oldVisit.ID; } } } v = new Visit() { CountryAbbr = "", DateCreated = DateTime.UtcNow, DateModified = null, IPAddress = Request.UserHostAddress, LastPingDate = DateTime.UtcNow, Referer = referer, Status = RecordStatus.Active, WebsiteVisitorReferenceID = wvri, ClientCookie = cc, Website = w, BrowserName = b, ScreenHeight = sh, ScreenWidth = sw, LastVisitID = oldVisitID }; visitRepository.InsertVisit(v); visitRepository.Save(); } if (v != null) { vp = visitRepository.GetLastVisitedPageofVisit(v.ID); } //if visitpage is not found or visitpage does not match with webpage in current context //than create a new visitpage obj if (vp == null || vp.webpage.ID != wp.ID) { vp = new VisitPage() { LastPingDate = DateTime.UtcNow, visit = v, webpage = wp, DateCreated = DateTime.UtcNow, BrowserWidth = null, BrowserHeight = null, ScrollLeft = sl, ScrollTop = st }; visitRepository.InsertVisitPage(vp); visitRepository.Save(); } } return(base.File(Server.MapPath("~/content/trans.png"), "image/png")); }
public virtual ActionResult Delete_Get(Webpage document) { return(PartialView(document)); }
public virtual ActionResult Edit([IoCModelBinder(typeof(EditWebpageModelBinder))] Webpage doc) { _documentService.SaveDocument(doc); TempData.SuccessMessages().Add(string.Format("{0} successfully saved", doc.Name)); return(RedirectToAction("Edit", new { id = doc.Id })); }
public virtual ActionResult Edit_Get(Webpage doc) { _webpageBaseViewDataService.SetEditPageViewData(ViewData, doc); doc.SetAdminViewData(ViewData); return(View(doc)); }
public override string Name(Webpage webpage) { return("Fields"); }
private List <MobileFriendlyNavigationChildNode> GetChildNodeTransforms(Dictionary <Webpage, List <MobileFriendlyNavigationChildNode> > mobileFriendlyNavigationChildNodes, Webpage parent) { if (parent == null) { return(new List <MobileFriendlyNavigationChildNode>()); } var nodes = mobileFriendlyNavigationChildNodes[parent]; if (nodes.Any() && !(parent is SitemapPlaceholder)) { foreach (var node in nodes) { node.DisplayOrder = node.DisplayOrder + 1; } nodes.Insert(0, new MobileFriendlyNavigationChildNode { ChildCount = 0, Id = parent.Id, Name = parent.Name, ParentId = parent.Id, PublishOn = parent.PublishOn, UrlSegment = parent.LiveUrlSegment, DocumentType = parent.GetType().FullName, DisplayOrder = 0 }); } return(_processChildNodes.Process(nodes, parent).OrderBy(node => node.DisplayOrder).ToList()); }
public List <string> SaveFormData(Webpage webpage, HttpRequestBase request) { var formProperties = webpage.FormProperties; var formPosting = new FormPosting { Webpage = webpage }; _session.Transact(session => { webpage.FormPostings.Add(formPosting); session.SaveOrUpdate(formPosting); }); var errors = new List <string>(); _session.Transact(session => { foreach (var formProperty in formProperties) { try { if (formProperty is FileUpload) { var file = request.Files[formProperty.Name]; if (file == null && formProperty.Required) { throw new RequiredFieldException("No file was attached to the " + formProperty.Name + " field"); } if (file != null && !string.IsNullOrWhiteSpace(file.FileName)) { var value = SaveFile(webpage, formPosting, file); formPosting.FormValues.Add(new FormValue { Key = formProperty.Name, Value = value, IsFile = true, FormPosting = formPosting }); } } else { var value = SanitizeValue(formProperty, request.Form[formProperty.Name]); if (string.IsNullOrWhiteSpace(value) && formProperty.Required) { throw new RequiredFieldException("No value was posted for the " + formProperty.Name + " field"); } formPosting.FormValues.Add(new FormValue { Key = formProperty.Name, Value = value, FormPosting = formPosting }); } } catch (Exception ex) { errors.Add(ex.Message); } } if (errors.Any()) { session.Delete(formPosting); } else { formPosting.FormValues.ForEach(value => session.Save(value)); SendFormMessages(webpage, formPosting); } }); return(errors); }
private IEnumerable <string> GetPrimaryTerms(Webpage webpage) { yield return(webpage.Name); }
public async override Task RunAsync(AuthorizationData authorizationData) { try { ApiEnvironment environment = ((OAuthDesktopMobileAuthCodeGrant)authorizationData.Authentication).Environment; AdInsightExampleHelper AdInsightExampleHelper = new AdInsightExampleHelper(this.OutputStatusMessage); AdInsightExampleHelper.AdInsightService = new ServiceClient <IAdInsightService>(authorizationData, environment); CampaignManagementExampleHelper CampaignManagementExampleHelper = new CampaignManagementExampleHelper(this.OutputStatusMessage); CampaignManagementExampleHelper.CampaignManagementService = new ServiceClient <ICampaignManagementService>(authorizationData, environment); // To get started with dynamic search ads, first you'll need to add a new Campaign // with its type set to DynamicSearchAds. When you create the campaign, you'll need to // include a DynamicSearchAdsSetting that specifies the target website domain and language. var campaigns = new[] { new Campaign { CampaignType = CampaignType.DynamicSearchAds, Settings = new [] { new DynamicSearchAdsSetting { DomainName = "contoso.com", Language = "English" } }, Name = "Women's Shoes " + DateTime.UtcNow, Description = "Red shoes line.", // You must choose to set either the shared budget ID or daily amount. // You can set one or the other, but you may not set both. BudgetId = null, DailyBudget = 50, BudgetType = Microsoft.BingAds.V12.CampaignManagement.BudgetLimitType.DailyBudgetStandard, // You can set your campaign bid strategy to Enhanced CPC (EnhancedCpcBiddingScheme) // and then, at any time, set an individual ad group bid strategy to // Manual CPC (ManualCpcBiddingScheme). BiddingScheme = new EnhancedCpcBiddingScheme { }, TimeZone = "PacificTimeUSCanadaTijuana", // Used with CustomParameters defined in lower level entities such as ads. TrackingUrlTemplate = "http://tracker.example.com/?season={_season}&promocode={_promocode}&u={lpurl}" }, }; AddCampaignsResponse addCampaignsResponse = await CampaignManagementExampleHelper.AddCampaignsAsync( authorizationData.AccountId, campaigns, false); long?[] campaignIds = addCampaignsResponse.CampaignIds.ToArray(); Microsoft.BingAds.V12.CampaignManagement.BatchError[] campaignErrors = addCampaignsResponse.PartialErrors.ToArray(); CampaignManagementExampleHelper.OutputArrayOfLong(campaignIds); CampaignManagementExampleHelper.OutputArrayOfBatchError(campaignErrors); // Next, create a new AdGroup within the dynamic search ads campaign. var adGroups = new[] { new AdGroup { Name = "Women's Red Shoe Sale", StartDate = null, EndDate = new Date { Month = 12, Day = 31, Year = DateTime.UtcNow.Year + 1 }, CpcBid = new Bid { Amount = 0.09 }, Language = "English", // For ad groups you can use either of the InheritFromParentBiddingScheme or ManualCpcBiddingScheme objects. // If you do not set this element, then InheritFromParentBiddingScheme is used by default. BiddingScheme = new ManualCpcBiddingScheme { }, } }; AddAdGroupsResponse addAdGroupsResponse = await CampaignManagementExampleHelper.AddAdGroupsAsync((long)campaignIds[0], adGroups, null); long?[] adGroupIds = addAdGroupsResponse.AdGroupIds.ToArray(); Microsoft.BingAds.V12.CampaignManagement.BatchError[] adGroupErrors = addAdGroupsResponse.PartialErrors.ToArray(); CampaignManagementExampleHelper.OutputArrayOfLong(adGroupIds); CampaignManagementExampleHelper.OutputArrayOfBatchError(adGroupErrors); // You can add one or more Webpage criterion to each ad group that helps determine // whether or not to serve dynamic search ads. var adGroupCriterions = new List <AdGroupCriterion>(); var adGroupWebpagePositivePageContent = new BiddableAdGroupCriterion { AdGroupId = (long)adGroupIds[0], CriterionBid = new FixedBid { Amount = 0.50 }, Criterion = new Webpage { Parameter = new WebpageParameter { Conditions = new[] { new WebpageCondition { Argument = "flowers", Operand = WebpageConditionOperand.PageContent, } }, CriterionName = "Ad Group Webpage Positive Page Content Criterion" }, }, // DestinationUrl and FinalUrls are not supported with Webpage criterion. // The Final URL is dynamically created at the ad level. DestinationUrl = null, FinalUrls = null, // You could use a tracking template which would override the campaign level // tracking template. Tracking templates defined for lower level entities // override those set for higher level entities. // In this example we are using the campaign level tracking template. TrackingUrlTemplate = null, // Set custom parameters that are specific to this webpage criterion, // and can be used by the criterion, ad group, campaign, or account level tracking template. // In this example we are using the campaign level tracking template. UrlCustomParameters = new CustomParameters { Parameters = new[] { new CustomParameter() { Key = "promoCode", Value = "PROMO1" }, new CustomParameter() { Key = "season", Value = "summer" }, } } }; adGroupCriterions.Add(adGroupWebpagePositivePageContent); // To discover the categories that you can use for Webpage criterion (positive or negative), // use the GetDomainCategories operation with the Ad Insight service. var getDomainCategoriesResponse = await AdInsightExampleHelper.GetDomainCategoriesAsync( null, DOMAIN_NAME, LANGUAGE); var categories = getDomainCategoriesResponse.Categories; // If any categories are available let's use one as a condition. if (categories.Count > 0) { var adGroupWebpagePositiveCategory = new BiddableAdGroupCriterion { AdGroupId = (long)adGroupIds[0], CriterionBid = new FixedBid { Amount = 0.50 }, Criterion = new Webpage { Parameter = new WebpageParameter { Conditions = new[] { new WebpageCondition { Argument = categories[0].CategoryName, Operand = WebpageConditionOperand.Category, } }, CriterionName = "Ad Group Webpage Positive Category Criterion" }, } }; adGroupCriterions.Add(adGroupWebpagePositiveCategory); } // If you want to exclude certain portions of your website, you can add negative Webpage // criterion at the campaign and ad group level. var adGroupWebpageNegativeUrl = new NegativeAdGroupCriterion { AdGroupId = (long)adGroupIds[0], Criterion = new Webpage { Parameter = new WebpageParameter { // You can choose whether you want the criterion argument to match partial URLs, // page content, page title, or categories that Bing thinks applies to your website. Conditions = new[] { new WebpageCondition { Argument = DOMAIN_NAME, Operand = WebpageConditionOperand.Url, } }, // If you do not specify any name, then it will be set to a concatenated list of conditions. CriterionName = null } }, }; adGroupCriterions.Add(adGroupWebpageNegativeUrl); OutputStatusMessage("Adding Ad Group Webpage Criterion . . . \n"); CampaignManagementExampleHelper.OutputArrayOfAdGroupCriterion(adGroupCriterions); AddAdGroupCriterionsResponse addAdGroupCriterionsResponse = await CampaignManagementExampleHelper.AddAdGroupCriterionsAsync(adGroupCriterions, AdGroupCriterionType.Webpage); long?[] adGroupCriterionIds = addAdGroupCriterionsResponse.AdGroupCriterionIds.ToArray(); OutputStatusMessage("New Ad Group Criterion Ids:\n"); CampaignManagementExampleHelper.OutputArrayOfLong(adGroupCriterionIds); BatchErrorCollection[] adGroupCriterionErrors = addAdGroupCriterionsResponse.NestedPartialErrors.ToArray(); OutputStatusMessage("\nAddAdGroupCriterions Errors:\n"); CampaignManagementExampleHelper.OutputArrayOfBatchErrorCollection(adGroupCriterionErrors); // The negative Webpage criterion at the campaign level applies to all ad groups // within the campaign; however, if you define ad group level negative Webpage criterion, // the campaign criterion is ignored for that ad group. var campaignCriterions = new List <CampaignCriterion>(); var campaignWebpageNegative = new NegativeCampaignCriterion { CampaignId = (long)campaignIds[0], Criterion = new Webpage { Parameter = new WebpageParameter { Conditions = new[] { new WebpageCondition { Argument = DOMAIN_NAME + "\\seattle", Operand = WebpageConditionOperand.Url, } }, CriterionName = "Campaign Negative Webpage Url Criterion" } } }; campaignCriterions.Add(campaignWebpageNegative); OutputStatusMessage("Adding Campaign Webpage Criterion . . . \n"); CampaignManagementExampleHelper.OutputArrayOfCampaignCriterion(campaignCriterions); AddCampaignCriterionsResponse addCampaignCriterionsResponse = await CampaignManagementExampleHelper.AddCampaignCriterionsAsync(campaignCriterions, CampaignCriterionType.Webpage); long?[] campaignCriterionIds = addCampaignCriterionsResponse.CampaignCriterionIds.ToArray(); OutputStatusMessage("\nNew Campaign Criterion Ids:\n"); CampaignManagementExampleHelper.OutputArrayOfLong(campaignCriterionIds); BatchErrorCollection[] campaignCriterionErrors = addCampaignCriterionsResponse.NestedPartialErrors.ToArray(); OutputStatusMessage("\nAddCampaignCriterions Errors:\n"); CampaignManagementExampleHelper.OutputArrayOfBatchErrorCollection(campaignCriterionErrors); // Finally you can add a DynamicSearchAd into the ad group. The ad title and display URL // are generated automatically based on the website domain and language that you want to target. var ads = new Ad[] { new DynamicSearchAd { Text = "Find New Customers & Increase Sales! Start Advertising on Contoso Today.", Path1 = "seattle", Path2 = "shoe sale", // You cannot set FinalUrls. The Final URL will be a dynamically selected landing page. // The final URL is distinct from the path that customers will see and click on in your ad. FinalUrls = null, // You could use a tracking template which would override the campaign level // tracking template. Tracking templates defined for lower level entities // override those set for higher level entities. // In this example we are using the campaign level tracking template. TrackingUrlTemplate = null, // Set custom parameters that are specific to this ad, // and can be used by the ad, webpage, ad group, campaign, or account level tracking template. // In this example we are using the campaign level tracking template. UrlCustomParameters = new CustomParameters { Parameters = new[] { new CustomParameter() { Key = "promoCode", Value = "PROMO1" }, new CustomParameter() { Key = "season", Value = "summer" }, } } }, }; AddAdsResponse addAdsResponse = await CampaignManagementExampleHelper.AddAdsAsync((long)adGroupIds[0], ads); long?[] adIds = addAdsResponse.AdIds.ToArray(); Microsoft.BingAds.V12.CampaignManagement.BatchError[] adErrors = addAdsResponse.PartialErrors.ToArray(); CampaignManagementExampleHelper.OutputArrayOfLong(adIds); CampaignManagementExampleHelper.OutputArrayOfBatchError(adErrors); // Retrieve the Webpage criterion for the campaign. var getCampaignCriterionsByIdsResponse = await CampaignManagementExampleHelper.GetCampaignCriterionsByIdsAsync( null, (long)campaignIds[0], CampaignCriterionType.Webpage ); OutputStatusMessage("Retrieving the Campaign Webpage Criterions that we added . . . \n"); campaignCriterions = getCampaignCriterionsByIdsResponse.CampaignCriterions.ToList(); CampaignManagementExampleHelper.OutputArrayOfCampaignCriterion(campaignCriterions); // Retrieve the Webpage criterion for the ad group and then test some update scenarios. var getAdGroupCriterionsByIdsResponse = await CampaignManagementExampleHelper.GetAdGroupCriterionsByIdsAsync( null, (long)adGroupIds[0], AdGroupCriterionType.Webpage ); OutputStatusMessage("Retrieving the Ad Group Webpage Criterions that we added . . . \n"); adGroupCriterions = getAdGroupCriterionsByIdsResponse.AdGroupCriterions.ToList(); CampaignManagementExampleHelper.OutputArrayOfAdGroupCriterion(adGroupCriterions); // You can update the bid for BiddableAdGroupCriterion var updateBid = new FixedBid { Amount = 0.75 }; // You can update the Webpage criterion name but cannot update the conditions. // To update the conditions you must delete the criterion and add a new criterion. // This update attempt will return an error. var updateCriterionAttemptFailure = new Webpage { Parameter = new WebpageParameter { Conditions = new[] { new WebpageCondition { Argument = "Books", Operand = WebpageConditionOperand.PageContent, } }, CriterionName = "Update Attempt Failure" }, }; var updateCriterionAttemptSuccess = new Webpage { Parameter = new WebpageParameter { CriterionName = "Update Attempt Success" }, }; foreach (var adGroupCriterion in adGroupCriterions) { var biddableAdGroupCriterion = adGroupCriterion as BiddableAdGroupCriterion; if (biddableAdGroupCriterion != null) { ((BiddableAdGroupCriterion)(adGroupCriterion)).CriterionBid = updateBid; ((BiddableAdGroupCriterion)(adGroupCriterion)).Criterion = updateCriterionAttemptSuccess; } else { var negativeAdGroupCriterion = adGroupCriterion as NegativeAdGroupCriterion; if (negativeAdGroupCriterion != null) { ((NegativeAdGroupCriterion)(adGroupCriterion)).Criterion = updateCriterionAttemptFailure; } } } OutputStatusMessage("Updating Ad Group Webpage Criterion . . . \n"); CampaignManagementExampleHelper.OutputArrayOfAdGroupCriterion(adGroupCriterions); UpdateAdGroupCriterionsResponse updateAdGroupCriterionsResponse = await CampaignManagementExampleHelper.UpdateAdGroupCriterionsAsync(adGroupCriterions, AdGroupCriterionType.Webpage); adGroupCriterionErrors = updateAdGroupCriterionsResponse.NestedPartialErrors.ToArray(); OutputStatusMessage("UpdateAdGroupCriterions Errors:\n"); CampaignManagementExampleHelper.OutputArrayOfBatchErrorCollection(adGroupCriterionErrors); // Delete the campaign, ad group, criterion, and ad that were previously added. // You should remove this operation if you want to view the added entities in the // Bing Ads web application or another tool. await CampaignManagementExampleHelper.DeleteCampaignsAsync(authorizationData.AccountId, new[] { (long)campaignIds[0] }); OutputStatusMessage(string.Format("\nDeleted Campaign Id {0}\n", campaignIds[0])); } // Catch authentication exceptions catch (OAuthTokenRequestException ex) { OutputStatusMessage(string.Format("Couldn't get OAuth tokens. Error: {0}. Description: {1}", ex.Details.Error, ex.Details.Description)); } // Catch Campaign Management service exceptions catch (FaultException <Microsoft.BingAds.V12.CampaignManagement.AdApiFaultDetail> ex) { OutputStatusMessage(string.Join("; ", ex.Detail.Errors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); } catch (FaultException <Microsoft.BingAds.V12.CampaignManagement.ApiFaultDetail> ex) { OutputStatusMessage(string.Join("; ", ex.Detail.OperationErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); OutputStatusMessage(string.Join("; ", ex.Detail.BatchErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); } catch (FaultException <Microsoft.BingAds.V12.CampaignManagement.EditorialApiFaultDetail> ex) { OutputStatusMessage(string.Join("; ", ex.Detail.OperationErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); OutputStatusMessage(string.Join("; ", ex.Detail.BatchErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); } catch (Exception ex) { OutputStatusMessage(ex.Message); } }
public override bool ShouldShow(Webpage webpage) { return(true); }
public IEnumerable <string> GetPrimary(Webpage webpage) { return(GetPrimaryTerms(webpage)); }
public ActionResult Unpublish(Webpage webpage) { _documentService.Unpublish(webpage); return(RedirectToAction("Edit", new { id = webpage.Id })); }
public override string Name(Webpage webpage) { return("SEO & Properties"); }
protected void Page_Load(object sender, EventArgs e) { _WebpageId = AlwaysConvert.ToInt(Request.QueryString["WebpageId"]); _Webpage = WebpageDataSource.Load(_WebpageId); if (_Webpage == null) { Response.Redirect("Default.aspx"); } if (!Page.IsPostBack) { //INITIALIZE FORM ON FIRST VISIT Name.Focus(); UpdateCaption(); Name.Text = _Webpage.Name; CustomUrl.Text = _Webpage.CustomUrl; if (CustomUrl.Text.StartsWith("~/")) { CustomUrl.Text = CustomUrl.Text.Substring(2); } CustomUrlValidator.OriginalValue = _Webpage.CustomUrl; WebpageContent.Value = _Webpage.Description; Visibility.SelectedIndex = (int)_Webpage.Visibility; CategoryTree.SelectedCategories = _Webpage.Categories.ToArray(); PageTitle.Text = _Webpage.Title; MetaKeywordsValue.Text = _Webpage.MetaKeywords; MetaDescriptionValue.Text = _Webpage.MetaDescription; HtmlHead.Text = _Webpage.HtmlHead; ThumbnailUrl.Text = _Webpage.ThumbnailUrl; ThumbnailAltText.Text = _Webpage.ThumbnailAltText; Summary.Text = _Webpage.Summary; PublishedBy.Text = _Webpage.PublishedBy; PublishDate.SelectedDate = _Webpage.PublishDate.HasValue ? _Webpage.PublishDate.Value : DateTime.MinValue; LayoutList.DataBind(); BindThemes(); string layout = _Webpage.Layout != null ? _Webpage.Layout.FilePath : string.Empty; ListItem item = LayoutList.Items.FindByValue(layout); if (item != null) { item.Selected = true; } Name.Focus(); // SHOW SAVE CONFIRMATION NOTIFICATION IF NEEDED if (Request.UrlReferrer != null && Request.UrlReferrer.AbsolutePath.ToLowerInvariant().EndsWith("addcontentpage.aspx")) { SavedMessage.Visible = true; SavedMessage.Text = string.Format(SavedMessage.Text, LocaleHelper.LocalNow); } } MetaKeywordsCharCount.Text = ((int)(MetaKeywordsValue.MaxLength - MetaKeywordsValue.Text.Length)).ToString(); MetaDescriptionCharCount.Text = ((int)(MetaDescriptionValue.MaxLength - MetaDescriptionValue.Text.Length)).ToString(); AbleCommerce.Code.PageHelper.SetPickImageButton(ThumbnailUrl, BrowseThumbnailUrl); AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(MetaKeywordsValue, MetaKeywordsCharCount); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Name); AbleCommerce.Code.PageHelper.SetPageDefaultButton(Page, SaveButton); AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(MetaDescriptionValue, MetaDescriptionCharCount); if (!AbleContext.Current.Store.Settings.EnableWysiwygEditor) { AbleCommerce.Code.PageHelper.SetHtmlEditor(WebpageContent, HtmlButton); } else { HtmlButton.Visible = false; } }
public override void RenderTabPane(HtmlHelper <Webpage> html, Webpage webpage) { html.RenderPartial("SEO", webpage); }
/// <summary> /// Determines the category context for the current request. /// </summary> /// <returns>The category context for the current request.</returns> public static int GetCategoryId() { // LOOK FOR A CATEGORY IN THE QUERY STRING HttpRequest request = HttpContext.Current.Request; int categoryId = AlwaysConvert.ToInt(request.QueryString["CategoryId"]); Category category = CategoryDataSource.Load(categoryId); if (category != null) { return(categoryId); } // LOOK FOR A PRODUCT Product product = ProductDataSource.Load(GetProductId()); if (product != null) { // CHECK PRODUCT CATEGORIES int count = product.Categories.Count; if (count > 0) { if (count > 1) { // CHECK IF LAST VISITED CATEGORY IS ASSOCIATED WITH THIS OBJECT int lastCategoryId = PageVisitHelper.LastVisitedCategoryId; if (product.Categories.Contains(lastCategoryId)) { return(lastCategoryId); } } // RETURN THE FIRST CATEGORY ASSOCIATED WITH THIS OBJECT return(product.Categories[0]); } } // LOOK FOR A WEBPAGE Webpage webpage = WebpageDataSource.Load(GetWebpageId()); if (webpage != null) { int count = webpage.Categories.Count; if (count > 0) { if (count > 1) { // CHECK IF LAST VISITED CATEGORY IS ASSOCIATED WITH THIS OBJECT int lastCategoryId = PageVisitHelper.LastVisitedCategoryId; if (webpage.Categories.Contains(lastCategoryId)) { return(lastCategoryId); } } // RETURN THE FIRST CATEGORY ASSOCIATED WITH THIS OBJECT return(webpage.Categories[0]); } } // LOOK FOR A LINK Link link = LinkDataSource.Load(GetLinkId()); if (link != null) { int count = link.Categories.Count; if (count > 0) { if (count > 1) { // CHECK IF LAST VISITED CATEGORY IS ASSOCIATED WITH THIS OBJECT int lastCategoryId = PageVisitHelper.LastVisitedCategoryId; if (link.Categories.Contains(lastCategoryId)) { return(lastCategoryId); } } // RETURN THE FIRST CATEGORY ASSOCIATED WITH THIS OBJECT return(link.Categories[0]); } } // SEE IF A PARENT CATEGORY ID IS FOUND int parentCategoryId = AlwaysConvert.ToInt(request.QueryString["ParentCategoryId"]); if (parentCategoryId != 0) { return(parentCategoryId); } // NO CATEGORY CONTEXT FOUND return(0); }
public static List <DocumentMetadata> GetValidParentTypes(Webpage webpage) { Type type = webpage.Unproxy().GetType(); return(DocumentMetadatas.FindAll(metadata => metadata.ValidChildrenTypes.Contains(type))); }
public override void RenderTabPane(HtmlHelper <Webpage> html, Webpage webpage) { html.RenderAction("Show", "Versions", new { document = webpage }); }
public override string Name(Webpage webpage) { return("Versions"); }
public override string Name(Webpage webpage) { return(string.Format("Entries ({0})", webpage.FormPostingsCount())); }