Пример #1
0
 /// <summary>
 /// 修改浏览次数
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 /// <reamrks>tianzhenyun 2012-03-22</reamrks>
 public bool UpdateBrowser(E_WenKu data)
 {
     return(dal.UpdateBrowser(data));
 }
Пример #2
0
 /// <summary>
 /// 获取要转换的文库列表
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 /// <remarks>tianzhenyun 2012-03-22</remarks>
 public DataTable ConvertList(E_WenKu data)
 {
     return(dal.ConvertList(data));
 }
Пример #3
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        protected void databind()
        {
            //获取个人信息,判断他的信息是否完善,如果不完善,跳转到个人资料页面进行填写。
            E_Personal dataPersonal = new E_Personal();

            dataPersonal.UserID     = UserID;
            dataPersonal.PersonalID = PersonalID;
            dataPersonal            = new T_Personal().GetModel(dataPersonal);
            if (dataPersonal == null)
            {
                Response.Redirect("../main.aspx");
            }
            //判断资料是否完善
            if (!new T_Personal().IsPerfect(dataPersonal))
            {
                Jscript.AlertAndRedirect(this, "个人信息不完善", "/personal/modify.aspx");
                return;
            }

            //绑定文件类型
            EnumUtil.BindList <EnumFileType>(rdType);
            rdType.Items.RemoveAt(rdType.Items.Count - 1);//去掉最后一个其它
            //文库项目分类
            DataTable dt = new T_WenKuClass().GetList();

            //绑定目录分类
            ddlCategory.Items.Add(new ListItem("全部", "-1"));
            if (dt == null)
            {
                return;
            }
            foreach (DataRow row in dt.Rows)
            {
                ddlCategory.Items.Add(new ListItem(row["WenKuClassName"].ToString(), row["WenKuClassID"].ToString()));
            }
            ddlCategory.Items.Add(new ListItem("其它", "0"));


            //获取文库列表
            E_WenKu data = new E_WenKu();

            //data.UserID = UserID;
            data.WenKuClassID         = Requests.GetQueryInt("cid", -1);
            ddlCategory.SelectedValue = data.WenKuClassID.ToString();

            data.Keywords        = Requests.GetQueryString("keywords");
            txtName.Text         = data.Keywords;
            data.SetFileType     = Requests.GetQueryInt("filetype", 0);
            rdType.SelectedValue = ((int)data.FileType).ToString();
            data.SetStatusFlag   = (int)EnumStatusFlag.审核通过且上线;

            data.Page           = new MLMGC.DataEntity.E_Page();
            data.Page.PageIndex = pageIndex;
            data.Page.PageSize  = pageSize;

            rpList.DataSource = new T_WenKu().GetList(data);
            rpList.DataBind();

            //设置分页样式
            pageList1.PageSize              = pageSize;
            pageList1.CurrentPageIndex      = pageIndex;
            pageList1.RecordCount           = data.Page.TotalCount;
            pageList1.CustomInfoHTML        = string.Format("共有记录 <span class='red_font'>{0}</span> 条", pageList1.RecordCount);
            pageList1.TextAfterPageIndexBox = "&nbsp;页/" + pageList1.PageCount + "&nbsp;";
        }
