示例#1
0
文件: Text.cs 项目: radtek/GitKB288
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BCW.Model.Text model)
        {
            int id = dal.Add(model);

            try
            {
                int    usid     = model.UsID;
                string username = new BCW.BLL.User().GetUsName(usid);
                string Notes    = "发表帖子";
                new BCW.Draw.draw().AddjfbyTz(usid, username, Notes);//点值抽奖
            }
            catch { }

            return(id);
        }
示例#2
0
文件: Text.cs 项目: radtek/GitKB288
        /// <summary>
        /// 增加一条派币帖
        /// </summary>
        public int AddPricesLimit(BCW.Model.Text model)
        {
            int id = dal.AddPricesLimit(model);

            try
            {
                string xmlPath            = "/Controls/winners.xml";
                string TextForUbb         = (ub.GetSub("TextForUbb", xmlPath));         //设置内线提示的文字
                string WinnersStatus      = (ub.GetSub("WinnersStatus", xmlPath));      //状态1维护2测试0正常
                string WinnersOpenOrClose = (ub.GetSub("WinnersOpenOrClose", xmlPath)); //0|停止放送机会|1|开启放送机会
                string WinnersOpenChoose  = (ub.GetSub("WinnersOpenChoose", xmlPath));  //1全社区2社区3仅游戏
                string WinnersGuessOpen   = (ub.GetSub("WinnersGuessOpen", xmlPath));   //1发内线2不发内线
                int    usid     = (model.UsID);
                string username = model.UsName;
                string Notes    = "帖子币";
                int    ID       = new BCW.BLL.Action().GetMaxId();
                int    isHit    = new BCW.winners.winners().CheckActionForAll(0, 0, usid, username, Notes, ID);
                if (isHit == 1)
                {
                    if (WinnersGuessOpen == "1")
                    {
                        new BCW.BLL.Guest().Add(0, usid, username, TextForUbb);//发内线到该ID
                    }
                }
            }
            catch {  }

            try
            {
                int    usid     = model.UsID;
                string username = new BCW.BLL.User().GetUsName(usid);
                string Notes    = "发表帖子";
                new BCW.Draw.draw().AddjfbyTz(usid, username, Notes);//点值抽奖
            }
            catch { }

            return(id);
        }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     threadId = Utils.ParseInt(Utils.GetRequest("threadId", "get", 1, @"^\d*$", ""));
     tbText   = new BCW.BLL.Text().GetText(threadId);
 }
