protected void Page_Load(object sender, EventArgs e)
 {
     CatagoryTableAdapter adp = new CatagoryTableAdapter();
     DataTable dt = adp.GetCatagoryName();
     DirectoryInfo diAsset = new DirectoryInfo(Server.MapPath("Assets"));
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         string catagoryFolderName = dt.Rows[i][0].ToString();
         DirectoryInfo catagoryFolderDir = new DirectoryInfo(diAsset.FullName + "/" + catagoryFolderName);
         if (!catagoryFolderDir.Exists)
         {
             catagoryFolderDir.Create();
         }
         SubcatagoryTableAdapter subTa = new SubcatagoryTableAdapter();
         DataTable subDt = subTa.GetSubCatagoryNames(catagoryFolderName);
         for (int j = 0; j < subDt.Rows.Count; j++)
         {
             string subCatagoryFolderName = subDt.Rows[j][2].ToString();
             DirectoryInfo subCatagoryFolderDir = new DirectoryInfo(catagoryFolderDir + "/" + subCatagoryFolderName);
             if (!subCatagoryFolderDir.Exists)
             {
                 subCatagoryFolderDir.Create();
             }
         }
     }
 }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CatagoryTableAdapter adp     = new CatagoryTableAdapter();
        DataTable            dt      = adp.GetCatagoryName();
        DirectoryInfo        diAsset = new DirectoryInfo(Server.MapPath("Assets"));

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string        catagoryFolderName = dt.Rows[i][0].ToString();
            DirectoryInfo catagoryFolderDir  = new DirectoryInfo(diAsset.FullName + "/" + catagoryFolderName);
            if (!catagoryFolderDir.Exists)
            {
                catagoryFolderDir.Create();
            }
            SubcatagoryTableAdapter subTa = new SubcatagoryTableAdapter();
            DataTable subDt = subTa.GetSubCatagoryNames(catagoryFolderName);
            for (int j = 0; j < subDt.Rows.Count; j++)
            {
                string        subCatagoryFolderName = subDt.Rows[j][2].ToString();
                DirectoryInfo subCatagoryFolderDir  = new DirectoryInfo(catagoryFolderDir + "/" + subCatagoryFolderName);
                if (!subCatagoryFolderDir.Exists)
                {
                    subCatagoryFolderDir.Create();
                }
            }
        }
    }