Beispiel #1
0
        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));
        }
Beispiel #2
0
 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();
 }
Beispiel #3
0
 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();
 }
Beispiel #4
0
 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");
 }
Beispiel #5
0
        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();
        }
Beispiel #6
0
        /// <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");
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        /// <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;
        }
Beispiel #9
0
        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));
        }
Beispiel #10
0
        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();
        }
Beispiel #11
0
        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());
        }
Beispiel #12
0
        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);
        }
Beispiel #13
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            enable = WS.RequestInt("enable", -1);
            group = WS.RequestInt("group", -1);
            url = string.Format("List.aspx?ebable={0}&group={1}", enable.ToString(), group.ToString());

            //删除
            var ids = WS.RequestString("id").Split(',').ToList().ToInt64();
            if (WS.RequestString("id").IsNullOrEmpty())
            {
                Js.AlertAndGoback("您没有选择任何项");
                return;
            }

            DataEntities ent = new DataEntities();

            foreach (var id in ids)
            {
                var q = (from l in ent.User where l.ID == id select l).FirstOrDefault();
                var resumes = from l in ent.JobResumeInfo where l.UserID == q.ID select l;
                var apps = from l in ent.JobApplicationRecord where l.UserID == q.ID select l;

                ent.DeleteObjects(resumes);
                ent.DeleteObjects(apps);
                ent.DeleteObject(q);
            }
            ent.SaveChanges();
            ent.Dispose();

            Js.AlertAndChangUrl("删除成功!", url);
        }
Beispiel #14
0
        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();
        }
Beispiel #15
0
        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();

            }
        }
Beispiel #16
0
 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();
 }
Beispiel #17
0
 public void DeleteItem(int id)
 {
     using (DataEntities ent = new DataEntities())
     {
         var n = (from l in ent.Message where l.ID == id select l).First();
         ent.DeleteObject(n);
         ent.SaveChanges();
     }
     this.BindData();
     X.Msg.Notify("消息", "删除成功!").Show();
 }
Beispiel #18
0
        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.MovieInfo where ids.IndexOf(l.id.ToString()) > 0 select l).ToList();
            foreach (var q in qs)
            {
                ent.DeleteObject(q);
            }
            ent.SaveChanges();
            ent.Dispose();

            Js.Jump(url);
        }
Beispiel #19
0
        protected void DeleteAnswer(int id)
        {
            int clsid = WS.RequestInt("class");
            int quID = WS.RequestInt("id");

            DataEntities ent = new DataEntities();
            var q = (from l in ent.Answer where l.ID == id select l).FirstOrDefault();
            ent.DeleteObject(q);

            Class cls = ObjectExtents.Class(clsid);
            Question qu = //QuestionView.GetModelByID(WS.RequestString("id"));
                (from l in ent.Question where l.ID == quID select l).FirstOrDefault();
            if (cls.ID > 0 && qu.ID > 0)
            {
                CreatePage.CreateContentPage(qu, cls);
            }
            rp_list.DataSource = from l in ent.Answer where l.QuestionID == qu.ID select l;
            rp_list.DataBind();
            ent.SaveChanges();
            ent.Dispose();
        }
Beispiel #20
0
        /// <summary>
        /// 删除章节
        /// </summary>
        /// <param name="id">章节ID</param>
        protected void ChapterDelete(long id)
        {
            try
            {
                DataEntities ent = new DataEntities();

                var c = (from l in ent.BookChapter where l.ID == id select l).FirstOrDefault();
                var b = c.GetBook();
                Class cls = c.GetClass();
                Voodoo.IO.File.Delete(Server.MapPath(BasePage.GetBookChapterTxtUrl(c, cls)));
                ent.DeleteObject(c);
                ent.SaveChanges();

                var lastChapter = //BookChapterView.Find("BookId={0} order by ChapterIndex,id desc");
                    (from l in ent.BookChapter where l.BookID == b.ID orderby l.ChapterIndex orderby l.ID descending select l).FirstOrDefault();
                b.UpdateTime = lastChapter.UpdateTime;
                b.LastChapterID = lastChapter.ID;
                b.LastChapterTitle = lastChapter.Title;

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

                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(true));
            }
            catch (System.Exception e)
            {
                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(false));
            }
        }
Beispiel #21
0
 /// <summary>
 /// 删除书籍
 /// </summary>
 /// <param name="id">ID</param>
 protected void BookDelete(int id)
 {
     using (DataEntities ent = new DataEntities())
     {
         var book = (from l in ent.Book where l.ID == id select l).FirstOrDefault();
         bool result = false;
         try
         {
             ent.DeleteObject(book);
             result = true;
         }
         catch
         {
             result = false;
         }
         Response.Clear();
         Response.Write(Voodoo.IO.XML.Serialize(result));
     }
 }
Beispiel #22
0
        protected void On_Remove(object sender, DirectEventArgs e)
        {
            RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel;
            DataEntities ent = new DataEntities();

            foreach (SelectedRow row in sm.SelectedRows)
            {
                try
                {
                    int id = row.RecordID.ToInt32();
                    var n = (from l in ent.Message where l.ID == id select l).First();
                    ent.DeleteObject(n);
                }
                catch { }
            }
            ent.SaveChanges();
            ent.Dispose();
            this.BindData();
            X.Msg.Notify("消息", "删除成功!").Show();
        }
Beispiel #23
0
        protected void DeleteImage(int imageID)
        {
            using (DataEntities ent = new DataEntities())
            {
                Images img = (from l in ent.Images where l.ID == imageID select l).First();
                Voodoo.IO.File.Delete(Server.MapPath(img.FilePath));
                Voodoo.IO.File.Delete(Server.MapPath(img.SmallPath));
                ent.DeleteObject(img);

                rp_list.DataSource = from l in ent.Images where l.AlbumID == WS.RequestInt("id") select l;
                rp_list.DataBind();
            }
        }