Exemplo n.º 1
0
        /// <summary>
        /// 获取项目资料列表
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        /// <remarks>tianzhenyun 2011-10-13</remarks>
        public DataTable GetList(E_Material data)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@EnterpriseID", SqlDbType.Int),
                new SqlParameter("@MaterialType", SqlDbType.TinyInt),
                new SqlParameter("@PageIndex", SqlDbType.Int),
                new SqlParameter("@PageSize", SqlDbType.Int),
                new SqlParameter("@TotalCount", SqlDbType.Int),
            };
            parms[0].Value     = data.EnterpriseID;
            parms[1].Value     = (int)data.MaterialType;
            parms[2].Value     = data.Page.PageIndex;
            parms[3].Value     = data.Page.PageSize;
            parms[4].Direction = ParameterDirection.Output;
            DataTable dt = DbHelperSQL.RunProcedureTable("ProcEP_B_MaterialS_ListSelect", parms);

            data.Page.TotalCount = Convert.ToInt32(parms[4].Value == DBNull.Value?0:parms[4].Value);
            return(dt);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        protected void databind()
        {
            E_Material data = new E_Material();

            data.MaterialType = EnumMaterialType.项目资料;
            data.EnterpriseID = EnterpriceID;
            //分页参数
            data.Page           = new MLMGC.DataEntity.E_Page();
            data.Page.PageSize  = pageSize;
            data.Page.PageIndex = pageIndex;

            rpList.DataSource = new  T_Material().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;";
        }
Exemplo n.º 3
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        protected void databind()
        {
            //加载文件基本信息
            int id = Requests.GetQueryInt("id", 0);

            E_Material data = new E_Material();

            data.MaterialID   = id;
            data.EnterpriseID = EnterpriceID;
            data              = new T_Material().GetModel(data);
            txtCaption.Text   = data.MaterialName;
            hlUrl.Text        = data.FileName;
            hlUrl.NavigateUrl = MLMGC.COMP.Config.GetEnterpriseStudyUrl(EnterpriceID, data.Url);
            //用隐藏域存储附件信息
            hfFile.Value = string.Format("{0}|{1}|{2}|{3}", data.FileName, data.FileType, data.FileSize, data.Url);
            //验证要共享的文件是否存在,若存在则不能共享
            bool flag = new T_WenKu().Exists(new E_WenKu()
            {
                FileName = data.FileName
            });

            if (flag)
            {
                Jscript.AlertAndRedirect(this, "该文档已存在无法共享", "../Material/StudyMaterialList.aspx");
                return;
            }

            //获取文库目录分类
            DataTable dt = new T_WenKuClass().GetList();

            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"));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 删除项目资料
        /// </summary>
        /// <param name="materialID"></param>
        protected void Delete(long materialID)
        {
            E_Material data = new E_Material();

            data.MaterialID   = materialID;
            data.EnterpriseID = EnterpriceID;
            bool flag = new T_Material().Delete(data);

            new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log()
            {
                EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "删除项目资料", IP = MLMGC.COMP.Requests.GetRealIP()
            });
            if (flag)
            {
                //MLMGC.COMP.Jscript.AlertAndRedirect(this, "删除成功", "MaterialList.aspx");
                MLMGC.COMP.Jscript.ShowMsg("删除成功", this);
            }
            else
            {
                MLMGC.COMP.Jscript.ShowMsg("删除失败", this);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 得到一个项目资料对象
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        /// <remarks>tianzhenyun 2011-10-13</remarks>
        public E_Material GetModel(E_Material data)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@MaterialID", SqlDbType.Int),
                new SqlParameter("@EnterpriseID", SqlDbType.Int)
            };
            parms[0].Value = data.MaterialID;
            parms[1].Value = data.EnterpriseID;
            DataTable dt = DbHelperSQL.RunProcedureTable("ProcEP_B_MaterialS_Select", parms);

            if (dt != null && dt.Rows.Count == 1)
            {
                data.MaterialName = dt.Rows[0]["MaterialName"].ToString();
                data.ClassName    = dt.Rows[0]["ClassName"].ToString();
                data.FileName     = dt.Rows[0]["FileName"].ToString();
                data.Url          = dt.Rows[0]["Url"].ToString();
                data.FileType     = dt.Rows[0]["FileType"].ToString();
                data.FileSize     = Convert.ToInt32(dt.Rows[0]["FileSize"]);
                return(data);
            }
            return(null);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 企业资料共享
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 /// <remarks>tianzhenyun 2012-03-16</remarks>
 public bool Share(E_Material data)
 {
     return(dal.Share(data));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 得到项目资料列表
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public DataTable GetList(E_Material data)
 {
     return(dal.GetList(data));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 得到项目资料对象
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public E_Material GetModel(E_Material data)
 {
     return(dal.GetModel(data));
 }
Exemplo n.º 9
0
 /// <summary>
 /// 删除项目资料
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool Delete(E_Material data)
 {
     return(dal.Delete(data));
 }
Exemplo n.º 10
0
 /// <summary>
 /// 更新项目资料
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool Update(E_Material data)
 {
     return(dal.Update(data));
 }
Exemplo n.º 11
0
 /// <summary>
 /// 增加项目资料
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool Add(E_Material data)
 {
     return(dal.Add(data));
 }
Exemplo n.º 12
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);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 点击确定处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //判断是否输入标题和分类
            if (txtMaterialName.Text == "" && txtClassName.Text == "")
            {
                MLMGC.COMP.Jscript.ShowMsg("请输入标题和分类", this);
                return;
            }
            else if (txtMaterialName.Text == "")
            {
                MLMGC.COMP.Jscript.ShowMsg("请输入标题", this);
                return;
            }
            else if (txtClassName.Text == "")
            {
                MLMGC.COMP.Jscript.ShowMsg("请输入分类", this);
                return;
            }

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

            if (list == null || list.Count == 0)
            {
                MLMGC.COMP.Jscript.ShowMsg("上传文件失败", this);
                return;
            }
            //----------------文件上传成功 生成txt文本 进行文件类型转换---------------

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

            //----封装对象----
            E_Material data = new E_Material();

            data.MaterialType = EnumMaterialType.项目资料;
            data.EnterpriseID = EnterpriceID;
            data.MaterialName = txtMaterialName.Text;
            data.ClassName    = txtClassName.Text;
            data.FileName     = list[0].FileName;
            data.FileType     = list[0].FileType;
            data.FileSize     = Convert.ToInt32(list[0].FileSize);
            data.Url          = list[0].FileAddress;

            //判断是添加还是修改
            if (type == "add")
            {
                bool flag = new T_Material().Add(data);
                new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log()
                {
                    EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "添加项目资料", IP = MLMGC.COMP.Requests.GetRealIP()
                });
                if (flag)
                {
                    MLMGC.COMP.Jscript.AlertAndRedirect(this, "添加成功", "MaterialList.aspx");
                }
                else
                {
                    MLMGC.COMP.Jscript.ShowMsg("添加失败", this);
                }
            }
            else
            {
                //获取项目资料编号
                long materialID = MLMGC.COMP.Requests.GetQueryLong("materialid", 0);
                data.MaterialID = materialID;

                bool flag = new T_Material().Update(data);
                new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log()
                {
                    EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "修改项目资料", IP = MLMGC.COMP.Requests.GetRealIP()
                });
                if (flag)
                {
                    MLMGC.COMP.Jscript.AlertAndRedirect(this, "修改成功", "MaterialList.aspx");
                }
                else
                {
                    MLMGC.COMP.Jscript.ShowMsg("修改失败", this);
                }
            }
        }
