Exemple #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            CommonBusiness  cmnb = new CommonBusiness();
            List <AssetDTO> DTO  = new List <AssetDTO>();

            DTO = assetB.GetAssetListBySize(cmb_Term.SelectedValue, false, int.Parse(txt_FileSize.Text));
            //DataTable dt = new DataTable();
            //dt.Columns.Add("fd", Type.GetType("System.String"));
            //dt.Columns.Add("classcode", Type.GetType("System.String"));
            //dt.Columns.Add("term", Type.GetType("System.String"));
            ////dt.Columns.Add("AssetID", Type.GetType("System.String"));
            //dt.Columns.Add("FileSize", Type.GetType("System.String"));
            //dt.Columns.Add("FileDate", Type.GetType("System.String"));
            //DataRow dtRow = dt.NewRow();
            //for (int i = 0; i < DTO.Count; i++)
            //{
            //    string fd = DTO[i].FileDate;
            //    string classcode = DTO[i].Class_Code.ToString();
            //    string term = DTO[i].Term.ToString();
            //    string d = fd.Replace('/', '-');
            //    string assetId = DTO[i].AssetID.ToString();
            //    string path = Server.MapPath("../content/" + term + "/" + classcode + "/" + d);


            //    if (Directory.Exists(path))
            //    {
            //        DirectoryInfo di = new DirectoryInfo(path);
            //        // Get a reference to each file in that directory.
            //        FileInfo[] fiArr = di.GetFiles("mp3.zip");

            //        foreach (FileInfo f in fiArr)
            //            if (f.Length < (int.Parse(txt_FileSize.Text) * 1024))
            //            {
            //                dtRow["fd"] = d.ToString();
            //                dtRow["classcode"] = classcode.ToString();
            //                dtRow["term"] = term.ToString();
            //                //dtRow["AssetID"] = assetId.ToString();
            //                dtRow["FileSize"] = Math.Ceiling(decimal.Parse(f.Length.ToString()) / 1024);
            //                dtRow["FileDate"] = DTO[i].FileDate;
            //                dt.Rows.Add(dtRow);
            //                dtRow = dt.NewRow();
            //                //System.IO.Directory.Delete(path, true);
            //            }
            //    }
            //}
            grd_FileList.DataSource = DTO;
            grd_FileList.DataBind();
        }