예제 #1
0
 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);
     }
 }
예제 #2
0
 private static void ListAllEmployees()
 {
     try
     {
         List <Employ> employList = EmployBL.GetAllEmployBL();
         if (employList != null)
         {
             Console.WriteLine("******************************************************************************");
             Console.WriteLine("EmployID\t\tName\t\tDepartment\t\tSalary");
             Console.WriteLine("******************************************************************************");
             foreach (Employ employ in employList)
             {
                 Console.WriteLine("{0}\t\t{1}\t\t{2}\t\t{3}", employ.EmployID, employ.EmployName, employ.Department, employ.Salary);
             }
             Console.WriteLine("******************************************************************************");
         }
         else
         {
             Console.WriteLine("No Employ Details Available");
         }
     }
     catch (EmployException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
예제 #3
0
 private static void DeleteEmploy()
 {
     try
     {
         int deleteEmployID;
         Console.WriteLine("Enter EmployID to Delete:");
         deleteEmployID = Convert.ToInt32(Console.ReadLine());
         Employ deleteEmploy = EmployBL.SearchEmployBL(deleteEmployID);
         if (deleteEmploy != null)
         {
             bool guestdeleted = EmployBL.DeleteEmployBL(deleteEmployID);
             if (guestdeleted)
             {
                 Console.WriteLine("Employ Deleted");
             }
             else
             {
                 Console.WriteLine("Employ not Deleted ");
             }
         }
         else
         {
             Console.WriteLine("No Employ Details Available");
         }
     }
     catch (EmployException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
예제 #4
0
 private static void SearchEmployByID()
 {
     try
     {
         int searchEmployID;
         Console.WriteLine("Enter EmployID to Search:");
         searchEmployID = Convert.ToInt32(Console.ReadLine());
         Employ searchEmploy = EmployBL.SearchEmployBL(searchEmployID);
         if (searchEmploy != null)
         {
             Console.WriteLine("******************************************************************************");
             Console.WriteLine("EmployID\t\tName\t\tDepartment\t\tSalary");
             Console.WriteLine("******************************************************************************");
             Console.WriteLine("{0}\t\t{1}\t\t{2}{3}", searchEmploy.EmployID, searchEmploy.EmployName, searchEmploy.Department, searchEmploy.Salary);
             Console.WriteLine("******************************************************************************");
         }
         else
         {
             Console.WriteLine("No Employ Details Available");
         }
     }
     catch (EmployException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
예제 #5
0
        public EmployGrid()
        {
            InitializeComponent();
            DataSet   employList = EmployBL.GetAllEmployBL();
            DataTable dt         = employList.Tables[0];

            grid1.DataContext = dt.DefaultView;
        }
예제 #6
0
        public EmployGrid()
        {
            InitializeComponent();
            List <Employ> employList = EmployBL.GetAllEmployBL();
            DataTable     dt         = ToDataTable(employList);

            grid1.DataContext = dt.DefaultView;
        }
예제 #7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int    searchEmployID = Convert.ToInt32(txtEmpId.Text);
            Employ searchEmploy   = EmployBL.SearchEmployBL(searchEmployID);

            if (searchEmploy != null)
            {
                txtEmpname.Text    = searchEmploy.EmployName;
                txtSalary.Text     = searchEmploy.Salary.ToString();
                txtDepartment.Text = searchEmploy.Department;
            }
        }
예제 #8
0
        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...");
            }
        }
예제 #9
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int    updateEmployID = Convert.ToInt32(txtEmpId.Text);
            Employ updatedEmploy  = EmployBL.SearchEmployBL(updateEmployID);

            if (updatedEmploy != null)
            {
                updatedEmploy.EmployName = txtEmpname.Text;
                updatedEmploy.Department = txtDepartment.Text;
                updatedEmploy.Salary     = Convert.ToInt32(txtSalary.Text);
                bool employUpdated = EmployBL.UpdateEmployBL(updatedEmploy);
                if (employUpdated)
                {
                    MessageBox.Show("Record Updated...");
                }
            }
        }
예제 #10
0
 private static void UpdateEmploy()
 {
     try
     {
         int updateEmployID;
         Console.WriteLine("Enter EmployID to Update Details:");
         updateEmployID = Convert.ToInt32(Console.ReadLine());
         Employ updatedEmploy = EmployBL.SearchEmployBL(updateEmployID);
         if (updatedEmploy != null)
         {
             Console.WriteLine("Update Employ Name :");
             updatedEmploy.EmployName = Console.ReadLine();
             Console.WriteLine("Update Employ Department ");
             updatedEmploy.Department = Console.ReadLine();
             Console.WriteLine("Update Salary :");
             updatedEmploy.Salary = Convert.ToInt32(Console.ReadLine());
             bool employUpdated = EmployBL.UpdateEmployBL(updatedEmploy);
             if (employUpdated)
             {
                 Console.WriteLine("Employ Details Updated");
             }
             else
             {
                 Console.WriteLine("Employ Details not Updated ");
             }
         }
         else
         {
             Console.WriteLine("No Employ Details Available");
         }
     }
     catch (EmployException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }