Esempio n. 1
0
        public JsonResult Delete(string formName, string catName)
        {
            DocumentBL documentBl     = new DocumentBL();
            int        recordaffected = documentBl.DeleteForm(formName);

            #region for Form Archive
            if (recordaffected == 1)
            {
                string archivedFolder  = "~/ArchivedForms/" + catName + "/";
                string uploadedFolder  = "~/Uploads/" + catName + "/";
                string sourcePath      = Server.MapPath(uploadedFolder);
                string destinationPath = Server.MapPath(archivedFolder);
                string uploadedFile    = Path.Combine(sourcePath, formName);
                string archiveFile     = Path.Combine(destinationPath, formName);
                if (System.IO.File.Exists(uploadedFile))
                {
                    if (!Directory.Exists(destinationPath))
                    {
                        Directory.CreateDirectory(destinationPath);
                    }
                    System.IO.File.Move(uploadedFile, archiveFile);
                }
            }
            #endregion
            return(Json(recordaffected, JsonRequestBehavior.AllowGet));
        }