private void button2_Click(object sender, EventArgs e)
 {
     if (Login.login_type == "user")
     {
         ORMDataContext     a1 = new ORMDataContext();
         Verification_table v1 = new Verification_table();
         v1.Hostel_name   = comboBox1.SelectedItem.ToString();
         v1.Login_name    = Login.login_name;
         v1.Verifi_status = "pending";
         MessageBox.Show("Applied successfully");
     }
     else if (Login.login_type == "admin")
     {
         ORMDataContext     a1 = new ORMDataContext();
         Verification_table v1 = new Verification_table();
         v1.Hostel_name   = comboBox1.SelectedItem.ToString();
         v1.Login_name    = Login.login_name;
         v1.Verifi_status = "Approved";
         MessageBox.Show("Room booked");
     }
     else
     {
         MessageBox.Show("You need to login first");
     }
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ORMDataContext db    = new ORMDataContext();
            var            query = from User_info in db.User_infos
                                   where User_info.First_name == textBox1.Text && User_info.Password == textBox2.Text && User_info.Account_type == "user"
                                   select User_info;
            var query1 = from User_info in db.User_infos
                         where User_info.First_name == textBox1.Text && User_info.Password == textBox2.Text && User_info.Account_type == "admin"
                         select User_info;

            if (query.Any())
            {
                this.Hide();
                Account_normal_page a1 = new Account_normal_page();
                login_name = textBox1.Text;
                login_type = "user";
                a1.Show();
            }
            else if (query1.Any())
            {
                this.Hide();
                Admin_panel a1 = new Admin_panel();
                login_name = textBox1.Text;
                login_type = "admin";
                a1.Show();
            }
            else
            {
                label4.Visible = true;
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            ORMDataContext db = new ORMDataContext();
            User_info      u1 = new User_info();

            if (textBox1.ReadOnly == false)
            {
                u1.First_name   = textBox1.Text;
                u1.Last_name    = textBox2.Text;
                u1.E_mail       = textBox4.Text;
                u1.Password     = textBox3.Text;
                u1.DOB          = textBox5.Text;
                u1.Account_type = "user";
                db.User_infos.InsertOnSubmit(u1);
                db.SubmitChanges();
                MessageBox.Show("Data inserted successfully");
            }
            else
            {
                User_info u2 = db.User_infos.SingleOrDefault();
                u2.First_name = textBox1.Text;
                u2.Last_name  = textBox2.Text;
                u2.E_mail     = textBox3.Text;
                u2.Password   = textBox4.Text;
                u2.DOB        = textBox5.Text;
                db.SubmitChanges();
                MessageBox.Show("Record updated");
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            ORMDataContext o1 = new ORMDataContext();
            Control        c1 = new Control();

            c1.ShowDialog();
            LoadData();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            ORMDataContext a1     = new ORMDataContext();
            var            query1 = from Cost_info in a1.Cost_infos
                                    where Cost_info.name == comboBox1.SelectedItem.ToString()
                                    select Cost_info;

            dataGridView1.DataSource = query1;
        }
        private void Account_normal_page_Load(object sender, EventArgs e)
        {
            ORMDataContext o1 = new ORMDataContext();
            User_info      u1 = new User_info();

            label2.Text = Login.login_name;
            label6.Text = Login.login_name;
            var query = (from User_info in o1.User_infos
                         where User_info.First_name == Login.login_name
                         select User_info.E_mail).Single();

            label7.Text = query.ToString();
            var query1 = (from User_info in o1.User_infos
                          where User_info.First_name == Login.login_name
                          select User_info.DOB).Single();

            label8.Text = query1.ToString();
        }
        private void Hostel_select_Load(object sender, EventArgs e)
        {
            ORMDataContext a1    = new ORMDataContext();
            Hostel_find    h1    = new Hostel_find();
            var            query = from Hostel_find in a1.Hostel_finds
                                   where Hostel_find.A_name == sel
                                   select Hostel_find.H_name;

            comboBox1.ValueMember   = "H_name";
            comboBox1.DisplayMember = "H_name";
            comboBox1.DataSource    = query;

            var query1 = from Cost_info in a1.Cost_infos
                         where Cost_info.name == comboBox1.SelectedItem.ToString()
                         select Cost_info;

            dataGridView1.DataSource = query1;
        }
Ejemplo n.º 8
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == null || textBox2.Text == null || textBox3.Text == null || textBox4.Text == null || textBox5.Text == null)
     {
         MessageBox.Show("Please fill up the form properly");
     }
     else if (textBox4.Text.Equals(textBox5.Text))
     {
         ORMDataContext db = new ORMDataContext();
         User_info      u1 = new User_info();
         u1.First_name = textBox1.Text;
         u1.Last_name  = textBox2.Text;
         u1.E_mail     = textBox3.Text;
         u1.Password   = textBox5.Text;
         u1.DOB        = dateTimePicker1.Text;
         db.User_infos.InsertOnSubmit(u1);
         db.SubmitChanges();
         MessageBox.Show("Account created successfully");
     }
     else
     {
         MessageBox.Show("Password mismatch");
     }
 }
        private void LoadData()
        {
            ORMDataContext o1 = new ORMDataContext();

            dataGridView1.DataSource = o1.User_infos;
        }