Пример #4
0
        /// <summary>
        /// 点击上传按钮处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string caption = txtCaption.Text.Trim();
            string intro   = txtIntro.Text.Trim();
            string keyword = txtKeyword.Text.Trim();
            string custom  = txtCustom.Text.Trim();
            int    value   = Convert.ToInt32(ddlCategory.SelectedValue);

            if (string.IsNullOrEmpty(caption))
            {
                Jscript.ShowMsg("请输入标题", this);
                return;
            }
            if (value == -1 && string.IsNullOrWhiteSpace(custom))
            {
                Jscript.ShowMsg("请输入自定义分类", this);
                return;
            }

            //获取附件基本信息
            string attach = hfFile.Value;

            string[] arr = attach.Split('|');
            if (arr.Length == 0)
            {
                return;
            }

            if (Convert.ToInt64(arr[2]) > sizelimit)
            {
                Jscript.ShowMsg("文件过大无法共享!", this);
                return;
            }

            //1.-------拷贝对象资料到WenKu目录-------
            //原文件的物理路径
            string filepath = MLMGC.COMP.Config.GetEnterpriseS(EnterpriceID, arr[3]);

            if (File.Exists(filepath))
            {
                //目标文件的物理路径
                string destpath = MLMGC.COMP.Config.GetWenKu(arr[3]);
                File.Copy(filepath, destpath, true);//拷贝原文件
            }
            //-----------------------------------

            //2.----------插入WenKu数据------------
            E_WenKu data = new E_WenKu();

            data.EnterpriseID    = EnterpriceID;
            data.UserID          = 0;
            data.Caption         = caption;
            data.Intro           = intro;
            data.Keywords        = keyword;
            data.WenKuClassID    = value;
            data.CustomClassName = custom;
            data.UserType        = MLMGC.DataEntity.User.UserType.企业用户;

            data.FileName     = arr[0];
            data.SetFileType2 = arr[1];
            data.FileSize     = Convert.ToInt32(arr[2]);
            data.FileUrl      = arr[3];
            data.StatusFlag   = EnumStatusFlag.待审核;

            bool flag = new T_WenKu().Add(data);

            //--------------------------------------------

            if (flag) //如果成功则继续
            {
                //3.-------------修改数据库,标识该资料已被共享------------------
                E_Material dataM = new E_Material();
                dataM.EnterpriseID = EnterpriceID;
                dataM.MaterialID   = Requests.GetQueryInt("id", 0);
                dataM.WenKuFlag    = EnumWenKuFlag.待审核;
                dataM.WenKuID      = data.WenKuID;

                flag = new T_Material().Share(dataM);
                //-------------------------------------------------------------

                //4.--------------------修改监控文件 生成swf文件-------------------
                //转换文档为swf
                System.IO.FileStream   fs = new System.IO.FileStream(MLMGC.COMP.Config.MonitorFilePath + data.WenKuID.ToString() + ".txt", System.IO.FileMode.Create, System.IO.FileAccess.Write);
                System.IO.StreamWriter sw = new System.IO.StreamWriter(fs);
                sw.WriteLine(string.Format("\r\n{0}|{1}", data.WenKuID, arr[3]));
                sw.Close();
                fs.Close();
                //----------------------------------------------------
            }

            if (flag)
            {
                Jscript.AlertAndRedirect(this, "共享成功", "/enterprise/material/studymateriallist.aspx");
            }
            else
            {
                Jscript.ShowMsg("共享失败", this);
            }
        }
Пример #5
0
        /// <summary>
        /// 点击上传按钮处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string caption = txtCaption.Text.Trim();
            string intro   = txtIntro.Text.Trim();
            string keyword = txtKeyword.Text.Trim();
            string custom  = txtCustom.Text.Trim();
            int    value   = Convert.ToInt32(ddlCategory.SelectedValue);

            if (string.IsNullOrEmpty(caption))
            {
                Jscript.ShowMsg("请输入标题", this);
                return;
            }
            if (value == -1 && string.IsNullOrWhiteSpace(custom))
            {
                Jscript.ShowMsg("请输入自定义分类", this);
                return;
            }

            //上传文件
            List <PFileInfo> list = FileUpload1.Upload();

            if (list == null || list.Count == 0)
            {
                MLMGC.COMP.Jscript.ShowMsg("上传文件失败", this);
                return;
            }

            //--------判断该文件是否已存在--------
            bool b = new T_WenKu().Exists(new E_WenKu()
            {
                FileName = list[0].FileName
            });

            if (b)
            {
                Jscript.ShowMsg("该文件已存在", this);
                return;
            }
            //-----------------------------------

            E_WenKu data = new E_WenKu();

            data.UserType        = MLMGC.DataEntity.User.UserType.个人用户;
            data.UserID          = UserID;
            data.Caption         = caption;
            data.Intro           = intro;
            data.Keywords        = keyword;
            data.WenKuClassID    = value;
            data.CustomClassName = custom;

            data.SetFileType2 = list[0].FileType;
            data.FileName     = list[0].FileName;
            data.FileUrl      = list[0].FileAddress;
            data.FileSize     = Convert.ToInt32(list[0].FileSize);
            data.StatusFlag   = EnumStatusFlag.待审核;

            bool flag = new T_WenKu().Add(data);

            if (flag)
            {
                try
                {
                    //转换文档为swf
                    System.IO.FileStream   fs = new System.IO.FileStream(MLMGC.COMP.Config.MonitorFilePath + data.WenKuID.ToString() + ".txt", System.IO.FileMode.Create, System.IO.FileAccess.Write);
                    System.IO.StreamWriter sw = new System.IO.StreamWriter(fs);
                    sw.WriteLine(string.Format("\r\n{0}|{1}", data.WenKuID, list[0].FileAddress));
                    sw.Close();
                    fs.Close();
                }
                catch
                {
                }
            }
            if (flag)
            {
                Jscript.AlertAndRedirect(this, "上传成功", "Add.aspx");
            }
            else
            {
                Jscript.ShowMsg("上传失败!", this);
            }
        }