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.
144 lines
4.8 KiB
144 lines
4.8 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
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;
|
|
using Database;
|
|
using System.Web.UI.WebControls;
|
|
using Syncfusion.WinForms.DataGridConverter;
|
|
using Syncfusion.XlsIO;
|
|
using System.IO;
|
|
|
|
|
|
namespace OnDoc.Diverses
|
|
{
|
|
public partial class qdfLog : SfForm
|
|
{
|
|
public qdfLog()
|
|
{
|
|
InitializeComponent();
|
|
this.Style.TitleBar.BackColor = Theaming.Titelbar();
|
|
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
|
|
this.Style.ShadowOpacity = Theaming.ShadowOpacity;
|
|
this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity;
|
|
}
|
|
|
|
private void qdfLog_Load(object sender, EventArgs e)
|
|
{
|
|
Refresh_data(false);
|
|
}
|
|
private void Refresh_data(bool posds) {
|
|
DB db = new DB(AppParams.connectionstring);
|
|
|
|
db.clear_parameter();
|
|
db.add_parameter("@fnkt", "2");
|
|
db.Get_Tabledata("ondoc_qdf_parameters", true, false);
|
|
sfDataGrid1.DataSource = db.dsdaten.Tables[0];
|
|
int i = 0;
|
|
if (posds)
|
|
{
|
|
foreach (System.Data.DataRow dr in db.dsdaten.Tables[0].Rows)
|
|
{
|
|
|
|
if (dr["id"].ToString() == id.ToString())
|
|
{
|
|
this.sfDataGrid1.SelectedIndex = i;
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
db = null;
|
|
}
|
|
private void excel_export()
|
|
{
|
|
ExcelExportingOptions eo = new ExcelExportingOptions();
|
|
var excelEngine = sfDataGrid1.ExportToExcel(sfDataGrid1.View, eo);
|
|
|
|
var workBook = excelEngine.Excel.Workbooks[0];
|
|
|
|
IWorksheet sheet = workBook.Worksheets[0];
|
|
|
|
sheet.InsertColumn(1, 1, ExcelInsertOptions.FormatDefault);
|
|
var rowcount = this.sfDataGrid1.RowCount;
|
|
|
|
for (int i = 1; i < rowcount; i++)
|
|
{
|
|
sheet.Range["A" + (i + 1).ToString()].Number = (i - 1);
|
|
}
|
|
|
|
SaveFileDialog saveFilterDialog = new SaveFileDialog
|
|
{
|
|
FilterIndex = 2,
|
|
Filter = "Excel 97 to 2003 Files(*.xls)|*.xls|Excel 2007 to 2010 Files(*.xlsx)|*.xlsx|Excel 2013 File(*.xlsx)|*.xlsx",
|
|
FileName = ""
|
|
};
|
|
|
|
if (saveFilterDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
{
|
|
using (Stream stream = saveFilterDialog.OpenFile())
|
|
{
|
|
if (saveFilterDialog.FilterIndex == 1)
|
|
workBook.Version = ExcelVersion.Excel97to2003;
|
|
else if (saveFilterDialog.FilterIndex == 2)
|
|
workBook.Version = ExcelVersion.Excel2016;
|
|
else
|
|
workBook.Version = ExcelVersion.Excel2013;
|
|
workBook.SaveAs(stream);
|
|
}
|
|
|
|
System.Diagnostics.Process.Start(saveFilterDialog.FileName);
|
|
|
|
}
|
|
}
|
|
|
|
private void toolStripButton1_Click(object sender, EventArgs e)
|
|
{
|
|
excel_export();
|
|
}
|
|
|
|
string bemerkung = "";
|
|
string id = "";
|
|
private void sfDataGrid1_CellClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
var rowIndex = e.DataRow.RowIndex;
|
|
//Get the column index value
|
|
var columnIndex = e.DataColumn.ColumnIndex;
|
|
var selectedItem = e.DataRow;
|
|
var dataRow = (e.DataRow.RowData as DataRowView).Row;
|
|
id = dataRow["id"].ToString();
|
|
bemerkung = dataRow["Bemerkung"].ToString();
|
|
}
|
|
catch { }
|
|
|
|
}
|
|
|
|
private void bemerkungErfassenToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
InputDialog dlg = new InputDialog("Bemerkung", "Bemerkung", bemerkung);
|
|
dlg.ShowDialog();
|
|
if (dlg.DialogResult == DialogResult.OK)
|
|
{
|
|
DB db = new DB(AppParams.connectionstring);
|
|
string sql = "Update OnDoc_Protokoll_MDGKapitalleistung set bemerkung='" + dlg.result + "', mutiert_am=getdate(),mutierer=" + AppParams.CurrentMitarbeiter.ToString() + " where id=" + id.ToString(); ;
|
|
db.Exec_SQL(sql);
|
|
db = null;
|
|
Refresh_data(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|