Exemple #1
0
    /// <summary>
    /// 添加/编辑文章/图片/文件
    /// </summary>
    private void UpdateOther(string act, string TypeName, int ptype, int nid, int id)
    {
        int meid = new BCW.User.Users().GetUsId();

        if (meid == 0)
        {
            Utils.Login();
        }

        string ac       = Utils.GetRequest("ac", "post", 1, "", "");
        string Title    = Utils.GetRequest("Title", "post", 2, @"^[\s\S]{1,50}$", "" + TypeName + "标题限1-50字");
        string KeyWord  = Utils.GetRequest("KeyWord", "post", 1, "", "");
        string Content  = Utils.GetRequest("Content", "post", 2, @"^[\s\S]{1,}$", "" + TypeName + "内容不能为空");
        string TarText  = string.Empty;
        string LanText  = string.Empty;
        string SafeText = string.Empty;
        string LyText   = string.Empty;
        string UpText   = string.Empty;
        int    IsVisa   = 0;
        bool   IsAd     = true;
        bool   blpic    = bool.Parse(Utils.GetRequest("blpic", "post", 1, @"^False|True$", "False"));//文件是否上传截图
        int    BzType   = 0;
        int    Cent     = 0;
        string sFiles   = string.Empty;
        string aName    = string.Empty;
        string Model    = Utils.GetRequest("Model", "post", 1, "", "");
        int    newId    = 0;

        //关键字的生成
        if (string.IsNullOrEmpty(KeyWord))
        {
            KeyWord = Out.CreateKeyWord(Title, 2);
        }
        else
        {
            if (KeyWord.Length > 500)
            {
                Utils.Error("关键字不能超500字", "");
            }
            KeyWord = Utils.GetRequest("KeyWord", "post", 2, @"^[^\#]{1,50}(?:\#[^\#]{1,50}){0,500}$", "关键字填写格式错误");
        }
        if (blpic != true)
        {
            if (id == 0)
            {
                aName = "添加" + TypeName + "";
            }
            else
            {
                aName = "编辑" + TypeName + "";
            }
        }
        else
        {
            aName = "上传截图";
        }
        Master.Title = aName;

        BCW.Model.Detail model = new BCW.Model.Detail();
        model.Title     = Title;
        model.KeyWord   = KeyWord;
        model.Model     = Model.ToUpper().Replace(",", ",");
        model.IsAd      = IsAd;
        model.Types     = ptype;
        model.NodeId    = nid;
        model.Content   = Content;
        model.TarText   = TarText;
        model.LanText   = LanText;
        model.SafeText  = SafeText;
        model.LyText    = LyText;
        model.UpText    = UpText;
        model.IsVisa    = IsVisa;
        model.AddTime   = DateTime.Now;
        model.Readcount = 0;
        model.Recount   = 0;
        model.Cent      = Cent;
        model.BzType    = BzType;
        model.Hidden    = 1;
        model.UsID      = meid;
        if (id == 0)
        {
            newId = new BCW.BLL.Detail().Add(model);
        }
        else
        {
            newId    = id;
            model.ID = id;
            new BCW.BLL.Detail().Update(model);
        }

        //-----------------文件附件提交开始
        if (SaveFiles(ptype, newId, out sFiles))
        {
            aName += "/上传文件";
        }
        //-----------------文件附件提交结束
        //得到截图文件
        string sPics = "";
        string Pics  = "";

        if (sFiles != "")
        {
            sPics = Utils.Mid(sFiles, 1, sFiles.Length);
        }
        if (sPics == "#")
        {
            sPics = "";
        }

        if (sPics != "")
        {
            Pics = new BCW.BLL.Detail().GetPics(newId);
            if (Pics != "")
            {
                sPics = Pics + "#" + sPics;
            }

            new BCW.BLL.Detail().UpdatePics(newId, sPics);
        }

        //截图上传开始

        if (blpic == true)
        {
            UiPic(act, ptype, nid, newId);
        }
        else
        {
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("" + aName + "成功!请等待管理员进行审核,多谢您对本站的支持!");
            builder.Append(Out.Tab("</div>", ""));
            builder.Append(Out.Tab("<div class=\"title\">", Out.Hr()));
            builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">首页</a>-");
            builder.Append("<a href=\"" + Utils.getPage("default.aspx") + "\">返回上级</a>");
            builder.Append(Out.Tab("</div>", ""));
        }
    }
Exemple #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(BCW.Model.Detail model)
 {
     return(dal.Add(model));
 }
Exemple #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BCW.Model.Detail model)
 {
     dal.Update(model);
 }
