Esempio n. 1
0
        //传入ID才可修改最新的词条
        public IActionResult BKEditor()
        {
            switch (Mode)
            {
            case "admin":
                //if (!B_Admin.CheckIsLogged(Request.RawUrl)) { return null; }
                M_AdminInfo adminMod = B_Admin.GetLogin(HttpContext);
                if (adminMod == null)
                {
                    return(WriteOK("无权访问"));
                }
                break;

            case "user":
            default:    //是否限定创建权限,用户所在组是否拥有创建权限
                //B_User.CheckIsLogged(Request.RawUrl);
                if (!bkBll.AuthCheck(GuestConfig.GuestOption.BKOption.CreateBKGroup, mu.GroupID))
                {
                    return(WriteErr("你没有创建或编辑词条的权限"));
                }
                break;
            }
            M_Baike bkMod = GetModel_Editor(ref err);

            if (!string.IsNullOrEmpty(err))
            {
                return(WriteErr(err)); return(null);
            }
            if (bkMod == null)
            {
                bkMod = new M_Baike();
            }
            return(View(bkMod));
        }
Esempio n. 2
0
        //传入ID才可修改最新的词条
        public ActionResult BKEditor()
        {
            switch (Mode)
            {
            case "admin":
                if (!B_Admin.CheckIsLogged(Request.RawUrl))
                {
                    return(null);
                }
                break;

            case "user":
            default:    //是否限定创建权限,用户所在组是否拥有创建权限
                B_User.CheckIsLogged(Request.RawUrl);
                if (!bkBll.AuthCheck(GuestConfig.GuestOption.BKOption.CreateBKGroup, mu.GroupID))
                {
                    function.WriteErrMsg("你没有创建或编辑词条的权限"); return(null);
                }
                break;
            }
            M_Baike bkMod = GetModel_Editor(ref err);

            if (!string.IsNullOrEmpty(err))
            {
                function.WriteErrMsg(err); return(null);
            }
            if (bkMod == null)
            {
                bkMod = new M_Baike();
            }
            return(View(bkMod));
        }
Esempio n. 3
0
    protected void Save_Btn_Click(object sender, EventArgs e)
    {
        M_UserInfo mu = buser.GetLogin();

        if (Mid > 0)
        {
            bkMod = bkBll.SelReturnModel(Mid);
        }
        bkMod.Contents       = Contents_T.Text;
        bkMod.Brief          = Brief_T.Text;
        bkMod.BriefImg       = pic_hid.Value;
        bkMod.Extend         = info_hid.Value;
        bkMod.Reference      = refence_hid.Value;
        bkMod.UpdateTime     = DateTime.Now;
        bkMod.Classification = class_hid.Value;
        bkMod.Editnumb++;
        bkMod.Btype = BType_T.Text.Replace(" ", "");
        if (bkMod.ID > 0)
        {
            bkBll.UpdateByID(bkMod);
        }
        else
        {
            bkMod.Status   = 1;
            bkMod.UserId   = mu.UserID;
            bkMod.UserName = mu.UserName;
            bkMod.Tittle   = Tittle;
            bkMod.ID       = bkBll.insert(bkMod);
        }
        function.WriteSuccessMsg("词条操作完成", "Details.aspx?ID=" + bkMod.ID);
    }
        protected void MyBind(int tittle)
        {
            M_Baike bkMod = bkBll.SelReturnModel(Mid);

            BaikeName.Text   = bkMod.Tittle;
            txbRoleName.Text = bkMod.UserName;
            tbRoleInfo.Text  = bkMod.Contents;
            TextBox1.Text    = bkMod.Reference;
            TextBox2.Text    = bkMod.Btype;
            TextBox3.Text    = bkMod.Extend;
            TextBox5.Text    = bkMod.Brief;
            string gradestr = bkMod.GradeIDS;

            string[] gradeids = gradestr.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
            if (gradeids.Length != 0)
            {
                classification_D.SelectedValue = gradeids[1];
                int cid = Convert.ToInt32(classification_D.SelectedValue);
                switch (gradeids.Length)
                {
                case 3:
                    BindClass2(cid);
                    classification2_D.SelectedValue = gradeids[2];
                    break;

                case 4:
                    BindClass2(cid);
                    classification2_D.SelectedValue = gradeids[2];
                    BindClass3(cid, Convert.ToInt32(classification2_D.SelectedValue));
                    classification3_D.SelectedValue = gradeids[3];
                    break;
                }
            }
        }
