本文整理汇总了C#中Voodoo.Basement.DataEntities.CreateQuery方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.CreateQuery方法的具体用法?C# DataEntities.CreateQuery怎么用?C# DataEntities.CreateQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voodoo.Basement.DataEntities
的用法示例。
在下文中一共展示了DataEntities.CreateQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BookSearch
public List<Book> BookSearch(string str_sql)
{
using (DataEntities ent = new DataEntities())
{
return ent.CreateQuery<Book>(string.Format("select * from Book where {0}",str_sql)).ToList();
}
}
示例2: BookExist
public bool BookExist(string str_sql)
{
using (DataEntities ent = new DataEntities())
{
return ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql)).Count()>0;
}
}
示例3: BookFind
public Book BookFind(string str_sql)
{
using (DataEntities ent = new DataEntities())
{
return ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql)).FirstOrDefault();
}
}
示例4: booklist
/// <summary>
/// 书籍列表
/// </summary>
/// <param name="top"></param>
/// <param name="custitle"></param>
/// <param name="m_where"></param>
/// <param name="orderby"></param>
/// <param name="htmlTemp"></param>
/// <returns></returns>
public static string booklist(string top, string custitle, string m_where, string orderby, string htmlTemp)
{
StringBuilder sb = new StringBuilder();
using (DataEntities ent = new DataEntities())
{
var list = ent.CreateQuery<Book>(string.Format("select VALUE t from Book as t where {0} order by {1} limit {2}",m_where,orderby,top));
var i = 0;
foreach (var q in list)
{
i++;
string item = htmlTemp;
item = item.Replace("{addtime}", q.Addtime.ToDateTime().ToString("yyyy-MM-dd"));
item=item.Replace("{author}",q.Author);
item=item.Replace("{classid}",q.ClassID.ToS());
item=item.Replace("{classname}",q.ClassName);
item=item.Replace("{clickcount}",q.ClickCount.ToS());
item=item.Replace("{corpusid}",q.CorpusID.ToS());
item=item.Replace("{corpustitle}",q.CorpusTitle);
item=item.Replace("{enable}",q.Enable.ToBoolean().ToChinese());
item=item.Replace("{faceimage}",q.FaceImage);
item=item.Replace("{id}",q.ID.ToS());
item=item.Replace("{intro}",q.Intro);
item=item.Replace("{isfirstpost}",q.IsFirstPost.ToBoolean().ToChinese());
item=item.Replace("{isvip}",q.IsVip.ToBoolean().ToChinese());
item=item.Replace("{lastchapterid}",q.LastChapterID.ToS());
item=item.Replace("{lastchaptertitle}",q.LastChapterTitle);
item=item.Replace("{lastvipchapterid}",q.LastVipChapterID.ToS());
item=item.Replace("{lastvipchaptertitle}",q.LastVipChapterTitle);
item=item.Replace("{length}",q.Length.ToS());
item=item.Replace("{replycount}",q.ReplyCount.ToS());
item=item.Replace("{savecount}",q.SaveCount.ToS());
item=item.Replace("{status}",q.Status==0?"连载中":"已完结");
item=item.Replace("{title}",q.Title);
item=item.Replace("{tjcount}",q.TjCount.ToS());
item=item.Replace("{updatetime}",q.UpdateTime.ToDateTime().ToString("yyyy-MM-dd"));
item=item.Replace("{vipupdatetime}",q.VipUpdateTime.ToDateTime().ToString("yyyy-MM-dd"));
item=item.Replace("{ztid}",q.ZtID.ToS());
item=item.Replace("{ztname}",q.ZtName);
item=item.Replace("{title}",q.Title);
item=item.Replace("{url}",BasePage.GetBookUrl(q,q.GetClass()));
item = item.Replace("{ftitle}", custitle.ToInt32() > 0 ? q.Title.CutString(custitle.ToInt32()) : q.Title);
item = item.Replace("{index}", (i - 1).ToS());
item = item.Replace("{rownum}", (i).ToS());
sb.Append(item);
}
}
return sb.ToS();
}
示例5: BookDelete
public void BookDelete(string str_sql)
{
//删除文件
DataEntities ent = new DataEntities();
var books = ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql)).ToList();
foreach (var book in books)
{
DirectoryInfo dir = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(BasePage.GetBookUrl(book, book.GetClass()))).Directory;
if (dir.Exists)
{
dir.Delete(true);
}
ent.DeleteObject(book);
}
ent.SaveChanges();
ent.Dispose();
}
示例6: ClassDelete
public void ClassDelete(string str_sql)
{
DataEntities ent = new DataEntities();
var books = ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql));
foreach (var b in books)
{
ent.DeleteObject(b);
}
ent.SaveChanges();
ent.Dispose();
}
示例7: getmovielist
/// <summary>
/// 获取电影列表
/// </summary>
/// <param name="top">条数</param>
/// <param name="custitle">标题截取</param>
/// <param name="m_where">条件语句</param>
/// <param name="htmlTemp">模板</param>
/// <returns></returns>
public static string getmovielist(string top, string custitle, string m_where, string htmlTemp)
{
StringBuilder sb = new StringBuilder();
using (DataEntities ent = new DataEntities())
{
List<MovieInfo> movies = ent.CreateQuery<MovieInfo>(string.Format("select top {0} * from MovieInfo where {1}", top, m_where)).ToList();
var i = 0;
foreach (MovieInfo m in movies)
{
i++;
string item = htmlTemp;
item = item.Replace("{url}", BasePage.GetMovieUrl(m, m.GetClass()));
item = item.Replace("{id}", m.id.ToS());
item = item.Replace("{authors}", m.Actors);
item = item.Replace("{classid}", m.ClassID.ToS());
item = item.Replace("{classname}", m.ClassName);
item = item.Replace("{director}", m.Director);
item = item.Replace("{faceimage}", m.FaceImage);
item = item.Replace("{inserttime}", m.InsertTime.ToDateTime().ToString("yyyy-MM-dd"));
item = item.Replace("{intro}", m.Intro);
item = item.Replace("{ismovie}", m.IsMove == true ? "电影" : "电视剧");
item = item.Replace("{lastdramatitle}", m.LastDramaTitle);
item = item.Replace("{location}", m.Location);
item = item.Replace("{publicyear}", m.PublicYear);
item = item.Replace("{status}", m.Status == 0 ? "更新中" : "完结");
item = item.Replace("{tags}", m.Tags);
item = item.Replace("{title}", m.Title);
item = item.Replace("{ftitle}", m.Title.CutString(custitle.ToInt32()));
item = item.Replace("{updatetime}", m.UpdateTime.ToDateTime().ToString("yyyy-MM-dd"));
item = item.Replace("{clickcount}", m.ClickCount.ToS());
item = item.Replace("{replycount}", m.ReplyCount.ToS());
item = item.Replace("{scoreavg}", m.ScoreAvg.ToS());
item = item.Replace("{rownum}", i.ToS());
item = item.Replace("{index}", (i - 1).ToS());
sb.Append(item);
}
}
return sb.ToS();
}
示例8: getlocationlist
/// <summary>
/// 获取地区列表
/// </summary>
/// <param name="m_where"></param>
/// <param name="top"></param>
/// <param name="templatestring"></param>
/// <returns></returns>
public static string getlocationlist(string cutstring, string m_where, string top, string templatestring)
{
StringBuilder sb = new StringBuilder();
DataEntities ent = new DataEntities();
var movies = //MovieInfoView.GetModelList(m_where);
ent.CreateQuery<MovieInfo>(string.Format("select * from MovieInfo where {0}", m_where)).ToList();
ent.Dispose();
var locations = movies.GroupBy(p => p.Location).OrderByDescending(p => p.Count()).Take(top.ToInt32(10));
foreach (var location in locations)
{
string tmp = templatestring;
tmp = tmp.Replace("{name}", location.Key.Replace(":", ""));
tmp = tmp.Replace("{fname}", location.Key.Replace(":", "").CutString(cutstring.ToInt32(100)));
sb.AppendLine(tmp);
}
return sb.ToS();
}
示例9: getindustrylist
/// <summary>
/// 获取行业列表
/// </summary>
/// <param name="top"></param>
/// <param name="custitle"></param>
/// <param name="m_where"></param>
/// <param name="orderby"></param>
/// <param name="htmlTemp"></param>
/// <returns></returns>
public static string getindustrylist(string top, string custitle, string m_where, string orderby, string htmlTemp)
{
StringBuilder sb = new StringBuilder();
using (DataEntities ent = new DataEntities())
{
List<JobIndustry> list = ent.CreateQuery<JobIndustry>(string.Format("select VALUE t from JobIndustry as t where {1} order by {2} limit {0}", top, m_where, orderby)).ToList();
var i = 0;
foreach (var q in list)
{
i++;
string item = htmlTemp;
item = item.Replace("{id}", q.ID.ToS());
item = item.Replace("{name}", q.Name);
item = item.Replace("{parentid}", q.ParentID.ToS());
item = item.Replace("{isleaf}", q.IsLeaf.ToS());
item = item.Replace("{index}", (i - 1).ToS());
sb.Append(item);
}
return sb.ToS();
}
}
示例10: getclasslist
/// <summary>
/// 获取类别列表
/// </summary>
/// <param name="top">获取的条数</param>
/// <param name="custitle">标题截取长度</param>
/// <param name="m_where">条件语句</param>
/// <param name="htmlTemp">模板</param>
/// <returns></returns>
public static string getclasslist(string top, string custitle, string m_where, string htmlTemp)
{
StringBuilder sb = new StringBuilder();
DataEntities ent = new DataEntities();
List<Class> cls = ent.CreateQuery<Class>(string.Format("select VALUE t from Class as t where {1} order by t.id desc limit {0}", top, m_where)).ToList();
ent.Dispose();
foreach (Class c in cls)
{
string item = htmlTemp;
item = item.Replace("{url}", BasePage.GetClassUrl(c));
item = item.Replace("{alter}", c.Alter);
item = item.Replace("{classdescription}", c.ClassDescription);
item = item.Replace("{classfolder}", c.ClassForder);
item = item.Replace("{classicon}", c.ClassICON);
item = item.Replace("{classkeywords}", c.ClassKeywords);
item = item.Replace("{classname}", c.ClassName);
item = item.Replace("{fclassname}", c.ClassName.CutString(custitle.ToInt32(10)));
item = item.Replace("{classpageextname}", c.ClassPageExtName);
item = item.Replace("{id}", c.ID.ToS());
sb.Append(item);
}
return sb.ToS();
}
示例11: getclassbyfilter
/// <summary>
/// 根据条件获取分类列表
/// </summary>
/// <param name="m_where">条件语句</param>
/// <returns></returns>
public static string getclassbyfilter(string m_where)
{
DataEntities ent = new DataEntities();
List<Class> cls = //ClassView.GetModelList(m_where);
ent.CreateQuery<Class>(string.Format("select VALUE t from Class as t where {0}", m_where)).ToList();
StringBuilder sb = new StringBuilder();
foreach (Class c in cls)
{
sb.AppendLine(string.Format("<a href=\"{0}\">{1}</a> ",
BasePage.GetClassUrl(c),
c.ClassName
));
}
ent.Dispose();
return sb.ToString();
}
示例12: ChapterDelete
public void ChapterDelete(string str_sql)
{
//删除文件
DataEntities ent = new DataEntities();
var chapters = ent.CreateQuery<BookChapter>(string.Format("select * from BookChapter where {0}",str_sql));
foreach (var chapter in chapters)
{
string htmlPath = HttpContext.Current.Server.MapPath(BasePage.GetBookChapterUrl(chapter, chapter.GetClass()));
string txtPath = HttpContext.Current.Server.MapPath(BasePage.GetBookChapterTxtUrl(chapter, chapter.GetClass()));
Voodoo.IO.File.Delete(htmlPath);
Voodoo.IO.File.Delete(txtPath);
ent.DeleteObject(chapter);
}
ent.SaveChanges();
ent.Dispose();
}
示例13: ClassSearch
public List<Class> ClassSearch(string str_sql)
{
using (DataEntities ent = new DataEntities())
{
return ent.CreateQuery<Class>(string.Format("select * from Class where {0}", str_sql)).ToList();
}
}
示例14: ClassFind
public Class ClassFind(string str_sql)
{
using (DataEntities ent = new DataEntities())
{
return ent.CreateQuery<Class>(string.Format("select * from Class where {0}", str_sql)).FirstOrDefault();
}
}
示例15: cmsflashpic
/// <summary>
/// 轮播Flash
/// </summary>
/// <param name="ClassID"></param>
/// <param name="count"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="showTitle"></param>
/// <param name="titleLength"></param>
/// <param name="interval"></param>
/// <param name="ExtSql"></param>
/// <param name="Order"></param>
/// <returns></returns>
public static string cmsflashpic(string ClassID, string count, string width, string height, string showTitle, string titleLength, string interval, string ExtSql, string Order)
{
DataEntities ent = new DataEntities();
StringBuilder sb = new StringBuilder();
sb.AppendLine("<!--开始FLASH-->");
sb.AppendLine("<div class=\"flash\">");
sb.AppendLine("<script type=\"text/javascript\">");
sb.AppendLine("<!--");
sb.AppendLine(string.Format("var interval_time={0};", interval));
sb.AppendLine(string.Format("var focus_width={0};", width));
sb.AppendLine(string.Format("var focus_height={0};", height));
if (showTitle.ToInt32() > 0)
{
sb.AppendLine("var text_height=20;");
}
else
{
sb.AppendLine("var text_height=0;");
}
sb.AppendLine("var text_align=\"center\";");
sb.AppendLine("var swf_height = focus_height+text_height;");
sb.AppendLine("var swfpath=\"/e/data/images/pixviewer.swf\";");
sb.AppendLine("var swfpatha=\"/e/data/images/pixviewer.swf\";");
StringBuilder sb_pics = new StringBuilder();
StringBuilder sb_links = new StringBuilder();
StringBuilder sb_texts = new StringBuilder();
#region 图片变量
sb_pics.Append("var pics=\"");
sb_links.Append("var links=\"");
sb_texts.Append("var texts=\"");
string str_sql = string.Format("(ZtID='{0}' or ClassID='{1}') and len(TitleImage)>0", ClassID, ClassID);
if (ExtSql.Length > 0)
{
str_sql += " and " + ExtSql;
}
if (Order.Length > 0)
{
str_sql += " order by " + Order;
}
List<News> newses = //NewsView.GetModelList(str_sql, count.ToInt32());
ent.CreateQuery<News>(string.Format("select top {0} * from News where {1}", count, str_sql)).ToList();
newses = newses.Where(p => p.TitleImage.IndexOf(".gif") < 0).ToList();//不支持GIF文件
foreach (News n in newses)
{
sb_pics.Append(n.TitleImage + "|");
sb_links.Append(BasePage.GetNewsUrl(n, n.GetClass()) + "|");
sb_texts.Append(n.Title.CutString(titleLength.ToInt32()) + "|");
}
sb_pics = sb_pics.TrimEnd('|');
sb_links = sb_links.TrimEnd('|');
sb_texts = sb_texts.TrimEnd('|');
sb_pics.Append("\";\n");
sb_links.Append("\";\n");
sb_texts.Append("\";\n");
sb.Append(sb_pics.ToString());
sb.Append(sb_links.ToString());
sb.Append(sb_texts.ToString());
#endregion
#region 输出Flash
sb.AppendLine("document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"'+ focus_width +'\" height=\"'+ swf_height +'\">'); ");
sb.AppendLine("document.write('<param name=\"movie\" value=\"'+swfpath+'\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#ffffff\">'); ");
sb.AppendLine("document.write('<param name=\"menu\" value=\"false\"><param name=wmode value=\"opaque\">'); ");
sb.AppendLine("document.write('<param name=\"FlashVars\" value=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'\">'); ");
sb.AppendLine("document.write('<embed src=\"'+swfpath+'\" wmode=\"opaque\" FlashVars=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'\" menu=\"false\" bgcolor=\"#ffffff\" quality=\"high\" width=\"'+ focus_width +'\" height=\"'+ swf_height +'\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');");
sb.AppendLine("document.write('</object>');");
#endregion
sb.AppendLine("//-->");
sb.AppendLine("</script>");
sb.AppendLine("</div>");
ent.Dispose();
return sb.ToString();
}