当前位置: 首页>>代码示例>>C#>>正文


C# DataEntities.DeleteObject方法代码示例

本文整理汇总了C#中Voodoo.Basement.DataEntities.DeleteObject方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.DeleteObject方法的具体用法?C# DataEntities.DeleteObject怎么用?C# DataEntities.DeleteObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Voodoo.Basement.DataEntities的用法示例。


在下文中一共展示了DataEntities.DeleteObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Button1_Click

        protected void Button1_Click(object sender, EventArgs e)
        {
            var ids = WS.RequestString("id").Split(',').ToList();
            DataEntities ent = new DataEntities();

            switch (type)
            {
                case "kuaib":
                    var qs = from l in ent.MovieUrlKuaib where ids.IndexOf(l.id.ToString()) > 0 select l;
                    foreach (var q in qs)
                    {
                        ent.DeleteObject(q);
                    }
                    break;
                case "baidu":
                    var bs = from l in ent.MovieUrlBaidu where ids.IndexOf(l.id.ToString()) > 0 select l;
                    foreach (var q in bs)
                    {
                        ent.DeleteObject(q);
                    }
                    break;
                case "mag":
                    var ms = from l in ent.MovieUrlMag where ids.IndexOf(l.id.ToString()) > 0 select l;
                    foreach (var q in ms)
                    {
                        ent.DeleteObject(q);
                    }
                    break;
            }
            ent.SaveChanges();
            ent.Dispose();
            Response.Redirect(string.Format("UrlList.aspx?bookid={0}", id));
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:33,代码来源:UrlList.aspx.cs

示例2: Button1_Click

 protected void Button1_Click(object sender, EventArgs e)
 {
     DataEntities ent = new DataEntities();
     var ids = WS.RequestString("id").Split(',').ToList(); ;
     var qs = from l in ent.UserGroup where ids.IndexOf(l.ID.ToString()) > 0 select l;
     foreach (var q in qs)
     {
         ent.DeleteObject(q);
     }
     ent.Dispose();
     BindList();
 }
开发者ID:kuibono,项目名称:KCMS2,代码行数:12,代码来源:GroupList.aspx.cs

示例3: btn_Del_Click

 protected void btn_Del_Click(object sender, EventArgs e)
 {
     DataEntities ent = new DataEntities();
     var ids = WS.RequestString("id").Split(',').ToList().Select(p => Convert.ToInt32(p)); ;
     var qs = from l in ent.TemplateVar where ids.Contains(l.ID) select l;
     foreach (var q in qs)
     {
         ent.DeleteObject(q);
     }
     ent.SaveChanges();
     ent.Dispose();
     BindList();
 }
开发者ID:kuibono,项目名称:KCMS2,代码行数:13,代码来源:VarTemplateList.aspx.cs

示例4: Button1_Click

 protected void Button1_Click(object sender, EventArgs e)
 {
     var ids = WS.RequestString("id").Split(',').ToList().ToInt64();
     DataEntities ent = new DataEntities();
     foreach (var id in ids)
     {
         var q = (from l in ent.AdGroup where l.ID == id select l).FirstOrDefault();
         ent.DeleteObject(q);
     }
     ent.SaveChanges();
     ent.Dispose();
     Js.AlertAndChangUrl("删除成功!", "List.aspx");
 }
开发者ID:kuibono,项目名称:KCMS2,代码行数:13,代码来源:List.aspx.cs

示例5: btn_Del_Click

        protected void btn_Del_Click(object sender, EventArgs e)
        {
            var ids = WS.RequestString("id").Split(',').ToList();
            DataEntities ent = new DataEntities();
            var qs = (from l in ent.InfoType where ids.IndexOf(l.id.ToS()) > 0 select l).ToList();
            foreach (var q in qs)
            {
                ent.DeleteObject(q);
            }

            ent.SaveChanges();
            ent.Dispose();
        }
开发者ID:kuibono,项目名称:KCMS2,代码行数:13,代码来源:InfoTypeList.aspx.cs

示例6: Delete

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids"></param>
        protected void Delete(string ids)
        {
            DataEntities ent = new DataEntities();
            var id = ids.Split(',').ToList();
            var qs = from l in ent.SysUser where id.IndexOf(l.ID.ToString()) > 0 select l;
            foreach (var q in qs)
            {
                ent.DeleteObject(q);
            }
            ent.SaveChanges();
            ent.Dispose();

            Js.AlertAndChangUrl("删除成功!", "List.aspx");
        }
开发者ID:kuibono,项目名称:KCMS2,代码行数:18,代码来源:List.aspx.cs

示例7: 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();
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:18,代码来源:ClientService.svc.cs

示例8: DeleteClass

        /// <summary>
        /// 删除栏目
        /// </summary>
        /// <param name="classes"></param>
        /// <returns></returns>
        public static Result DeleteClass(List<Class> classes)
        {
            DataEntities ent = new DataEntities();
            Result r = new Result();
            foreach (var cls in classes)
            {
                DirectoryInfo dir = new DirectoryInfo(HttpContext.Current.Server.MapPath(BasePage.GetClassUrl(cls)));
                if (dir.Exists)
                {
                    dir.Delete(true);
                }
                ent.DeleteObject(cls);
            }
            ent.SaveChanges();
            ent.Dispose();

            r.Success = true;
            r.Text = string.Format("成功删除{0}个栏目",classes.Count);
            return r;
        }
开发者ID:kuibono,项目名称:KCMS2,代码行数:25,代码来源:ClassAction.cs

示例9: Button1_Click

        protected void Button1_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            var ids = WS.RequestString("id").Split(',').ToList();
            var chapters = (from l in ent.BookChapter where ids.IndexOf(l.ID.ToString()) > 0 select l).ToList();
            foreach (var chapter in chapters)
            {
                string FilePath = Server.MapPath(GetBookChapterUrl(chapter, chapter.GetClass()));
                Voodoo.IO.File.Delete(FilePath);
                ent.DeleteObject(chapter);
            }

            var book = (from l in ent.Book where l.ID == id select l).FirstOrDefault();
            var cls = book.GetClass();

            //更新书籍的最新章节
            var lastChapter = //BookChapterView.Find(string.Format("bookid={0} order by ChapterIndex,ID desc",id));
                (from l in ent.BookChapter where l.BookID == id orderby l.ChapterIndex orderby l.ID descending select l).First();
            book.LastChapterID = lastChapter.ID;
            book.LastChapterTitle = lastChapter.Title;

            chapters = (from l in ent.BookChapter where l.BookID == id orderby l.ChapterIndex orderby l.ID descending select l).ToList();

            ent.SaveChanges();
            ent.Dispose();

            foreach (var chapter in chapters)
            {
                CreatePage.CreateBookChapterPage(chapter, book, cls);
            }

            CreatePage.CreateContentPage(book, cls);

            CreatePage.CreateListPage(cls, 0);

            CreatePage.GreateIndexPage();

            Response.Redirect(string.Format("ChapterList.aspx?bookid={0}", id));
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:40,代码来源:ChapterList.aspx.cs

示例10: btn_Del_Click

        protected void btn_Del_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();
            var ids = WS.RequestString("id").Split(',').ToList().ToInt32();

            foreach (var id in ids)
            {
                var page = (from l in ent.TemplatePage where l.id == id select l).FirstOrDefault();
                ent.DeleteObject(page);
                FileInfo f = new FileInfo(Server.MapPath(page.FileName));
                if (f.Exists)
                {
                    try
                    {
                        f.Delete();
                    }
                    catch { }
                }
            }

            ent.SaveChanges();
            ent.Dispose();
            BindList();
        }
