Exemplo n.º 1
0
    private void InitModule()
    {
        if (Request["ID"] == null)
        {
            return;
        }
        int id = int.Parse(Request["ID"].ToString());

        hiddenID.Text = id.ToString();
        FineOffice.Modules.OA_Attachment model = attachmentBll.GetModel(d => d.ID == id);
        txtFileName.Text = model.FileName;
    }
Exemplo n.º 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         FineOffice.Modules.OA_Attachment model = attachmentBll.GetModel(d => d.ID == int.Parse(hiddenID.Text));
         model.FileName = txtFileName.Text.Trim();
         attachmentBll.Update(model);
         PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("refresh_attachment"));
     }
     catch (Exception ex)
     {
         Alert.ShowInParent(ex.Message);
     }
 }
Exemplo n.º 3
0
    protected void btnDownAttachment_Click(object sender, EventArgs e)
    {
        int id = int.Parse(attachmentGrid.DataKeys[attachmentGrid.SelectedRowIndex][0].ToString());

        FineOffice.Modules.OA_Attachment model = attBll.GetModel(d => d.ID == id);
        byte[] attachmentData = SharpZipLib.DeCompress(model.AttachmentData);

        FineOffice.Web.FileTypeHelper typeHelper = new FineOffice.Web.FileTypeHelper();
        Response.Clear();
        Response.Buffer  = true;
        Response.Charset = "utf-8";
        Response.AddHeader("Content-Disposition", "attachment; filename=" + typeHelper.ToHexString(model.FileName + "." + model.XType));
        Response.AddHeader("Content-Length", attachmentData.Length.ToString());
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.OutputStream.Write(attachmentData, 0, attachmentData.Length);
        Response.Flush();
    }