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

            model.group_id      = Convert.ToInt32(txtgroup_id.Text);
            model.rc_title      = Convert.ToString(txtrc_title.Text);
            model.rc_type       = Convert.ToInt32(txtrc_type.Text);
            model.rc_data_id    = Convert.ToInt32(txtrc_data_id.Text);
            model.thumb_path    = Convert.ToString(txtthumb_path.Text);
            model.original_path = Convert.ToString(txtoriginal_path.Text);
            model.remark        = Convert.ToString(txtremark.Text);
            model.add_time      = Convert.ToDateTime(txtadd_time.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改全局相册信息,主键:" + id); //记录日志
                JscriptMsg("修改全局相册信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
Exemplo n.º 2
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BLL.common_albums   bll   = new BLL.common_albums();
            Model.common_albums model = bll.GetModel(" group_id = " + (int)EnumCollection.img_group.系统默认二维码logo);
            if (model != null)
            {
                ChkAdminLevel("_default_logo", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
                if (!DoEdit(model.id))
                {
                    JscriptMsg("保存过程中发生错误!", "");
                    return;
                }

                JscriptMsg("修改系统默认二维码logo成功!", "");
            }
            else
            {
                ChkAdminLevel("_default_logo", EnumCollection.ActionEnum.Add.ToString()); //检查权限
                if (!DoAdd())
                {
                    JscriptMsg("保存过程中发生错误!", "");
                    return;
                }

                JscriptMsg("添加系统默认二维码logo成功!", "");
            }
        }
Exemplo n.º 3
0
        private bool DoAdd()
        {
            Model.common_albums model = new Model.common_albums();
            BLL.common_albums   bll   = new BLL.common_albums();

            model.group_id      = (int)EnumCollection.img_group.系统默认二维码logo;
            model.rc_type       = 0;
            model.rc_data_id    = 0;
            model.thumb_path    = "";
            model.original_path = this.txtad_data_img.Text.Trim();
            model.remark        = "";
            model.add_time      = System.DateTime.Now;

            int id = bll.Add(model);

            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加系统默认二维码logo,主键:" + id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
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_albums bll = new BLL.common_albums();
            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);
        }
Exemplo n.º 5
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_albums", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.common_albums bll = new BLL.common_albums();
            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("Manage.aspx", "keywords={0}", this.keywords));
        }
Exemplo n.º 6
0
        private void ShowInfo()
        {
            BLL.common_albums   bll   = new BLL.common_albums();
            Model.common_albums model = bll.GetModel(" group_id = " + (int)EnumCollection.img_group.系统默认二维码logo);

            if (model != null)
            {
                this.txtad_data_img.Text = model.original_path;
            }
        }
Exemplo n.º 7
0
        private bool DoEdit(int id)
        {
            BLL.common_albums   bll   = new BLL.common_albums();
            Model.common_albums model = bll.GetModel(id);

            model.original_path = this.txtad_data_img.Text.Trim();

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改系统默认二维码logo,主键:" + id); //记录日志
                return(true);
            }
            else
            {
                return(false);
            }
        }
 private void BindInfo()
 {
     BLL.common_albums   bll   = new BLL.common_albums();
     Model.common_albums model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtgroup_id.Text      = model.group_id + "";
     txtrc_title.Text      = model.rc_title + "";
     txtrc_type.Text       = model.rc_type + "";
     txtrc_data_id.Text    = model.rc_data_id + "";
     txtthumb_path.Text    = model.thumb_path + "";
     txtoriginal_path.Text = model.original_path + "";
     txtremark.Text        = model.remark + "";
     txtadd_time.Text      = model.add_time + "";
 }
Exemplo n.º 9
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_albums", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtgroup_id.Text.Trim() == "" || txtgroup_id.Text.Trim().Length > 4)
            {
                strError += "分组id为空或超出长度![br]";
            }
            if (txtrc_title.Text.Trim() == "" || txtrc_title.Text.Trim().Length > 50)
            {
                strError += "标题为空或超出长度![br]";
            }
            if (txtrc_type.Text.Trim() == "" || txtrc_type.Text.Trim().Length > 4)
            {
                strError += "关联内容分类id为空或超出长度![br]";
            }
            if (txtrc_data_id.Text.Trim() == "" || txtrc_data_id.Text.Trim().Length > 4)
            {
                strError += "关联内容数据ID为空或超出长度![br]";
            }
            if (txtthumb_path.Text.Trim() == "" || txtthumb_path.Text.Trim().Length > 255)
            {
                strError += "缩略图地址为空或超出长度![br]";
            }
            if (txtoriginal_path.Text.Trim() == "" || txtoriginal_path.Text.Trim().Length > 255)
            {
                strError += "原图地址为空或超出长度![br]";
            }
            if (txtremark.Text.Trim() == "" || txtremark.Text.Trim().Length > 500)
            {
                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_albums model = new Model.common_albums();
            BLL.common_albums   bll   = new BLL.common_albums();

            model.group_id      = Convert.ToInt32(txtgroup_id.Text);
            model.rc_title      = Convert.ToString(txtrc_title.Text);
            model.rc_type       = Convert.ToInt32(txtrc_type.Text);
            model.rc_data_id    = Convert.ToInt32(txtrc_data_id.Text);
            model.thumb_path    = Convert.ToString(txtthumb_path.Text);
            model.original_path = Convert.ToString(txtoriginal_path.Text);
            model.remark        = Convert.ToString(txtremark.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("保存过程中发生错误!", "");
            }
        }
Exemplo n.º 10
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);
            }
        }
Exemplo n.º 11
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();
            }
        }