public static bool DeleteTenderingFile(int fileId, Grid layoutRoot)
 {
     if (!UserData.CurrentAccessRight.TenderingDelete)
     {
         ErrorHandler.ShowErrorMessage("امکان انجام این عملیات وجود ندارد");
         return(false);
     }
     if (fileId <= 0)
     {
         return(false);
     }
     if (ErrorHandler.PromptUserForPermision(ErrorHandler.ErrorMessages["Prompt"]) == MessageBoxResult.No)
     {
         return(false);
     }
     layoutRoot.Children.Add(busy);
     Task.Factory.StartNew(delegate
     {
         DataManagement.DeleteTenderingFile(fileId);
     }).ContinueWith(delegate
     {
         layoutRoot.Children.Remove(busy);
         if (TransactionFinished != null)
         {
             TransactionFinished();
         }
     }, TaskScheduler.FromCurrentSynchronizationContext());
     return(true);
 }
        public static bool DeleteTenderingFile(int tenderingId, TenderingIndex docIndex, int?contractorId, string version, Grid layoutRoot, int?advertisementId = null, int?meetingId = null, int?warrantyId = null)
        {
            if (!HasTenderingFile(tenderingId, docIndex, contractorId, version, layoutRoot, advertisementId, meetingId) && warrantyId == null)
            {
                ErrorHandler.ShowErrorMessage("فایل ثبت شده وجود ندارد!ابتدا فایل را بارگذاری کنید");
                return(false);
            }
            if (!UserData.CurrentAccessRight.TenderingDelete)
            {
                ErrorHandler.ShowErrorMessage("امکان انجام این عملیات وجود ندارد");
                return(false);
            }
            int docid = DataManagement.RetrieveTenderingDocumentId(docIndex);

            if (docid == -1)
            {
                return(false);
            }
            if (ErrorHandler.PromptUserForPermision(ErrorHandler.ErrorMessages["Prompt"]) == MessageBoxResult.No)
            {
                return(false);
            }
            layoutRoot.Children.Add(busy);
            Task.Factory.StartNew(delegate
            {
                DataManagement.DeleteTenderingFile(tenderingId, docid, contractorId, advertisementId, meetingId, warrantyId);
            }).ContinueWith(delegate
            {
                layoutRoot.Children.Remove(busy);
                if (TransactionFinished != null)
                {
                    TransactionFinished();
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
            return(true);
        }