private void lst_Guardians_IndexChange(object sender, System.EventArgs e) { if (dta_GuardianList.SelectedItem == null) { return; } GuardianInfoDB parentDB = new GuardianInfoDB(); String guardianInfo = ""; for (int i = 0; i < dta_GuardianList.SelectedItems.Count; i++) { System.Data.DataRowView selectedFile = (System.Data.DataRowView)dta_GuardianList.SelectedItems[i]; guardianInfo = Convert.ToString(selectedFile.Row.ItemArray[2]); } this.guardianID = guardianInfo; string imageLink = parentDB.GetGuardianImagePath(this.guardianID); if (imageLink != null && File.Exists(imageLink)) { ImageBrush ib = new ImageBrush(); ib.ImageSource = new BitmapImage(new Uri(imageLink, UriKind.Relative)); cnv_GuardianPic.Background = ib; cnv_GuardianPic.Visibility = System.Windows.Visibility.Visible; } else { ImageBrush ib = new ImageBrush(); ib.ImageSource = new BitmapImage(new Uri(@"" + "C:/Users/Public/Documents" + "/Childcare Application/Pictures/default.jpg", UriKind.Relative)); cnv_GuardianPic.Background = ib; } }
private void SubmitID() { GuardianInfoDB parentDB = new GuardianInfoDB(); if (string.IsNullOrWhiteSpace(this.txt_IDEntry.Text)) { WPFMessageBox.Show("Please enter the parents ID number."); } else { string ID = txt_IDEntry.Text; if (parentDB.GuardianNotDeletedAndExists(ID)) { if (editParent) { DisplayAdminEditParentWindow(ID); } else { DisplayAdminEditChildInfo(ID); } } else { WPFMessageBox.Show("User ID or PIN does not exist"); txt_IDEntry.Focus(); } } }
public void SetUpParentDisplay() { GuardianInfoDB parentDB = new GuardianInfoDB(); string[] parentInfo = parentDB.GetParentInfo(this.guardianID); string imageLink = parentDB.GetGuardianImagePath(this.guardianID); if (parentInfo != null) { lbl_ParentName.Content = parentInfo[2] + " " + parentInfo[3]; if (imageLink != null && File.Exists(imageLink)) { ImageBrush ib = new ImageBrush(); ib.ImageSource = new BitmapImage(new Uri(imageLink, UriKind.Relative)); cnv_GuardianPic.Background = ib; } else { ImageBrush ib = new ImageBrush(); ib.ImageSource = new BitmapImage(new Uri(@"" + "C:/Users/Public/Documents" + "/Childcare Application/Pictures/default.jpg", UriKind.Relative)); cnv_GuardianPic.Background = ib; } } else { ExitToLogin(); } }
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); }
//Loads the information for the parent on to the side of the window private void LoadParentData() { GuardianInfoDB parentInfo = new GuardianInfoDB(); if (File.Exists(parentInfo.GetPhotoPath(txt_GuardianID.Text))) { cnv_ParentIcon.Background = new ImageBrush(new BitmapImage(new Uri(parentInfo.GetPhotoPath(txt_GuardianID.Text), UriKind.Relative))); } else { cnv_ParentIcon.Background = new ImageBrush(new BitmapImage(new Uri(@"" + "C:/Users/Public/Documents" + "/Childcare Application/Pictures/default.jpg", UriKind.Relative))); } lbl_Name.Content = parentInfo.GetParentName(txt_GuardianID.Text); lbl_Address1.Content = parentInfo.GetAddress1(txt_GuardianID.Text); lbl_Address2.Content = parentInfo.GetAddress2(txt_GuardianID.Text); lbl_Address3.Content = parentInfo.GetAddress3(txt_GuardianID.Text); lbl_Phone.Content = parentInfo.GetPhoneNumber(txt_GuardianID.Text); UpdateRegularDue(txt_GuardianID.Text); UpdateCampDue(txt_GuardianID.Text); // Come back here UpdateMiscDue(txt_GuardianID.Text); UpdateTotalDue(txt_GuardianID.Text); }
public NewParentLogin() { InitializeComponent(); this.db = new GuardianInfoDB(); this.MouseDown += WindowMouseDown; txt_ParentID1.Focus(); }
public void UpdateRegularDue(String parentID) { GuardianInfoDB parentInfo = new GuardianInfoDB(); lbl_RegularDueValue.Content = parentInfo.GetCurrentDue(txt_GuardianID.Text, "Regular"); string total = parentInfo.GetTotalDue(parentID); }
public AdminChangeGuardianPIN(string pID) { InitializeComponent(); this.db = new GuardianInfoDB(); this.MouseDown += WindowMouseDown; txt_ParentID1.Text = pID; psw_ParentPIN1.Focus(); }
public AdminEditParentInfo(string parentID) { InitializeComponent(); AddStates(); this.db = new GuardianInfoDB(); btn_Delete.Background = new SolidColorBrush(Colors.Red); LoadParentInfo(parentID); this.MouseDown += WindowMouseDown; }
private void btn_CurrentMonthReport_Click(object sender, RoutedEventArgs e) { GuardianInfoDB parentInfo = new GuardianInfoDB(); String fromDate, toDate; Settings settings = new Settings(); int fromMonth, fromYear, fromDay, toMonth, toYear, toDay; if (txt_GuardianID.Text.Length == 6 && parentInfo.GuardianIDExists(txt_GuardianID.Text)) { fromDay = Convert.ToInt32(settings.BillingStartDate); toDay = fromDay - 1; if (DateTime.Now.Day < 20) //previous month and this month { if (DateTime.Now.Month != 1) { fromYear = DateTime.Now.Year; fromMonth = DateTime.Now.Month - 1; } else { fromYear = DateTime.Now.Year - 1; fromMonth = 12; } toYear = DateTime.Now.Year; toMonth = DateTime.Now.Month; } else //this month and next month { fromYear = DateTime.Now.Year; fromMonth = DateTime.Now.Month; if (DateTime.Now.Month != 12) { toYear = DateTime.Now.Year; toMonth = DateTime.Now.Month + 1; } else { toYear = DateTime.Now.Year + 1; toMonth = 1; } } fromDate = BuildDateString(fromYear, fromMonth, fromDay); toDate = BuildDateString(toYear, toMonth, toDay); LoadReport(fromDate, toDate); LoadParentData(); } else { WPFMessageBox.Show("The Parent ID you entered does not exist in the database. Please verify it is correct."); txt_GuardianID.Focus(); } }
private void btn_Enter_Click(object sender, RoutedEventArgs e) { ConnectionsDB conDB = new ConnectionsDB(); GuardianInfoDB gdb = new GuardianInfoDB(); string fID = "", pID = ""; bool formNotComplete = CheckIfNull(); if (!formNotComplete)//form is completed { bool sameID = CheckIfSame(txt_GuardianID.Text, txt_GuardianID2.Text); bool regexID = RegExpressions.RegexID(txt_GuardianID.Text); if (sameID && regexID)//both IDand PIN are the same vlues { pID = txt_GuardianID.Text; MakeFamilyID(pID); if (linked == 0) //link child { int connID = this.db.GetMaxConnectionID(); connID = connID + 1; string connectionID = string.Format("{0:000000}", connID); fID = MakeFamilyID(pID); bool guardianExists = false; guardianExists = gdb.GuardianNotDeletedAndExists(pID); if (guardianExists) { conDB.UpdateAllowedConnections(connectionID, pID, childID, fID); } else { WPFMessageBox.Show("Guardian with ID: " + pID + " does not exist."); } } else if (linked == 1) //delink child { bool connExists = conDB.ConnectionExists(pID, childID); bool guardianExists = gdb.GuardianNotDeletedAndExists(pID); if (connExists && guardianExists) { conDB.DeleteAllowedConnection(childID, pID); } else { WPFMessageBox.Show("No connection to the Guardian with ID: " + pID + " exists or no Guardian with that ID exists."); } } this.Close(); } } }
public void UpdateMiscDue(String parentID) { GuardianInfoDB parentInfo = new GuardianInfoDB(); var price = parentInfo.GetCurrentDue(parentID, "Misc"); lbl_MiscDueValue.Content = price; var row = table.NewRow(); row["Event Type"] = "Total Price: "; row["Total"] = price; table.Rows.Add(row); }
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); }
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 void SubmitPayment(string type) { GuardianInfoDB parentinfo = new GuardianInfoDB(); if (txt_GuardianID.Text.Length == 6 && parentinfo.GuardianIDExists(txt_GuardianID.Text)) { PaymentEntry paymentEntry = new PaymentEntry(txt_GuardianID.Text, this, type); paymentEntry.ShowDialog(); } else { WPFMessageBox.Show("The Parent ID you entered does not exist in the database. Please verify it is correct."); txt_GuardianID.Focus(); } }
private void btn_LoadAll_Click(object sender, RoutedEventArgs e) { GuardianInfoDB parentInfo = new GuardianInfoDB(); if (txt_GuardianID.Text.Length == 6 && parentInfo.GuardianIDExists(txt_GuardianID.Text)) { LoadReport(); LoadParentData(); } else { WPFMessageBox.Show("The Parent ID you entered does not exist in the database. Please verify it is correct."); txt_GuardianID.Focus(); } }
private void DateRangeReport() { GuardianInfoDB parentInfo = new GuardianInfoDB(); String initialFrom = Convert.ToDateTime(dte_fromDate.Text).ToString("dd/MM/yyyy"); String initialTo = Convert.ToDateTime(dte_toDate.Text).ToString("dd/MM/yyyy"); if (initialFrom.Length >= 10 && initialTo.Length >= 10) { initialFrom = initialFrom.Substring(0, 10); initialTo = initialTo.Substring(0, 10); } if (initialFrom.Length == 10 && initialTo.Length == 10) { if (txt_GuardianID.Text.Length == 6 && parentInfo.GuardianIDExists(txt_GuardianID.Text)) { String[] fromParts = initialFrom.Split('/'); String[] toParts = initialTo.Split('/'); if (fromParts.Length == 3 && toParts.Length == 3) { String fromDate = fromParts[2] + "-" + fromParts[1] + "-" + fromParts[0]; String toDate = toParts[2] + "-" + toParts[1] + "-" + toParts[0]; LoadReport(fromDate, toDate); LoadParentData(); } else { WPFMessageBox.Show("You must enter a valid date range!"); dte_fromDate.Focus(); } } else { WPFMessageBox.Show("The Parent ID you entered does not exist in the database. Please verify it is correct."); txt_GuardianID.Focus(); } } else { WPFMessageBox.Show("You must enter a valid date range!"); dte_fromDate.Focus(); } }
private void AddTotalsColumn(DataTable table) { GuardianInfoDB gDB = new GuardianInfoDB(); table.Columns.Add("Current Due", typeof(string)); if (table.Rows.Count > 1) { string id = ""; bool campTotalDisplayed = false; bool regTotalDisplayed = false; for (int i = 0; i < table.Rows.Count; i++) { if (id != table.Rows[i][0].ToString().Remove(5)) { campTotalDisplayed = false; regTotalDisplayed = false; id = table.Rows[i][0].ToString().Remove(5); } if (IsRegular(table.Rows[i][3].ToString())) { if (!regTotalDisplayed) { table.Rows[i][5] = String.Format("{0:0.00}", gDB.GetCurrentDue(table.Rows[i][0].ToString(), "Regular")); regTotalDisplayed = true; } } else if (table.Rows[i][3].ToString().Contains("Camp") || table.Rows[i][3].ToString().Contains("camp")) { if (!campTotalDisplayed) { campTotalDisplayed = true; table.Rows[i][5] = String.Format("{0:0.00}", gDB.GetCurrentDue(table.Rows[i][0].ToString(), "Camp")); } } if (table.Rows[i][5] == "$0.00") { table.Rows[i][5] = ""; } } } }
private void LoadData() { ChildInfoDatabase childDB = new ChildInfoDatabase(); TransactionDB transDB = new TransactionDB(); GuardianInfoDB parentDB = new GuardianInfoDB(); ConnectionsDB conDB = new ConnectionsDB(); this.txt_ChildName.Text = childDB.GetChildName(this.transactionID); this.txt_GuardianName.Text = transDB.GetParentNameFromTrans(this.transactionID); this.originalFee = transDB.GetTransactionTotal(this.transactionID); this.txt_TransactionTotal.Text = String.Format("{0:0.00}", transDB.GetTransactionTotal(this.transactionID)); this.originalEventName = transDB.GetTransEventName(this.transactionID); string eventName = this.originalEventName; LoadEventCMB(eventName); this.txt_CheckIn.Text = transDB.GetTwelveHourTime(this.transactionID, "CheckedIn"); this.txt_CheckOut.Text = transDB.GetTwelveHourTime(this.transactionID, "CheckedOut"); this.txt_Date.Text = transDB.GetTransactionDate(this.transactionID); this.transaction = new TransactionCharge(transDB.GetGuardianIDFromTrans(this.transactionID), conDB.GetAllowanceID(this.transactionID)); }
private void lst_Guardians_IndexChange(object sender, System.EventArgs e) { if (dta_GuardianList.SelectedItem != null) { GuardianInfoDB parentDB = new GuardianInfoDB(); ConnectionsDB conDB = new ConnectionsDB(); String allowanceID = ""; DataRowView selectedFile = (DataRowView)dta_GuardianList.SelectedItem; allowanceID = Convert.ToString(selectedFile.Row.ItemArray[2]); this.guardianID = conDB.GetGuardianID(allowanceID); string imageLink = parentDB.GetGuardianImagePath(this.guardianID); if (imageLink != null) { ImageBrush ib = new ImageBrush(); ib.ImageSource = new BitmapImage(new Uri(imageLink, UriKind.Relative)); cnv_GuardianPic.Background = ib; cnv_GuardianPic.Visibility = System.Windows.Visibility.Visible; } } }
public void Search() { GuardianInfoDB parentDB = new GuardianInfoDB(); CleanDisplay(); if (String.IsNullOrWhiteSpace(txt_SearchBox.Text)) { WPFMessageBox.Show("Please enter a name or ID."); return; } int n; bool isNumeric = int.TryParse(txt_SearchBox.Text, out n); if (isNumeric) { bool validated = parentDB.ValidateGuardianID(txt_SearchBox.Text); if (validated) { ChildLogin ChildLoginWindow = new ChildLogin(txt_SearchBox.Text); ChildLoginWindow.Show(); ChildLoginWindow.WindowState = WindowState.Maximized; this.Close(); } else { WPFMessageBox.Show("No search results found"); } } else { DataTable guardianInfo = parentDB.RetieveGuardiansByLastName(txt_SearchBox.Text); if (guardianInfo == null || guardianInfo.Rows.Count == 0) { WPFMessageBox.Show("No search results found"); return; } dta_GuardianList.ItemsSource = guardianInfo.DefaultView; } }
private void InitializeCurrentBalance() { GuardianInfoDB parentInfoDB = new GuardianInfoDB(); lbl_CurrentBalance.Content += " " + parentInfoDB.GetCurrentDue(guardianID, this.type); }
public void UpdateMiscDue(String parentID) { GuardianInfoDB parentInfo = new GuardianInfoDB(); lbl_MiscDueValue.Content = parentInfo.GetCurrentDue(txt_GuardianID.Text, "Misc"); }
public void UpdateTotalDue(String parentID) { GuardianInfoDB parentInfo = new GuardianInfoDB(); lbl_TotalDueValue.Content = parentInfo.GetTotalDue(parentID); }