Userfehler eingaben abgefangen
Beim erstellen von neue Projekte wird auf usereingaben geachtet
This commit is contained in:
7
SanSystem/FrmNewProjekt.Designer.cs
generated
7
SanSystem/FrmNewProjekt.Designer.cs
generated
@@ -62,6 +62,7 @@
|
||||
this.txt_pro_nr.Name = "txt_pro_nr";
|
||||
this.txt_pro_nr.Size = new System.Drawing.Size(250, 26);
|
||||
this.txt_pro_nr.TabIndex = 3;
|
||||
this.txt_pro_nr.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_pro_nr_KeyPress);
|
||||
//
|
||||
// txt_ort
|
||||
//
|
||||
@@ -81,7 +82,7 @@
|
||||
this.btn_save.UseVisualStyleBackColor = true;
|
||||
this.btn_save.Click += new System.EventHandler(this.btn_save_Click);
|
||||
//
|
||||
// FrmNewProjekt
|
||||
// frmNewProjekt
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -91,8 +92,8 @@
|
||||
this.Controls.Add(this.txt_pro_nr);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "FrmNewProjekt";
|
||||
this.Text = "FrmNewProjekt";
|
||||
this.Name = "frmNewProjekt";
|
||||
this.Text = "Neues Projekt hinzufügen";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using KlassenBIB;
|
||||
using Database;
|
||||
using KlassenBIB;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -24,8 +25,18 @@ namespace SanSystem
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private bool project_already_excist(string projektnummer)
|
||||
{
|
||||
return Datenbank.Instance.TeufelDB.Projekte.FindAll(x => x.Nummer.Equals(projektnummer)).Count > 0;
|
||||
}
|
||||
|
||||
private void btn_save_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(project_already_excist(txt_pro_nr.Text))
|
||||
{
|
||||
MessageBox.Show(string.Format("Projekt mit den nummer {0} excistiert bereits. Projekt wird nicht angelegt", txt_pro_nr.Text));
|
||||
return;
|
||||
}
|
||||
Projekt projekt = new Projekt();
|
||||
projekt.Nummer = txt_pro_nr.Text;
|
||||
projekt.Ort = txt_ort.Text;
|
||||
@@ -33,5 +44,15 @@ namespace SanSystem
|
||||
this.Close();
|
||||
//Global.Instance.ChangeProjekt(txt_pro_nr.Text);
|
||||
}
|
||||
|
||||
private void txt_pro_nr_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if(e.KeyChar == '/' || e.KeyChar == '\\')
|
||||
{
|
||||
e.Handled = true;
|
||||
MessageBox.Show("Es sind keine Zeichen wie '/' oder '\\' erlaubt ");
|
||||
txt_pro_nr.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,10 +32,19 @@ namespace SanSystem
|
||||
private void btn_gen_Click(object sender, EventArgs e)
|
||||
{
|
||||
MassenStatistik massenStatistik = null;
|
||||
List<Inspektionsobjekt> objekte;
|
||||
if (inspektionsobjekts == null)
|
||||
massenStatistik = new MassenStatistik(Datenbank.Instance.loadedProjekt.Objekte, dt_targetDatum.Value);
|
||||
objekte = Datenbank.Instance.loadedProjekt.Objekte;
|
||||
else
|
||||
massenStatistik = new MassenStatistik(inspektionsobjekts, dt_targetDatum.Value);
|
||||
objekte = inspektionsobjekts;
|
||||
|
||||
if(objekte.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Es wurde keine Objekte gefunden. Funktion wird abgebrochen");
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
massenStatistik = new MassenStatistik(objekte, dt_targetDatum.Value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,10 @@ namespace SanSystem
|
||||
this.inspektionsobjekts = inspektionsobjekts;
|
||||
targetDatum = datum;
|
||||
|
||||
|
||||
BuildBericht(SearchForWaranties());
|
||||
List<Inspektionsobjekt> objekte = SearchForWaranties();
|
||||
if (objekte.Count < 1)
|
||||
return;
|
||||
BuildBericht(objekte);
|
||||
}
|
||||
static string ConvertToDecimals(double input, uint kommazahl = 2)
|
||||
{
|
||||
@@ -38,6 +40,7 @@ namespace SanSystem
|
||||
|
||||
double gesamtLiner = 0;
|
||||
double gesamtHarz = 0;
|
||||
if (list.Count < 1) return;
|
||||
foreach (Inspektionsobjekt objekt in list)
|
||||
{
|
||||
DataRow dr = inliner.NewRow();
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace SanSystem
|
||||
private async void OnExportedExecuted(string destinationPath)
|
||||
{
|
||||
Task<bool> export = Task.Factory.StartNew(() => BüroExporter.Export(Datenbank.Instance.loadedProjekt, destinationPath));
|
||||
export.ContinueWith(task => MessageBox.Show("Büro export abgeschlossen"));
|
||||
await export.ContinueWith(task => MessageBox.Show("Büro export abgeschlossen"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace UpdateLib
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show("Fehler beim uberprüfen von Updates\nVersuchen Sie später nochmal!\n\nFehlertext: " + e.Message, "Update", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
//MessageBox.Show("Fehler beim uberprüfen von Updates\nVersuchen Sie später nochmal!\n\nFehlertext: " + e.Message, "Update", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user