本文整理汇总了C#中Article类的典型用法代码示例。如果您正苦于以下问题:C# Article类的具体用法?C# Article怎么用?C# Article使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Article类属于命名空间,在下文中一共展示了Article类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateContentItem
/// <summary>
/// This should only run after the Article exists in the data store.
/// </summary>
/// <returns>The newly created ContentItemID from the data store.</returns>
public ContentItem CreateContentItem(Article objArticle, int tabId)
{
var typeController = new ContentTypeController();
var colContentTypes = (from t in typeController.GetContentTypes() where t.ContentType == ContentTypeName select t);
int contentTypeId;
if (colContentTypes.Count() > 0)
{
var contentType = colContentTypes.Single();
contentTypeId = contentType == null ? CreateContentType() : contentType.ContentTypeId;
}
else
{
contentTypeId = CreateContentType();
}
var objContent = new ContentItem
{
Content = objArticle.Title + " " + HttpUtility.HtmlDecode(objArticle.Description),
ContentTypeId = contentTypeId,
Indexed = false,
ContentKey = "aid=" + objArticle.ArticleId,
ModuleID = objArticle.ModuleId,
TabID = tabId
};
objContent.ContentItemId = Util.GetContentController().AddContentItem(objContent);
// Add Terms
var cntTerm = new Terms();
cntTerm.ManageArticleTerms(objArticle, objContent);
return objContent;
}
开发者ID:irobinson,项目名称:DnnSimpleArticle,代码行数:38,代码来源:Content.cs
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (((DataView)odsDieuTriHo.Select()).Count <= DataPager1.PageSize)
{
DataPager1.Visible = false;
}
string strTitle, strDescription, strMetaTitle, strMetaDescription;
if (!string.IsNullOrEmpty(Request.QueryString["di"]))
{
var oArticle = new Article();
var oArticleCategory = new ArticleCategory();
var dv = oArticle.ArticleSelectOne(Request.QueryString["di"]).DefaultView;
if (dv != null && dv.Count <= 0) return;
var row = dv[0];
strTitle = Server.HtmlDecode(row["ArticleTitleEn"].ToString());
strDescription = Server.HtmlDecode(row["DescriptionEn"].ToString());
strMetaTitle = Server.HtmlDecode(row["MetaTittleEn"].ToString());
strMetaDescription = Server.HtmlDecode(row["MetaDescriptionEn"].ToString());
}
else
{
strTitle = strMetaTitle = "Cough Treatment";
strDescription = "";
strMetaDescription = "";
}
Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
Header.Controls.Add(meta);
}
}
开发者ID:hungtien408,项目名称:web-bezut,代码行数:35,代码来源:dieu-tri-ho.aspx.cs
示例3: AddEntity
public void AddEntity()
{
//Please use a normal running database and not the ones contained in the Base Class
using (var store = new DocumentStore())
{
store.Conventions.FindIdentityPropertyNameFromEntityName = typeName => "ID";
store.Conventions.FindIdentityProperty = prop => prop.Name == "ID";
IDocumentSession session = store.OpenSession();
var article = new Article
{
Title = "Article 1",
SubTitle = "Article 1 subtitle",
PublishDate = DateTime.UtcNow.Add(TimeSpan.FromDays(1))
};
session.Store(article);
session.SaveChanges();
Assert.True(article.ID > 0);
var insertedArticle = session.Query<Article>().Where(
a => a.ID.In(new int[] {article.ID}) && a.PublishDate > DateTime.UtcNow).FirstOrDefault();
Assert.NotNull(insertedArticle);
}
}
开发者ID:kpantos,项目名称:ravendb,代码行数:27,代码来源:DynamicId.cs
示例4: ArticleButton
public ArticleButton(Article art)
{
ArticleButtonDesign design = null;
string designdef = DatabaseHandler.GetArticleButtonDesignXml(art);
if (designdef == "")
design = ArticleButtonDesign.GetDefaultDesign();
else
{
design = new ArticleButtonDesign();
XmlReader reader = XmlReader.Create(new StringReader(designdef));
design.ReadXml(reader);
}
this.BackColor = design.BackColor;
this.ForeColor = design.ForeColor;
this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.FlatAppearance.BorderSize = 0;
this.FlatAppearance.BorderColor = Color.Black;
this.Size = new Size(120, 30);
this.Location = CalculateArticleLocation(art.Position);
if (!art.IsEnabled)
{
this.Enabled = false;
this.Font = new Font(this.Font, FontStyle.Strikeout);
this.BackColor = Color.FromArgb(234, 234, 234);
}
if (!art.IsVisible) this.Visible = false;
if (!art.DoPrint) this.Font = new Font(this.Font, FontStyle.Italic);
this.Text = art.Name;
}
开发者ID:fhoner,项目名称:Kasse,代码行数:34,代码来源:ArticleButton.cs
示例5: Main
static void Main(string[] args)
{
OrderedMultiDictionary<double, Article> articles = new OrderedMultiDictionary<double, Article>(true);
//filling the dictionary takes a few seconds
for (int i = 0; i <= 2000000; i++)
{
double price = i / 100.3;
Article article = new Article(i * 971, Math.Round(price, 2), i.ToString(), i.ToString());
articles.Add(price, article);
}
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
var articlesInRange = GetArticlesInPriceRange(articles, 1d, 300000d);
stopwatch.Stop();
//Uncomment to see found items title and price
StringBuilder sb = new StringBuilder();
//foreach (var node in articlesInRange)
//{
// foreach (var item in node.Value)
// {
// sb.AppendFormat("{0}: {1}\n", item.Title, item.Price);
// }
//}
Console.WriteLine(sb.ToString());
Console.WriteLine("Found count: {0}", articlesInRange.Count);
Console.WriteLine("Items in range found in: {0}", stopwatch.Elapsed);
}
开发者ID:Dyno1990,项目名称:TelerikAcademy-1,代码行数:34,代码来源:PriceRange.cs
示例6: AddEntity
public void AddEntity()
{
//SetUp
using (var store = NewDocumentStore())
{
store.Conventions.FindIdentityPropertyNameFromEntityName = (typeName) => "ID";
store.Conventions.FindIdentityProperty = prop => prop.Name == "ID";
using (IDocumentSession session = store.OpenSession())
{
var article = new Article()
{
Title = "Article 1",
SubTitle = "Article 1 subtitle",
PublishDate = DateTime.UtcNow.Add(TimeSpan.FromDays(1))
};
session.Store(article);
session.SaveChanges();
Assert.True(article.ID > 0);
var insertedArticle = session.Query<Article>().Where(
a => a.ID.In(new int[] {article.ID}) && a.PublishDate > DateTime.UtcNow).FirstOrDefault();
Assert.NotNull(insertedArticle);
}
}
}
开发者ID:925coder,项目名称:ravendb,代码行数:29,代码来源:DyanmicId.cs
示例7: GetFilesByArticle
public List<string> GetFilesByArticle(Article article)
{
var findNameBom = GetFileNameToFindBom(article);
var findNameDoc = GetFileNameToFindDoc(article);
var pathDataBom = Path.Combine(LocationDirectory, "BOM");
var pathDataDoc = Path.Combine(LocationDirectory, "Doc");
var dataFilesPatchBom = new List<string>();
var taskBom = new Task(() =>
{
dataFilesPatchBom.AddRange(Directory.GetFiles(pathDataBom, "*.pdf", SearchOption.AllDirectories));
dataFilesPatchBom.AddRange(Directory.GetFiles(pathDataBom, "*.tif*", SearchOption.AllDirectories));
});
taskBom.Start();
var dataFilesPatchDoc = new List<string>();
var taskDoc = new Task(() =>
{
dataFilesPatchDoc.AddRange(Directory.GetFiles(pathDataDoc, "*.pdf", SearchOption.AllDirectories));
dataFilesPatchDoc.AddRange(Directory.GetFiles(pathDataDoc, "*.tif*", SearchOption.AllDirectories));
});
taskDoc.Start();
Task.WaitAll(taskDoc, taskBom);
var files = dataFilesPatchBom.Where(x => x.Replace(pathDataBom, string.Empty).Contains(findNameBom)).Union(dataFilesPatchDoc.Where(y => y.Replace(pathDataDoc, string.Empty).Contains(findNameDoc))).ToList();
return files;
}
开发者ID:ctukc-nt,项目名称:UPPY,代码行数:32,代码来源:SiemensDocsFilesNameGetter.cs
示例8: Add
public void Add(Article article)
{
ArticleBundle targetBundle = null;
foreach (ArticleBundle bundle in articleBundleSet)
{
if (bundle.MainArticle.Blog != article.Blog && AreSame(bundle.MainArticle, article))
{
targetBundle = bundle;
break;
}
}
if (targetBundle != null)
{
articleBundleSet.Remove(targetBundle);
targetBundle.Bundle(article);
articleBundleSet.Add(targetBundle);
}
else
{
articleBundleSet.Add(new ArticleBundle(article));
while (articleBundleSet.Count > maxNumArticleBundles)
{
articleBundleSet.Remove(articleBundleSet.Max);
}
}
}
开发者ID:sinshu,项目名称:oit_antenna,代码行数:26,代码来源:ArticleBundleHolder.cs
示例9: DoDelete
public ActionResult DoDelete(Article article)
{
article.ACategoryName = "recycle";
DataOperator dop = new DataOperator(Runtime.SqlConfig);
dop.Update(article);
return Redirect("/Admin/Success.do");
}
开发者ID:Jeremaihloo,项目名称:CSharpProject,代码行数:7,代码来源:ArticleEditorController.cs
示例10: ParsePagingPage
public override IEnumerable<Article> ParsePagingPage(string rawHtml)
{
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(rawHtml);
var articleNodes = htmlDoc.DocumentNode.SelectNodes("//tr[@height=28 and @bgcolor='white']");
if (articleNodes == null)
{
yield break;
}
foreach (var articleNode in articleNodes)
{
var link = articleNode.SelectSingleNode("td[@class='bbsSubject']").SelectSingleNode("a").Attributes["href"].Value;
const string token = "=&l=";
var articleId = int.Parse(link.Substring(link.LastIndexOf(token) + token.Length));
var article = new Article
{
Game = (int)Games.tera,
TargetSite = (int)TargetSites.inven,
CategoryId = CategoryId,
ArticleId = articleId,
Link = link,
Author = articleNode.SelectSingleNode("td[@align='left']").InnerText.Trim(),
};
yield return article;
}
}
开发者ID:hyunjong-lee,项目名称:Mastermind_bluehole,代码行数:30,代码来源:InvenCrawler.cs
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string strTitle, strDescription, strMetaTitle, strMetaDescription;
if (!string.IsNullOrEmpty(Request.QueryString["tv"]))
{
var oTuVan = new Article();
var dv = oTuVan.ArticleSelectOne(Request.QueryString["tv"]).DefaultView;
if (dv != null && dv.Count <= 0) return;
var row = dv[0];
strTitle = Server.HtmlDecode(row["ArticleTitle"].ToString());
strDescription = Server.HtmlDecode(row["Description"].ToString());
strMetaTitle = Server.HtmlDecode(row["MetaTittle"].ToString());
strMetaDescription = Server.HtmlDecode(row["MetaDescription"].ToString());
//hdnSanPham.Value = progressTitle(dv[0]["ProductCategoryName"].ToString()) + "-pci-" + dv[0]["ProductCategoryID"].ToString() + ".aspx";
}
else
{
strTitle = strMetaTitle = "Tư Vấn";
strDescription = "";
strMetaDescription = "";
}
Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
Header.Controls.Add(meta);
lblTitle.Text = strTitle;
lblTitle2.Text = strTitle;
}
}
开发者ID:hungtien408,项目名称:web-quanaotreem,代码行数:34,代码来源:tu-van-chi-tiet.aspx.cs
示例12: GetMockRepository
public static Repository GetMockRepository(
Article article = null,
ArticleRevision articleRevision = null,
ArticleRedirect articleRedirect = null)
{
var documentStore =
new EmbeddableDocumentStore
{
Configuration =
{
RunInUnreliableYetFastModeThatIsNotSuitableForProduction
= true,
DefaultStorageTypeName = "munin",
RunInMemory = true,
}
}.Initialize();
DocumentStoreInitializer.InitDocumentStore(documentStore);
var repository = new Repository(documentStore);
if (article != null)
{
repository.SaveArticle(article, articleRevision);
}
if (articleRedirect != null)
{
string articleId = articleRedirect.RedirectToArticleSlug;
repository.SaveArticleRedirects(articleId, articleRedirect);
}
return new Repository(documentStore);
}
开发者ID:sebnilsson,项目名称:WikiDown,代码行数:34,代码来源:RepositoryTestHelper.cs
示例13: GetResponse
public AbstractResponse GetResponse(ReplyInfo reply, string openId)
{
if (reply.MessageType == MessageType.Text)
{
TextReplyInfo info = reply as TextReplyInfo;
TextResponse response = new TextResponse {
CreateTime = DateTime.Now,
Content = info.Text
};
if (reply.Keys == "登录")
{
string str = string.Format("http://{0}/Vshop/Login.aspx?SessionId={1}", HttpContext.Current.Request.Url.Host, openId);
response.Content = response.Content.Replace("$login$", string.Format("<a href=\"{0}\">一键登录</a>", str));
}
return response;
}
NewsResponse response2 = new NewsResponse {
CreateTime = DateTime.Now,
Articles = new List<Article>()
};
foreach (NewsMsgInfo info2 in (reply as NewsReplyInfo).NewsMsg)
{
Article item = new Article {
Description = info2.Description,
PicUrl = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, info2.PicUrl),
Title = info2.Title,
Url = string.IsNullOrEmpty(info2.Url) ? string.Format("http://{0}/Vshop/ImageTextDetails.aspx?messageId={1}", HttpContext.Current.Request.Url.Host, info2.Id) : info2.Url
};
response2.Articles.Add(item);
}
return response2;
}
开发者ID:ZhangVic,项目名称:asp1110git,代码行数:32,代码来源:CustomMsgHandler.cs
示例14: addSentencesToArticle
private static void addSentencesToArticle(string file, Article article)
{
Sentence current = new Sentence();
string sentence = null;
string[] words = file.Split('\n');
for (int i = 0; i < words.Length; i++)
{
if (words[i] == "")
{
//now we are at the end of a sentence
if (sentence != null)
{
addWordsToSentence(sentence, current);
sentence = null;
article.addSentence(current); //add sentence to the article
current = new Sentence(); //empty the sentence;
}
}
else
{
sentence += (words[i] + '\n'.ToString());
}
}
if (sentence != null) //maybe the last sentence
{
addWordsToSentence(sentence, current);
article.addSentence(current);
}
}
开发者ID:yassersouri,项目名称:Corpus-Builder,代码行数:29,代码来源:ArticleUtils.cs
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BLArticle bll = new BLArticle();
art = bll.SelectOne(Request.QueryString["Id"]);
if (art != null)
{
this.artName.InnerText = art.ArticleName;
this.artDate.InnerText = art.AddDate.ToString("yyyy-MM-dd HH:mm:ss");
string path = GetPath(art.ArticlePath);
string artContent="出错了...";
try
{
artContent = System.Text.Encoding.Default.GetString(System.IO.File.ReadAllBytes(path));
}
catch { }
//artContent = System.Text.Encoding.Default.GetString(System.IO.File.ReadAllBytes(art.ArticlePath));
this.articleContent.InnerHtml = artContent;
fileName=art.ArticleName+art.AddDate.ToString("yyyy-MM-dd.HH-mm-ss");
listReview = new BLReview().SelectByArticleId(art.Id.ToString());
}
}
}
开发者ID:duxiyao,项目名称:dxyweb_online,代码行数:27,代码来源:ArticleMaster.aspx.cs
示例16: DoUpdate
public ActionResult DoUpdate(Article article)
{
DataOperator dop = new DataOperator(Runtime.SqlConfig);
article.ATime = DateTime.Now;
dop.Update(article);
return Redirect("/Admin/Success.do");
}
开发者ID:Jeremaihloo,项目名称:CSharpProject,代码行数:7,代码来源:ArticleEditorController.cs
示例17: GetListTest
public void GetListTest()
{
var obj = new Article("object");
obj.SetList<int>("multifield", new[] { 1, 2, 3, 4, 5 });
var list = obj.GetList<decimal>("multifield");
Assert.IsTrue(list.Intersect(new decimal[] { 1, 2, 3, 4, 5 }).Count() == 5);
}
开发者ID:neilunadkat,项目名称:appacitive-dotnet-sdk,代码行数:7,代码来源:MultiValuedFixture.cs
示例18: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string strTitle, strDescription, strMetaTitle, strMetaDescription;
if (!string.IsNullOrEmpty(Request.QueryString["tt"]))
{
var oArticle = new Article();
var oArticleCategory = new ArticleCategory();
var dv = oArticle.ArticleSelectOne(Request.QueryString["tt"]).DefaultView;
if (dv != null && dv.Count <= 0) return;
var row = dv[0];
var dv2 = oArticleCategory.ArticleCategorySelectOne(row["ArticleCategoryID"].ToString()).DefaultView;
strTitle = Server.HtmlDecode(row["ArticleTitleEn"].ToString());
strDescription = Server.HtmlDecode(row["DescriptionEn"].ToString());
strMetaTitle = Server.HtmlDecode(row["MetaTittleEn"].ToString());
strMetaDescription = Server.HtmlDecode(row["MetaDescriptionEn"].ToString());
lblTitleNews.Text = dv2[0]["ArticleCategoryNameEn"].ToString();
}
else
{
strTitle = strMetaTitle = "News";
strDescription = "";
strMetaDescription = "";
}
Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
Header.Controls.Add(meta);
}
}
开发者ID:hungtien408,项目名称:web-bezut,代码行数:34,代码来源:tin-tuc-chi-tiet.aspx.cs
示例19: GetArticlesAfterAsync
public async Task<List<Article>> GetArticlesAfterAsync (Article latestArticle, Priority priority)
{
List<Article> articles = new List<Article> ();
Task<List<Article>> getArticlesTask;
var timestamp = latestArticle.CreatedAt.ToUnixTimestamp ();
switch (priority) {
case Priority.Background:
getArticlesTask = _apiService.Background.GetArticlesAfter (timestamp, ApiService.Device);
break;
case Priority.UserInitiated:
getArticlesTask = _apiService.UserInitiated.GetArticlesAfter (timestamp, ApiService.Device);
break;
case Priority.Speculative:
getArticlesTask = _apiService.Speculative.GetArticlesAfter (timestamp, ApiService.Device);
break;
default:
getArticlesTask = _apiService.UserInitiated.GetArticlesAfter (timestamp, ApiService.Device);
break;
}
if (CrossConnectivity.Current.IsConnected)
{
articles = await Policy
.Handle<WebException> ()
.WaitAndRetryAsync (2, retryAttempt => TimeSpan.FromSeconds (Math.Pow (2, retryAttempt)))
.ExecuteAsync(async () => await getArticlesTask);
}
return articles.Select(article => {
article.ImageUrl = ApiService.ApiBaseAddress + article.ImageUrl;
return article;
}).ToList();
}
开发者ID:dbeattie71,项目名称:HDP-Mobil,代码行数:35,代码来源:NewsService.cs
示例20: PopulateBodyTransitions
private void PopulateBodyTransitions(Article a)
{
List<string> tokens = Tokenize(a.Body);
List<string> history = new List<string>();
for (int i = 0; i < tokens.Count; i++) {
List<string> previous = new List<string>(history);
Context ctx;
while (previous.Count > 0) {
Dictionary<string, int> next;
int count = 0;
ctx = new Context(previous.ToArray());
_BodyModel.TryGetValue(ctx, out next);
if (next == null) next = new Dictionary<string, int>();
next.TryGetValue(tokens[i], out count);
if (next.Count == 0) _BodyModel[ctx] = next;
next[tokens[i]] = count + 1;
Console.WriteLine("Set transition for {0} -> {2} to weight {1}", ctx.ToString(), count + 1, tokens[i]);
previous.RemoveAt(0);
}
history.Add(tokens[i]);
while (history.Count > MaxDegree) {
history.RemoveAt(0);
}
}
}
开发者ID:dbalatero,项目名称:pitchspork,代码行数:35,代码来源:PitchsporkModel_building.cs
注:本文中的Article类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论