示例#1
0
    private void AddJuanSavePage(int meid)
    {
        int id  = Utils.ParseInt(Utils.GetRequest("id", "all", 2, @"^[0-9]\d*$", "ID错误"));
        int nid = Utils.ParseInt(Utils.GetRequest("nid", "all", 2, @"^[0-9]\d*$", "ID错误"));

        Book.Model.Navigation model = new Book.BLL.Navigation().GetNavigation(id);
        if (model == null)
        {
            Utils.Error("不存在的分类", "");
        }
        Book.Model.ShuMu m = new Book.BLL.ShuMu().GetShuMu(nid);
        if (m == null)
        {
            Utils.Error("不存在的书本", "");
        }
        if (m.isdel == 1)
        {
            Utils.Error("不存在的记录", "");
        }
        if (m.aid != meid)
        {
            Utils.Error("不存在的记录", "");
        }
        string title = Utils.GetRequest("title", "all", 2, @"^[\s\S]{1,50}$", "分卷名称限1-50字");
        int    pid   = Utils.ParseInt(Utils.GetRequest("pid", "all", 2, @"^[0-9]\d*$", "排序错误"));

        Book.Model.Contents n = new Book.Model.Contents();
        n.jid      = -1;
        n.shi      = nid;
        n.state    = 1;
        n.summary  = "";
        n.tags     = "";
        n.title    = title;
        n.addtime  = DateTime.Now;
        n.contents = "";
        n.aid      = m.aid;
        n.pid      = pid;

        new Book.BLL.Contents().Add(n);
        Utils.Success("添加分卷", "添加分卷成功,正在返回..", Utils.getUrl("bookman.aspx?act=view&id=" + id + "&nid=" + nid + ""), "1");
    }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Book.Model.Contents model)
 {
     dal.Update(model);
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Book.Model.Contents model)
 {
     return(dal.Add(model));
 }
示例#4
0
    private void AddContentSavePage(int meid)
    {
        int id  = Utils.ParseInt(Utils.GetRequest("id", "all", 2, @"^[0-9]\d*$", "ID错误"));
        int nid = Utils.ParseInt(Utils.GetRequest("nid", "all", 2, @"^[0-9]\d*$", "ID错误"));
        int jid = Utils.ParseInt(Utils.GetRequest("jid", "all", 2, @"^[0-9]\d*$", "ID错误"));

        Book.Model.Navigation model = new Book.BLL.Navigation().GetNavigation(id);
        if (model == null)
        {
            Utils.Error("不存在的分类", "");
        }
        Book.Model.ShuMu m = new Book.BLL.ShuMu().GetShuMu(nid);
        if (m == null)
        {
            Utils.Error("不存在的书本", "");
        }
        if (m.isdel == 1)
        {
            Utils.Error("不存在的记录", "");
        }
        if (m.aid != meid)
        {
            Utils.Error("不存在的记录", "");
        }
        string title    = Utils.GetRequest("title", "all", 2, @"^[\s\S]{1,50}$", "章节名称限1-50字");
        string contents = Utils.GetRequest("contents", "all", 2, @"^[\s\S]{1,}$", "章节内容不能为空");
        string tags     = Utils.GetRequest("tags", "all", 3, @"^[^\#]{1,50}(?:\#[^\#]{1,50}){0,500}$", "多个搜索关键词请用#分开,不能为空");
        int    pid      = Utils.ParseInt(Utils.GetRequest("pid", "all", 2, @"^[0-9]\d*$", "排序错误"));

        int state = Utils.ParseInt(ub.GetSub("BookIsContents", xmlPath));

        Book.Model.Contents n = new Book.Model.Contents();
        n.jid      = jid;
        n.shi      = nid;
        n.state    = state;
        n.summary  = "";
        n.tags     = tags;
        n.title    = title;
        n.addtime  = DateTime.Now;
        n.contents = contents;
        n.aid      = m.aid;
        n.pid      = pid;
        new Book.BLL.Contents().Add(n);
        //最后更新
        new Book.BLL.ShuMu().Updategxtime(nid);
        //更新提醒会员
        if (!string.IsNullOrEmpty(m.gxids))
        {
            string[] idsTemp = m.gxids.Split("#".ToCharArray());
            for (int i = 0; i < idsTemp.Length; i++)
            {
                int    aid     = Utils.ParseInt(idsTemp[i]);
                string mygxids = new Book.BLL.ShuSelf().Getgxids(aid);
                string gxids   = "";
                if (mygxids != "")
                {
                    if (!("#" + mygxids + "#").Contains("#" + nid + "#"))
                    {
                        gxids = nid + "#" + mygxids;
                    }
                }
                else
                {
                    gxids = nid.ToString();
                }

                if (gxids != "")
                {
                    new Book.BLL.ShuSelf().Updategxids(aid, gxids);
                }
            }
        }
        Utils.Success("添加章节", "添加章节成功,正在返回..", Utils.getUrl("bookman.aspx?act=view&amp;id=" + id + "&amp;nid=" + nid + "&amp;jid=" + jid + ""), "1");
    }