Exemple #4
0
    /// <summary>
    /// 添加/编辑文章/图片/文件
    /// </summary>
    private void UpdateOther(string act, string TypeName, int ptype, int nid, int id)
    {
        string ac      = Utils.GetRequest("ac", "post", 1, "", "");
        string Title   = Utils.GetRequest("Title", "post", 2, @"^[\s\S]{1,50}$", "" + TypeName + "标题限1-50字");
        string KeyWord = Utils.GetRequest("KeyWord", "post", 1, "", "");
        string Content = string.Empty;

        if (ptype != 12)
        {
            Content = Utils.GetRequest("Content", "post", 2, @"^[\s\S]{1,}$", "" + TypeName + "内容不能为空");
        }
        string TarText  = string.Empty;
        string LanText  = string.Empty;
        string SafeText = string.Empty;
        string LyText   = string.Empty;
        string UpText   = string.Empty;
        int    IsVisa   = 0;

        if (ptype == 13)
        {
            TarText  = Utils.GetRequest("TarText", "post", 3, @"^[\s\S]{1,50}$", "资费说明限50字内,可留空");
            LanText  = Utils.GetRequest("LanText", "post", 3, @"^[\s\S]{1,50}$", "语言说明限50字内,可留空");
            SafeText = Utils.GetRequest("SafeText", "post", 3, @"^[\s\S]{1,50}$", "检查说明限50字内,可留空");
            LyText   = Utils.GetRequest("LyText", "post", 3, @"^[\s\S]{1,50}$", "来源说明限50字内,可留空");
            UpText   = Utils.GetRequest("UpText", "post", 3, @"^[\s\S]{1,50}$", "更新说明限50字内,可留空");
            IsVisa   = int.Parse(Utils.GetRequest("IsVisa", "post", 1, @"^[0-3]$", "0"));
        }
        bool   IsAd   = bool.Parse(Utils.GetRequest("IsAd", "post", 2, @"^False|True$", "" + TypeName + "性质选择错误"));
        bool   blpic  = bool.Parse(Utils.GetRequest("blpic", "post", 1, @"^False|True$", "False"));//文件是否上传截图
        int    BzType = int.Parse(Utils.GetRequest("BzType", "post", 1, @"^[0-1]$", "0"));
        int    Cent   = int.Parse(Utils.GetRequest("Cent", "post", 1, @"^[0-9]\d*$", "0"));
        string sFiles = string.Empty;
        string aName  = string.Empty;
        string Model  = Utils.GetRequest("Model", "post", 1, "", "");
        int    newId  = 0;

        //关键字的生成
        if (string.IsNullOrEmpty(KeyWord))
        {
            KeyWord = Out.CreateKeyWord(Title, 2);
        }
        else
        {
            if (KeyWord.Length > 500)
            {
                Utils.Error("关键字不能超500字", "");
            }
            KeyWord = Utils.GetRequest("KeyWord", "post", 2, @"^[^\#]{1,50}(?:\#[^\#]{1,50}){0,500}$", "关键字填写格式错误");
        }
        if (blpic != true)
        {
            if (id == 0)
            {
                aName = "添加" + TypeName + "";
            }
            else
            {
                aName = "编辑" + TypeName + "";
            }
        }
        else
        {
            aName = "上传截图";
        }
        Master.Title = aName;

        //添加验证
        if (id == 0)
        {
            if (new BCW.BLL.Detail().Exists(Title))
            {
                Utils.Error("数据库记录已存在“" + Title + "”", "");
            }
        }

        BCW.Model.Detail model = new BCW.Model.Detail();
        model.Title     = Title;
        model.KeyWord   = KeyWord;
        model.Model     = Model.ToUpper().Replace(",", ",");
        model.IsAd      = IsAd;
        model.Types     = ptype;
        model.NodeId    = nid;
        model.Content   = Content;
        model.TarText   = TarText;
        model.LanText   = LanText;
        model.SafeText  = SafeText;
        model.LyText    = LyText;
        model.UpText    = UpText;
        model.IsVisa    = IsVisa;
        model.AddTime   = DateTime.Now;
        model.Readcount = 0;
        model.Recount   = 0;
        model.Cent      = Cent;
        model.BzType    = BzType;
        model.Hidden    = 0;
        model.UsID      = 0;
        if (id == 0)
        {
            newId = new BCW.BLL.Detail().Add(model);
        }
        else
        {
            newId    = id;
            model.ID = id;
            new BCW.BLL.Detail().Update(model);
        }

        //-----------------文章附件/图片附件的提交开始
        if (ptype == 11 || ptype == 12)
        {
            //文章上传文件开始
            if (Utils.ToSChinese(ac) == "上传")
            {
                if (SaveFiles(ptype, newId, out sFiles))
                {
                    aName += "/上传文章附件";
                }
            }
            //文章上传文件结束

            else if (Utils.ToSChinese(ac) == "上传图片")
            {
                if (SaveFiles(ptype, newId, out sFiles))
                {
                    aName += "/上传图片";
                }
            }
            //添加图片结束
        }
        //-----------------文章附件/图片附件的提交结束

        //-----------------文件附件提交开始
        else if (ptype == 13)
        {
            if (Utils.ToSChinese(ac) == "上传文件")
            {
                if (SaveFiles(ptype, newId, out sFiles))
                {
                    aName += "/上传文件";
                }
            }
        }
        //-----------------文件附件提交结束
        //得到截图文件
        string sPics = "";
        string Pics  = "";

        if (sFiles != "")
        {
            sPics = Utils.Mid(sFiles, 1, sFiles.Length);
        }
        if (sPics == "#")
        {
            sPics = "";
        }

        if (sPics != "")
        {
            Pics = new BCW.BLL.Detail().GetPics(newId);
            if (Pics != "")
            {
                sPics = Pics + "#" + sPics;
            }

            new BCW.BLL.Detail().UpdatePics(newId, sPics);
        }

        //截图上传开始

        if (blpic == true)
        {
            UiPic(act, ptype, nid, newId);
        }
        else
        {
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("" + aName + "成功");
            builder.Append(Out.Tab("</div>", ""));
        }
    }