本文整理汇总了C#中Voodoo.Basement.DataEntities.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.Dispose方法的具体用法?C# DataEntities.Dispose怎么用?C# DataEntities.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voodoo.Basement.DataEntities
的用法示例。
在下文中一共展示了DataEntities.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btn_Submit_Click
protected void btn_Submit_Click(object sender, EventArgs e)
{
DataEntities ent = new DataEntities();
if (UserAction.HasPostRight(ddl_Class.SelectedValue.ToInt32()) == false)
{
Js.AlertAndGoback("对不起,对于本栏目您没有提问的权限!如有疑问,请联系管理员");
ent.Dispose();
return;
}
User u=UserAction.opuser;
int rclass = WS.RequestInt("ddl_Class", WS.RequestInt("class"));
string content = WS.RequestString("txt_Content").TrimDbDangerousChar().Trim().HtmlDeCode();
string title = WS.RequestString("txt_Title").TrimDbDangerousChar().Trim();
if (rclass < 0)
{
Js.AlertAndGoback("栏目不能为空");
return;
}
if (content.IsNullOrEmpty())
{
Js.AlertAndGoback("提问内容不能为空");
return;
}
if (title.IsNullOrEmpty())
{
Js.AlertAndGoback("标题不能为空");
return;
}
Question qs = new Question();
qs.AskTime = DateTime.Now;
qs.ClassID = rclass;
qs.ClickCount = 0;
qs.Content = content;
qs.Title = title;
qs.UserID = u.ID;
qs.UserName = u.UserName;
qs.ZtID = 0;
ent.AddToQuestion(qs);
ent.SaveChanges();
CreatePage.CreateContentPage(qs, qs.GetClass());
CreatePage.CreateListPage(qs.GetClass(), 1);
string url = BasePage.GetQuestionUrl(qs, qs.GetClass());
ent.Dispose();
Js.AlertAndChangUrl("提问发布成功!", url);
}
示例2: Btn_Save_Click
protected void Btn_Save_Click(object sender, EventArgs e)
{
DataEntities ent = new DataEntities();
int id = 0;
try
{
id = Spe_Tree.SelectedNode.Value.ToInt32(0);
}
catch
{
}
if (chk_Edit.Checked)
{
var q = (from l in ent.JobIndustry where l.ID == id select l).FirstOrDefault();
q.Name = txt_Name.Text;
}
else
{
JobIndustry spe = new JobIndustry();
spe.ParentID = id;
spe.Name = txt_Name.Text;
ent.AddToJobIndustry(spe);
}
ent.SaveChanges();
ent.Dispose();
Spe_Tree.Nodes.Clear();
LoadTree();
}
示例3: LoadInfo
protected void LoadInfo()
{
ddl_SysModel.DataSource = TemplateAction.AllSysModel;
ddl_SysModel.DataTextField = "ModelName";
ddl_SysModel.DataValueField = "ID";
ddl_SysModel.DataBind();
int id = WS.RequestInt("id");
DataEntities ent = new DataEntities();
TemplateList tl = (from l in ent.TemplateList where l.ID == id select l).FirstOrDefault();
ent.Dispose();
try
{
txt_TempName.Text = tl.TempName;
txt_CutKeywords.Text = tl.CutKeywords.ToS();
txt_CutTitle.Text = tl.CutTitle.ToS();
txt_ShowRecordCount.Text = tl.ShowRecordCount.ToS();
txt_TimeFormat.Text = tl.TimeFormat;
txt_Content.Text = tl.Content;
txt_Listvar.Text = tl.ListVar;
ddl_SysModel.SelectedValue = tl.SysModel.ToS();
}
catch { }
}
示例4: btn_Save_Click
protected void btn_Save_Click(object sender, EventArgs e)
{
int id = WS.RequestInt("id");
DataEntities ent = new DataEntities();
TemplateList tl ;
try
{
tl = (from l in ent.TemplateList where l.ID == id select l).First();
}
catch
{
tl = new TemplateList();
}
tl.TempName = txt_TempName.Text;
tl.CutKeywords = txt_CutKeywords.Text.ToInt32();
tl.CutTitle = txt_CutTitle.Text.ToInt32();
tl.ShowRecordCount = txt_ShowRecordCount.Text.ToInt32();
tl.TimeFormat = txt_TimeFormat.Text;
tl.Content = txt_Content.Text.Replace("'", "''"); ;
tl.ListVar = txt_Listvar.Text.Replace("'", "''"); ;
tl.SysModel = ddl_SysModel.SelectedValue.ToInt32();
if (tl.ID <= 0)
{
tl.GroupID = 1;
tl.SysModel = 1;
ent.AddToTemplateList(tl);
}
ent.SaveChanges();
ent.Dispose();
Js.AlertAndGoback("保存成功!");
}
示例5: btn_tree_new_Click
protected void btn_tree_new_Click(object sender, EventArgs e)
{
int pnID = PanelTree.SelectedNode.Value.ToInt32(0);
int parentID = 0;
try
{
parentID=SubTree.SelectedNode.Value.ToInt32(0);
}
catch
{
}
SysNavTree tree = new SysNavTree();
tree.Group = cbl_tree_group.GetValues();
tree.Icon = ddl_tree_icon.SelectedValue;
tree.InnerHtml = txt_tree_html.Text;
tree.OrderIndex = txt_tree_orderindex.Text.ToInt32();
tree.PanelID = pnID;
tree.ParentID = parentID;
tree.Title = txt_tree_title.Text;
tree.Url = txt_tree_url.Text;
DataEntities ent = new DataEntities();
ent.AddToSysNavTree(tree);
ent.SaveChanges();
ent.Dispose();
Js.AlertAndChangUrl("新增成功", "SysmenuManagement.aspx");
}
示例6: LoadInfo
protected void LoadInfo()
{
DataEntities ent = new DataEntities();
ddl_RegForm.DataSource = from l in ent.UserForm select l;
ddl_RegForm.DataTextField = "FormName";
ddl_RegForm.DataValueField = "ID";
ddl_RegForm.DataBind();
int id = WS.RequestInt("id");
UserGroup g = (from l in ent.UserGroup where l.ID == id select l).FirstOrDefault();
if (null==g)
{
return;
}
txt_GroupName.Text = g.GroupName;
txt_grade.Text = g.Grade.ToS();
txt_MaxPost.Text = g.MaxPost.ToS();
chk_PostAotuAudit.Checked = g.PostAotuAudit.ToBoolean();
chk_EnableReg.Checked = g.EnableReg.ToBoolean();
chk_RegAutoAudit.Checked = g.RegAutoAudit.ToBoolean();
ddl_RegForm.SelectedValue = g.RegForm.ToS();
ent.Dispose();
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataEntities ent = new DataEntities();
var chapters = //BookChapterView.GetModelList("enable=1 order by UpdateTime desc", 500);
(from l in ent.BookChapter where l.Enable==true orderby l.UpdateTime descending select l).Take(500);
var items = new List<Voodoo.other.SEO.RssItem>();
foreach (var chapter in chapters)
{
items.Add(new Voodoo.other.SEO.RssItem()
{
Title = chapter.BookTitle + "-" + chapter.Title,
PutTime = chapter.UpdateTime,
Link = SystemSetting.SiteUrl+GetBookChapterUrl(chapter, chapter.GetClass() ),
Description = chapter.BookTitle + "Update to chapter:" + chapter.Title + ", from chanel" + chapter.ClassName
});
}
var movies = (from l in ent.MovieInfo orderby l.UpdateTime descending select l).Take(800);
foreach (var m in movies)
{
items.Add(new Voodoo.other.SEO.RssItem()
{
Title = m.Title,
PutTime = m.UpdateTime.ToDateTime(),
Link = SystemSetting.SiteUrl + GetMovieUrl(m,m.GetClass()),// GetBookChapterUrl(chapter, BookView.GetClass(chapter)),
Description = m.Title + "Update to :" + m.LastDramaTitle + ", from chanel" + m.ClassName+", Intro:"+m.Intro
});
}
ent.Dispose();
Response.Clear();
Voodoo.other.SEO.Rss.GetRss(items, SystemSetting.SiteName, SystemSetting.SiteUrl, SystemSetting.Description, SystemSetting.Copyright);
}
示例8: btn_Save_Click
protected void btn_Save_Click(object sender, EventArgs e)
{
DataEntities ent = new DataEntities();
int id = WS.RequestInt("id");
TemplateVar tl = new TemplateVar();
try
{
tl = (from l in ent.TemplateVar where l.ID == id select l).First();
}
catch { }
tl.VarName = txt_VarName.Text;
tl.Content = txt_Content.Text.Replace("'", "''");
if (tl.ID==null||tl.ID <= 0)
{
ent.AddToTemplateVar(tl);
}
ent.SaveChanges();
var pages = (from l in ent.TemplatePage where l.CreateWith == 5 select l).ToList();
TemplateHelper th = new TemplateHelper();
foreach (var p in pages)
{
try
{
string html = th.GetStatisPage(p.id);
Voodoo.IO.File.Write(Server.MapPath(p.FileName), html);
}
catch { }
}
ent.Dispose();
Js.AlertAndChangUrl("保存成功!", "VarTemplateList.aspx");
}
示例9: btn_Save_Click
protected void btn_Save_Click(object sender, EventArgs e)
{
int id = WS.RequestInt("id");
DataEntities ent = new DataEntities();
Voodoo.Basement.AdGroup q = new Voodoo.Basement.AdGroup();
if (id > 0)
{
q = (from l in ent.AdGroup where l.ID == id select l).FirstOrDefault();
}
q.Name = txt_Name.Text;
q.height = txt_Height.Text.ToInt32();
q.width = txt_Width.Text.ToInt32();
if (id > 0 && q != null)
{
}
else
{
//com.UserID = userid;
ent.AddToAdGroup(q);
}
ent.SaveChanges();
ent.Dispose();
Js.AlertAndChangUrl("保存成功!", "List.aspx");
}
示例10: BindList
protected void BindList()
{
DataEntities ent = new DataEntities();
switch (type)
{
case "kuaib":
var cpl = from l in ent.MovieUrlKuaib where l.MovieID == id select l;
rp_List.DataSource = cpl;
rp_List.DataBind();
break;
case "baidu":
var cpl_baidu = from l in ent.MovieUrlBaidu where l.MovieID == id select l;
rp_List.DataSource = cpl_baidu;
rp_List.DataBind();
break;
case "mag":
var cpl_mag = from l in ent.MovieUrlMag where l.MovieID == id select l;
rp_List.DataSource = cpl_mag;
rp_List.DataBind();
break;
default:
var df = from l in ent.MovieUrlKuaib where l.MovieID == id select l;
rp_List.DataSource = df;
rp_List.DataBind();
break;
}
ent.Dispose();
}
示例11: btn_Save_Click
protected void btn_Save_Click(object sender, EventArgs e)
{
DataEntities ent = new DataEntities();
int id = WS.RequestInt("id");
UserGroup g = (from l in ent.UserGroup where l.ID == id select l).FirstOrDefault();
if (g == null)
{
g = new UserGroup();
}
g.GroupName = txt_GroupName.Text;
g.Grade = txt_grade.Text.ToInt32();
g.MaxPost = txt_MaxPost.Text.ToInt32();
g.PostAotuAudit = chk_PostAotuAudit.Checked;
g.EnableReg = chk_EnableReg.Checked;
g.RegAutoAudit = chk_RegAutoAudit.Checked;
g.RegForm = ddl_RegForm.SelectedValue.ToInt32();
if (g.ID <= 0)
{
ent.AddToUserGroup(g);
}
ent.SaveChanges();
ent.Dispose();
Js.AlertAndChangUrl("保存成功!", "GroupList.aspx");
}
示例12: Drama
/// <summary>
/// 单集列表
/// </summary>
/// <param name="id"></param>
protected void Drama(int id)
{
DataEntities ent = new DataEntities();
MovieDrama d = (from l in ent.MovieDrama where l.id == id select l).FirstOrDefault();
ent.Dispose();
Response.Clear();
Response.Write(CreateDramapage(d,d.GetClass()));
}
示例13: CreateBook
protected void CreateBook(int bookid)
{
DataEntities ent = new DataEntities();
Book b = (from l in ent.Book where l.ID == bookid select l).FirstOrDefault();
ent.Dispose();
Voodoo.Basement.CreatePage.CreateContentPage(b, b.GetClass());
}
示例14: btn_Save_Click
protected void btn_Save_Click(object sender, EventArgs e)
{
DataEntities ent = new DataEntities();
int id = WS.RequestInt("id");
JobPost p = new JobPost();
if (id > 0)
{
p = (from l in ent.JobPost where l.ID == id select l).FirstOrDefault();
}
p.CompanyID = ddl_Company.SelectedValue.ToInt32();
p.Title = txt_Title.Text;
p.Province = ddl_Province.SelectedValue.ToInt32();
p.City = ddl_City.SelectedValue.ToInt32();
p.Salary = ddl_Salary.SelectedValue.ToInt32();
p.Expressions = ddl_Expressions.SelectedValue.ToInt32();
p.Edu = ddl_Edu.SelectedValue.ToInt32();
p.EmployNumber = txt_EmployNumber.Text.ToInt32();
p.Intro = txt_Intro.Text;
p.PostTime = DateTime.Now;
p.IsSetTop = chk_Settop.Checked;
p.SetTopTime = DateTime.Now;
p.ExpireTime = txt_ExpireTime.Text.ToDateTime();
//绑定教育
List<JobPostEduAndEmployeeCount> edus = new List<JobPostEduAndEmployeeCount>();
foreach (var ed in JobAction.Edu)
{
edus.Add(new JobPostEduAndEmployeeCount() { Checked = false, key = ed.Key, Number = 0, Text = ed.Value });
}
string[] chk = WS.RequestString("chk").Split(',');
string[] nums = WS.RequestString("number").Split(',');
for (int i = 0; i < chk.Length; i++)
{
edus[i].Checked = chk[i].ToBoolean();
edus[i].Number = nums[i].ToInt32();
}
p.Ext1 = Voodoo.IO.XML.Serialize(edus);
if (p.ID <= 0)
{
//处理城市热度
try
{
var ct = (from l in ent.City where l.id == p.City select l).FirstOrDefault();
ct.Hot += 1;
}
catch { }
ent.AddToJobPost(p);
}
ent.SaveChanges();
ent.Dispose();
Js.AlertAndChangUrl("保存成功!", refer);
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
long id = WS.RequestString("id").ToInt64();
DataEntities ent = new DataEntities();
BookChapter c = (from l in ent.BookChapter where l.ID == id select l).FirstOrDefault();
ent.Dispose();
Response.Clear();
Response.Write(Voodoo.IO.XML.Serialize(c));
}