Beispiel #1
0
        private void limited_report_button_Click(object sender, EventArgs e)
        {
            //taking selected dates from the user
            DateTime start = picker_from_form.Value;
            DateTime end   = picker_to_form.Value;

            //clear the panel for new data
            panel1.Controls.Clear();

            //add the interface for the limited report (buttons)

            panel1.Controls.Add(limited_report_button);
            panel1.Controls.Add(From_text_button);
            panel1.Controls.Add(To_text_button);
            panel1.Controls.Add(picker_from_form);
            panel1.Controls.Add(picker_to_form);

            //formating date into dd-mm-yyyy
            picker_from_form.Format       = DateTimePickerFormat.Custom;
            picker_from_form.CustomFormat = "dd-MM-yyyy";
            picker_to_form.Format         = DateTimePickerFormat.Custom;
            picker_to_form.CustomFormat   = "dd-MM-yyyy";

            //check if the dates are correct
            if (end <= DateTime.Today && start < end)
            {
                panel1.Controls.Add(SomerenUI.showLimitedRevenueReport(start, end));
            }
            else
            {
                //saying to a user to try again
                MessageBox.Show("Please, enter the valid dates ('from - to' and max. is 'today')", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }