Exemple #1
0
        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();
            }
        }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
        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();
            }
        }