using System;
using System.Collections;
using LogisticsSystem.Control;
using LogisticsSystem.Control.Helper;

namespace LogisticsSystem.SysMain.FileFlow
{
    public partial class Download : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckLogin();
            if (IsPostBack) return;
            LogHelper.Log("用户:" + Session["Username"] + " 进入文件下载");

            string flowid = Request.QueryString["fid"];
            if (flowid == string.Empty)
            {
                files.InnerHtml = "";
                return;
            }
            var file = (Hashtable)Session["SAddr"];

            if (file[flowid].ToString() == string.Empty)
            {
                files.InnerHtml = "<h3>该申请没有附件</h3>";
                return;
            }

            string[] addrs = file[flowid].ToString().Split(',');
            string html = string.Empty;
            int i = 1;
            foreach (string addr in addrs)
            {
                html += "<a href=\"" + addr + "\" onclick=\"return confirm('确定下载吗?');\">附件" + i.ToString() + "</a><br/><br/>";
                i++;
            }
            files.InnerHtml = html;

        }
    }
}