Es wird versucht eine richtige projektnummer zu errechnen
This commit is contained in:
@@ -39,8 +39,8 @@ namespace SanSystem
|
||||
|| (tmp.VonPunkt == null || tmp.VonPunkt.Equals(""))
|
||||
|| (tmp.Objektbezeichnung == null || tmp.Objektbezeichnung.Equals(""))
|
||||
|| tmp.Kanalrohrweite.Equals(0)
|
||||
) dgvw.DefaultCellStyle.BackColor = Color.Olive;
|
||||
if(tmp.Projektnummer == null) dgvw.DefaultCellStyle.BackColor = Color.Red;
|
||||
) dgvw.DefaultCellStyle.BackColor = Color.Olive;
|
||||
if(tmp.Projektnummer == null || tmp.Projektnummer.Equals("")) dgvw.DefaultCellStyle.BackColor = Color.Red;
|
||||
|
||||
}
|
||||
return true;
|
||||
@@ -70,7 +70,7 @@ namespace SanSystem
|
||||
string fehlermeldung = string.Empty;
|
||||
// Prüfen nach Projektnummern
|
||||
List<string> projektnummern = inspektionsobjekte.Select(x => x.Projektnummer).Distinct().ToList();
|
||||
if (projektnummern.Count > 1) fehlermeldung = string.Format("{0}",Global.Instance.language.Fehlermeldungen["duplicate_projektnumber_in_street"]);
|
||||
if(projektnummern.Count > 1) fehlermeldung = string.Format("{0}", Global.Instance.language.Fehlermeldungen["duplicate_projektnumber_in_street"]);
|
||||
|
||||
// Prüfen nach Ortnamen
|
||||
List<string> ortnamen = inspektionsobjekte.Select(x => x.OrtName).Distinct().ToList();
|
||||
@@ -78,6 +78,31 @@ namespace SanSystem
|
||||
|
||||
if (!fehlermeldung.Equals(string.Empty)) MessageBox.Show(fehlermeldung, "Inhalt Fehler", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
|
||||
if (projektnummern.Count > 1)
|
||||
{
|
||||
Dictionary<string, int> mayProNr = new Dictionary<string, int>();
|
||||
List<int> anzahle = new List<int>();
|
||||
foreach (string _prnr in projektnummern)
|
||||
{
|
||||
int anzahl = inspektionsobjekte.Where(x => x.Projektnummer.Equals(_prnr)).Count();
|
||||
mayProNr.Add(_prnr, anzahl);
|
||||
anzahle.Add(anzahl);
|
||||
}
|
||||
|
||||
int max = anzahle.Max();
|
||||
List<string> empProjNummer = new List<string>();
|
||||
foreach (KeyValuePair<string, int> kvp in mayProNr)
|
||||
{
|
||||
if (kvp.Value.Equals(max)) empProjNummer.Add(kvp.Key);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if (empProjNummer.Count > 1) MessageBox.Show(Global.Instance.language.Fehlermeldungen["suggest_proj_nr_not_found"]);
|
||||
else
|
||||
MessageBox.Show(string.Format("{0}\n{1}", Global.Instance.language.Fehlermeldungen["suggest_proj_nr"], empProjNummer.Last()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
txt_ort.Text = ortnamen.First();
|
||||
|
||||
@@ -125,6 +150,9 @@ namespace SanSystem
|
||||
private void btn_add_Click(object sender, EventArgs e)
|
||||
{
|
||||
Inspektionsobjekt inspektionsobjekt = new Inspektionsobjekt();
|
||||
inspektionsobjekt.Projektnummer = inspektionsobjekte.First().Projektnummer;
|
||||
inspektionsobjekt.OrtName = inspektionsobjekte.First().OrtName;
|
||||
inspektionsobjekt.StrasseName = inspektionsobjekte.First().StrasseName;
|
||||
Datenbank.Instance.loadedProjekt.Objekte.Add(inspektionsobjekt);
|
||||
|
||||
frmObjektEdit frmObjektEdit = new frmObjektEdit(inspektionsobjekt);
|
||||
|
||||
Reference in New Issue
Block a user