private int ProcessUploadedFile(string fileName)
    {
        int    idImport      = ApplicationConstants.INT_NULL_VALUE;
        string cleanFileName = ApplicationUtils.GetCleanFileName(fileName);
        string shareFilePath = string.Empty;

        // get the directory from appsettings
        string dirUrl    = ConfigurationManager.AppSettings["UploadFolderInitial"];
        string dirPath   = Server.MapPath(dirUrl);
        string shareName = @"\\" + Server.MachineName + @"\" + dirUrl;

        shareFilePath = shareName + @"\" + cleanFileName;
        ImportInitialBudget initialBudgetUpload = new ImportInitialBudget(SessionManager.GetSessionValueNoRedirect(this.Page, SessionStrings.CONNECTION_MANAGER));

        try
        {
            idImport = initialBudgetUpload.WriteToInitialBudgetImportTable(shareFilePath, currentUser.IdAssociate);
            if (idImport > 0)
            {
                btnProcess.Enabled = true;
                ProcessIdHdn.Value = idImport.ToString();
                MoveFileToDirectory(TargetDirectoryEnum.DIRECTORY_PROCESSED, shareFilePath);
            }
            return(idImport);
        }
        catch (Exception ex)
        {
            btnProcess.Enabled = false;
            MoveFileToDirectory(TargetDirectoryEnum.DIRECTORY_CANCELLED, shareFilePath);
            throw new IndException(ex);
        }
    }
 protected void btnProcess_Click(object sender, EventArgs e)
 {
     try
     {
         int idImport = default(int);
         Int32.TryParse(ProcessIdHdn.Value.ToString(), out idImport);
         ImportInitialBudget initialBudgetUpload = new ImportInitialBudget(SessionManager.GetSessionValueNoRedirect(this.Page, SessionStrings.CONNECTION_MANAGER));
         try
         {
             int retVal = initialBudgetUpload.InsertToBudgetTable(idImport);
             if (retVal >= 0)
             {
                 this.ShowError(new IndException(string.Format(ApplicationMessages.IMPORT_FILE_PROCESSED, idImport.ToString())));
                 TrackingActivityLog tkl = new TrackingActivityLog(SessionManager.GetConnectionManager(this));
                 tkl.InsertTrackingActivityLog(currentProject, currentUser, ETrackingActivity.UploadedInitialBudget);
             }
         }
         catch (Exception ex)
         {
             this.ShowError(new IndException(ex.Message.ToString()));
         }
     }
     catch (Exception ex)
     {
         ShowError(new IndException(ex));
         return;
     }
 }