private static void AddEmploy() { try { Employ newEmploy = new Employ(); //Console.WriteLine("Enter GuestID :"); //newGuest.GuestID = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter Employ Name :"); newEmploy.EmployName = Console.ReadLine(); Console.WriteLine("Enter Department :"); newEmploy.Department = Console.ReadLine(); Console.WriteLine("Enter Salary "); newEmploy.Salary = Convert.ToInt32(Console.ReadLine()); bool employAdded = EmployBL.AddEmployBL(newEmploy); if (employAdded) { Console.WriteLine("Employ Added"); } else { Console.WriteLine("Employ not Added"); } } catch (EmployException ex) { Console.WriteLine(ex.Message); } catch (Exception e) { Console.WriteLine(e.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { Employ newEmploy = new Employ(); newEmploy.EmployName = txtEmpname.Text; newEmploy.Department = txtDepartment.Text; newEmploy.Salary = Convert.ToInt32(txtSalary.Text); bool employAdded = EmployBL.AddEmployBL(newEmploy); if (employAdded) { MessageBox.Show("Employ Record Added..."); } }