using Database;
using KlassenBIB;
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;
namespace SanSystem
{
///
///
///
public partial class frmNewProjekt : Form
{
///
///
///
public frmNewProjekt()
{
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;
Global.Instance.SetProjekt(projekt);
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();
}
}
}
}