//保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_course_info", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.course_info   bll   = new BLL.course_info();
            Model.course_info model = bll.GetModel(this.id);

            model.group_id    = Convert.ToInt32(txtgroup_id.Text);
            model.category_id = Convert.ToInt32(txtcategory_id.Text);
            model.name        = Convert.ToString(txtname.Text);
            model.cover       = Convert.ToString(txtcover.Text);
            model.info        = Convert.ToString(txtinfo.Text);
            model.notice      = Convert.ToString(txtnotice.Text);
            model.qrcode      = Convert.ToString(txtqrcode.Text);
            model.qrcode_logo = Convert.ToString(txtqrcode_logo.Text);
            model.user_id     = Convert.ToInt32(txtuser_id.Text);
            model.is_show     = Convert.ToInt32(txtis_show.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 #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.course_info DataRowToModel(DataRow row)
 {
     Model.course_info model = new Model.course_info();
     if (row != null)
     {
         if (row["id"] != null) //&& row["id"].ToString() != ""
         {
             model.id = Convert.ToInt32(row["id"]);
         }
         if (row["group_id"] != null) //&& row["group_id"].ToString() != ""
         {
             model.group_id = Convert.ToInt32(row["group_id"]);
         }
         if (row["category_id"] != null) //&& row["category_id"].ToString() != ""
         {
             model.category_id = Convert.ToInt32(row["category_id"]);
         }
         if (row["name"] != null) //&& row["name"].ToString() != ""
         {
             model.name = Convert.ToString(row["name"]);
         }
         if (row["cover"] != null) //&& row["cover"].ToString() != ""
         {
             model.cover = Convert.ToString(row["cover"]);
         }
         if (row["info"] != null) //&& row["info"].ToString() != ""
         {
             model.info = Convert.ToString(row["info"]);
         }
         if (row["notice"] != null) //&& row["notice"].ToString() != ""
         {
             model.notice = Convert.ToString(row["notice"]);
         }
         if (row["qrcode"] != null) //&& row["qrcode"].ToString() != ""
         {
             model.qrcode = Convert.ToString(row["qrcode"]);
         }
         if (row["qrcode_logo"] != null) //&& row["qrcode_logo"].ToString() != ""
         {
             model.qrcode_logo = Convert.ToString(row["qrcode_logo"]);
         }
         if (row["user_id"] != null) //&& row["user_id"].ToString() != ""
         {
             model.user_id = Convert.ToInt32(row["user_id"]);
         }
         if (row["is_show"] != null) //&& row["is_show"].ToString() != ""
         {
             model.is_show = Convert.ToInt32(row["is_show"]);
         }
         if (row["add_time"] != null && row["add_time"].ToString() != "")
         {
             model.add_time = Convert.ToDateTime(row["add_time"]);
         }
         return(model);
     }
     else
     {
         return(null);
     }
 }
Exemple #3
0
        /// <summary>
        /// 获得Model
        /// </summary>
        /// <param name="whereStr"></param>
        /// <returns></returns>
        public Model.course_info GetModel(string whereStr)
        {
            DataTable dt = dal.GetList(whereStr).Tables[0];

            Model.course_info model = dt.Rows.Count > 0 ? DataRowToModel(dt.Rows[0]) : null;
            return(model);
        }
Exemple #4
0
        /// <summary>
        /// 获得Model
        /// </summary>
        /// <param name="Top">大于0取前几行数据,否则取全部</param>
        /// <param name="whereStr">where条件</param>
        /// <param name="filedOrder">排序字段Order By + filedOrder (不可为空)</param>
        /// <returns></returns>
        public Model.course_info GetModel(int Top, string whereStr, string filedOrder)
        {
            DataTable dt = dal.GetList(Top, whereStr, filedOrder).Tables[0];

            Model.course_info model = dt.Rows.Count > 0 ? DataRowToModel(dt.Rows[0]) : null;
            return(model);
        }
Exemple #5
0
        private void SetIsShow()
        {
            int id = RequestHelper.GetFormInt("id");

            BLL.course_info   bll   = new BLL.course_info();
            Model.course_info model = bll.GetModel(id);
            if (model != null)
            {
                if (model.is_show == (int)EnumCollection.course_is_show.是)
                {
                    model.is_show = (int)EnumCollection.course_is_show.否;
                }
                else
                {
                    model.is_show = (int)EnumCollection.course_is_show.是;
                }

                bll.Update(model);

                HttpContext.Current.Response.Write("1");
                HttpContext.Current.Response.End();
            }
            else
            {
                HttpContext.Current.Response.Write("0");
                HttpContext.Current.Response.End();
            }
        }
Exemple #6
0
        private bool DoAdd()
        {
            BLL.course_info   bll   = new BLL.course_info();
            Model.course_info model = new Model.course_info();

            model.group_id    = (int)EnumCollection.course_group.精品微课;
            model.category_id = Convert.ToInt32(this.ddlCategory.SelectedValue);
            model.name        = Convert.ToString(txtname.Text);
            model.cover       = Convert.ToString(txtcover.Text);
            model.info        = Convert.ToString(txtinfo.Text);
            model.qrcode      = "";
            model.qrcode_logo = Convert.ToString(txtqrcode_logo.Text);
            model.user_id     = admin_info.id;
            model.is_show     = (int)EnumCollection.course_is_show.是;
            model.add_time    = System.DateTime.Now;

            int id = bll.Add(model);

            if (id > 0)
            {
                model.id     = id;
                model.qrcode = "/QrCode.aspx?type=course&id=" + id;
                bll.Update(model);

                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加课程信息,主键:" + id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.course_info model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"UPDATE ybd_course_info SET 
                group_id = @group_id
                ,category_id = @category_id
                ,name = @name
                ,cover = @cover
                ,info = @info
                ,notice = @notice
                ,qrcode = @qrcode
                ,qrcode_logo = @qrcode_logo
                ,user_id = @user_id
                ,is_show = @is_show
                ,add_time = @add_time
            WHERE id = @id");

            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int,                       4)
                ,                       new SqlParameter("@group_id",    SqlDbType.Int, 4)
                ,                       new SqlParameter("@category_id", SqlDbType.Int, 4)
                ,                       new SqlParameter("@name",        SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@cover",       SqlDbType.NVarChar, 255)
                ,                       new SqlParameter("@info",        SqlDbType.NVarChar, 4000)
                ,                       new SqlParameter("@notice",      SqlDbType.NVarChar, 4000)
                ,                       new SqlParameter("@qrcode",      SqlDbType.NVarChar, 500)
                ,                       new SqlParameter("@qrcode_logo", SqlDbType.NVarChar, 500)
                ,                       new SqlParameter("@user_id",     SqlDbType.Int, 4)
                ,                       new SqlParameter("@is_show",     SqlDbType.Int, 4)
                ,                       new SqlParameter("@add_time",    SqlDbType.DateTime, 8)
            };
            parameters[0].Value  = model.id;
            parameters[1].Value  = model.group_id;
            parameters[2].Value  = model.category_id;
            parameters[3].Value  = model.name;
            parameters[4].Value  = model.cover;
            parameters[5].Value  = model.info;
            parameters[6].Value  = model.notice;
            parameters[7].Value  = model.qrcode;
            parameters[8].Value  = model.qrcode_logo;
            parameters[9].Value  = model.user_id;
            parameters[10].Value = model.is_show;
            parameters[11].Value = model.add_time;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #8
0
        private void ShowInfo(int _id)
        {
            BLL.course_info   bll   = new BLL.course_info();
            Model.course_info model = bll.GetModel(this.id);

            if (model == null)
            {
                JscriptMsg("信息不存在或已被删除!", "back");
                return;
            }

            this.ddlCategory.SelectedValue = model.category_id + "";
            this.txtname.Text        = model.name + "";
            this.txtcover.Text       = model.cover + "";
            this.txtinfo.Text        = model.info + "";
            this.txtqrcode_logo.Text = model.qrcode_logo + "";
            //this.qrcodeview.Value = model.qrcode + "";
        }
 private void BindInfo()
 {
     BLL.course_info   bll   = new BLL.course_info();
     Model.course_info model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtgroup_id.Text    = model.group_id + "";
     txtcategory_id.Text = model.category_id + "";
     txtname.Text        = model.name + "";
     txtcover.Text       = model.cover + "";
     txtinfo.Text        = model.info + "";
     txtnotice.Text      = model.notice + "";
     txtqrcode.Text      = model.qrcode + "";
     txtqrcode_logo.Text = model.qrcode_logo + "";
     txtuser_id.Text     = model.user_id + "";
     txtis_show.Text     = model.is_show + "";
     txtadd_time.Text    = model.add_time + "";
 }
Exemple #10
0
        private bool DoEdit(int id)
        {
            BLL.course_info   bll   = new BLL.course_info();
            Model.course_info model = bll.GetModel(id);

            model.group_id    = (int)EnumCollection.course_group.精品微课;
            model.category_id = Convert.ToInt32(this.ddlCategory.SelectedValue);
            model.name        = Convert.ToString(txtname.Text);
            model.cover       = Convert.ToString(txtcover.Text);
            model.info        = Convert.ToString(txtinfo.Text);
            model.qrcode      = "/QrCode.aspx?type=course&id=" + model.id;
            model.qrcode_logo = Convert.ToString(txtqrcode_logo.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改课程信息,主键:" + model.id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.course_info model)
 {
     return(dal.Update(model));
 }
Exemple #12
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.course_info model)
 {
     return(dal.Add(model));
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.course_info model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"Insert Into ybd_course_info(
                group_id            
                            ,category_id            
                            ,name            
                            ,cover            
                            ,info            
                            ,notice            
                            ,qrcode            
                            ,qrcode_logo            
                            ,user_id            
                            ,is_show            
                            ,add_time            
             ) Values (
                @group_id               
                            ,@category_id               
                            ,@name               
                            ,@cover               
                            ,@info               
                            ,@notice               
                            ,@qrcode               
                            ,@qrcode_logo               
                            ,@user_id               
                            ,@is_show               
                            ,@add_time               
             );
            SELECT @@IDENTITY;");

            SqlParameter[] parameters =
            {
                new SqlParameter("@group_id", SqlDbType.Int,                             4)
                ,                             new SqlParameter("@category_id", SqlDbType.Int, 4)
                ,                             new SqlParameter("@name",        SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@cover",       SqlDbType.NVarChar, 255)
                ,                             new SqlParameter("@info",        SqlDbType.NVarChar, 4000)
                ,                             new SqlParameter("@notice",      SqlDbType.NVarChar, 4000)
                ,                             new SqlParameter("@qrcode",      SqlDbType.NVarChar, 500)
                ,                             new SqlParameter("@qrcode_logo", SqlDbType.NVarChar, 500)
                ,                             new SqlParameter("@user_id",     SqlDbType.Int, 4)
                ,                             new SqlParameter("@is_show",     SqlDbType.Int, 4)
                ,                             new SqlParameter("@add_time",    SqlDbType.DateTime, 8)
            };
            parameters[0].Value  = model.group_id;
            parameters[1].Value  = model.category_id;
            parameters[2].Value  = model.name;
            parameters[3].Value  = model.cover;
            parameters[4].Value  = model.info;
            parameters[5].Value  = model.notice;
            parameters[6].Value  = model.qrcode;
            parameters[7].Value  = model.qrcode_logo;
            parameters[8].Value  = model.user_id;
            parameters[9].Value  = model.is_show;
            parameters[10].Value = model.add_time;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_course_info", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtgroup_id.Text.Trim() == "" || txtgroup_id.Text.Trim().Length > 4)
            {
                strError += "分组ID 1公共资源 2学校资源为空或超出长度![br]";
            }
            if (txtcategory_id.Text.Trim() == "" || txtcategory_id.Text.Trim().Length > 4)
            {
                strError += "分类ID为空或超出长度![br]";
            }
            if (txtname.Text.Trim() == "" || txtname.Text.Trim().Length > 50)
            {
                strError += "名称为空或超出长度![br]";
            }
            if (txtcover.Text.Trim() == "" || txtcover.Text.Trim().Length > 255)
            {
                strError += "封面图为空或超出长度![br]";
            }
            if (txtinfo.Text.Trim() == "" || txtinfo.Text.Trim().Length > 4000)
            {
                strError += "简介为空或超出长度![br]";
            }
            if (txtnotice.Text.Trim() == "" || txtnotice.Text.Trim().Length > 4000)
            {
                strError += "公告为空或超出长度![br]";
            }
            if (txtqrcode.Text.Trim() == "" || txtqrcode.Text.Trim().Length > 500)
            {
                strError += "二维码图片为空或超出长度![br]";
            }
            if (txtqrcode_logo.Text.Trim() == "" || txtqrcode_logo.Text.Trim().Length > 500)
            {
                strError += "二维码logo为空或超出长度![br]";
            }
            if (txtuser_id.Text.Trim() == "" || txtuser_id.Text.Trim().Length > 4)
            {
                strError += "发布者id为空或超出长度![br]";
            }
            if (txtis_show.Text.Trim() == "" || txtis_show.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.course_info model = new Model.course_info();
            BLL.course_info   bll   = new BLL.course_info();

            model.group_id    = Convert.ToInt32(txtgroup_id.Text);
            model.category_id = Convert.ToInt32(txtcategory_id.Text);
            model.name        = Convert.ToString(txtname.Text);
            model.cover       = Convert.ToString(txtcover.Text);
            model.info        = Convert.ToString(txtinfo.Text);
            model.notice      = Convert.ToString(txtnotice.Text);
            model.qrcode      = Convert.ToString(txtqrcode.Text);
            model.qrcode_logo = Convert.ToString(txtqrcode_logo.Text);
            model.user_id     = Convert.ToInt32(txtuser_id.Text);
            model.is_show     = Convert.ToInt32(txtis_show.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("保存过程中发生错误!", "");
            }
        }
Exemple #15
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);
            }
        }
Exemple #16
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();
            }
        }