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

namespace Publishmentation
{
    public partial class ReportForm : Form
    {
        public ReportForm()
        {
            InitializeComponent();
        }
        FormCollection frm = new FormCollection();
        private void ReportForm_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = dataset;
            comboBox1.SelectedIndex=0;
            frm = Application.OpenForms;
           
        }

        private void ReportForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            frm["Form1"].Enabled = true;
            frm["Form1"].Show();
            frm["Form1"].Focus();
        }
        Connector connetion = new Connector();
        DataSet dataset = new DataSet();
        SqlCommand command = new SqlCommand();
        private void button1_Click(object sender, EventArgs e)
        {
            command.Parameters.Clear();
            dataset.Clear();
            dataGridView1.DataBindings.Clear();
            int receipt;
            receipt = comboBox1.SelectedIndex;
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@var", SqlDbType.Int));
            command.Parameters["@var"].Value = 1;
            command.Parameters.Add(new SqlParameter("@receipt", SqlDbType.Bit));
            command.Parameters["@receipt"].Value = receipt;
            command.CommandText = "report";
            dataset = connetion.storeProcedure3(command);
            command.Parameters["@var"].Value = 2;
            dataset = connetion.storeProcedure3(command);
            command.Parameters["@var"].Value = 3;
            dataset = connetion.storeProcedure3(command);
            dataGridView1.DataBindings.Add("DataSource", dataset, dataset.Tables[0].TableName);
            dataGridView1.Refresh();
        }

        private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }
    }
}