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_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 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 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(); } }