Esempio n. 1
0
        private void BindData()
        {
            #region 组装查询条件
            string whereStr = " group_id = " + (int)EnumCollection.examination_group.心理测试 + " and parent_id = " + this.chapter;
            //string whereStr = " 1 = 1 ";
            string _keywords = keywords.Replace("'", "");

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

            //if (this.chapter > 0)
            //{
            //    whereStr += " parent_id = " + this.chapter;
            //}

            #endregion

            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;
            }

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_examination bll = new BLL.common_examination();
            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("questionnaire_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);
        }
Esempio n. 2
0
        private bool DoAdd()
        {
            bool result = false;

            Model.course_chapter model = new Model.course_chapter();

            model.group_id      = (int)EnumCollection.chapter_group.精品微课;
            model.course_id     = this.course_id;
            model.name          = txtname.Text.Trim();
            model.tag           = "";
            model.parent_id     = Convert.ToInt32(this.ddlChapter.SelectedValue);
            model.add_time      = DateTime.Now;
            model.chapter_level = 1;

            if (model.parent_id > 0)
            {
                Model.course_chapter parent_model = new BLL.course_chapter().GetModel(model.parent_id);
                if (parent_model != null)
                {
                    model.chapter_level = parent_model.chapter_level + 1;
                }
            }

            int id = new BLL.course_chapter().Add(model);

            if (id > 0)
            {
                result = true;
            }
            return(result);
        }
Esempio n. 3
0
        private void BindData()
        {
            #region 组装查询条件

            string whereStr  = " group_id = " + (int)EnumCollection.chapter_group.精品微课 + " and course_id = " + this.course + " and chapter_level = 1 ";
            string _keywords = keywords.Replace("'", "");

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

            #endregion

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

            this.totalCount = bll.GetRecordCount("View_ChapterList", whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("question_chapter_list.aspx", "keywords={0}&page={1}&course={2}", this.keywords, "__id__", this.course + "");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        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.course_chapter bll = new BLL.course_chapter();
            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);
        }
Esempio n. 5
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_classroom_chapter", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.course_chapter bll = new BLL.course_chapter();
            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("chapter_list.aspx", "", ""));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.keywords = RequestHelper.GetQueryString("keywords");
            this.pageSize = GetPageSize(10); //每页数量

            this.chapter = RequestHelper.GetQueryInt("chapter");
            this.group   = RequestHelper.GetQueryInt("group");
            this.type    = RequestHelper.GetQueryInt("type");

            if (this.chapter == 0)
            {
                JscriptMsg("没有此章节", "back");
                return;
            }

            Model.course_chapter chapterModel = new BLL.course_chapter().GetModel(this.chapter);
            if (chapterModel != null)
            {
                chapter_name = chapterModel.name;
                Model.course_info course = new BLL.course_info().GetModel(chapterModel.course_id);
                if (course != null)
                {
                    course_name = course.name;
                }
            }

            if (!Page.IsPostBack)
            {
                ChkAdminLevel("_common_questions", EnumCollection.ActionEnum.View.ToString()); //检查权限
                BindSelect();
                BindData();
            }
        }
Esempio n. 7
0
        private void ShowInfo(int _id)
        {
            BLL.course_chapter   bll   = new BLL.course_chapter();
            Model.course_chapter model = bll.GetModel(_id);

            this.ddlChapter.SelectedValue = model.parent_id + "";
            this.txtname.Text             = model.name;
        }
        private void BindData()
        {
            string whereStr = " chapter_level = 1 and group_id = " + (int)EnumCollection.chapter_group.精品微课 + " and course_id = " + course_id;

            BLL.course_chapter bll = new BLL.course_chapter();
            this.rptList.DataSource = bll.GetListNew(whereStr, "0");
            this.rptList.DataBind();
        }
        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);
        }
