private void textBox1_TextChanged(object sender, EventArgs e) { AirLineDbEntities1 db = new AirLineDbEntities1(); var items = db.Cust_Details.Where(a => a.Name.Equals(textBox1.Text)).ToList(); dataGridView2.DataSource = items; }
private void logbtn_Click(object sender, EventArgs e) { AirLineDbEntities1 db = new AirLineDbEntities1(); if (txtuser.Text != string.Empty && txtpass.Text != string.Empty) { var user = db.Admins.Where(a => a.UserName.Equals(txtuser.Text)).SingleOrDefault(); if (user != null) { if (user.Password.Equals(txtpass.Text)) { MessageBox.Show("Succeed Login"); } else { MessageBox.Show("Wrong Password!"); } } else { MessageBox.Show("Wrong User name"); } } else { MessageBox.Show("Please fill User Name & Password!"); } }
private void Search_Cust_Load(object sender, EventArgs e) { AirLineDbEntities1 db = new AirLineDbEntities1(); var items = db.Cust_Details.ToList(); dataGridView2.DataSource = items; }
public Ticket_Reservation() { InitializeComponent(); db = new AirLineDbEntities1(); BindSource(); BindDestination(); }
private void button3_Click(object sender, EventArgs e) { db = new AirLineDbEntities1(); Cust_Details customer = db.Cust_Details.Where(a => a.Id == id).FirstOrDefault(); customer.Name = nametxt.Text; customer.LastName = lastnametxt.Text; customer.Address = addresstxt.Text; customer.PhoneNumber = phonenumtxt.Text; customer.Email = emailtxt.Text; customer.BirthDate = datebirthtxt.Value; db.SaveChanges(); MessageBox.Show("Record Updated"); }
private void button1_Click(object sender, EventArgs e) { AirLineDbEntities1 db = new AirLineDbEntities1(); Cust_Details customers = new Cust_Details { Name = nametxt.Text, LastName = lastnametxt.Text, Address = addresstxt.Text, PhoneNumber = phonenumtxt.Text, Email = emailtxt.Text, BirthDate = datebirthtxt.Value }; db.Cust_Details.Add(customers); db.SaveChanges(); MessageBox.Show("Add one customer"); }
public Customers(int?Id) { InitializeComponent(); if (Id != null) { button1.Visible = false; db = new AirLineDbEntities1(); Cust_Details customer = db.Cust_Details.Where(a => a.Id == Id).FirstOrDefault(); id = customer.Id; nametxt.Text = customer.Name; lastnametxt.Text = customer.LastName; addresstxt.Text = customer.Address; phonenumtxt.Text = customer.PhoneNumber; emailtxt.Text = customer.Email; datebirthtxt.Value = (DateTime)customer.BirthDate; } else { button3.Visible = false; } }
public Flight_Details() { InitializeComponent(); db = new AirLineDbEntities1(); }