private void BrowseBtn_Click(object sender, RoutedEventArgs e) { if (CurrentContract.PermanentRecord == true) { ErrorHandler.NotifyUser("سند به ثبت نهایی رسیده است"); return; } FileDataObject d = FilingManager.GetFileDataObject(); // check if the file is empty or the selected item is nulland return if (d == null) { return; } var f = new PaymentFile() { Index = 1, Name = d.FileName, FileContent = d.FileContent, AttachedDate = DateTime.Now, FileGuid = Guid.NewGuid(), PaymentDraftId = (dataGrid.SelectedItem as PaymentDraft).PaymentDraftId }; DataManagement.AddPaymentDraftFile(f); ErrorHandler.NotifyUser("فایل ثبت شد"); }