private void button14_Click(object sender, EventArgs e) { var condition1 = fname; if (condition1.Text != "") { var customer_data = new Customer(); customer_data.First_Name = fname.Text; customer_data.Last_Name = lname.Text; hardware_d.Customers.Add(customer_data); hardware_d.SaveChanges(); loadcus(); } else { MessageBox.Show("Customer Field cannot be empty!"); } }
private void btncus_add_Click(object sender, EventArgs e) { if (fname.Text != "") { var customer_data = new Customer(); customer_data.First_Name = fname.Text; customer_data.Last_Name = lname.Text; customer_data.Telephone = tel.Text; hardware_d.Customers.Add(customer_data); hardware_d.SaveChanges(); dataGridView1.Refresh(); } else { MessageBox.Show("Customer Field cannot be empty!"); } dataGridView1.Refresh(); }
private void button1_Click(object sender, EventArgs e) { if (fname_txt.Text != null && lname_txt.Text != null && pass_txt.Text != null && user_stat.SelectedItem != null) { var employees = new Employee(); employees.First_Name = fname_txt.Text; employees.Last_Name = lname_txt.Text; employees.password = pass_txt.Text; var userstats_ = user_stat.SelectedItem.ToString(); employees.Active = userstats_; hardware_d.Employees.Add(employees); hardware_d.SaveChanges(); MessageBox.Show("Data Successfully Submitted!"); } else { MessageBox.Show("Please enter all data requested by the form!"); } }