protected void Btn_returnToList_Click(object sender, EventArgs e) { foreach (GridDataItem grd in grd_FailedList.Items) { TableCell fd = (TableCell)grd["FileDate"]; TableCell classcode = (TableCell)grd["class_code"]; TableCell term = (TableCell)grd["term"]; CheckBox check = (CheckBox)grd.FindControl("chk"); if (check.Checked) { assetB.set_archive(classcode.Text, fd.Text, term.Text, false); cmb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 20, ""); } } grd_FailedList.Dispose(); grd_FailedList.DataSource = assetB.GetAssetListByTerm(cmb_Term.SelectedValue, true); grd_FailedList.DataBind(); }
protected void cmb_Term_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { CommonBusiness cmnb = new CommonBusiness(); List <AssetDTO> DTO = new List <AssetDTO>(); DTO = assetB.GetAssetListByTerm(cmb_Term.SelectedValue, false); 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(); // DataTable dtmp3 = new DataTable(); dtmp3.Columns.Add("fd", Type.GetType("System.String")); dtmp3.Columns.Add("classcode", Type.GetType("System.String")); dtmp3.Columns.Add("term", Type.GetType("System.String")); //dtmp3.Columns.Add("AssetID", Type.GetType("System.String")); dtmp3.Columns.Add("FileSize", Type.GetType("System.String")); dtmp3.Columns.Add("FileDate", Type.GetType("System.String")); DataRow dtmp3row = dtmp3.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"); if (di.Exists) { foreach (FileInfo f in fiArr) { if (f.Length < 1000000) { 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); } } FileInfo[] fiArrmp3 = di.GetFiles("*.mp3"); foreach (FileInfo f in fiArrmp3) { dtmp3row["fd"] = d.ToString(); dtmp3row["classcode"] = classcode.ToString(); dtmp3row["term"] = term.ToString(); //dtmp3row["AssetID"] = assetId.ToString(); dtmp3row["FileSize"] = Math.Ceiling(decimal.Parse(f.Length.ToString()) / 1024); dtmp3row["FileDate"] = DTO[i].FileDate; dtmp3.Rows.Add(dtmp3row); dtmp3row = dtmp3.NewRow(); //System.IO.Directory.Delete(path, true); } } } } grd_DeleteInformationClass.DataSource = dt; grd_DeleteInformationClass.DataBind(); grd_NoZipFile.DataSource = dtmp3; grd_NoZipFile.DataBind(); }