Exemplo n.º 14
0
        protected void databind()
        {
            string type = Requests.GetQueryString("type");
            string ids  = Requests.GetQueryString("ids");
            //显示邮件配置信息
            E_MailConfig data = new T_MailConfig().GetConfig(new E_MailConfig()
            {
                EnterpriseID = base.EnterpriceID,
                UserID       = UserID
            });

            if (data == null)
            {
                //隐藏发送邮件信息
                plSend.Visible = false;
                return;
            }
            else
            {
                //隐藏配置信息
                plConfig.Visible   = false;
                lbSendUser.Text    = data.Name;
                lbSendUser.ToolTip = "发送邮箱:" + data.Email;
            }
            //----------------读取邮件地址----------------
            if (StringUtil.IsStringArrayList(ids))
            {
                DataTable dt = new T_ClientInfoHelper().SelectOperate(new E_ClientInfoHelper()
                {
                    EnterpriseID = EnterpriceID, ClientInfoIDs = ids
                });
                List <string> listEmail = new List <string>();
                List <string> listErr   = new List <string>();
                //--遍历取出邮箱地址
                foreach (DataRow dr in dt.Rows)
                {
                    if (!string.IsNullOrEmpty(dr["Email"].ToString()))
                    {
                        listEmail.Add(dr["Email"].ToString());
                    }
                    else
                    {
                        listErr.Add(dr["ClientName"].ToString());
                    }
                }
                txtReceiveEmail.Text = string.Join(",", listEmail.ToArray());
                if (listErr.Count > 0)
                {
                    lbErrClient.Text = "部分客户无邮箱地址无法发送邮件";// +string.Join(",", listErr);
                }
            }
            //----------------显示项目资料信息----------------
            E_Material dataM = new E_Material();

            dataM.EnterpriseID   = EnterpriceID;
            dataM.Page           = new MLMGC.DataEntity.E_Page();
            dataM.Page.PageSize  = 0;
            dataM.Page.PageIndex = 1;

            rpList.DataSource = new MLMGC.BLL.Enterprise.Material.T_Material().GetList(dataM);
            rpList.DataBind();
        }