Beispiel #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     employeeBO.Add(list);
     txtMSNV.Text = employeeBO.AutoGetMSNV();
     list.Clear();
     dataDS.Rows.Clear();
 }
        static void AddEmployee()
        {
            try
            {
                Employee emp = new Employee();
                Console.WriteLine("Enter name");
                emp.Name = Console.ReadLine();

                Console.WriteLine("Enter email");
                emp.Email = Console.ReadLine();

                EmployeeBO BO      = new EmployeeBO();
                bool       IsAdded = BO.Add(emp);
                if (IsAdded)
                {
                    Console.WriteLine("Added successfull");
                }
                else
                {
                    Console.WriteLine("Add failed. Try later");
                }
            }
            catch (EmployeeException ex)
            {
                Console.WriteLine("Validation failed : " + ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.Message);
            }
        }