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

namespace DabirKhane
{
   
    public partial class list : Form
    {
        public string jadval;
        
        public void command()
        {
            if (radioButton1.Checked == true)
                Variables.GozareshComand  = string.Format("select * from {0} where shandikatori between '{1}' and '{2}'", Variables.TableName , textBox1.Text, textBox2.Text);
            if (radioButton2.Checked == true)
                Variables.GozareshComand = string.Format("select * from {0} where shvarede between '{1}' and '{2}'", Variables.TableName, textBox3.Text, textBox4.Text);
            if (radioButton3.Checked == true)
                Variables.GozareshComand = string.Format("select * from {0} where tarikh between '{1}' and '{2}'", Variables.TableName, textBox5.Text, textBox6.Text);
            if (radioButton4.Checked == true)
                Variables.GozareshComand = string.Format("select * from {0} where mozoh='{1}'", Variables.TableName, textBox7.Text);
            if (radioButton5.Checked == true)
                Variables.GozareshComand = string.Format("select * from {0} where gmozohi='{1}'", Variables.TableName, textBox8.Text);
            
        }
        public list()
        {
            InitializeComponent();
        }

       

        private void button2_Click_1(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
                case 0:
                    {
                        Variables.TableName = "ersali";
                        Variables.REPbool = true;
                        break;
                    }
                case 1:
                    {
                        Variables.TableName = "daryafti";
                        Variables.REPbool = false;
                        break;
                    }
            }
            command();
                       
            chap listchap = new chap();
            listchap.ShowDialog();

        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox6.Text = "";
            textBox7.Text = "";
            textBox8.Text = "";
        }

        private void groupBox2_Enter(object sender, EventArgs e)
        {

        }

        private void list_Load(object sender, EventArgs e)
        {

        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox5.Text = "";
            textBox6.Text = "";
            textBox7.Text = "";
            textBox8.Text = "";
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            textBox3.Text = "";
            textBox4.Text = "";
            textBox1.Text = "";
            textBox2.Text = "";
            textBox7.Text = "";
            textBox8.Text = "";
        }

        private void radioButton4_CheckedChanged(object sender, EventArgs e)
        {
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox6.Text = "";
            textBox1.Text = "";
            textBox2.Text = "";
            textBox8.Text = "";
        }

        private void radioButton5_CheckedChanged(object sender, EventArgs e)
        {
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox6.Text = "";
            textBox1.Text = "";
            textBox2.Text = "";
            textBox7.Text = "";
        }
    }
}