Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
        protected void btn_AddFailedList_Click(object sender, EventArgs e)
        {
            CommonBusiness cmnb = new CommonBusiness();

            foreach (GridDataItem grd in grd_FileList.Items)
            {
                HiddenField fd        = (HiddenField)grd.FindControl("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.Value, term.Text, true);
                    cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 20, "");
                }
            }

            List <AssetDTO> DTO = new List <AssetDTO>();

            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.MasterTableView.Dispose();
            grd_FileList.DataSource = DTO;
            grd_FileList.DataBind();
        }