private NameValueCollection getContentDataAsNameValue() { NameValueCollection postData = new NameValueCollection(); postData.Add("Id", CurrentContentId.ToString()); postData.Add("ClassName", "Content"); postData.Add("Title", editTitle.Text.Equals(editTitle.Tag) ? "" : editTitle.Text); postData.Add("SpotTitle", editSpotTitle.Text.Equals(editSpotTitle.Tag) ? "" : editSpotTitle.Text); if (editCategoryId.SelectedItem != null) { postData.Add("CategoryId", ((Item)editCategoryId.SelectedItem).Id.ToString()); } postData.Add("Description", editDescription.Text.Equals(editDescription.Tag) ? "" : editDescription.Text); postData.Add("Tags", editTags.Text.Equals(editTags.Tag) ? "" : editTags.Text); postData.Add("PublishDate", editPublishDate.Value.ToString("dd.MM.yyyy")); postData.Add("Metin", editMetin.Text.Equals(editMetin.Tag) ? "" : editMetin.Text); postData.Add("IsManset", editIsManset.Checked ? "1" : "0"); if (editAuthor.SelectedItem != null) { postData.Add("AuthorId", ((Item)editAuthor.SelectedItem).Id.ToString()); } return(postData); }
public void ProcessRequest(HttpContext context) { _site = null; if (SiteId != 0) { _site = new AWAPI_BusinessLibrary.library.SiteLibrary().Get(SiteId); } if (_site == null || !_site.isEnabled) { return; } string culture = CultureCode; if (String.IsNullOrEmpty(CultureCode)) { culture = _site.cultureCode; } _feed = new SyndicationFeed("AWAPI CMS Feed", "", null); _feed.Authors.Add(new SyndicationPerson("")); _feed.Categories.Add(new SyndicationCategory("contents")); _feed.AttributeExtensions.Add(new XmlQualifiedName("site"), _site.title); _feed.AttributeExtensions.Add(new XmlQualifiedName("sitelink"), _site.link); _feed.AttributeExtensions.Add(new XmlQualifiedName("defaultculture"), _site.cultureCode); _feed.AttributeExtensions.Add(new XmlQualifiedName("culture"), culture); _feed.AttributeExtensions.Add(new XmlQualifiedName("currentcontentid"), CurrentContentId.ToString()); _feed.AttributeExtensions.Add(new XmlQualifiedName("pagesize"), PageSize.ToString()); _feed.AttributeExtensions.Add(new XmlQualifiedName("pageindex"), PageIndex.ToString()); _feed.AttributeExtensions.Add(new XmlQualifiedName("servertime"), DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss")); AddParamsToFeed(); context.Response.ContentType = "text/xml"; context.Response.ContentEncoding = System.Text.Encoding.UTF8; switch (MethodName) { case "get": if (ContentId <= 0 && !String.IsNullOrEmpty(Alias)) { GetByAlias(SiteId, Alias, Lineage, Deep, culture); } else { Get(SiteId, ContentId, Lineage, Deep, culture); } break; case "getlist": GetList(SiteId, ContentId, Lineage, Deep, Tags, culture); break; case "gettaglist": GetTagList(SiteId); break; default: break; } string output = ""; XmlWriter writer = XmlWriter.Create(context.Response.Output); if (_feed != null) { switch (ReturnType) { case "atom": context.Response.ContentType = "application/atom+xml"; _feed.Description = new TextSyndicationContent("AWAPI Content in Atom 1.0 Feed Format"); Atom10FeedFormatter atom = new Atom10FeedFormatter(_feed); atom.WriteTo(writer); break; case "json": context.Response.ContentType = "application/json"; Rss20FeedFormatter rssFeed = new Rss20FeedFormatter(_feed); if (rssFeed != null) { output = Newtonsoft.Json.JsonConvert.SerializeObject(rssFeed); //JavaScriptSerializer ser = new JavaScriptSerializer(); //output = ser.Serialize(rssFeed); } break; default: //rss _feed.Description = new TextSyndicationContent("AWAPI Content in RSS 2.0 Feed Format"); context.Response.ContentType = "application/rss+xml"; Rss20FeedFormatter rss = new Rss20FeedFormatter(_feed); rss.WriteTo(writer); break; } } if (output != "") { context.Response.Write(output); } writer.Close(); }