Esempio n. 5
0
 //-----------------------------------Tools
 public void ConverToEdit(M_Baike target, M_Baike source, string type = "")
 {
     if (type.Equals("all"))//完成拷贝,新建百科时复制一份入Baike_Edit
     {
         target.UserId     = source.UserId;
         target.UserName   = source.UserName;
         target.AddTime    = source.AddTime;
         target.Status     = source.Status;
         target.UpdateTime = source.UpdateTime;
         target.VerStr     = source.VerStr;
         target.OldID      = source.OldID;
     }
     target.EditID         = source.EditID;
     target.Tittle         = source.Tittle;
     target.Contents       = source.Contents;
     target.Reference      = source.Reference;
     target.Btype          = source.Btype;
     target.Extend         = source.Extend;
     target.Elite          = source.Elite;
     target.Brief          = source.Brief;
     target.BriefImg       = source.BriefImg;
     target.Classification = source.Classification;
     target.Editnumb       = source.Editnumb;
     target.GradeIDS       = source.GradeIDS;
     target.Flow           = source.Flow;
 }
Esempio n. 6
0
 private void MyBind()
 {
     bkMod = bkBll.SelReturnModel(Mid);
     bke_title.InnerText = Tittle;
     if (Mid > 0)
     {
         bke_title.InnerText = bkMod.Tittle;
         Contents_T.Text     = bkMod.Contents;
         Brief_T.Text        = bkMod.Brief;
         //Contents_T.Text = SafeSC.ReadFileStr("/Test/content.txt");
         pic_img.Src        = bkMod.BriefImg;
         info_hid.Value     = bkMod.Extend;
         class_hid.Value    = bkMod.Classification;
         class_sp.InnerText = "(" + bkMod.Classification + ")";
         refence_hid.Value  = bkMod.Reference;
         BType_T.Text       = bkMod.Btype;
     }
     else
     {
         if (string.IsNullOrEmpty(Tittle))
         {
             function.WriteErrMsg("未指定词条标题");
         }
     }
 }
Esempio n. 7
0
        public IActionResult Details()
        {
            M_Baike bkMod = GetModel();

            ViewBag.Mid    = Mid;
            ViewBag.EditID = EditID;
            return(View(bkMod));
        }
        private void MyBind()
        {
            M_Baike bkMod = bkBll.SelModelByFlow(Flow);

            VerStr         = bkMod.VerStr;
            EGV.DataSource = editBll.SelBy(-100, Flow, "");
            EGV.DataBind();
        }
Esempio n. 9
0
        //public DataTable SelBy(int status, string flow, string skey)
        //{
        //    List<SqlParameter> sp = new List<SqlParameter>();
        //    string where = "1=1 ";
        //    if (status != -100) { where += " AND Status=" + status; }
        //    if (!string.IsNullOrEmpty(skey)) { where += " AND Tittle LIKE @skey"; sp.Add(new SqlParameter("skey", "%" + skey + "%")); }
        //    if (!string.IsNullOrEmpty(flow)) { where += " AND Flow =@flow"; sp.Add(new SqlParameter("flow", flow)); }
        //    return DBCenter.Sel(TbName, where, PK + " DESC", sp);
        //}
        /// <summary>
        /// 使用该版词条替代原有的词条
        /// </summary>
        public void Apply(int id)
        {
            B_Baike     bkBll  = new B_Baike();
            M_BaikeEdit source = SelReturnModel(id);
            M_Baike     target = bkBll.SelModelByFlow(source.Flow);

            ConverToEdit(target, source, "all");
            target.Status = 1;
            bkBll.UpdateByID(target);
        }
 //推荐用户增加分数
 public void ChangeUserElid(M_Baike model)
 {
     if (model.Elite != 1 && GuestConfig.GuestOption.BKOption.RemmPoint > 0)
     {
         M_UserInfo mu    = buser.SelReturnModel(model.UserId);
         int        point = GuestConfig.GuestOption.BKOption.RemmPoint;
         buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis()
         {
             score     = point,
             ScoreType = (int)((M_UserExpHis.SType)(Enum.Parse(typeof(M_UserExpHis.SType), GuestConfig.GuestOption.BKOption.PointType))),
             detail    = mu.UserName + "创建的词条[" + model.Tittle + "]被管理员设为推荐,增加奖励:" + point
         });
     }
 }
