using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FarsiMsgBox;

namespace ajans
{
    public partial class form_report : Form
    {
        public form_report()
        {
            InitializeComponent();
        }

        private void form_report_FormClosed(object sender, FormClosedEventArgs e)
        {
            static_variables.form_report_show = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            report Report = new report();
            dgListReport.DataSource = Report.SelectMaxPresent();
            dgListReport.DataMember = "present";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            report Report = new report();
            dgListReport.DataSource = Report.SelectMinPresent();
            dgListReport.DataMember = "present";
        }

        private void button5_Click(object sender, EventArgs e)
        {
            if (txtdvrid.Text == "")
            {
                FarsiMessage.ShowMessageBox("لطفا کد راننده را وارد نمایید", "پیغام", ShowButton.تائید_تنها, MsgIcon.Information_1);
                txtdvrid.Focus();
            }
            else
            {
                report Report = new report();
                dgListReport.DataSource = Report.SelectLastPresent(txtdvrid.Text);
                dgListReport.DataMember = "present";
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            report Report = new report();
            dgListReport.DataSource = Report.SelectMaxRequest();
            dgListReport.DataMember = "request";
        }

        private void button4_Click(object sender, EventArgs e)
        {
            report Report = new report();
            dgListReport.DataSource = Report.SelectMinRequest();
            dgListReport.DataMember = "request";
        }

        private void button10_Click(object sender, EventArgs e)
        {
            if (txtcusid.Text == "")
            {
                FarsiMessage.ShowMessageBox("لطفا کد اشتراک را وارد نمایید", "پیغام", ShowButton.تائید_تنها, MsgIcon.Information_1);
                txtcusid.Focus();
            }
            else
            {
                report Report = new report();
                dgListReport.DataSource = Report.SelectCountRequest(txtcusid.Text);
                dgListReport.DataMember = "request";
            }
        }

        private void button7_Click(object sender, EventArgs e)
        {
            report Report = new report();
            dgListReport.DataSource = Report.SelectMaxService();
            dgListReport.DataMember = "service";
        }

        private void button9_Click(object sender, EventArgs e)
        {
            if (txtAvrage.Text == "")
            {
                FarsiMessage.ShowMessageBox("لطفا تاریخ ماه را طبق نمونه وارد کنید.", "پیغام", ShowButton.تائید_تنها, MsgIcon.Information_1);
                txtAvrage.Focus();
            }
            else
            {
                report Report = new report();
                dgListReport.DataSource = Report.SelectAvrageService(txtAvrage.Text);
                dgListReport.DataMember = "service";
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {

        }

        private void button12_Click(object sender, EventArgs e)
        {

        }

        private void button8_Click(object sender, EventArgs e)
        {
            report Report = new report();
            dgListReport.DataSource = Report.SelectMinService();
            dgListReport.DataMember = "service";
        }

        private void button11_Click(object sender, EventArgs e)
        {
            report Report = new report();
            dgListReport.DataSource = Report.SelectMaxStreet();
            dgListReport.DataMember = "service";
        }

        private void exit_Click(object sender, EventArgs e)
        {
            this.Opacity = 1;
            for (int i = 100; i > 1; i--)
            {
                this.Opacity -= 0.01;
                Application.DoEvents();
            }
            this.Close();
        }
    }
}
