public mainForm() { InitializeComponent(); sendStats(); if (Person.isAdmin()) { departmentLabel.Visible = true; departmentBox.Visible = true; foreach (String d in Departments.getList()) { departmentBox.Items.Add(d); } } query = baseQuery + "FROM pendenz WHERE state = 'open'" + Query.admin() + Query.department(departmentBox.Text) + Query.ending("desc"); nameLabel.Text = $"Name: {Person.getInfo()[1]} {Person.getInfo()[2]} / {Person.getInfo()[0]}\nAbteilung: {Person.getInfo()[4]}\nDatum: {DateTime.Today.ToShortDateString()}"; string[] status = { "open", "done", "cancelled" }; foreach (var s in status) { searchStatusBox.Items.Add(s); } oldTable = db.Select(query); issueDataView.DataSource = oldTable; tabControl_Selected(null, null); isOn = true; setCompany(); setReason(); if (updateAvailable()) { updateButton.Text = "Updates verfügbar!"; updateButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); } threadStarter(); }
private void submitStorno(object sender, EventArgs e) { if (!stornoFieldsComplete()) { MessageBox.Show("Bitte sämtliche Felder ausfüllen.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string department = Person.getInfo()[4]; if (Person.isAdmin() && departmentBox.Text != "") { department = departmentBox.Text; } var amountDouble = Double.Parse(amount.Text); var date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); var query = $"INSERT INTO stats (invoice, credit, company, amount, user, date, reason, department) Values " + $"('{invoice.Text}', '{credit.Text}', '{companyBox.Text}', {amountDouble}, '{Person.getID()}', '{date}', '{reasonBox.Text}', '{department}')"; db.Insert(query); } }