Esempio n. 11
0
 //给创建用户增加分数
 private void ChangeUserExp(M_Baike model)
 {
     if (model.Status != 1 && GuestConfig.GuestOption.BKOption.CreatePoint > 0)
     {
         M_UserInfo mu    = buser.SelReturnModel(model.UserId);
         int        point = GuestConfig.GuestOption.BKOption.CreatePoint;
         buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis()
         {
             score     = point,
             ScoreType = (int)((M_UserExpHis.SType)(Enum.Parse(typeof(M_UserExpHis.SType), GuestConfig.GuestOption.BKOption.PointType))),
             detail    = mu.UserName + "创建了词条[" + model.Tittle + "],增加奖励:" + point
         });
     }
 }
Esempio n. 12
0
        public IActionResult BKEditor_Add()
        {
            M_Baike     bkMod   = GetModel_Editor(ref err);
            M_BaikeEdit editMod = new M_BaikeEdit();

            if (!string.IsNullOrEmpty(err))
            {
                return(WriteErr(err));
            }
            bkMod.Contents       = Request.Form["Contents_T"];
            bkMod.Brief          = Request.Form["Brief_T"];
            bkMod.BriefImg       = Request.Form["pic_hid"];
            bkMod.Extend         = Request.Form["info_hid"];
            bkMod.Reference      = Request.Form["refence_hid.Value"];
            bkMod.UpdateTime     = DateTime.Now;
            bkMod.Classification = Request.Form["class_hid"];
            //bkMod.Editnumb++;
            bkMod.Btype = RequestEx["BType_T"].Replace(" ", "");
            if (bkMod.ID < 1)//新建百科(新百科也需要管理员审核)
            {
                bkMod.Status   = (int)ZLEnum.ConStatus.UnAudit;
                bkMod.UserId   = mu.UserID;
                bkMod.UserName = mu.UserName;
                bkMod.Tittle   = Tittle;
                bkMod.ID       = bkBll.insert(bkMod);
                editBll.ConverToEdit(editMod, bkMod, "all");
                editBll.Insert(editMod);
                //function.WriteSuccessMsg("创建百科成功", "/Baike/Details?ID=" + bkMod.ID);
            }
            else if (EditID > 0) //修改自己填的未审核百科
            {
                editMod = editBll.SelReturnModel(EditID);
                editBll.ConverToEdit(editMod, bkMod, "all");
                editBll.UpdateByID(editMod);
            }
            else if (Mid > 0) //存为新的版本,待审核,并跳至用户中心处
            {
                editBll.ConverToEdit(editMod, bkMod);
                editMod.Status   = (int)ZLEnum.ConStatus.UnAudit;
                editMod.UserId   = mu.UserID;
                editMod.UserName = mu.UserName;
                editMod.OldID    = Mid;
                editBll.Insert(editMod);
            }
            else
            {
                return(WriteErr("保存条件不正确"));
            }
            return(WriteOK("操作成功,请等待管理员审核", "/User/Guest/BaikeContribution"));
        }
Esempio n. 13
0
        public IActionResult BKList()
        {
            ViewBag.viewDir = viewDir;
            // string VerStr { get { return DataConvert.CStr(ViewState["VerStr"]); } set { ViewState["VerStr"] = value; } }
            M_Baike     bkMod   = bkBll.SelModelByFlow(Flow);
            PageSetting setting = editBll.SelPage(CPage, PSize, new Com_Filter()
            {
                addon = Flow
            });

            //VerStr = bkMod.VerStr;
            //EGV.DataSource = editBll.SelBy(-100, Flow, "");
            //EGV.DataBind();
            return(View("BKList", setting));
        }
Esempio n. 14
0
        public IActionResult CompBaike()
        {
            M_BaikeEdit editMod = editBll.SelReturnModel(EditID);
            M_Baike     bkMod   = bkBll.SelModelByFlow(editMod.Flow);

            if (bkMod == null)
            {
                bkMod = new M_Baike();
            }
            if (editMod == null)
            {
                editMod = new M_BaikeEdit();
            }
            ViewBag.editMod = editMod;
            return(View(bkMod));
        }
Esempio n. 15
0
        //-------------------------------------Tools
        private M_Baike GetModel_Editor(ref string err)
        {
            M_Baike bkMod = null;

            if (Mid < 1 && EditID < 1)
            {
                if (string.IsNullOrEmpty(Tittle))
                {
                    err = "未指定词条标题"; return(null);
                }
                bkMod = new M_Baike();
            }
            else if (Mid > 0)
            {
                bkMod = bkBll.SelReturnModel(Mid);
            }
            else if (EditID > 0)
            {
                bkMod = editBll.SelReturnModel(EditID);
                if (mu.UserID != bkMod.UserId)
                {
                    err = "你无权修改该版本词条"; return(null);
                }
                if (Mode.Equals("admin")) //管理员可不限制操作
                {
                }
                else
                {
                    if (bkMod.Status == 1)
                    {
                        err = "该版本已审核,无法再次修改,<a href='BKEditor?ID=" + bkBll.SelModelByFlow(bkMod.Flow).ID + "'>创建新的版本</a>"; return(null);
                    }
                }
            }
            else if (Mid > 0 && EditID > 0)
            {
                err = "传参错误,指向不明确"; return(null);
            }
            else
            {
                err = "错误,未匹配的版本"; return(null);
            }
            return(bkMod);
        }
