private void button1_Click(object sender, EventArgs e) { MydatabaseDataContext emp = new MydatabaseDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\lenovo\Documents\Visual Studio 2012\Projects\car\car\login.mdf;Integrated Security=True"); Employee_list em = new Employee_list(); em.Name = textBox1.Text; em.Address = richTextBox1.Text; em.Email = textBox2.Text; em.Phone_No_ = int.Parse(textBox3.Text); em.Position = textBox4.Text; em.Password = textBox5.Text; emp.Employee_lists.InsertOnSubmit(em); emp.SubmitChanges(); dataGridView1.DataSource = emp.Employee_lists; }
private void button1_Click(object sender, EventArgs e) { MydatabaseDataContext lg = new MydatabaseDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\lenovo\Documents\Visual Studio 2012\Projects\car\car\login.mdf;Integrated Security=True"); Login l = new Login(); var query = from login in lg.Logins where login.Id == int.Parse(textBox1.Text) && login.Password == textBox2.Text && login.Position == comboBox1.SelectedItem.ToString() select login; Employee_list el = new Employee_list(); var query2 = from Employee_list in lg.Employee_lists where Employee_list.Id == int.Parse(textBox1.Text) && Employee_list.Password == textBox2.Text && Employee_list.Position == comboBox1.SelectedItem.ToString() select Employee_list; if (query.Any()) { if (comboBox1.Text == "Super Admin") { SuperAdmin obj = new SuperAdmin(); this.Hide(); obj.Show(); } else if (comboBox1.Text == "Admin") { AdminPanel obj = new AdminPanel(); //obj.button2.Hide(); this.Hide(); obj.Show(); } } else if (query2.Any()) { SalesReport obj = new SalesReport(); obj.sadminbutton.Hide(); this.Hide(); obj.Show(); } else { MessageBox.Show("Sorry! Your id or password or position is incorrect.Try again"); } }
partial void DeleteEmployee_list(Employee_list instance);
partial void UpdateEmployee_list(Employee_list instance);
partial void InsertEmployee_list(Employee_list instance);