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.OleDb;


namespace hotel
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
           
            Class1 c1 = new Class1();
            string sel = "select * from login";
            Boolean flag = false;
            
            if (textBox1.Text != "" || textBox2.Text != "")
            {
                sel += " where ";
                if (textBox1.Text != "")
                {
                    sel += "user='" + textBox1.Text + "'";
                    flag = true;

                }
                if (textBox2.Text != "")
                {
                    if (flag)
                        sel += " and ";
                    sel += "pass='" + textBox2.Text + "'";
                    flag = true;

                }
                DataSet ds = new DataSet();
                ds = c1.select(sel);


                if (ds.Tables["t1"].Rows.Count == 1)
                {
                    Form2 f2 = new Form2();
                    Hide();
                    f2.Show();
                    
                }
                else
                {
                    MessageBox.Show("کاربری با این مشخصات وجود ندارد", "توجه", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    textBox1.Text = "";
                    textBox2.Text = "";
                }

            }
        }

      


        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void button3_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.skinEngine1.SkinFile = Environment.CurrentDirectory + @"\s\" + "a (12).ssk";
            this.skinEngine1.Active = true;
        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