Esempio n. 16
0
    protected void MyBind()
    {
        M_Baike bkMod = bkBll.SelReturnModel(Mid);

        if (bkMod == null)
        {
            function.WriteErrMsg("该词条不存在!");
        }
        M_BaikeEdit editMod = new M_BaikeEdit();

        if (EditID > 0)//版本预览模式(指定一个版本记录的id查看详情)
        {
            editMod = editBll.SelReturnModel(EditID);
            if (editMod == null)
            {
                function.WriteErrMsg("该词条不存在或审核未通过!");
            }
            if (b_User.GetLogin().UserID != editMod.UserId && !badmin.CheckLogin())
            {
                function.WriteErrMsg("您没有权限查看此词条信息!");
            }
        }
        Contents_div.InnerHtml = bkMod.Contents;
        tittle_sp.InnerText    = bkMod.Tittle;
        cate_sp.InnerText      = "( " + bkMod.Classification + " )";
        Brief_L.Text           = bkMod.Brief;
        if (string.IsNullOrEmpty(bkMod.BriefImg))
        {
            pic_div.Visible = false;
        }
        else
        {
            pic_img.Src = bkMod.BriefImg;
        }
        info_hid.Value    = bkMod.Extend;
        refence_hid.Value = bkMod.Reference;
        //词条标签
        string[] btypeArr = bkMod.Btype.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
        foreach (string item in btypeArr)
        {
            BType_L.Text += "<a href='/Guest/Baike/Search.aspx?btype=" + HttpUtility.UrlEncode(item) + "' class='btype_a' target='_blank'>" + item + "</a>";
        }
    }
Esempio n. 17
0
 //收藏模块后期处理
 protected void lbtFavorite_Click(object sender, EventArgs e)
 {
     M_Baike bkMod = bkBll.SelByTittle(Tittle);
     //DataTable dt1 = SqlHelper.ExecuteTable(CommandType.Text, "select * from ZL_Favorite where Owner=" + b_User.GetLogin().UserID + "and FavoriType=4 and InfoID=" + bkMod.ID, null);
     //if (dt1.Rows.Count > 0)
     //{
     //    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('收藏失败,已收藏该词条!');</script>");
     //    return;
     //}
     //int flag = SqlHelper.ExecuteNonQuery(CommandType.Text, "insert into ZL_Favorite values('" + muser.UserID + "','" + bkMod.ID + "','" + DateTime.Now.ToString() + "','4','/Guest/Baike/Details.aspx?soure=manager&tittle=@key','')", sp);
     //if (flag == 1)
     //{
     //    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('收藏成功!');</script>");
     //}
     //else
     //{
     //    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('收藏失败,请重试!');</script>");
     //}
 }
        protected void save_Click(object sender, EventArgs e)
        {
            int    id     = Convert.ToInt32(Request["id"]);
            int    s      = Convert.ToInt32(check.SelectedValue);
            string action = Request.QueryString["action"];

            if (action == "manage")
            {
                if (classification_D.SelectedIndex <= 0)
                {
                    function.WriteErrMsg("请选择分类");
                    return;
                }

                string cl       = "";
                string gradeids = "";
                if (classification3_D.SelectedIndex > 0)
                {
                    cl       = classification3_D.SelectedItem.Text;
                    gradeids = cl + ":" + classification_D.SelectedValue + ":" + classification2_D.SelectedValue + ":" + classification3_D.SelectedValue;
                }
                else if (classification2_D.SelectedIndex > 0)
                {
                    cl       = classification2_D.SelectedItem.Text;
                    gradeids = cl + ":" + classification_D.SelectedValue + ":" + classification2_D.SelectedValue;
                }
                else
                {
                    cl       = classification_D.SelectedItem.Text;
                    gradeids = cl + ":" + classification_D.SelectedValue;
                }
                M_Baike bkMod = bkBll.SelReturnModel(id);
                bkMod.Status         = s;
                bkMod.Brief          = TextBox5.Text;
                bkMod.Classification = cl;
                bkMod.GradeIDS       = gradeids;
                bkBll.UpdateByID(bkMod);
                function.WriteSuccessMsg("审核成功", "BkCheck.aspx");
            }
        }
