//See all the information of a selected child about what //he has done throughout the day since he is at school private void btShow_Click(object sender, EventArgs e) { try { if (clbChildren.CheckedItems.Count == 1) { ShowChild sForm = new ShowChild(clbChildren.SelectedIndex, listChildren, listMeals, language); sForm.Show(); } else if (clbChildren.CheckedItems.Count == 0) { WarningNotSelct warningNot = new WarningNotSelct(language["NotSelc"]); warningNot.Show(); } else { WarningSelectOnlyOne warningOnyl = new WarningSelectOnlyOne(language["Only1Ch"]); warningOnyl.Show(); } } catch (Exception) { Warning warning = new Warning(language["WFail"]); warning.Show(); } }
//Conditions for edit a child,if the condition is not met, //an alert message will be private void btEdit_Click(object sender, EventArgs e) { try { if (clbChildren.CheckedIndices.Count == 1) { FormEdit fEdit = new FormEdit(clbChildren.SelectedIndex, listChildren, language); fEdit.Show(); } else if (clbChildren.CheckedIndices.Count == 0) { WarningNotSelct warningNot = new WarningNotSelct(language["NotSelec"]); warningNot.Show(); } else { WarningSelectOnlyOne warningOnyl = new WarningSelectOnlyOne(language["Only1Ch"]); warningOnyl.Show(); } } catch (Exception) { Warning warning = new Warning(language["WFail"]); warning.Show(); } }
//Conditions for remove a child,if the condition is not met, //an alert message will be private void btDelete_Click(object sender, EventArgs e) { try { if (clbChildren.CheckedItems.Count > 0) { ErasureConfirmation er = new ErasureConfirmation(language); if (er.ShowDialog() == DialogResult.OK) { RemoveChild rChild = new RemoveChild( clbChildren.SelectedIndex, listChildren); clbChildren.Items.RemoveAt(clbChildren.SelectedIndex); } } else { WarningNotSelct warningNot = new WarningNotSelct(language["NotSelc"]); warningNot.Show(); } } catch (Exception) { Warning warning = new Warning(language["WFail"]); warning.Show(); } }