You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.9 KiB
77 lines
2.9 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Runtime.Remoting.Messaging;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using OnDoc.Klassen;
|
|
using Syncfusion.Windows.Forms.Tools;
|
|
using Syncfusion.WinForms.Controls;
|
|
using Syncfusion.WinForms.DataGrid;
|
|
using Syncfusion.WinForms.DataGrid.Interactivity;
|
|
|
|
namespace OnDoc.UIControls
|
|
{
|
|
public partial class Serienbrief : SfForm
|
|
{
|
|
public Serienbrief()
|
|
{
|
|
InitializeComponent();
|
|
this.Style.TitleBar.BackColor = Theaming.Titelbar();
|
|
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
|
|
}
|
|
|
|
private void Serienbrief_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void RibbonButtonExit_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void RibbonButtonExcelImport_Click(object sender, EventArgs e)
|
|
{
|
|
DataTable importdata = new DataTable();
|
|
openFileDialog1.Filter = "Excel-Dateien files (*.xlsx)|*.xlsx|CSV-Dateien (*.csv)|*.csv|Alle Dateien (*.*)|*.*";
|
|
openFileDialog1.FilterIndex = 0;
|
|
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
|
{
|
|
ExcelNet.ExcelReader reader = new ExcelNet.ExcelReader();
|
|
string selected_sheetname = "";
|
|
var sheets = new List<string>();
|
|
sheets = reader.Get_ExcelSheets(openFileDialog1.FileName);
|
|
if (sheets.Count > 1) {
|
|
DocMgmt.Serienbrief_Sheetselect sheetselect = new DocMgmt.Serienbrief_Sheetselect(sheets);
|
|
sheetselect.ShowDialog();
|
|
if (sheetselect.DialogResult == DialogResult.OK)
|
|
{
|
|
selected_sheetname = sheetselect.get_selected_sheet();
|
|
}
|
|
else { return; }
|
|
}
|
|
else { selected_sheetname = sheets[0]; }
|
|
|
|
reader.Excel_To_Datatabable(openFileDialog1.FileName, selected_sheetname,true, ref importdata);
|
|
if (importdata.Rows.Count < 1)
|
|
{
|
|
MessageBox.Show("Die ausgewählten Daten können nicht verwendet werden.", "Import", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
return;
|
|
}
|
|
if (importdata.Columns[0].Caption.ToUpper() != "PARTNERNR")
|
|
{
|
|
MessageBox.Show("Die importierten Daten enthalten keine Spalte 'Partnernr'. Der Vorgang wird abgebrochen.", "Import", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
importdata.Rows.Clear();
|
|
importdata.Columns.Clear();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|