开发者ID:kuibono,项目名称:KCMS2,代码行数:24,代码来源:PageTemplateList.aspx.cs

示例11: Button1_Click

        protected void Button1_Click(object sender, EventArgs e)
        {
            var ids = WS.RequestString("id").Split(',').ToList().ToInt64();
            DataEntities ent = new DataEntities();
            foreach (var id in ids)
            {
                var q = (from l in ent.JobResumeInfo where l.ID == id select l).FirstOrDefault();
                var resumeCer=from l in ent.JobResumeCertificate where l.ResumeID==q.ID select l;
                var resumeEdu = from l in ent.JobResumeEdu where l.ResumeID == q.ID select l;
                var resumeExp = from l in ent.JobResumeExperience where l.ResumeID == q.ID select l;
                var resumeFile = from l in ent.JobResumeFile where l.ResumeID == q.ID select l;
                var resumeLan = from l in ent.JobResumeLanguage where l.ResumeID == q.ID select l;
                var resumeTrain = from l in ent.JobResumeTrain where l.ResumeID == q.ID select l;

                ent.DeleteObjects(resumeCer);
                ent.DeleteObjects(resumeEdu);
                ent.DeleteObjects(resumeExp);
                ent.DeleteObjects(resumeFile);
                ent.DeleteObjects(resumeLan);
                ent.DeleteObjects(resumeTrain);

                ent.DeleteObject(q);

            }
            ent.SaveChanges();
            ent.Dispose();
            Js.AlertAndChangUrl("删除成功!", "List.aspx?uid="+WS.RequestInt("uid").ToS());
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:28,代码来源:List.aspx.cs

示例12: Button1_Click

        protected void Button1_Click(object sender, EventArgs e)
        {
            var ids = WS.RequestString("id").Split(',').ToList();
            DataEntities ent = new DataEntities();
            var qs = from l in ent.News where ids.IndexOf(l.ID.ToString()) > 0 select l;
            foreach (var q in qs)
            {
                ent.DeleteObject(q);
            }
            ent.SaveChanges(); ;
            ent.Dispose();

            if (cls > 0)
            {
                CreatePage.CreateListPage(ObjectExtents.Class(cls), 1);
            }
            CreatePage.GreateIndexPage();
            Js.AlertAndChangUrl("删除成功!", url);
        }
开发者ID:kuibono,项目名称:KCMS2,代码行数:19,代码来源:NewsList.aspx.cs

示例13: 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();
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:18,代码来源:ClientService.svc.cs

示例14: Form_Save

        protected void Form_Save(object sender, DirectEventArgs e)
        {
            using (DataEntities ent = new DataEntities())
            {
                var n = new Voodoo.Basement.Product();
                try
                {
                    int id = ID.Text.ToInt32();
                    n = (from l in ent.Product where l.ID == id select l).First();
                }
                catch { }

                n.AddTime = AddTime.Value.ToDateTime();
                n.ClassID = ClassID.SelectedItem.Value.ToInt32();
                n.ClassName = ClassID.SelectedItem.Text;
                n.ClickCount = ClickCount.Value.ToInt32();
                n.Contact = Contact.Text;
                n.Enable = Enable.Checked;
                //n.FaceImage = "";

                n.Intro = Intro.Text;
                n.Name = Name.Text;
                n.OrderIndex = OrderIndex.Value.ToInt32();
                n.Price = Price.Value.ToDecimal();
                n.ProduceLocation = ProduceLocation.Text;
                n.SetTop = SetTop.Checked;
                n.Specification = Specification.Text;
                n.Tel = Tel.Text;
                n.Units = Units.Text;
                if (n.ID <= 0)
                {
                    ent.AddToProduct(n);
                }
                ent.SaveChanges();

                if (FaceImage.HasFile)
                {
                    Class cls = (from l in ent.Class where l.ID == n.ClassID select l).First();
                    string fileName = string.Format("/u/products/{0}.jpg", n.ID);
                    Voodoo.Basement.BasePage.UpLoadImage(FaceImage.PostedFile, fileName, cls.ImageWidth.ToInt32(), cls.ImageHeight.ToInt32());//194, 204
                    n.FaceImage = fileName;
                    ent.SaveChanges();
                }

                if (UpFile.HasFile)
                {
                    var files = from l in ent.File where l.ItemID == n.ID select l;
                    foreach (var f in files)
                    {
                        ent.DeleteObject(f);
                    }

                    string ext = UpFile.FileName.GetFileExtNameFromPath();
                    string fileName = string.Format("/u/products/{0}", UpFile.FileName);
                    Voodoo.Basement.BasePage.UpLoadFile(UpFile.PostedFile, fileName);

                    Voodoo.Basement.File file = new Voodoo.Basement.File();
                    file.ClassID = n.ClassID;
                    file.FileDirectory = "/u/products/";
                    file.FileExtName = ext;
                    file.FileName = UpFile.FileName;
                    file.FilePath = fileName;
                    file.FileSize = UpFile.PostedFile.ContentLength;
                    file.FileType = 0;
                    file.ItemID = n.ID;
                    file.SmallPath = "";
                    file.UpTime = DateTime.Now;
                    ent.AddToFile(file);
                    ent.SaveChanges();
                }

                this.GridPanel1.Store.Primary.CommitChanges();
                this.BindData();
                TabPanel1.SetActiveTab(0);
                FormPanel1.Title = "新增";
                FormPanel1.Reset();
                X.Msg.Notify("消息", "保存成功!").Show();

            }
        }
开发者ID:kuibono,项目名称:KCMS2,代码行数:80,代码来源:List.aspx.cs

示例15: 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();
 }
开发者ID:svn2github,项目名称:KCMS2,代码行数:11,代码来源:ClientService.svc.cs


注:本文中的Voodoo.Basement.DataEntities.DeleteObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。