本文整理汇总了C#中Data.EntityFramework.BLL.TriglavBL.getAllPosts方法的典型用法代码示例。如果您正苦于以下问题:C# TriglavBL.getAllPosts方法的具体用法?C# TriglavBL.getAllPosts怎么用?C# TriglavBL.getAllPosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data.EntityFramework.BLL.TriglavBL
的用法示例。
在下文中一共展示了TriglavBL.getAllPosts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
using (TriglavBL temp = new TriglavBL())
{
Directory directory = FSDirectory.Open(new DirectoryInfo("J:/Triglav_Web_App/Triglav/Web/Lucene/LuceneIndex"));
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_29);
var writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
List<Post> sviPostovi = temp.getAllPosts(1);
foreach (var post in sviPostovi)
{
var document = new Document();
document.Add(new Field("id", Convert.ToString(post.id), Field.Store.YES, Field.Index.NOT_ANALYZED));
document.Add(new Field("Naslov", post.Naslov, Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("Sadrzaj", post.Sadrzaj, Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("Sazetak", post.Sazetak, Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("Tagovi", post.Tagovi, Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("DatumKreiranja", Convert.ToString(post.DatumKreiranja), Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("DatumZadnjeIzmjene", Convert.ToString(post.DatumZadnjeIzmjene), Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("DatumZadnjeAktivnosti", Convert.ToString(post.DatumZadnjeAktivnosti), Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("BrojOdgovora", Convert.ToString(post.BrojOdgovora), Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("Likes", Convert.ToString(post.Likes), Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("Unlikes", Convert.ToString(post.Unlikes), Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("VlasnikId", Convert.ToString(post.VlasnikID), Field.Store.YES, Field.Index.ANALYZED));
document.Add(new Field("Unlikes", Convert.ToString(post.Unlikes), Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(document);
}
writer.Optimize();
writer.Close();
}
}
示例2: SaveValidation
private bool SaveValidation()
{
using (TriglavBL temp = new TriglavBL())
{
List<Post> listaClanaka = temp.getAllPosts(1);
foreach (var clanak in listaClanaka)
{
if (String.Compare(txt_Naslov.Text, Convert.ToString(clanak.Naslov), true) == 0)
{
Response.Write("<script>alert('Greška! Članak pod ovim imenom već postoji.\n Pokušajte promijeniti naslov članka.');</script>");
return false;
}
}
if (txt_Naslov.Text.Count() < 3)
{
Response.Write("<script>alert('Greška! Naziv mora biti duži od 3 karaktera.');</script>");
return false;
}
if (txt_Sazetak.Text.Count() < 3)
{
Response.Write("<script>alert('Greška! Sažetak mora biti duži od 3 karaktera.');</script>");
return false;
}
if (txt_Sadrzaj.Text.Count() < 3)
{
Response.Write("<script>alert('Greška! Sadržaj mora biti duži od 3 karaktera.');</script>");
return false;
}
if (txt_Tagovi.Text.Count() < 3)
{
Response.Write("<script>alert('Greška! Tagovi moraju biti duži od 3 karaktera.');</script>");
return false;
}
return true;
}
}