Files
2018-10-14 23:26:09 +02:00

78 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Layout;
using DevExpress.ExpressApp.Model.NodeGenerators;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Templates;
using DevExpress.ExpressApp.Utils;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.Validation;
namespace SISBusiness.Module.Controllers
{
// For more typical usage scenarios, be sure to check out https://documentation.devexpress.com/eXpressAppFramework/clsDevExpressExpressAppViewControllertopic.aspx.
public partial class GLAccount_VC : ViewController
{
public GLAccount_VC()
{
InitializeComponent();
// Target required Views (via the TargetXXX properties) and create their Actions.
}
protected override void OnActivated()
{
base.OnActivated();
// Perform various tasks depending on the target View.
}
protected override void OnViewControlsCreated()
{
base.OnViewControlsCreated();
// Access and customize the target View control.
}
protected override void OnDeactivated()
{
// Unsubscribe from previously subscribed events and release other references and resources.
base.OnDeactivated();
}
private void aExportGLAccountsToFile_Execute(object sender, SimpleActionExecuteEventArgs e)
{
FolderBrowserDialog _FolderBrowserDialog = new FolderBrowserDialog();
if (_FolderBrowserDialog.ShowDialog() == DialogResult.OK)
{
foreach (GLAccounts _GLAccounts in View.SelectedObjects)
{
if (_GLAccounts.ImportedRegistryHeader != null)
{
if (_GLAccounts.ImportedRegistryHeader.DocumentFile != null)
{
string _Path = _FolderBrowserDialog.SelectedPath + @"\" + _GLAccounts.ImportedRegistryHeader.RegistryNumber + ".pdf";
using (FileStream _FileStream = File.Create(_Path))
{
_GLAccounts.ImportedRegistryHeader.DocumentFile.SaveToStream(_FileStream);
_FileStream.Flush();
_FileStream.Close();
}
}
}
}
}
}
}
}