private bool IsValidForCalculations() { GuardianInfoDB parentDB = new GuardianInfoDB(); ChildInfoDatabase childDB = new ChildInfoDatabase(); if (!parentDB.GuardianNameExists(txt_GuardianName.Text)) { return(false); } if (!childDB.ChildNameExists(txt_ChildName.Text)) { return(false); } if (cmb_EventName.SelectedIndex < 0) { return(false); } if (!ValidTime(txt_CheckIn.Text)) { return(false); } if (!ValidTime(txt_CheckOut.Text)) { return(false); } if (!ValidDate(txt_Date.Text)) { return(false); } return(true); }
private void ReadyTransaction(object sender, RoutedEventArgs e) { TransactionDB transDB = new TransactionDB(); ConnectionsDB conDB = new ConnectionsDB(); ChildInfoDatabase childDB = new ChildInfoDatabase(); GuardianInfoDB parentDB = new GuardianInfoDB(); if (parentDB.GuardianNameExists(txt_GuardianName.Text) && childDB.ChildNameExists(txt_ChildName.Text)) { SetAllowanceID(); this.transaction = new TransactionCharge(conDB.GetGuardianID(allowanceID), allowanceID); CalculateTransaction(sender, e); } }
private bool VerifyFormData() { GuardianInfoDB parentDB = new GuardianInfoDB(); ChildInfoDatabase childDB = new ChildInfoDatabase(); EventDB eventDB = new EventDB(); if (!parentDB.GuardianNameExists(txt_GuardianName.Text)) { WPFMessageBox.Show("The guardian name you entered does not exist in the database! Please verify you have spelled it correctly."); txt_GuardianName.Focus(); return(false); } if (!childDB.ChildNameExists(txt_ChildName.Text)) { WPFMessageBox.Show("The child name you entered does not exist in the database! Please verify you have spelled it correctly."); txt_ChildName.Focus(); return(false); } if (cmb_EventName.SelectedIndex < 0) { WPFMessageBox.Show("You must select an event from the drop down menu!"); cmb_EventName.Focus(); return(false); } if (!ValidTime(txt_CheckIn.Text)) { WPFMessageBox.Show("You must enter a valid time in the checked in text box!"); txt_CheckIn.Focus(); return(false); } if (!ValidTime(txt_CheckOut.Text)) { WPFMessageBox.Show("You must enter a valid time in the checked out text box!"); txt_CheckOut.Focus(); return(false); } if (!ValidDate(txt_Date.Text)) { WPFMessageBox.Show("You must enter a valid date in the transaction date text box!"); txt_Date.Focus(); return(false); } if (!ValidTransactionTotal(txt_TransactionTotal.Text)) { WPFMessageBox.Show("You must enter a valid transaction total in the transaction total text box!"); txt_TransactionTotal.Focus(); return(false); } return(true); }