-CSV betöltés kifejlesztése
-Action beállítása (kép is)
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
this.aGIROInfo_ImportCSV.ConfirmationMessage = null;
|
||||
this.aGIROInfo_ImportCSV.Id = "aGIROInfo_ImportCSV";
|
||||
this.aGIROInfo_ImportCSV.ToolTip = null;
|
||||
this.aGIROInfo_ImportCSV.Execute += new DevExpress.ExpressApp.Actions.SimpleActionExecuteEventHandler(this.aGIROInfo_ImportCSV_Execute);
|
||||
//
|
||||
// GIROInfo_VC
|
||||
//
|
||||
|
||||
@@ -13,6 +13,13 @@ using DevExpress.ExpressApp.Templates;
|
||||
using DevExpress.ExpressApp.Utils;
|
||||
using DevExpress.Persistent.Base;
|
||||
using DevExpress.Persistent.Validation;
|
||||
using DevExpress.Xpo;
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
using DevExpress.ExpressApp.Xpo;
|
||||
|
||||
namespace Nuvolar.Module.Win.CSharp.Controllers
|
||||
{
|
||||
@@ -23,6 +30,8 @@ namespace Nuvolar.Module.Win.CSharp.Controllers
|
||||
{
|
||||
InitializeComponent();
|
||||
// Target required Views (via the TargetXXX properties) and create their Actions.
|
||||
this.aGIROInfo_ImportCSV.TargetObjectType = typeof(GIROInfo);
|
||||
this.aGIROInfo_ImportCSV.TargetViewType = ViewType.ListView;
|
||||
}
|
||||
protected override void OnActivated()
|
||||
{
|
||||
@@ -39,5 +48,58 @@ namespace Nuvolar.Module.Win.CSharp.Controllers
|
||||
// Unsubscribe from previously subscribed events and release other references and resources.
|
||||
base.OnDeactivated();
|
||||
}
|
||||
|
||||
private void aGIROInfo_ImportCSV_Execute(object sender, SimpleActionExecuteEventArgs e)
|
||||
{
|
||||
XPObjectSpace _onew = Application.CreateObjectSpace() as XPObjectSpace;
|
||||
OpenFileDialog _OpenFileDialog = new OpenFileDialog();
|
||||
|
||||
Nuvolar.Module.Win.WaitFormClass _WaitFormClass = new WaitFormClass();
|
||||
|
||||
_OpenFileDialog.Filter = "csv Files (*.csv)|*.csv";
|
||||
_OpenFileDialog.FilterIndex = 1;
|
||||
|
||||
if (_OpenFileDialog.ShowDialog() == DialogResult.OK && (!String.IsNullOrEmpty(_OpenFileDialog.FileName)))
|
||||
{
|
||||
StreamReader _textStreamReader = new StreamReader(_OpenFileDialog.FileName,Encoding.Default);
|
||||
string _StrBuffer;
|
||||
|
||||
_StrBuffer = _textStreamReader.ReadToEnd();
|
||||
using (TextFieldParser parser = new TextFieldParser(new StringReader(_StrBuffer)))
|
||||
{
|
||||
parser.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited;
|
||||
parser.SetDelimiters(";");
|
||||
|
||||
_WaitFormClass.Initwork(1, 1, 4652);
|
||||
while (!parser.EndOfData)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] columns = parser.ReadFields();
|
||||
|
||||
GIROInfo _GIROInfo = _onew.FindObject<GIROInfo>(CriteriaOperator.Parse("GIROID=?",columns[0]));
|
||||
if (_GIROInfo == null)
|
||||
{
|
||||
_GIROInfo = _onew.CreateObject<GIROInfo>();
|
||||
}
|
||||
|
||||
_GIROInfo.GIROID = columns[0];
|
||||
_GIROInfo.ShortName = columns[1];
|
||||
_GIROInfo.Address = columns[2];
|
||||
|
||||
_onew.CommitChanges();
|
||||
_WaitFormClass.DoWork();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
_WaitFormClass.FinalWork();
|
||||
}
|
||||
}
|
||||
_WaitFormClass.FinalWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Application>
|
||||
<ActionDesign>
|
||||
<Actions>
|
||||
<Action Id="aGIROInfo_ImportCSV" ImageName="BO_Security_Permission_Type" Caption="GIRO import CSV" />
|
||||
</Actions>
|
||||
</ActionDesign>
|
||||
<SchemaModules>
|
||||
<SchemaModule Name="SystemModule" Version="15.2.5.0" IsNewNode="True" />
|
||||
<SchemaModule Name="SystemModule" Version="16.2.3.0" IsNewNode="True" />
|
||||
</SchemaModules>
|
||||
</Application>
|
||||
@@ -103,6 +103,7 @@
|
||||
<Reference Include="DevExpress.Xpo.v16.2">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
<Private>False</Private>
|
||||
@@ -114,6 +115,7 @@
|
||||
<Reference Include="System.Drawing">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
<Private>False</Private>
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
DevExpress.ExpressApp.ModuleBase, DevExpress.ExpressApp.v16.2, Version=16.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.ExpressApp.ViewController, DevExpress.ExpressApp.v16.2, Version=16.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
DevExpress.ExpressApp.SystemModule.SystemModule, DevExpress.ExpressApp.v16.2, Version=16.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
Reference in New Issue
Block a user