Exemple #1
0
        private void SetProductIsShow()
        {
            int id = RequestHelper.GetFormInt("id");

            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(id);
            if (model != null)
            {
                if (model.upvote == (int)EnumCollection.YesOrNot.是)
                {
                    model.upvote = (int)EnumCollection.YesOrNot.否;
                }
                else
                {
                    model.upvote = (int)EnumCollection.YesOrNot.是;
                }

                bll.Update(model);

                HttpContext.Current.Response.Write("1");
                HttpContext.Current.Response.End();
            }
            else
            {
                HttpContext.Current.Response.Write("0");
                HttpContext.Current.Response.End();
            }
        }
Exemple #2
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_case_list", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.common_article bll = new BLL.common_article();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(EnumCollection.ActionEnum.Delete.ToString(), "删除经典案例" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("case_list.aspx", "keywords={0}&cate={1}", this.keywords, this.cate + ""));
        }
Exemple #3
0
        private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " 1 = 1 ";
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (Title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", ""));
                    return;
                }
            }
            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_article bll = new BLL.common_article();
            this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("Manage.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.id   = RequestHelper.GetQueryInt("id", 0);
            this.cate = RequestHelper.GetQueryInt("cate", 0);

            if (!new BLL.common_category().Exists(this.cate))
            {
                Response.Write("<script>alert('没有此分类');history.back(-1);</script>");
                Response.End();
                return;
            }

            if (!IsPostBack)
            {
                Model.common_category cateModel = new BLL.common_category().GetModel(this.cate);
                if (cateModel != null)
                {
                    this.cate_name = cateModel.name;
                }

                Model.common_article model = new BLL.common_article().GetModel(this.id);
                if (model == null)
                {
                    Response.Write("<script>alert('没有此新闻');history.back(-1);</script>");
                    Response.End();
                    return;
                }

                title    = model.title;
                subtitle = model.subtitle;
                add_time = Convert.ToDateTime(model.add_time).ToString("yyyy-MM-dd");
                contents = model.contents;
            }
        }
