private void toolStripButton4_Click(object sender, EventArgs e) { if (selectedPersonId == null) { MessageBox.Show("Välj först ett barn från listan nedan.", "Fel"); } else { // Kontroll Boolean control = false; // Hämta in data. var child = dbOject.executeDbQuery("select * from Children where person_id = '" + selectedPersonId + "'"); if (child.Rows.Count > 0) { control = true; } else { string personNr = selectedPersonId.Insert(6, "-"); child = dbOject.executeDbQuery("select * from Children where person_id = '" + personNr + "'"); if (child.Rows.Count > 0) { control = true; } } // Om det finns ett bra visa if (control == true) { DataRow childDr = child.Rows[child.Rows.Count - 1]; // Skapa objekt för klassen funkton functions funcObject = new functions(); MessageBox.Show(childDr["first_name"].ToString() + " " + childDr["last_name"].ToString() + "\nStatus: " + funcObject.translateStatusCode(int.Parse(childDr["status"].ToString())) + "\n\n2 Månader: " + funcObject.getDateByStartDatePlusInterval(childDr["planned_birthday"].ToString(), 61, "yyyy-MM-dd") + "\n5-6 Månader: " + funcObject.getDateByStartDatePlusInterval(childDr["planned_birthday"].ToString(), 183, "yyyy-MM-dd") + "\n10-12 Månader: " + funcObject.getDateByStartDatePlusInterval(childDr["planned_birthday"].ToString(), 365, "yyyy-MM-dd") + "\n18-20 Månader: " + funcObject.getDateByStartDatePlusInterval(childDr["planned_birthday"].ToString(), 610, "yyyy-MM-dd") + "\n2 år: " + funcObject.getDateByStartDatePlusInterval(childDr["planned_birthday"].ToString(), 730, "yyyy-MM-dd") + "\n5 år: " + funcObject.getDateByStartDatePlusInterval(childDr["planned_birthday"].ToString(), 2013, "yyyy-MM-dd"), "Detaljer"); } } }
public Manage(string sqlQueryIn, DataTable dataIn, NeoHomePage homeIn) { InitializeComponent(); homeWindow = homeIn; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ManageForm_FormClosing); // lagra frågan i variabel sqlQuery = sqlQueryIn; if (dataIn != null) { dataFromOtherView = dataIn.Copy(); } // init funktions klassen funcObject = new functions(); // this.Text = "Hantera"; // Fyll i listvyn getDataFromDb(); }