Beispiel #1
0
        private void IniData()
        {
            tvMain.Nodes.Clear();
            TreeNode trNo = new TreeNode("内部文件");

            trNo.ImageUrl = "~/Image/Folder.ico";
            trNo.Target   = "0";
            tb_FolderService folderSer = new tb_FolderService();
            List <tb_Folder> allFolder = folderSer.GetListArray("");


            tb_AttachmentService ATTSer = new tb_AttachmentService();
            List <tb_Attachment> atts   = ATTSer.GetListArray_TV("");


            for (int i = 0; i < atts.Count; i++)
            {
                tb_Folder fole = new tb_Folder();
                fole.Type = "file";


                fole.ParentId    = Convert.ToInt32(atts[i].Folder_Id);
                fole.Folder_NAME = atts[i].MainName + "(" + atts[i].createTime + ")";
                fole.AttId1      = atts[i].id.ToString();
                fole.Folder_ID   = -1;
                allFolder.Add(fole);
            }
            showFolder(allFolder, trNo);
            tvMain.Nodes.Add(trNo);

            tvMain.CollapseAll();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                IniData();
                lblParent.Text      = "";
                lblFolderId.Visible = false;
                tb_AttachmentService attSer = new tb_AttachmentService();
                if (base.Request["Id"] != null)
                {
                    this.btnAdd.Visible = false;

                    tb_Attachment attachment = attSer.GetListArrayByParentId(Convert.ToInt32(base.Request["Id"]));
                    txtAttName.Text  = attachment.MainName;
                    txtRemark.Text   = attachment.Remark;
                    txtVersion.Text  = attachment.version;
                    lblFolderId.Text = attachment.Folder_Id.ToString();
                    lblParent.Text   = attachment.FolderName;
                    lblAttName.Text  = attachment.fileName;
                }
                else
                {
                    this.btnUpdate.Visible = false;
                }
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                tb_AttachmentService attSer = new tb_AttachmentService();
                List <tb_Attachment> atts   = attSer.GetListArray("");
                gvList.DataSource = atts;
                gvList.DataBind();


                tb_FolderService folderSer = new tb_FolderService();
                List <tb_Folder> allFolder = folderSer.GetListArray("");
                allFolder.Insert(0, new tb_Folder());
                ddlFolders.DataSource = allFolder;
                ddlFolders.DataBind();
                ddlFolders.DataTextField  = "Folder_NAME";
                ddlFolders.DataValueField = "Folder_ID";

                #region 是否有删除功能
                if (Session["currentUserId"] != null)
                {
                    VAN_OA.Dal.TB_AdminDeleteService deleteSer = new VAN_OA.Dal.TB_AdminDeleteService();
                    if (deleteSer.CheckIsExistByUserId(Convert.ToInt32(Session["currentUserId"])) == false)
                    {
                        gvList.Columns[6].Visible = false;
                    }
                }
                #endregion
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // string url="<script>window.open('55.htm', '','fullscreen=yes')</script>";

                // Response.Write(url);
                //if (1 == 1)
                //{
                //    return;
                //}

                if (Request["id"] != null)
                {
                    tb_AttachmentService attSer = new tb_AttachmentService();
                    tb_Attachment        atts   = attSer.GetListArrayByParentId_Pre(Request["id"]);
                    if (atts != null)
                    {
                        string qizhui = System.Web.HttpContext.Current.Request.MapPath("Attachment/") + Request["id"];

                        string fileExtension = atts.fileName.Substring(atts.fileName.LastIndexOf(".") + 1).ToLower();



                        if (fileExtension == "doc" || fileExtension == "docx")
                        {
                            if (File.Exists(qizhui + "." + "htm") == false)
                            {
                                WordToHtml(qizhui + "." + fileExtension, qizhui + ".htm");
                            }
                            // url = "/Attachment/" + Request["id"] + ".htm";
                            Response.Redirect("~/Attachment/" + Request["id"] + ".htm");
                        }

                        else if (fileExtension == "xlsx" || fileExtension == "xls")
                        {
                            if (File.Exists(qizhui + "." + "htm") == false)
                            {
                                ExcelConvertToHtml(qizhui + "." + fileExtension, qizhui + ".htm");
                            }
                            //  url = "/Attachment/" + Request["id"] + ".htm";
                            Response.Redirect("~/Attachment/" + Request["id"] + ".htm");
                        }
                        else
                        {
                            Response.Redirect("~/Attachment/" + Request["id"] + "." + fileExtension);


                            //Response.ContentType = atts.FileType;
                            //Response.BinaryWrite((byte[])atts.fileNo);
                            //Response.Write(atts.fileName.ToString());
                        }
                    }

                    // Response.Write("<script>window.close();window.opener=null;</script>");
                }
            }
        }
Beispiel #5
0
        protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string id = this.gvList.DataKeys[e.RowIndex].Value.ToString();

            tb_AttachmentService attSer = new tb_AttachmentService();

            attSer.Delete(id.ToString());
            show();
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                if (Request["id"]!=null)
                {
                    tb_AttachmentService attSer = new tb_AttachmentService();
                    tb_Attachment atts = attSer.GetListArrayByParentId_Down( Request["id"]);
                    if (atts != null )
                    {
                        string qizhui = System.Web.HttpContext.Current.Request.MapPath("Attachment/") + Request["id"];

                        string fileExtension = atts.fileName.Substring(atts.fileName.LastIndexOf(".") + 1).ToLower();

                        string url = qizhui + "." + fileExtension;
                        down1(Request["id"]+"." + fileExtension, url);

                       

                      


                        //Response.Buffer = true;
                        //Page.Response.Clear();//清除缓冲区所有内容
                        //Page.Response.ContentType = "application/octet-stream";
                        //Page.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(atts.fileName));
                        //byte[] file;
                        //if (atts.fileNo == null)
                        //{
                        //    file = new byte[0];
                        //}
                        //else
                        //{
                        //    file = (Byte[])atts.fileNo;//读出数据
                        //}
                        //int a = file.Length;
                        //if (atts.fileNo != null)
                        //{
                        //    Response.BinaryWrite(file);
                        //}
                        //Response.Flush();
                        //Response.End();

                    }

                  // Response.Write("<script>window.close();window.opener=null;</script>"); 
                }
            }
        }
Beispiel #7
0
        private void show()
        {
            try
            {
                string sql = " ";
                if (txtMainName.Text.Trim() != "")
                {
                    sql += string.Format(" and mainName like '%{0}%'", txtMainName.Text);
                }
                if (txtFrom.Text != "")
                {
                    if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('创建时间 格式错误!');</script>");
                        return;
                    }
                    sql += string.Format(" and createTime>='{0} 00:00:00'", txtFrom.Text);
                }
                if (txtTo.Text != "")
                {
                    if (CommHelp.VerifesToDateTime(txtTo.Text) == false)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('创建时间 格式错误!');</script>");
                        return;
                    }
                    sql += string.Format(" and createTime<='{0} 23:59:59'", txtTo.Text);
                }

                if (ddlFolders.Text != "0")
                {
                    sql += string.Format(" and tb_Attachment.folder_Id={0}", ddlFolders.Text);
                }
                tb_AttachmentService attSer = new tb_AttachmentService();
                List <tb_Attachment> atts   = attSer.GetListArray(sql);
                gvList.DataSource = atts;
                gvList.DataBind();
            }
            catch (Exception)
            {
            }
        }