Esempio n. 10
0
 protected string ReturnCourseName(int id)
 {
     Model.course_chapter chapter = new BLL.course_chapter().GetModel(id);
     if (chapter != null)
     {
         Model.course_info course = new BLL.course_info().GetModel(chapter.course_id);
         if (course != null)
         {
             return(course.name);
         }
     }
     return("");
 }
 protected string ReturnClassroomName(int id)
 {
     Model.course_chapter chapter = new BLL.course_chapter().GetModel(id);
     if (chapter != null)
     {
         Model.classroom_info classroom = new BLL.classroom_info().GetModel(chapter.course_id);
         if (classroom != null)
         {
             return(classroom.name);
         }
     }
     return("");
 }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.action  = RequestHelper.GetQueryString("action");
            this.id      = RequestHelper.GetQueryInt("id");
            this.chapter = RequestHelper.GetQueryInt("chapter");

            if (this.id > 0)
            {
                if (!new BLL.common_examination().Exists(this.id))
                {
                    JscriptMsg("记录不存在或已被删除!", "back");
                    return;
                }
            }
            if (this.chapter > 0)
            {
                Model.course_chapter model = new BLL.course_chapter().GetModel(this.chapter);
                if (model == null)
                {
                    JscriptMsg("没有此章节!", "back");
                    return;
                }
                else
                {
                    this.lblChapterName.Text = model.name;
                    Model.course_info course = new BLL.course_info().GetModel(model.course_id);
                    if (course != null)
                    {
                        this.lblCourseName.Text = course.name;
                    }
                    else
                    {
                        JscriptMsg("没有此课程!", "back");
                        return;
                    }
                }
            }

            if (!Page.IsPostBack)
            {
                ChkAdminLevel("_examination_list", EnumCollection.ActionEnum.View.ToString()); //检查权限

                if (action == EnumCollection.ActionEnum.Modify.ToString())                     //修改
                {
                    addrow = this.id;
                    ShowInfo(this.id);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string _action = RequestHelper.GetQueryString("action");

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

            if (this.chapter == 0)
            {
                JscriptMsg("没有此章节", "back");
                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;
                }
            }

            if (!string.IsNullOrEmpty(_action) && _action == EnumCollection.ActionEnum.Modify.ToString())
            {
                this.action = EnumCollection.ActionEnum.Modify.ToString();//修改类型
                this.id     = RequestHelper.GetQueryInt("id");
                if (this.id == 0)
                {
                    JscriptMsg("传输参数不正确!", "back");
                    return;
                }
                if (!new BLL.common_questions().Exists(this.id))
                {
                    JscriptMsg("信息不存在或已被删除!", "back");
                    return;
                }
            }
            if (!Page.IsPostBack)
            {
                ChkAdminLevel("_common_questions", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
                BindSelect();
                if (action == EnumCollection.ActionEnum.Modify.ToString())                       //修改
                {
                    ShowInfo();
                }
            }
        }
Esempio n. 14
0
        protected Model.sys_manager admin_info; //管理员信息
        protected void Page_Load(object sender, EventArgs e)
        {
            admin_info = GetAdminInfo();

            this.action    = RequestHelper.GetQueryString("action");
            this.id        = RequestHelper.GetQueryInt("id");
            this.chapter   = RequestHelper.GetQueryInt("chapter");
            this.page      = RequestHelper.GetQueryInt("page", 1);
            this.course_id = RequestHelper.GetQueryInt("course_id", 0);

            if (this.id > 0)
            {
                if (!new BLL.common_resource().Exists(this.id))
                {
                    JscriptMsg("记录不存在或已被删除!", "back");
                    return;
                }
            }
            if (this.chapter > 0)
            {
                Model.course_chapter model = new BLL.course_chapter().GetModel(this.chapter);
                if (model == null)
                {
                    JscriptMsg("没有此章节!", "back");
                    return;
                }
                else
                {
                    this.chapter_name = model.name;
                    Model.course_info course = new BLL.course_info().GetModel(model.course_id);
                    if (course != null)
                    {
                        this.course_name = course.name;
                    }
                }
            }

            if (!Page.IsPostBack)
            {
                ChkAdminLevel("_resource_list", EnumCollection.ActionEnum.View.ToString()); //检查权限
                BindSelect();
                this.txtpath.Attributes.Add("readonly", "true");

                if (action == EnumCollection.ActionEnum.Modify.ToString()) //修改
                {
                    ShowInfo(this.id);
                }
            }
        }
Esempio n. 15
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            Model.course_chapter model = new BLL.course_chapter().GetModel(_id);

            model.group_id  = (int)EnumCollection.chapter_group.精品微课;
            model.parent_id = Convert.ToInt32(this.ddlChapter.SelectedValue);
            model.name      = txtname.Text.Trim();

            if (new BLL.course_chapter().Update(model))
            {
                result = true;
            }
            return(result);
        }
 private void BindInfo()
 {
     BLL.course_chapter   bll   = new BLL.course_chapter();
     Model.course_chapter model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtgroup_id.Text      = model.group_id + "";
     txtcourse_id.Text     = model.course_id + "";
     txtname.Text          = model.name + "";
     txttag.Text           = model.tag + "";
     txtchapter_level.Text = model.chapter_level + "";
     txtparent_id.Text     = model.parent_id + "";
     txtadd_time.Text      = model.add_time + "";
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.action  = RequestHelper.GetQueryString("action");
            this.id      = RequestHelper.GetQueryInt("id");
            this.chapter = RequestHelper.GetQueryInt("chapter");
            this.page    = RequestHelper.GetQueryInt("page", 1);

            if (this.id > 0)
            {
                if (!new BLL.common_article().Exists(this.id))
                {
                    JscriptMsg("记录不存在或已被删除!", "back");
                    return;
                }
            }

            if (this.chapter > 0)
            {
                Model.course_chapter model = new BLL.course_chapter().GetModel(this.chapter);
                if (model == null)
                {
                    JscriptMsg("没有此章节!", "back");
                    return;
                }
                else
                {
                    this.chapter_name = model.name;
                    Model.course_info course = new BLL.course_info().GetModel(model.course_id);
                    if (course != null)
                    {
                        this.course_name = course.name;
                    }
                }
            }

            if (!Page.IsPostBack)
            {
                ChkAdminLevel("_course_discuss", EnumCollection.ActionEnum.View.ToString()); //检查权限

                if (action == EnumCollection.ActionEnum.Modify.ToString())                   //修改
                {
                    ShowInfo(this.id);
                }
            }
        }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_course_chapter", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.course_chapter   bll   = new BLL.course_chapter();
            Model.course_chapter model = bll.GetModel(this.id);

            model.group_id      = Convert.ToInt32(txtgroup_id.Text);
            model.course_id     = Convert.ToInt32(txtcourse_id.Text);
            model.name          = Convert.ToString(txtname.Text);
            model.tag           = Convert.ToString(txttag.Text);
            model.chapter_level = Convert.ToInt32(txtchapter_level.Text);
            model.parent_id     = Convert.ToInt32(txtparent_id.Text);
            model.add_time      = Convert.ToDateTime(txtadd_time.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改课程章节信息,主键:" + id); //记录日志
                JscriptMsg("修改课程章节信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
Esempio n. 19
0
        private void Bind()
        {
            DataTable dt = new BLL.course_chapter().GetListNew(" group_id = " + (int)EnumCollection.chapter_group.精品微课 + " and course_id = " + this.course_id, "0");

            this.ddlChapter.Items.Clear();
            foreach (DataRow dr in dt.Rows)
            {
                string Id         = dr["id"].ToString();
                int    ClassLayer = int.Parse(dr["chapter_level"].ToString());
                string Title      = dr["name"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlChapter.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlChapter.Items.Add(new ListItem(Title, Id));
                }
            }
            this.ddlChapter.Items.Insert(0, new ListItem("无父级章节", "0"));
        }
Esempio n. 20
0
        private void BindData()
        {
            BLL.course_chapter   ccBll   = new BLL.course_chapter();
            Model.course_chapter chapter = ccBll.GetModel(this.chapter);
            if (chapter == null)
            {
                JscriptMsg("没有此节", "back");
                return;
            }

            this.chapter_name = chapter.name;
            Model.course_chapter pModel = ccBll.GetModel(chapter.parent_id);
            if (pModel == null)
            {
                JscriptMsg("没有此章", "back");
                return;
            }

            this.parent_name = pModel.name;
            Model.classroom_info ciModel = new BLL.classroom_info().GetModel(pModel.course_id);
            if (ciModel == null)
            {
                JscriptMsg("没有此课堂", "back");
                return;
            }

            this.class_name = ciModel.name;
            Model.user_info user = new BLL.user_info().GetModel(" phone = '" + adminInfo.user_name + "' ");
            if (user == null)
            {
                JscriptMsg("没有此教师", "back");
                return;
            }

            if (ciModel.user_id != user.id)
            {
                JscriptMsg("此课堂不属于你", "back");
                return;
            }

            Model.common_examination exaModel = new BLL.common_examination().GetModel(this.exa_id);
            if (exaModel == null)
            {
                JscriptMsg("没有此作业", "back");
                return;
            }

            this.examination = exaModel.name;
            #region 组装查询条件
            string whereStr = " 1 = 1 ";

            DataTable dtids = new BLL.examination_question().GetList(" exa_id = " + this.exa_id);
            string    ids   = string.Empty;
            foreach (DataRow item in dtids.Rows)
            {
                ids += Convert.ToInt32(item["q_id"]) + ",";
            }

            ids = Utils.DelLastComma(ids);

            if (!string.IsNullOrEmpty(ids))
            {
                whereStr += " and id in (" + ids + ") ";
            }


            string _keywords = keywords.Replace("'", "");

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

            if (this.type > 0)
            {
                this.ddlType.SelectedValue = this.type + "";
                whereStr += " and type = " + this.type;
            }
            #endregion

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

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("currect_question_list.aspx", "keywords={0}&page={1}&type={2}", this.keywords, "__id__", this.type + "");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Esempio n. 21
0
        private void DownCourseQrCode()
        {
            var Server = HttpContext.Current.Server;

            int    course_id      = RequestHelper.GetFormInt("course_id");
            string WebPath        = System.Configuration.ConfigurationManager.AppSettings["WebPath"];
            string webApi_address = WebPath + "/QrCode.aspx";

            BLL.course_info   bll    = new BLL.course_info();
            Model.course_info course = bll.GetModel(course_id);
            if (course != null)
            {
                string course_name = course.name.Trim();
                //1、生成书籍的二维码文件夹
                string virualRootPath = string.Format("/tempDown/{0}", course.name.Trim());
                string tempRootPath   = Server.MapPath(string.Format("/tempDown/{0}", course_name)).Trim();

                if (Directory.Exists(tempRootPath))
                {
                    Directory.Delete(tempRootPath, true);
                }
                if (!Directory.Exists(tempRootPath))
                {
                    Directory.CreateDirectory(tempRootPath);
                }

                if (string.IsNullOrWhiteSpace(webApi_address))
                {
                    writeMsgError(-1, "没有配置WebPath地址!");
                    return;
                }

                string bookQrCodePath = System.IO.Path.Combine(tempRootPath, string.Format("{0}_书籍资源.png", course_name)).Trim();

                string course_qrcode = string.Format("{0}/html/course_details.html?id={1}", WebPath, course.id); //要根据各个的生成规则生成二维码

                string logoPath = course.qrcode_logo;                                                            //二维码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";
                    }
                }
                using (var ms = new MemoryStream())
                {
                    QrCodeHelper.GetRQCodeCombin(course_qrcode, ms, bookQrCodePath, Server.MapPath(logoPath));
                }
                //2、生成章的文件夹
                BLL.course_chapter          ccBll            = new BLL.course_chapter();
                BLL.common_resource         crBll            = new BLL.common_resource();
                List <Model.course_chapter> firstChapterList = ccBll.GetModelList(" group_id = 1 and chapter_level = 1 and course_id = " + course.id);
                foreach (Model.course_chapter chapter in firstChapterList)
                {
                    string chapterPath = System.IO.Path.Combine(tempRootPath, string.Format("章_{0}", chapter.name)).Trim();
                    if (Directory.Exists(chapterPath))
                    {
                        Directory.Delete(chapterPath, true);
                    }
                    if (!Directory.Exists(chapterPath))
                    {
                        Directory.CreateDirectory(chapterPath);
                    }

                    //3、生成节的文件夹
                    //List<Model.course_chapter> secondChapterList = ccBll.GetModelList(" group_id = 1 and chapter_level = 2 and course_id = " + course.id + " and parent_id = " + chapter.id);
                    //foreach (Model.course_chapter part in secondChapterList)
                    //{
                    //    string partPath = System.IO.Path.Combine(chapterPath, string.Format("节_{0}", part.name)).Trim();
                    //    if (Directory.Exists(partPath))
                    //    {
                    //        Directory.Delete(partPath, true);
                    //    }
                    //    if (!Directory.Exists(partPath))
                    //    {
                    //        Directory.CreateDirectory(partPath);
                    //    }

                    //4、生成章下所有资源二维码图片
                    List <Model.common_resource> resourceList = crBll.GetModelList(" is_del = 0 and from_id = " + (int)EnumCollection.resource_from.精品微课 + " and data_id = " + chapter.id);
                    foreach (Model.common_resource item in resourceList)
                    {
                        string resCode = string.Empty;
                        switch (item.type)
                        {
                        case (int)EnumCollection.resource_type.图文资源:
                            if (item.from_id == (int)EnumCollection.resource_from.精品微课)
                            {
                                resCode = WebPath + "/html/article_details.html?id=" + item.id;
                            }
                            else
                            {
                                resCode = WebPath + "/html/knowledge_details.html?id=" + item.id;
                            }
                            break;

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

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

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

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

                        case (int)EnumCollection.resource_type.维模型:
                            resCode = WebPath + "/html/3d.html?id=" + item.id;
                            break;
                        }
                        //生成明细资源
                        //string resPath = System.IO.Path.Combine(partPath, string.Format("{0}_{1}_资源_{2}.png", chapter.name, part.name, item.title.Trim())).Trim();
                        string resPath = System.IO.Path.Combine(chapterPath, item.title.Trim() + ".png").Trim();

                        using (var ms = new MemoryStream())
                        {
                            QrCodeHelper.GetRQCodeCombin(resCode, ms, resPath, Server.MapPath(logoPath));
                        }
                    }
                    //}
                }

                //打包—下载
                FastZip fz = new FastZip();
                fz.CreateEmptyDirectories = true;
                fz.CreateZip(string.Format("{0}.zip", tempRootPath), tempRootPath, true, "");
                // ZFiles.DownLoadFile(Server.MapPath(string.Format("{0}.zip", virualRootPath)));
                ZFiles.DownloadFile(System.Web.HttpContext.Current, Server.MapPath(string.Format("{0}.zip", virualRootPath)), 1024 * 50);
            }
        }
Esempio n. 22
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_course_chapter", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtgroup_id.Text.Trim() == "" || txtgroup_id.Text.Trim().Length > 4)
            {
                strError += "分组为空或超出长度![br]";
            }
            if (txtcourse_id.Text.Trim() == "" || txtcourse_id.Text.Trim().Length > 4)
            {
                strError += "课程ID为空或超出长度![br]";
            }
            if (txtname.Text.Trim() == "" || txtname.Text.Trim().Length > 50)
            {
                strError += "名称为空或超出长度![br]";
            }
            if (txttag.Text.Trim() == "" || txttag.Text.Trim().Length > 50)
            {
                strError += "标签为空或超出长度![br]";
            }
            if (txtchapter_level.Text.Trim() == "" || txtchapter_level.Text.Trim().Length > 4)
            {
                strError += "章节级别为空或超出长度![br]";
            }
            if (txtparent_id.Text.Trim() == "" || txtparent_id.Text.Trim().Length > 4)
            {
                strError += "父级ID为空或超出长度![br]";
            }
            if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8)
            {
                strError += "添加时间为空或超出长度![br]";
            }

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

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

            model.group_id      = Convert.ToInt32(txtgroup_id.Text);
            model.course_id     = Convert.ToInt32(txtcourse_id.Text);
            model.name          = Convert.ToString(txtname.Text);
            model.tag           = Convert.ToString(txttag.Text);
            model.chapter_level = Convert.ToInt32(txtchapter_level.Text);
            model.parent_id     = Convert.ToInt32(txtparent_id.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("保存过程中发生错误!", "");
            }
        }