示例#4
0
    /// <summary>
    /// 上传文件页面
    /// </summary>
    private void UploadPage(int forumid, int bid)
    {
        string ac   = Utils.ToSChinese(Utils.GetRequest("ac", "post", 1, "", ""));
        int    meid = new BCW.User.Users().GetUsId();

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

        if (ac != "发表文本")
        {
            BCW.User.Users.ShowVerifyRole("f", meid);                                         //非验证会员提示
            new BCW.User.Limits().CheckUserLimit(BCW.User.Limits.enumRole.Role_Upfile, meid); //会员上传权限
        }
        //论坛限制性
        BCW.Model.Forum Forummodel = new BCW.BLL.Forum().GetForum(forumid);
        //圈子限制性
        BCW.Model.Group modelgr = null;
        if (Forummodel.GroupId > 0)
        {
            modelgr = new BCW.BLL.Group().GetGroupMe(Forummodel.GroupId);
            if (modelgr == null)
            {
                Utils.Error("不存在的" + ub.GetSub("GroupName", "/Controls/group.xml") + "", "");
            }
            else if (DT.FormatDate(modelgr.ExTime, 0) != "1990-01-01 00:00:00" && modelgr.ExTime < DateTime.Now)
            {
                Utils.Error("" + ub.GetSub("GroupName", "/Controls/group.xml") + "已过期", "");
            }
            if (modelgr.ForumStatus == 2)
            {
                Utils.Error("" + ub.GetSub("GroupName", "/Controls/group.xml") + "论坛已关闭", "");
            }
            if (modelgr.ForumStatus == 1)
            {
                if (meid == 0)
                {
                    Utils.Login();
                }

                string GroupId = new BCW.BLL.User().GetGroupId(meid);
                if (GroupId.IndexOf("#" + Forummodel.GroupId + "#") == -1 && IsCTID(meid) == false)
                {
                    Utils.Error("非成员不能访问" + ub.GetSub("GroupName", "/Controls/group.xml") + "论坛!<br /><a href=\"" + Utils.getUrl("/bbs/group.aspx?act=addin&amp;id=" + Forummodel.GroupId + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">加入本" + ub.GetSub("GroupName", "/Controls/group.xml") + "</a>", "");
                }
            }
        }
        BCW.User.Users.ShowForumLimit(meid, Forummodel.Gradelt, Forummodel.Visitlt, Forummodel.VisitId, Forummodel.IsPc);
        if (ac == "续传" || bid == 0)//发帖
        {
            //是否刷屏
            string appName = "LIGHT_THREAD";
            int    Expir   = Convert.ToInt32(ub.GetSub("BbsThreadExpir", xmlPath2));
            BCW.User.Users.IsFresh(appName, Expir);

            BCW.User.Users.ShowVerifyRole("a", meid);                                                   //非验证会员提示
            new BCW.User.Limits().CheckUserLimit(BCW.User.Limits.enumRole.Role_Text, meid);             //会员本身权限
            new BCW.User.FLimits().CheckUserFLimit(BCW.User.FLimits.enumRole.Role_Text, meid, forumid); //版块内权限
            BCW.User.Users.ShowAddThread(meid, Forummodel.Postlt);
        }
        else//回帖
        {
            //是否刷屏
            string appName = "LIGHT_REPLY";
            int    Expir   = Convert.ToInt32(ub.GetSub("BbsReplyExpir", xmlPath2));
            BCW.User.Users.IsFresh(appName, Expir);

            BCW.User.Users.ShowVerifyRole("b", meid);                                                    //非验证会员提示
            new BCW.User.Limits().CheckUserLimit(BCW.User.Limits.enumRole.Role_Reply, meid);             //会员本身权限
            new BCW.User.FLimits().CheckUserFLimit(BCW.User.FLimits.enumRole.Role_Reply, meid, forumid); //版块内权限
            BCW.User.Users.ShowAddReply(meid, Forummodel.Replylt);
        }
        int kk    = 0;
        int reid  = 0;
        int ptype = 5;//标识为附件帖子

        if (ac == "续传")
        {
            //上传文件
            SaveFiles(meid, forumid, bid, reid, out kk);
            string strOut = string.Empty;
            if (kk < 0)
            {
                if (kk == -999)
                {
                    kk = 0;
                }

                strOut = "部分文件超出今天上传数量导致上传失败,";
                kk     = Math.Abs(kk);
            }
            //更新帖子文件数
            new BCW.BLL.Text().UpdateFileNum(bid, kk);
            new BCW.BLL.Text().UpdateTypes(bid, ptype);
            //记录日志
            string strLog = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + new BCW.BLL.User().GetUsName(meid) + "[/url]对主题[url=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]《" + new BCW.BLL.Text().GetTitle(bid) + "》[/url]追加" + kk + "个文件!";
            new BCW.BLL.Forumlog().Add(7, forumid, bid, strLog);
            Utils.Success("追加文件", "追加" + kk + "个文件成功," + strOut + "正在返回..", ReplaceWap(Utils.getUrl("topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "")), "2");
        }
        else
        {
            string mename  = new BCW.BLL.User().GetUsName(meid);
            string Title   = string.Empty;
            string Content = string.Empty;
            if (bid == 0)
            {
                Title   = Utils.GetRequest("Title", "post", 2, @"^[\s\S]{" + ub.GetSub("BbsThreadMin", xmlPath2) + "," + ub.GetSub("BbsThreadMax", xmlPath2) + "}$", "标题限" + ub.GetSub("BbsThreadMin", xmlPath2) + "-" + ub.GetSub("BbsThreadMax", xmlPath2) + "字");
                Title   = Title.Replace(char.ConvertFromUtf32(10), "").Replace(char.ConvertFromUtf32(13), "");
                Content = Utils.GetRequest("Content", "post", 2, @"^[\s\S]{" + ub.GetSub("BbsContentMin", xmlPath2) + "," + ub.GetSub("BbsContentMax", xmlPath2) + "}$", "请输入" + ub.GetSub("BbsContentMin", xmlPath2) + "-" + ub.GetSub("BbsContentMax", xmlPath2) + "字的内容");
            }
            else
            {
                Content = Utils.GetRequest("Content", "post", 2, @"^[\s\S]{1," + ub.GetSub("BbsReplyMax", xmlPath2) + "}$", "请输入不超" + ub.GetSub("BbsReplyMax", xmlPath2) + "字的回帖内容");
            }

            if (bid == 0)
            {
                int ThreadNum = Utils.ParseInt(ub.GetSub("BbsThreadNum", xmlPath));
                if (ThreadNum > 0)
                {
                    int ToDayCount = new BCW.BLL.Forumstat().GetCount(meid, 1);//今天发布帖子数
                    if (ToDayCount >= ThreadNum)
                    {
                        Utils.Error("系统限每天每ID限发帖子" + ThreadNum + "帖", "");
                    }
                }

                int    Price    = 0;
                int    Prices   = 0;
                int    HideType = 0;
                int    IsSeen   = 0;
                string PayCi    = string.Empty;

                BCW.Model.Text addmodel = new BCW.Model.Text();
                addmodel.ForumId     = forumid;
                addmodel.Types       = ptype;
                addmodel.Title       = Title;
                addmodel.Content     = Content;
                addmodel.HideContent = "";
                addmodel.UsID        = meid;
                addmodel.UsName      = mename;
                addmodel.Price       = Price;
                addmodel.Prices      = Prices;
                addmodel.HideType    = HideType;
                addmodel.PayCi       = PayCi;
                addmodel.IsSeen      = IsSeen;
                addmodel.AddTime     = DateTime.Now;
                addmodel.ReTime      = DateTime.Now;
                bid = new BCW.BLL.Text().Add(addmodel);
                //上传文件
                SaveFiles(meid, forumid, bid, reid, out kk);
                string strOut = string.Empty;
                if (kk < 0)
                {
                    if (kk == -999)
                    {
                        kk = 0;
                    }

                    strOut = "部分文件超出今天上传数量导致上传失败,";
                    kk     = Math.Abs(kk);
                }
                //更新帖子文件数
                new BCW.BLL.Text().UpdateFileNum(bid, kk);
                //论坛统计
                BCW.User.Users.UpdateForumStat(1, meid, mename, forumid);

                int GroupId = new BCW.BLL.Forum().GetGroupId(forumid);

                //动态记录
                if (GroupId == 0)
                {
                    new BCW.BLL.Action().Add(-1, 0, meid, mename, "在" + Forummodel.Title + "发表了文件帖子[URL=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]" + Title + "[/URL]");
                }
                else
                {
                    new BCW.BLL.Action().Add(-2, 0, meid, mename, "在圈坛-" + Forummodel.Title + "发表了文件帖子[URL=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]" + Title + "[/URL]");
                }
                //积分操作/论坛统计/圈子论坛不进行任何奖励

                if (GroupId == 0)
                {
                    new BCW.User.Cent().UpdateCent2(BCW.User.Cent.enumRole.Cent_Text, meid, true);
                }
                else
                {
                    if (!Utils.GetDomain().Contains("th"))
                    {
                        new BCW.User.Cent().UpdateCent2(BCW.User.Cent.enumRole.Cent_Text, meid, false);
                    }
                }
                if (kk == 0)
                {
                    new BCW.BLL.Text().UpdateTypes(bid, 0);//去掉附件帖标识
                }
                #region  这里开始修改提醒ID 发内线
                string remind = ub.GetSub("remindid" + forumid, "/Controls/bbs.xml"); //获取XML的值
                if (remind != "")                                                     //如果有提醒ID
                {
                    string[] IDS = remind.Split('#');
                    for (int i = 0; i < IDS.Length; i++)
                    {
                        if (GroupId != 0)
                        {
                            new BCW.BLL.Guest().Add(0, int.Parse(IDS[i]), new BCW.BLL.User().GetUsName(int.Parse(IDS[i])), "请注意!用户[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "(" + meid + ")[/url]在圈坛-" + Forummodel.Title + "发表了[URL=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]" + Title + "[/URL]的帖子");
                        }
                        else
                        {
                            new BCW.BLL.Guest().Add(0, int.Parse(IDS[i]), new BCW.BLL.User().GetUsName(int.Parse(IDS[i])), "请注意!用户[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "(" + meid + ")[/url]在" + Forummodel.Title + "发表了[URL=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]" + Title + "[/URL]的帖子");
                        }
                    }
                }
                #endregion
                Utils.Success("上传文件", "上传" + kk + "个文件成功," + strOut + "正在返回..", ReplaceWap(Utils.getPage("forum.aspx?forumid=" + forumid + "")), "2");
            }
            else
            {
                int ReplyNum = Utils.ParseInt(ub.GetSub("BbsReplyNum", xmlPath));
                if (ReplyNum > 0)
                {
                    int ToDayCount = new BCW.BLL.Forumstat().GetCount(meid, 2);//今天发布回帖数
                    if (ToDayCount >= ReplyNum)
                    {
                        Utils.Error("系统限每天每ID限回帖" + ReplyNum + "次", "");
                    }
                }

                int Floor = new BCW.BLL.Reply().GetFloor(bid);

                //派币帖
                string CentText = string.Empty;
                string PbCent   = string.Empty;
                int    iTypes   = new BCW.BLL.Text().GetTypes(bid);
                if (iTypes == 3)
                {
                    BCW.Model.Text p = new BCW.BLL.Text().GetPriceModel(bid);
                    if (p.Prices - p.Pricel > 0)
                    {
                        string bzText = string.Empty;
                        if (p.BzType == 0)
                        {
                            bzText = ub.Get("SiteBz");
                        }
                        else
                        {
                            bzText = ub.Get("SiteBz2");
                        }

                        long zPrice = 0;
                        if (p.Price2 > 0)
                        {
                            zPrice = Convert.ToInt64(new Random().Next(p.Price, (p.Price2 + 1)));//随机得到奖币值
                        }
                        else
                        {
                            zPrice = Convert.ToInt64(p.Price);
                        }

                        long GetPrice = 0;
                        if (p.Prices - p.Pricel < zPrice)
                        {
                            GetPrice = p.Prices - p.Pricel;
                        }
                        else
                        {
                            GetPrice = zPrice;
                        }

                        if (p.PayCi == "0")
                        {
                            if (("#" + p.ReplyID + "#").IndexOf("#" + meid + "#") == -1)
                            {
                                if (p.BzType == 0)
                                {
                                    new BCW.BLL.User().UpdateiGold(meid, mename, GetPrice, "派币帖回帖获得");
                                }
                                else
                                {
                                    new BCW.BLL.User().UpdateiMoney(meid, mename, GetPrice, "派币帖回帖获得");
                                }

                                //更新已派
                                new BCW.BLL.Text().UpdatePricel(bid, GetPrice);
                                CentText = "" + GetPrice + "" + bzText + "";
                                PbCent   = "楼主派" + GetPrice + "" + bzText + "";
                            }
                        }
                        else
                        {
                            if (("#" + p.PayCi + "#").IndexOf("#" + Utils.Right(Floor.ToString(), 1) + "#") != -1)
                            {
                                if (p.BzType == 0)
                                {
                                    new BCW.BLL.User().UpdateiGold(meid, mename, GetPrice, "派币帖回帖获得");
                                }
                                else
                                {
                                    new BCW.BLL.User().UpdateiMoney(meid, mename, GetPrice, "派币帖回帖获得");
                                }

                                //更新已派
                                new BCW.BLL.Text().UpdatePricel(bid, GetPrice);
                                CentText = "" + GetPrice + "" + bzText + "";
                                PbCent   = "踩中楼层" + Utils.Right(Floor.ToString(), 1) + "尾,楼主派" + GetPrice + "" + bzText + "";
                            }
                        }
                    }
                }

                BCW.Model.Reply model = new BCW.Model.Reply();
                model.Floor    = Floor;
                model.ForumId  = forumid;
                model.Bid      = bid;
                model.UsID     = meid;
                model.UsName   = mename;
                model.Content  = Content;
                model.FileNum  = 0;
                model.ReplyId  = 0;
                model.AddTime  = DateTime.Now;
                model.CentText = CentText;
                reid           = new BCW.BLL.Reply().Add(model);

                //更新回复ID
                string sPayID = new BCW.BLL.Text().GetReplyID(bid);
                if (("#" + sPayID + "#").IndexOf("#" + meid + "#") == -1)
                {
                    string ReplyID = string.Empty;
                    if (string.IsNullOrEmpty(sPayID))
                    {
                        ReplyID = meid.ToString();
                    }
                    else
                    {
                        ReplyID = sPayID + "#" + meid;
                    }
                    new BCW.BLL.Text().UpdateReplyID(bid, ReplyID);
                }
                //更新回复数
                new BCW.BLL.Text().UpdateReplyNum(bid, 1);
                //上传文件
                SaveFiles(meid, forumid, bid, reid, out kk);
                string strOut = string.Empty;
                if (kk < 0)
                {
                    if (kk == -999)
                    {
                        kk = 0;
                    }

                    strOut = "部分文件超出今天上传数量导致上传失败!";
                    kk     = Math.Abs(kk);
                }
                //更新回复文件数
                new BCW.BLL.Reply().UpdateFileNum(reid, kk);
                //论坛统计
                BCW.User.Users.UpdateForumStat(2, meid, mename, forumid);

                int GroupId = new BCW.BLL.Forum().GetGroupId(forumid);

                //动态记录
                if (GroupId == 0)
                {
                    new BCW.BLL.Action().Add(-1, 0, meid, mename, "在" + Forummodel.Title + "回复帖子[URL=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]" + new BCW.BLL.Text().GetTitle(bid) + "[/URL]");
                }
                else
                {
                    new BCW.BLL.Action().Add(-2, 0, meid, mename, "在圈坛-" + Forummodel.Title + "回复帖子[URL=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]" + new BCW.BLL.Text().GetTitle(bid) + "[/URL]");
                }
                //积分操作/论坛统计/圈子论坛不进行任何奖励
                if (GroupId == 0)
                {
                    new BCW.User.Cent().UpdateCent2(BCW.User.Cent.enumRole.Cent_Reply, meid, true);
                }
                else
                {
                    if (!Utils.GetDomain().Contains("th"))
                    {
                        new BCW.User.Cent().UpdateCent2(BCW.User.Cent.enumRole.Cent_Reply, meid, false);
                    }
                }
                Utils.Success("文件回帖", "回复" + kk + "个文件成功!" + strOut + "" + PbCent + "<br /><a href=\"" + ReplaceWap(Utils.getUrl("topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "")) + "\">返回主题</a><br /><a href=\"" + ReplaceWap(Utils.getUrl("reply.aspx?forumid=" + forumid + "&amp;bid=" + bid + "")) + "\">回复列表</a>", ReplaceWap(Utils.getUrl("reply.aspx?forumid=" + forumid + "&amp;bid=" + bid + "")), "2");
            }
        }
    }
示例#5
0
    private void ReloadPage()
    {
        string Date = DateTime.Now.ToString("yyyyMMdd");

        string str = new BCW.Service.GetNews().GetNewsXML(Date);

        //builder.Append(str);


        string[] Temp = Regex.Split(str, @"\],\[");
        for (int i = 1; i < Temp.Length; i++)
        {
            string   Title   = "";
            string   strUrl  = "";
            DateTime AddTime = DateTime.Now;
            int      nid     = 0;

            string[] temp = Regex.Split(Temp[i], ",\"");
            nid     = Convert.ToInt32(temp[0]);
            Title   = temp[1].Replace("\"", "");
            strUrl  = temp[2].Replace("\"", "");
            AddTime = Convert.ToDateTime("" + DateTime.Now.Year + "/" + temp[3].Replace("\"", "").Replace("]", ""));

            //1,"遭中俄反对 美防长称未确定在东亚何地部署萨德","http://news.sohu.com/20150411/n411104811.shtml","04/11 01:13"

            //builder.Append("" + nid + "<br />");
            //builder.Append("" + Title + "<br />");
            //builder.Append("" + strUrl + "<br />");
            //builder.Append("" + AddTime + "<br />");

            //国内0
            //国际1
            //社会2
            //国际财经3
            //军事4
            //体育5
            //娱乐6
            //文化7
            //汽车8

            int Types = Convert.ToInt32(ub.GetSub("NewsTypes", xmlPath));//导入文章栏目还是帖子
            //ID对应文章分类ID
            int NodeId = 0;
            //发布的ID(导入帖子时用到)
            int meid = 0;

            NodeId = Convert.ToInt32(ub.GetSub("NewsID" + nid + "", xmlPath));
            if (Types == 1)
            {
                meid = Convert.ToInt32(ub.GetSub("NewsIDb" + nid + "", xmlPath));
            }

            if (!strUrl.Contains("http://pic.") && strUrl.Contains(".shtml"))
            {
                //抓取N分钟内的News
                int min = 1440;
                if (AddTime > DateTime.Now.AddMinutes(-min))
                {
                    //if (Types == 0)
                    //{
                    //    if (!new BCW.BLL.Detail().Exists(Title))
                    //    {
                    //        BCW.Model.Detail model = new BCW.Model.Detail();
                    //        model.Title = Title;
                    //        model.KeyWord = Out.CreateKeyWord(Title, 2);
                    //        model.Model = "";
                    //        model.IsAd = true;
                    //        model.Types = 11;
                    //        model.NodeId = NodeId;
                    //        model.Content = strUrl;
                    //        model.TarText = "";
                    //        model.LanText = "";
                    //        model.SafeText = "";
                    //        model.LyText = "";
                    //        model.UpText = "";
                    //        model.IsVisa = 0;
                    //        model.AddTime = AddTime;
                    //        model.Readcount = 0;
                    //        model.Recount = 0;
                    //        model.Cent = 0;
                    //        model.BzType = 0;
                    //        model.Hidden = 0;
                    //        model.UsID = -1;//采集的标识

                    //        new BCW.BLL.Detail().Add(model);
                    //    }
                    //}
                    //else
                    //{

                    string mename = new BCW.BLL.User().GetUsName(meid);

                    DataSet ds = new BCW.BLL.Text().GetList("ID", "ForumId=" + NodeId + " and UsID=" + meid + " and Title='" + Title + "'");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        int    Price  = 0;
                        int    Prices = 0;
                        int    IsSeen = 0;
                        string PayCi  = string.Empty;

                        BCW.Model.Text addmodel = new BCW.Model.Text();
                        addmodel.ForumId     = NodeId;
                        addmodel.Types       = 0;
                        addmodel.Title       = Title;
                        addmodel.Content     = strUrl;
                        addmodel.HideContent = "";
                        addmodel.UsID        = meid;
                        addmodel.UsName      = mename;
                        addmodel.Price       = Price;
                        addmodel.Prices      = Prices;
                        addmodel.BzType      = 0;
                        addmodel.HideType    = 9; //采集的标识
                        addmodel.PayCi       = PayCi;
                        addmodel.IsSeen      = IsSeen;
                        addmodel.AddTime     = DateTime.Now;
                        addmodel.ReTime      = DateTime.Now;
                        new BCW.BLL.Text().Add(addmodel);
                    }
                    //}
                }
            }
        }
        Master.Title = "采集新闻列表";

        Master.Refresh = 60;
        Master.Gourl   = Utils.getUrl("go.aspx");
        builder.Append("采集完成,间隔60秒再次自动启动...");
    }
示例#6
0
    /// <summary>
    /// 陈志基 20160816
    /// 修改保存属性改变触发事件
    /// </summary>
    private void EditSavePage()
    {
        int      id            = int.Parse(Utils.GetRequest("id", "post", 2, @"^[1-9]\d*$", "帖子ID错误"));
        string   Title         = Utils.GetRequest("Title", "post", 2, @"^[^\^]{1,50}$", "标题限1-50字");
        string   Content       = Utils.GetRequest("Content", "post", 2, @"^[^\^]{1,50000}$", "请输入不超50000的内容");
        int      LabelId       = int.Parse(Utils.GetRequest("LabelId", "post", 2, @"^[0-9]\d*$", "类型选择错误"));
        int      UsID          = int.Parse(Utils.GetRequest("UsID", "post", 2, @"^[1-9]\d*$", "用户ID错误"));
        string   UsName        = Utils.GetRequest("UsName", "post", 2, @"^[^\^]{1,50}$", "昵称不超50字");
        int      ReadNum       = int.Parse(Utils.GetRequest("ReadNum", "post", 2, @"^[0-9]\d*$", "阅读数填写错误"));
        int      IsGood        = int.Parse(Utils.GetRequest("IsGood", "post", 2, @"^[0-1]$", "精华选择错误"));
        string   GoodSmallIcon = Utils.GetRequest("GoodSmallIcon", "post", 1, "", "");
        int      IsRecom       = int.Parse(Utils.GetRequest("IsRecom", "post", 2, @"^[0-1]$", "推荐选择错误"));
        int      IsTop         = int.Parse(Utils.GetRequest("IsTop", "post", 2, @"^-1|0|1|2$", "置顶选择错误"));
        int      IsLock        = int.Parse(Utils.GetRequest("IsLock", "post", 2, @"^[0-1]$", "锁定选择错误"));
        int      IsOver        = int.Parse(Utils.GetRequest("IsOver", "post", 2, @"^[0-1]$", "结束选择错误"));
        int      IsDel         = int.Parse(Utils.GetRequest("IsDel", "post", 2, @"^[0-1]$", "删除选择错误"));
        DateTime ReTime        = Utils.ParseTime(Utils.GetRequest("ReTime", "post", 2, DT.RegexTime, "回帖时间填写出错"));
        int      ForumID       = int.Parse(Utils.GetRequest("ForumID", "post", 2, @"^[1-9]\d*$", "推荐选择错误"));

        if (!new BCW.BLL.Text().Exists(id))
        {
            Utils.Error("不存在的帖子记录", "");
        }
        if (!new BCW.BLL.User().Exists(UsID))
        {
            Utils.Error("不存在的用户ID", "");
        }


        BCW.Model.Text model2 = new BCW.BLL.Text().GetText(id);

        if (model2.IsDel != IsDel)//触发事件
        {
            if (IsDel == 1)
            {
                new BCW.BLL.Forumstat().Update2(1, UsID, model2.ForumId, model2.AddTime);//更新统计表发帖
            }
            else
            {
                new BCW.BLL.Forumstat().Update3(1, UsID, model2.ForumId, model2.AddTime);//更新统计表发帖
            }
        }

        BCW.Model.Text model = new BCW.Model.Text();
        model.ID            = id;
        model.Title         = Title;
        model.Content       = Content;
        model.LabelId       = LabelId;
        model.UsID          = UsID;
        model.UsName        = UsName;
        model.ReadNum       = ReadNum;
        model.IsGood        = IsGood;
        model.GoodSmallIcon = GoodSmallIcon;
        model.IsRecom       = IsRecom;
        model.IsTop         = IsTop;
        model.IsLock        = IsLock;
        model.IsOver        = IsOver;
        model.IsDel         = IsDel;
        model.ReTime        = ReTime;
        model.ForumId       = ForumID;
        new BCW.BLL.Text().Update2(model);
        if (!ForumID.Equals(model2.ForumId))//触发事件
        {
            //去掉精华和推荐再转移
            if (model2.IsGood == 1)
            {
                new BCW.BLL.Text().UpdateIsGood(id, 0);
            }
            if (model2.IsRecom == 1)
            {
                new BCW.BLL.Text().UpdateIsRecom(id, 0);
            }
            //重新进行原论坛回复统计
            DataSet ds = new BCW.BLL.Reply().GetList("ID,AddTime,UsID,IsDel,UsName", "forumid=" + model2.ForumId + " and bid=" + id + "");
            {
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (int.Parse(ds.Tables[0].Rows[i]["IsDel"].ToString()) == 0)//如果回帖没有删除
                        {
                            //减少对旧论坛回帖用户的回帖统计
                            new BCW.BLL.Forumstat().Update2(2, int.Parse(ds.Tables[0].Rows[i]["UsID"].ToString()), model2.ForumId, DateTime.Parse(ds.Tables[0].Rows[i]["AddTime"].ToString()));
                            //增加对新论坛回帖用户的回帖统计
                            new BCW.BLL.Forumstat().Update3(2, int.Parse(ds.Tables[0].Rows[i]["UsID"].ToString()), ForumID, DateTime.Parse(ds.Tables[0].Rows[i]["AddTime"].ToString()));
                            // BCW.User.Users.UpdateForumStat(2, int.Parse(ds.Tables[0].Rows[i]["UsID"].ToString()), ds.Tables[0].Rows[i]["UsName"].ToString(), ForumID);
                        }
                        //更新回帖中的论坛ID
                        new BCW.BLL.Reply().UpdateForumID(int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()), ForumID);
                        // new BCW.BLL.Forumstat().Update2(2, model.UsID, forumid, DateTime.Parse(ds.Tables[0].Rows[i]["AddTime"].ToString()));
                        // BCW.User.Users.UpdateForumStat(2, model.UsID, model.UsName, newid);
                        // new BCW.BLL.Reply().UpdateForumID(int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()), newid);
                    }
                }
            }
            //转移的原论坛帖子统计
            new BCW.BLL.Forumstat().Update2(1, model2.UsID, model2.ForumId, model2.AddTime);
            //转移的新论坛帖子统计
            // BCW.User.Users.UpdateForumStat(1, model2.UsID, model2.UsName, ForumID);
            new BCW.BLL.Forumstat().Update3(1, model.UsID, ForumID, model.AddTime);
        }
        Utils.Success("编辑帖子", "编辑帖子成功..", Utils.getUrl("thread.aspx?act=edit&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + ""), "1");
    }
示例#7
0
文件: Text.cs 项目: radtek/GitKB288
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update2(BCW.Model.Text model)
 {
     dal.Update2(model);
 }
示例#8
0
    private void SavePage(int forumid, int bid, int id)
    {
        int meid = new BCW.User.Users().GetUsId();

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

        string GsDemoID = ub.GetSub("BbsGsDemoID", xmlPath);

        if (GsDemoID != "")
        {
            if (!("#" + GsDemoID + "#").Contains("#" + meid + "#"))
            {
                Utils.Error("此功能内测中,您的ID不在内测ID里", "");
            }
        }
        DateTime GsStopTime = Utils.ParseTime(ub.GetSub("BbsGsStopTime", xmlPath));
        int      GsqiNum    = Utils.ParseInt(ub.GetSub("BbsGsqiNum", xmlPath));

        if (GsqiNum == 0)
        {
            Utils.Error("本期尚未设置", "");
        }
        if (GsStopTime < DateTime.Now)
        {
            Utils.Error("本期第" + GsqiNum + "期已截止发表,截止时间" + GsStopTime + "", "");
        }
        if (id > 0)
        {
            BCW.Model.Forumvote model = new BCW.BLL.Forumvote().GetForumvote(id);
            if (model == null)
            {
                Utils.Error("不存在的记录", "");
            }
            if (model.UsID != meid)
            {
                Utils.Error("不存在的记录", "");
            }
        }
        else
        {
            BCW.Model.Text modelT = new BCW.BLL.Text().GetText(bid);
            if (modelT == null)
            {
                Utils.Error("不存在的记录", "");
            }
            if (modelT.UsID != meid)
            {
                Utils.Error("不存在的记录", "");
            }
            if (GsqiNum == modelT.Gqinum)
            {
                Utils.Error("本期已参赛过了", "");
            }
        }
        if (new BCW.User.ForumInc().IsForumGSIDS(forumid) == true)
        {
            string Choose = "";
            Choose = Utils.GetRequest("Choose", "post", 2, @"^[^\,]{1,50}(?:\,[^\,]{1,50}){0,500}$", "参赛内容选择出错");

            int cNum = Utils.GetStringNum(Choose, ",");
            if (new BCW.User.ForumInc().IsForum113(forumid) == true)
            {
                if (cNum != 5)
                {
                    Utils.Error("请选择6个生肖", "");
                }
            }
            else if (new BCW.User.ForumInc().IsForum114(forumid) == true)
            {
                if (Choose.Contains("单") || Choose.Contains("双"))
                {
                    if (cNum != 3)
                    {
                        Utils.Error("选择半波参赛时,请选择4个半波", "");
                    }
                }
                else
                {
                    if (cNum != 1)
                    {
                        Utils.Error("选择波色参赛时,请选择2个波色", "");
                    }
                }
            }
            else if (new BCW.User.ForumInc().IsForum116(forumid) == true)
            {
                if (cNum != 0)
                {
                    Utils.Error("请选择1个生肖", "");
                }
            }
            if (new BCW.User.ForumInc().IsForum117(forumid) == true)
            {
                if (cNum != 4)
                {
                    Utils.Error("请选择5个数字", "");
                }
            }
            if (new BCW.User.ForumInc().IsForum119(forumid) == true)
            {
                if (cNum != 4)
                {
                    Utils.Error("请选择5个尾数", "");
                }
            }
            if (new BCW.User.ForumInc().IsForum115(forumid) == true || new BCW.User.ForumInc().IsForum121(forumid) == true || new BCW.User.ForumInc().IsForum122(forumid) == true)
            {
                if (cNum != 0)
                {
                    Utils.Error("参数选择错误", "");
                }
            }
            string mename = new BCW.BLL.User().GetUsName(meid);
            if (id > 0)
            {
                string Title   = Utils.GetRequest("Title", "post", 2, @"^[\s\S]{1," + ub.GetSub("BbsThreadMax", xmlPath) + "}$", "标题限1-50字");
                string Content = Utils.GetRequest("Content", "post", 2, @"^[\s\S]{1," + ub.GetSub("BbsContentMax", xmlPath) + "}$", "请输入不超" + ub.GetSub("BbsContentMax", xmlPath) + "字的内容");

                BCW.Model.Text model2 = new BCW.Model.Text();
                model2.ID      = bid;
                model2.Title   = Title;
                model2.Content = Content;
                new BCW.BLL.Text().Update(model2);

                new BCW.BLL.Forumvote().UpdateNotes(id, Choose);
                //记录日志
                string strLog = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]修改了参赛内容!主题[url=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]《" + new BCW.BLL.Text().GetTitle(bid) + "》[/url]";
                new BCW.BLL.Forumlog().Add(7, forumid, bid, strLog);
            }
            else
            {
                BCW.Model.Forumvote f = new BCW.Model.Forumvote();
                f.Types   = 0;
                f.ForumID = forumid;
                f.BID     = bid;
                f.Notes   = Choose;
                f.state   = 0;
                f.qiNum   = GsqiNum;
                f.IsWin   = 0;
                f.AddTime = DateTime.Now;
                f.UsID    = meid;
                f.UsName  = mename;
                new BCW.BLL.Forumvote().Add(f);
                //更新期数进主题记录并加历史次数
                new BCW.BLL.Text().UpdateGqinum(bid, GsqiNum);
            }
            Utils.Success("参赛", "操作成功,正在进入参赛帖...", Utils.getUrl("topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + ""), "2");
        }
    }