private void btn_CurrentMonthReport_Click(object sender, RoutedEventArgs e) { ParentInfoDB parentInfo = new ParentInfoDB(); String fromDate, toDate; int fromMonth, fromYear, fromDay, toMonth, toYear, toDay; if (txt_ParentID.Text.Length == 6 && parentInfo.GuardianIDExists(txt_ParentID.Text)) { fromDay = 20; toDay = 19; 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; } else { toYear = DateTime.Now.Year + 1; toMonth = 1; } } fromDate = BuildDateString(fromYear, fromMonth, fromDay); toDate = BuildDateString(toYear, toMonth, toDay); BuildQuery(fromDate, toDate); LoadParentData(); } else { MessageBox.Show("The Parent ID you entered does not exist in the database. Please verify it is correct."); txt_ParentID.Focus(); } }
//Loads the information for the parent on to the side of the window private void LoadParentData() { ParentInfoDB parentInfo = new ParentInfoDB(); cnv_ParentIcon.Background = new ImageBrush(new BitmapImage(new Uri(parentInfo.GetPhotoPath(txt_ParentID.Text), UriKind.Relative))); lbl_Name.Content = parentInfo.GetParentName(txt_ParentID.Text); lbl_Address1.Content = parentInfo.GetAddress1(txt_ParentID.Text); lbl_Address2.Content = parentInfo.GetAddress2(txt_ParentID.Text); lbl_Address3.Content = parentInfo.GetAddress3(txt_ParentID.Text); lbl_Phone.Content = parentInfo.GetPhoneNumber(txt_ParentID.Text); UpdateCurDue(txt_ParentID.Text); }
private void btn_MakePayment_Click(object sender, RoutedEventArgs e) { ParentInfoDB parentinfo = new ParentInfoDB(); if (txt_ParentID.Text.Length == 6 && parentinfo.GuardianIDExists(txt_ParentID.Text)) { PaymentEntry paymentEntry = new PaymentEntry(txt_ParentID.Text, this); paymentEntry.Show(); } else { MessageBox.Show("The Parent ID you entered does not exist in the database. Please verify it is correct."); txt_ParentID.Focus(); } }
private void btn_CurrentMonthReport_Click(object sender, RoutedEventArgs e) { ParentInfoDB parentInfo = new ParentInfoDB(); String fromDate, toDate; int fromMonth, fromYear, fromDay, toMonth, toYear, toDay; fromDay = 20; toDay = 19; 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; } else { toYear = DateTime.Now.Year + 1; toMonth = 1; } } fromDate = BuildDateString(fromYear, fromMonth, fromDay); toDate = BuildDateString(toYear, toMonth, toDay); BuildQuery(fromDate, toDate); }
private void DateRangeReport() { ParentInfoDB parentInfo = new ParentInfoDB(); String initialFrom = txt_FromDate.Text; String initialTo = txt_ToDate.Text; 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_ParentID.Text.Length == 6 && parentInfo.GuardianIDExists(txt_ParentID.Text)) { String[] fromParts = initialFrom.Split('/'); String[] toParts = initialTo.Split('/'); String fromDate = fromParts[2] + "-" + fromParts[0] + "-" + fromParts[1]; String toDate = toParts[2] + "-" + toParts[0] + "-" + toParts[1]; BuildQuery(fromDate, toDate); LoadParentData(); } else { MessageBox.Show("The Parent ID you entered does not exist in the database. Please verify it is correct."); txt_ParentID.Focus(); } } else { MessageBox.Show("You must enter a valid date range!"); txt_FromDate.Focus(); } }
public void UpdateCurDue(String parentID) { ParentInfoDB parentInfo = new ParentInfoDB(); lbl_CurrentDueValue.Content = parentInfo.GetCurrentDue(txt_ParentID.Text); }