Exemple #5
0
        private bool DoAdd()
        {
            Model.common_article model = new Model.common_article();
            BLL.common_article   bll   = new BLL.common_article();

            model.group_id    = (int)EnumCollection.article_group.新闻动态;
            model.user_id     = 0;
            model.category_id = Convert.ToInt32(ddlCategory.SelectedValue);
            model.title       = Convert.ToString(txttitle.Text.Trim());
            model.subtitle    = Convert.ToString(txtsubtitle.Text.Trim());
            model.contents    = Convert.ToString(txtcontents.Text.Trim());
            model.img_src     = Convert.ToString(txtimg_src.Text.Trim());
            model.click       = 0;
            model.upvote      = 0;
            model.status      = (int)EnumCollection.examine_status.审核通过;
            model.add_time    = System.DateTime.Now;

            int id = bll.Add(model);

            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加新闻信息,主键:" + id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void BindData()
        {
            BLL.common_category catebll = new BLL.common_category();

            DataTable dt = catebll.GetList(" group_id = " + (int)EnumCollection.category_group.新闻动态 + " order by sort asc ");

            this.rptCategory.DataSource = dt;
            this.rptCategory.DataBind();

            if (this.cate <= 0)
            {
                Model.common_category cateModel = catebll.GetModel(1, " group_id = " + (int)EnumCollection.category_group.新闻动态, " sort asc ");
                if (cateModel != null)
                {
                    this.cate = cateModel.id;
                }
            }

            this.pageIndex = RequestHelper.GetQueryInt("page", 1);

            BLL.common_article bll      = new BLL.common_article();
            string             whereStr = " group_id = " + (int)EnumCollection.article_group.新闻动态 + " and category_id = " + this.cate;

            dt = bll.GetListByPage("*", "View_NewsList", whereStr, " add_time desc ", pageIndex, pageSize);
            this.rptNews.DataSource = dt;
            this.rptNews.DataBind();

            int totalCount = bll.GetRecordCount("View_NewsList", whereStr);

            string pageUrl = Utils.CombUrlTxt("news_list.aspx", "page={0}", "__id__");

            PageContent.InnerHtml = PageListHelper.OutPageList(totalCount, pageIndex, pageSize, pageUrl);
        }
Exemple #7
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_article", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(this.id);

            model.group_id    = Convert.ToInt32(txtgroup_id.Text);
            model.user_id     = Convert.ToInt32(txtuser_id.Text);
            model.category_id = Convert.ToInt32(txtcategory_id.Text);
            model.title       = Convert.ToString(txttitle.Text);
            model.subtitle    = Convert.ToString(txtsubtitle.Text);
            model.contents    = Convert.ToString(txtcontents.Text);
            model.img_src     = Convert.ToString(txtimg_src.Text);
            model.click       = Convert.ToInt32(txtclick.Text);
            model.upvote      = Convert.ToInt32(txtupvote.Text);
            model.status      = Convert.ToInt32(txtstatus.Text);
            model.add_time    = Convert.ToDateTime(txtadd_time.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改全局文章信息,主键:" + id); //记录日志
                JscriptMsg("修改全局文章信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
Exemple #8
0
        private bool DoEdit(int id)
        {
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(id);

            model.group_id    = (int)EnumCollection.article_group.关于我们;
            model.user_id     = 0;
            model.category_id = 0;
            model.title       = Convert.ToString(txttitle.Text);
            model.subtitle    = "";
            model.contents    = Convert.ToString(txtcontents.Text);
            model.img_src     = "";
            model.click       = 0;
            model.upvote      = 0;
            model.status      = (int)EnumCollection.YesOrNot.是;
            model.add_time    = System.DateTime.Now;

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改关于我们,主键:" + id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #9
0
        private bool DoAdd()
        {
            Model.common_article model = new Model.common_article();
            BLL.common_article   bll   = new BLL.common_article();

            model.group_id    = (int)EnumCollection.article_group.PC站关于我们;
            model.user_id     = 0;
            model.category_id = 0;
            model.title       = Convert.ToString(txttitle.Text);
            model.subtitle    = "";
            model.contents    = Convert.ToString(txtcontents.Text);
            model.img_src     = "";
            model.click       = 0;
            model.upvote      = 0;
            model.status      = (int)EnumCollection.YesOrNot.是;
            model.add_time    = System.DateTime.Now;

            int id = bll.Add(model);

            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加PC站关于我们,主键:" + id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void BindData()
        {
            DataTable dt = new BLL.common_adR().GetList("ad_group_id = " + (int)EnumCollection.adR_group.梧桐花轮播图 + " order by ad_group_id,ad_sort_id");

            this.rptBanner.DataSource = dt;
            this.rptBanner.DataBind();

            BLL.common_article bll = new BLL.common_article();
            dt = bll.GetListByPage(" group_id = " + (int)EnumCollection.article_group.我们的服务, "add_time desc", 1, 4);

            this.rptService.DataSource = dt;
            this.rptService.DataBind();

            dt = bll.GetListByPage(" group_id = " + (int)EnumCollection.article_group.客户案例, "add_time desc", 1, 8);

            this.rptCase.DataSource = dt;
            this.rptCase.DataBind();
            if (bll.GetRecordCount(" group_id = " + (int)EnumCollection.article_group.客户案例) <= 8)
            {
                this.more_i.Visible = false;
            }

            dt = bll.GetListByPage(" group_id = " + (int)EnumCollection.article_group.新闻动态, " add_time desc ", 1, 4);
            this.rptNews.DataSource = dt;
            this.rptNews.DataBind();
            if (bll.GetRecordCount(" group_id = " + (int)EnumCollection.article_group.新闻动态) <= 4)
            {
                this.news_more.Visible = false;
            }
        }
        private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " group_id = " + (int)EnumCollection.article_group.我们的服务;
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and ((title like  '%" + _keywords + "%') or (content like '%" + _keywords + "%'))";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("services_list.aspx", "keywords={0}", ""));
                    return;
                }
            }

            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_article bll = new BLL.common_article();
            this.rptList.DataSource = bll.GetListByPage(whereStr, "add_time desc", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("services_list.aspx", "keywords={0}&page={1}&cp={2}", this.keywords, "__id__", this.cp + "");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        private bool DoAdd()
        {
            Model.common_article model = new Model.common_article();
            BLL.common_article   bll   = new BLL.common_article();

            model.group_id    = (int)EnumCollection.article_group.精品微课问题讨论;
            model.user_id     = 0;
            model.category_id = this.chapter;
            model.title       = Convert.ToString(txttitle.Text);
            model.subtitle    = "";
            model.contents    = Convert.ToString(txtcontents.Text);
            model.img_src     = "";
            model.click       = 0;
            model.upvote      = 0;
            model.status      = (int)EnumCollection.examine_status.审核通过;
            model.add_time    = System.DateTime.Now;

            int id = bll.Add(model);

            if (id > 0)
            {
                #region 保存图片
                string[] albumArr = Request.Form.GetValues("hid_photo_name");
                if (albumArr != null && albumArr.Length > 0)
                {
                    for (int i = 0; i < albumArr.Length; i++)
                    {
                        string[] imgArr = albumArr[i].Split('|');
                        if (imgArr.Length == 3)
                        {
                            var img = new Model.common_albums
                            {
                                group_id      = (int)EnumCollection.img_group.精品微课问题讨论图片,
                                rc_type       = 0,
                                rc_data_id    = id,
                                add_time      = DateTime.Now,
                                original_path = imgArr[1],
                                thumb_path    = imgArr[2],
                                remark        = ""
                            };

                            new BLL.common_albums().Add(img);
                        }
                    }
                }
                #endregion 保存图片

                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加问题讨论信息,主键:" + id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #13
0
        private void ShowInfo()
        {
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(" group_id = " + (int)EnumCollection.article_group.关于我们);

            if (model != null)
            {
                this.txttitle.Text    = model.title;
                this.txtcontents.Text = model.contents;
            }
        }
        private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " group_id = " + (int)EnumCollection.article_group.精品微课问题讨论 + " and category_id = " + this.chapter;
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (Title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("discuss_list.aspx", "keywords={0}", ""));
                    return;
                }
            }

            Model.course_chapter ccModel = new BLL.course_chapter().GetModel(chapter);
            if (ccModel != null)
            {
                chapter_name = ccModel.name;
                Model.course_info course = new BLL.course_info().GetModel(ccModel.course_id);
                if (course != null)
                {
                    course_name = course.name;
                }
                else
                {
                    JscriptMsg("传递参数错误", "back");
                    return;
                }
            }
            else
            {
                JscriptMsg("传递参数错误", "back");
                return;
            }

            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_article bll = new BLL.common_article();
            this.rptList.DataSource = bll.GetListByPage("*", "View_CourseArticle", whereStr, "add_time desc", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount("View_CourseArticle", whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("discuss_list.aspx", "keywords={0}&page={1}&chapter={2}", this.keywords, "__id__", this.chapter + "");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        private void ShowInfo(int _id)
        {
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(_id);
            if (model == null)
            {
                JscriptMsg("信息不存在或已被删除!", "back");
                return;
            }

            this.ddlCategory.SelectedValue = model.category_id + "";
            this.txtcontents.Text          = model.contents;
        }
Exemple #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Model.common_article model = new BLL.common_article().GetModel(" group_id = " + (int)EnumCollection.article_group.PC站关于我们);
                if (model != null)
                {
                    contents = model.contents;
                }

                BindData();
            }
        }
Exemple #17
0
        private void ShowInfo(int _id)
        {
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(_id);
            if (model == null)
            {
                JscriptMsg("信息不存在或已被删除!", "back");
                return;
            }

            this.txttitle.Text    = model.title;
            this.txtimg_src.Text  = model.img_src;
            this.txtcontents.Text = model.contents;
        }
        private bool DoEdit(int id)
        {
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(this.id);

            model.group_id    = (int)EnumCollection.article_group.精品微课问题讨论;
            model.user_id     = 0;
            model.category_id = this.chapter;
            model.title       = Convert.ToString(txttitle.Text);
            model.contents    = Convert.ToString(txtcontents.Text);

            if (bll.Update(model))
            {
                #region 保存图片
                string[] albumArr = Request.Form.GetValues("hid_photo_name");

                if (albumArr != null && albumArr.Length > 0)
                {
                    DBUtility.DbHelperSQL.ExecuteSql("delete ybd_common_albums where rc_guid=" + model.id + " and group_id=" + (int)EnumCollection.img_group.精品微课问题讨论图片);//删除图片
                    for (int i = 0; i < albumArr.Length; i++)
                    {
                        string[] imgArr = albumArr[i].Split('|');
                        if (imgArr.Length == 3)
                        {
                            var img = new Model.common_albums
                            {
                                group_id      = (int)EnumCollection.img_group.精品微课问题讨论图片,
                                rc_type       = 0,
                                rc_data_id    = id,
                                add_time      = DateTime.Now,
                                original_path = imgArr[1],
                                thumb_path    = imgArr[2],
                                remark        = ""
                            };

                            new BLL.common_albums().Add(img);
                        }
                    }
                }
                #endregion 保存图片

                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改问题讨论信息,主键:" + model.id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #19
0
        private void BindInfo()
        {
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(this.id);
            if (model == null)
            {
                JscriptMsg("信息不存在或已被删除!", "back");
                return;
            }

            ddlClassroom.SelectedValue = model.category_id + "";
            txttitle.Text    = model.title + "";
            txtcontents.Text = model.contents + "";
            txtimg_src.Text  = model.img_src + "";
        }
        private void ShowInfo(int _id)
        {
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(_id);
            if (model == null)
            {
                JscriptMsg("信息不存在或已被删除!", "back");
                return;
            }


            txttitle.Text    = model.title + "";
            txtcontents.Text = model.contents + "";

            this.rptAlbumList.DataSource = new BLL.common_albums().GetList(" group_id = " + (int)EnumCollection.img_group.精品微课问题讨论图片 + " and rc_data_id = " + _id);
            this.rptAlbumList.DataBind();
        }
Exemple #21
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            #region
            string strError = string.Empty;

            if (txttitle.Text.Trim() == "" || txttitle.Text.Trim().Length > 200)
            {
                strError += "标题为空或超出长度![br]";
            }
            if (txtcontents.Text.Trim() == "" || txtcontents.Text.Trim().Length > 4000)
            {
                strError += "内容为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(" group_id = " + (int)EnumCollection.article_group.关于我们);
            if (model != null)
            {
                ChkAdminLevel("_about_us", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
                if (!DoEdit(model.id))
                {
                    JscriptMsg("保存过程中发生错误!", "");
                    return;
                }

                JscriptMsg("修改关于我们成功!", "");
            }
            else
            {
                ChkAdminLevel("_about_us", EnumCollection.ActionEnum.Add.ToString()); //检查权限
                if (!DoAdd())
                {
                    JscriptMsg("保存过程中发生错误!", "");
                    return;
                }

                JscriptMsg("添加关于我们成功!", "");
            }
        }
        private bool DoEdit(int id)
        {
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(this.id);

            model.category_id = Convert.ToInt32(ddlCategory.SelectedValue);
            model.contents    = Convert.ToString(txtcontents.Text.Trim());

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改服务项目,主键:" + model.id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #23
0
        private bool DoAdd()
        {
            Model.common_article model = new Model.common_article();
            BLL.common_article   bll   = new BLL.common_article();

            model.group_id = (int)EnumCollection.article_group.课堂公告;

            if (adminInfo.role_type == 2)//教师
            {
                Model.user_info user = new BLL.user_info().GetModel(" phone = '" + adminInfo.user_name + "' ");
                model.user_id = user.id;
            }
            else if (adminInfo.role_type == 1)//超管
            {
                Model.classroom_info ciModel = new BLL.classroom_info().GetModel(this.class_id);
                if (ciModel != null)
                {
                    model.user_id = ciModel.user_id;
                }
            }

            model.category_id = Convert.ToInt32(ddlClassroom.SelectedValue);
            //model.category_id = this.class_id;
            model.title    = Convert.ToString(txttitle.Text);
            model.subtitle = "";
            model.contents = Convert.ToString(txtcontents.Text);
            model.img_src  = Convert.ToString(txtimg_src.Text);
            model.click    = 0;
            model.upvote   = 0;
            model.status   = 1;
            model.add_time = System.DateTime.Now;

            int id = bll.Add(model);

            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加课堂公告信息,主键:" + id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BLL.common_article   bll   = new BLL.common_article();
                Model.common_article model = bll.GetModel(" group_id = " + (int)EnumCollection.article_group.务项目 + " and category_id = " + (int)EnumCollection.service_items_category.微课MOOC开发);

                if (model != null)
                {
                    str = model.contents;
                }

                model = bll.GetModel(" group_id = " + (int)EnumCollection.article_group.务项目 + " and category_id = " + (int)EnumCollection.service_items_category.立体化教材建设);
                if (model != null)
                {
                    str1 = model.contents;
                }

                model = bll.GetModel(" group_id = " + (int)EnumCollection.article_group.务项目 + " and category_id = " + (int)EnumCollection.service_items_category.智慧教室);
                if (model != null)
                {
                    str2 = model.contents;
                }

                model = bll.GetModel(" group_id = " + (int)EnumCollection.article_group.微课慕课项目简介 + " and category_id = " + (int)EnumCollection.mooc_item.参赛微课);
                if (model != null)
                {
                    str3 = model.contents;
                }

                model = bll.GetModel(" group_id = " + (int)EnumCollection.article_group.微课慕课项目简介 + " and category_id = " + (int)EnumCollection.mooc_item.在线开发课程);
                if (model != null)
                {
                    str4 = model.contents;
                }

                model = bll.GetModel(" group_id = " + (int)EnumCollection.article_group.微课慕课项目简介 + " and category_id = " + (int)EnumCollection.mooc_item.国家级精品课程);
                if (model != null)
                {
                    str5 = model.contents;
                }
            }
        }
Exemple #25
0
        private bool DoEdit(int id)
        {
            BLL.common_article   bll   = new BLL.common_article();
            Model.common_article model = bll.GetModel(this.id);

            model.title    = Convert.ToString(txttitle.Text.Trim());
            model.contents = Convert.ToString(txtcontents.Text.Trim());
            model.img_src  = Convert.ToString(txtimg_src.Text.Trim());

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改我们的团队,主键:" + model.id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #26
0
        private void BindData()
        {
            #region 组装查询条件

            if (this.class_id > 0)
            {
                this.ddlClassroom.SelectedValue = this.class_id + "";
            }
            else
            {
                this.class_id = Convert.ToInt32(this.ddlClassroom.SelectedValue);
            }

            string whereStr  = " group_id = " + (int)EnumCollection.article_group.课堂公告 + " and category_id = " + this.class_id;
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (Title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("notice_list.aspx", "keywords={0}&class_id={1}", "", this.class_id + ""));
                    return;
                }
            }
            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_article bll = new BLL.common_article();
            this.rptList.DataSource = bll.GetListByPage("*", "View_ClassroomNotice", whereStr, "ID DESC", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount("View_ClassroomNotice", whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("notice_list.aspx", "keywords={0}&page={1}&chass_id={2}", this.keywords, "__id__", this.class_id + "");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemple #27
0
 private void BindInfo()
 {
     BLL.common_article   bll   = new BLL.common_article();
     Model.common_article model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtgroup_id.Text    = model.group_id + "";
     txtuser_id.Text     = model.user_id + "";
     txtcategory_id.Text = model.category_id + "";
     txttitle.Text       = model.title + "";
     txtsubtitle.Text    = model.subtitle + "";
     txtcontents.Text    = model.contents + "";
     txtimg_src.Text     = model.img_src + "";
     txtclick.Text       = model.click + "";
     txtupvote.Text      = model.upvote + "";
     txtstatus.Text      = model.status + "";
     txtadd_time.Text    = model.add_time + "";
 }
Exemple #28
0
        private void GetQrCode(string type)
        {
            string str      = string.Empty;
            string id       = Request.QueryString["id"];
            string logopath = string.Empty;
            bool   is_logo  = true;

            Model.course_info course = null;

            switch (type)
            {
            case "course":    //课程
                is_logo = true;
                course  = new BLL.course_info().GetModel(Convert.ToInt32(id));
                if (course != null)
                {
                    str      = WebPath + "/html/course_details.html?id=" + id;
                    logopath = course.qrcode_logo;
                }
                else
                {
                    return;
                }
                break;

            case "re":    //资源
                is_logo = true;
                Model.common_resource resource = new BLL.common_resource().GetModel(Convert.ToInt32(id));
                if (resource != null)
                {
                    course = new BLL.course_info().GetModel(" id = (select course_id from ybd_course_chapter where id = " + resource.data_id + ")");
                    if (course != null)
                    {
                        logopath = course.qrcode_logo;
                    }

                    switch (resource.type)
                    {
                    case (int)Appoa.Common.EnumCollection.resource_type.图文资源:
                        if (resource.from_id == (int)EnumCollection.resource_from.精品微课)
                        {
                            str = WebPath + "/html/article_details.html?id=" + id;
                        }
                        else
                        {
                            str = WebPath + "/html/knowledge_details.html?id=" + id;
                        }
                        break;

                    case (int)Appoa.Common.EnumCollection.resource_type.文档资源:
                        resource.path = resource.path.Substring(0, resource.path.LastIndexOf('.'));
                        //str = WebPath + resource.path + ".html";
                        str = WebPath + "/html/doc_detail.html?id=" + id;
                        break;

                    case (int)Appoa.Common.EnumCollection.resource_type.音频资源:
                        str = WebPath + "/html/video_details.html?id=" + id;
                        break;

                    case (int)Appoa.Common.EnumCollection.resource_type.视频资源:
                        str = WebPath + "/html/video_details.html?id=" + id;
                        break;

                    case (int)Appoa.Common.EnumCollection.resource_type.英文发音:
                        str = WebPath + "/html/voice_detail.html?id=" + id;
                        break;

                    case (int)Appoa.Common.EnumCollection.resource_type.维模型:
                        str = WebPath + "/html/3d.html?id=" + id;
                        break;
                    }
                }
                else
                {
                    return;
                }
                break;

            case "test":    //测验
                Model.common_examination exam = new BLL.common_examination().GetModel(Convert.ToInt32(id));
                if (exam != null)
                {
                    str     = WebPath + "/html/test.html?id=" + id;
                    is_logo = true;
                    //course = new BLL.course_info().GetModel(" id = (select course_id from ybd_course_chapter where id = " + exam.parent_id + ")");
                    //if (course != null)
                    //{
                    //    logopath = course.qrcode_logo;
                    //}
                }
                else
                {
                    return;
                }
                break;

            case "talk":    //讨论
                Model.common_article article = new BLL.common_article().GetModel(Convert.ToInt32(id));
                if (article != null)
                {
                    str     = WebPath + "/html/discuss_details.html?id=" + id;
                    is_logo = true;
                    //course = new BLL.course_info().GetModel(" id = (select course_id from ybd_course_chapter where user_id = 0 and id = " + article.category_id + ")");
                    //if (course != null)
                    //{
                    //    logopath = course.qrcode_logo;
                    //}
                }
                else
                {
                    return;
                }
                break;

            case "quest":    //心理测试
                str = WebPath + "/html/questionnaire.html?id=" + id;
                break;

            case "classroom":    //课堂
                str = WebPath + "/html/join_class.html?id=" + id;
                break;
            }

            QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();

            qrCodeEncoder.QRCodeEncodeMode   = QRCodeEncoder.ENCODE_MODE.BYTE;
            qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
            qrCodeEncoder.QRCodeVersion      = 0;
            qrCodeEncoder.QRCodeScale        = 13;

            //将字符串生成二维码图片
            Bitmap image = qrCodeEncoder.Encode(str, Encoding.Default);

            //保存为PNG到内存流
            MemoryStream ms = new MemoryStream();

            image.Save(ms, ImageFormat.Png);

            if (is_logo)
            {
                if (string.IsNullOrEmpty(logopath))
                {
                    Model.common_albums defaultlogo = new BLL.common_albums().GetModel(" group_id = " + (int)Appoa.Common.EnumCollection.img_group.系统默认二维码logo);
                    if (defaultlogo != null)
                    {
                        logopath = defaultlogo.original_path;
                    }
                    else
                    {
                        logopath = "/html/images/Logo.png";
                    }
                }

                //logopath = "/html/images/Logo.png";

                MemoryStream ms1 = new MemoryStream();
                CombinImage(image, Server.MapPath("~" + logopath), 80).Save(ms1, System.Drawing.Imaging.ImageFormat.Png);

                //输出二维码图片
                Response.ClearContent();
                Response.ContentType = "image/Png";
                Response.BinaryWrite(ms1.ToArray());

                ms.Dispose();
                ms1.Dispose();

                Response.Flush();
                Response.End();
            }
            else
            {
                //输出二维码图片
                Response.ClearContent();
                Response.ContentType = "image/Png";
                Response.BinaryWrite(ms.ToArray());

                ms.Dispose();

                Response.Flush();
                Response.End();
            }
        }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_article", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtgroup_id.Text.Trim() == "" || txtgroup_id.Text.Trim().Length > 4)
            {
                strError += "分组为空或超出长度![br]";
            }
            if (txtuser_id.Text.Trim() == "" || txtuser_id.Text.Trim().Length > 4)
            {
                strError += "发布者id为空或超出长度![br]";
            }
            if (txtcategory_id.Text.Trim() == "" || txtcategory_id.Text.Trim().Length > 4)
            {
                strError += "分类id为空或超出长度![br]";
            }
            if (txttitle.Text.Trim() == "" || txttitle.Text.Trim().Length > 200)
            {
                strError += "标题为空或超出长度![br]";
            }
            if (txtsubtitle.Text.Trim() == "" || txtsubtitle.Text.Trim().Length > 200)
            {
                strError += "副标题为空或超出长度![br]";
            }
            if (txtcontents.Text.Trim() == "" || txtcontents.Text.Trim().Length > 4000)
            {
                strError += "内容为空或超出长度![br]";
            }
            if (txtimg_src.Text.Trim() == "" || txtimg_src.Text.Trim().Length > 255)
            {
                strError += "封面图为空或超出长度![br]";
            }
            if (txtclick.Text.Trim() == "" || txtclick.Text.Trim().Length > 4)
            {
                strError += "点击量为空或超出长度![br]";
            }
            if (txtupvote.Text.Trim() == "" || txtupvote.Text.Trim().Length > 4)
            {
                strError += "点赞数为空或超出长度![br]";
            }
            if (txtstatus.Text.Trim() == "" || txtstatus.Text.Trim().Length > 4)
            {
                strError += "审核状态为空或超出长度![br]";
            }
            if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8)
            {
                strError += "添加时间为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

            Model.common_article model = new Model.common_article();
            BLL.common_article   bll   = new BLL.common_article();

            model.group_id    = Convert.ToInt32(txtgroup_id.Text);
            model.user_id     = Convert.ToInt32(txtuser_id.Text);
            model.category_id = Convert.ToInt32(txtcategory_id.Text);
            model.title       = Convert.ToString(txttitle.Text);
            model.subtitle    = Convert.ToString(txtsubtitle.Text);
            model.contents    = Convert.ToString(txtcontents.Text);
            model.img_src     = Convert.ToString(txtimg_src.Text);
            model.click       = Convert.ToInt32(txtclick.Text);
            model.upvote      = Convert.ToInt32(txtupvote.Text);
            model.status      = Convert.ToInt32(txtstatus.Text);
            model.add_time    = Convert.ToDateTime(txtadd_time.Text);

            int id = bll.Add(model);
            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加全局文章信息,主键:" + id); //记录日志
                JscriptMsg("添加全局文章信息成功!", "Manage.aspx", "");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }