update 20250730
This commit is contained in:
@@ -12,6 +12,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Syncfusion.Windows.Forms.Tools;
|
||||
using Syncfusion.WinForms.Controls;
|
||||
using Syncfusion.WinForms.DataGrid.Enums;
|
||||
|
||||
|
||||
namespace OnDoc.UIControls.Administrator
|
||||
@@ -20,6 +21,7 @@ namespace OnDoc.UIControls.Administrator
|
||||
{
|
||||
|
||||
public string TableName { get; set; } = "";
|
||||
public string SQL { get; set; } = "";
|
||||
Database.DB db = new Database.DB(AppParams.connectionstring);
|
||||
|
||||
|
||||
@@ -32,7 +34,7 @@ namespace OnDoc.UIControls.Administrator
|
||||
this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity;
|
||||
}
|
||||
|
||||
public TableEditor(string tablename)
|
||||
public TableEditor(string tablename, bool allowdelete)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Style.TitleBar.BackColor = Theaming.Titelbar();
|
||||
@@ -41,6 +43,7 @@ namespace OnDoc.UIControls.Administrator
|
||||
this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity;
|
||||
TableName = tablename;
|
||||
this.Text = tablename;
|
||||
this.sfDataGrid1.AllowDeleting = allowdelete;
|
||||
}
|
||||
private void TableEditor_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -49,12 +52,23 @@ namespace OnDoc.UIControls.Administrator
|
||||
|
||||
private void update_data()
|
||||
{
|
||||
db.Get_Tabledata_for_Update("Select * from "+ TableName,false,true);
|
||||
if (this.SQL != "")
|
||||
{
|
||||
db.Get_Tabledata_for_Update(SQL, false, true);
|
||||
this.toolStripButton2.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
db.Get_Tabledata_for_Update("Select * from " + TableName, false, true);
|
||||
this.toolStripButton2.Enabled = true;
|
||||
}
|
||||
|
||||
sfDataGrid1.DataSource = db.daten.Tables[0];
|
||||
}
|
||||
|
||||
private void toolStripButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
db.Update_Data();
|
||||
ToastMessage.ShowToast("Speichern", "Daten erfolgreich gespeichert");
|
||||
|
||||
@@ -76,5 +90,20 @@ namespace OnDoc.UIControls.Administrator
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void editmode(bool allow)
|
||||
{
|
||||
sfDataGrid1.AllowEditing = allow;
|
||||
}
|
||||
|
||||
public void deletemode(bool allow)
|
||||
{
|
||||
sfDataGrid1.AllowDeleting = allow;
|
||||
}
|
||||
|
||||
public void addmode(bool allow)
|
||||
{
|
||||
if (!allow) { sfDataGrid1.AddNewRowPosition = RowPosition.None; } else { sfDataGrid1.AddNewRowPosition = RowPosition.Top; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user