Exemplo n.º 1
0
 public void Delete(Employee data)
 {
     EmployeeDAO.Delete(data);
 }
Exemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FormToModel();
            EmployeeEventArgs eventArgs = new EmployeeEventArgs();

            EmployeeInfo employeeInfo = new EmployeeInfo();

            Employee employee = new Employee();
            employee.Department = SalePointController.DepartmentModel;
            //employee.DepartmentId = SalePointController.DepartmentModel.DepartmentId;
            employee.EmployeeInfo = employeeInfo;

            employeeInfo.Employee = employee;
            //employeeInfo.DepartmentId = (int)SalePointController.DepartmentModel.DepartmentId;

            EmployeePK employeePK = new EmployeePK();
            employeePK.DepartmentId = SalePointController.DepartmentModel.DepartmentId;
            employeeInfo.EmployeePK = employeePK;
            employee.EmployeePK = employeePK;

            eventArgs.EmployeeInfo = employeeInfo;
            eventArgs.SelectedEmployee = -1;
            this.Enabled = false;

            EventUtility.fireEvent(AddEmployeeEvent,this,eventArgs);
            if(eventArgs.AddedEmployee!=null)
            {
                bdsEmployeeSource.Add(eventArgs.AddedEmployee);
                bdsEmployeeSource.EndEdit();
                dgvEmployees.Refresh();
                dgvEmployees.Invalidate();
            }
            this.Enabled = true;
            employeeController.EmployeeInfoModel = null;
        }
Exemplo n.º 3
0
 public Employee Add(Employee data)
 {
     EmployeeDAO.Add(data);
     return data;
 }
Exemplo n.º 4
0
 public void Update(Employee data)
 {
     EmployeeDAO.Update(data);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Delete Employee from database.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public void Delete(Employee data)
 {
     HibernateTemplate.Delete(data);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Add Employee to database.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public Employee Add(Employee data)
 {
     HibernateTemplate.Save(data);
     return data;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Update Employee to database.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public void Update(Employee data)
 {
     HibernateTemplate.Execute(
         delegate(ISession session)
         {
             session.Replicate(data, ReplicationMode.Overwrite);
             return data;
         }
         );
     //HibernateTemplate.Update(data);
 }