Esempio n. 19
0
        private M_Baike GetModel()
        {
            M_Baike model = null;

            if (Mid > 0)
            {
                model = bkBll.SelReturnModel(Mid);
                if (model.Status == (int)ZLEnum.ConStatus.UnAudit)
                {
                    throw new Exception("该信息尚未审核");
                }
            }
            else if (EditID > 0)
            {
                model = editBll.SelReturnModel(EditID);
                //if (model.UserId != mu.UserID && model.Status == (int)ZLEnum.ConStatus.UnAudit) { return WriteErr("非创建人无权预览该词条"); }
            }
            if (model == null)
            {
                throw new Exception("词条不存在");
            }
            return(model);
        }
Esempio n. 20
0
        private M_Baike GetModel()
        {
            M_UserInfo mu    = buser.GetLogin();
            M_Baike    model = null;

            if (Mid > 0)
            {
                model = bkBll.SelReturnModel(Mid);
                if (model.Status == (int)ZLEnum.ConStatus.UnAudit)
                {
                    function.WriteErrMsg("该信息尚未审核");
                }
            }
            else if (EditID > 0)
            {
                model = editBll.SelReturnModel(EditID);
                //if (model.UserId != mu.UserID && model.Status == (int)ZLEnum.ConStatus.UnAudit) { function.WriteErrMsg("非创建人无权预览该词条"); }
            }
            if (model == null)
            {
                function.WriteErrMsg("词条不存在");
            }
            return(model);
        }
Esempio n. 21
0
        public ActionResult AddToFav()
        {
            M_Favorite favMod = new M_Favorite();

            favMod.InfoID     = DataConvert.CLng(Request["infoID"]);
            favMod.Owner      = mu.UserID;
            favMod.AddDate    = DateTime.Now;
            favMod.FavoriType = DataConvert.CLng(Request.Form["type"], 1);
            //---------------------------
            favMod.FavItemID = "";
            favMod.Title     = HttpUtility.HtmlEncode(Request["title"]);
            favMod.FavUrl    = Request.Form["url"];
            switch (favMod.FavoriType)
            {
            case 1:
            case 3:
            {
                M_CommonData conMod = conBll.SelReturnModel(favMod.InfoID);
                if (conMod == null)
                {
                    err = "内容ID[" + favMod.InfoID + "]不存在"; break;
                }
                if (string.IsNullOrEmpty(favMod.Title))
                {
                    favMod.Title = conMod.Title;
                }
            }
            break;

            case 2:
            {
                M_Product proMod = proBll.GetproductByid(favMod.InfoID);
                if (proMod == null)
                {
                    err = "商品不存在"; break;
                }
                if (string.IsNullOrEmpty(favMod.Title))
                {
                    favMod.Title = proMod.Proname;
                }
            }
            break;

            case 4:
            {
                B_Ask askBll = new B_Ask();
                M_Ask askMod = askBll.SelReturnModel(favMod.InfoID);
                if (askMod == null)
                {
                    err = "问题不存在"; break;
                }
                if (string.IsNullOrEmpty(favMod.Title))
                {
                    favMod.Title = StringHelper.SubStr(askMod.Qcontent);
                }
            }
            break;

            case 5:
            {
                B_Baike bkBll = new B_Baike();
                M_Baike bkMod = bkBll.SelReturnModel(favMod.InfoID);
                if (bkMod == null)
                {
                    err = "百科不存在"; break;
                }
                if (string.IsNullOrEmpty(favMod.Title))
                {
                    favMod.Title = bkMod.Tittle;
                }
            }
            break;
            }
            if (string.IsNullOrEmpty(favMod.Title))
            {
                favMod.Title = "无标题";
            }
            if (favMod.InfoID < 1)
            {
                err = "未指定内容ID";
            }
            else if (favMod.Owner < 1)
            {
                err = "用户未登录";
            }
            else
            {
                favBll.insert(favMod);
            }
            ViewBag.err = err;
            return(View());
        }
Esempio n. 22
0
 public bool UpdateByID(M_Baike model)
 {
     model.TbName = initMod.TbName;
     return(DBCenter.UpdateByID(model, model.ID));
 }
Esempio n. 23
0
 public int insert(M_Baike model)
 {
     return(DBCenter.Insert(model));
 }