public DepartmentModel FindDepartment(int iddepartment)
        {
            for (int i = 0; i < listDepartments.Count; i++)
            {
                if (listDepartments[i].idDepartment == iddepartment)
                {
                    return(listDepartments[i]);
                }
            }
            DepartmentModel department = new DepartmentModel();

            return(department);
        }
Exemple #2
0
        public void EditStaffInfo(int id, string name, DateTime birthday, GenderType gender, int idDepartment, string CMND, int salary)
        {
            StaffModel      staff      = FindStaff(id);
            DepartmentModel department = departmentcontrol.FindDepartment(idDepartment);
            int             index      = listStaff.IndexOf(staff);

            listStaff[index].nameStaff  = name;
            listStaff[index].birthday   = birthday;
            listStaff[index].gender     = gender;
            listStaff[index].department = department;
            listStaff[index].CMND       = CMND;
            listStaff[index].salary     = salary;
            IOMethod.Instance.EditData <StaffModel>(path, listStaff);
        }
        public void CreateDepartment(string namedepartment, int numberstaff /*, int idmanager*/)
        {
            if (listDepartments.Count == 0)
            {
                DepartmentModel.ID = 0;
            }
            else
            {
                DepartmentModel.ID = listDepartments[listDepartments.Count - 1].idDepartment;
            }
            DepartmentModel department = new DepartmentModel(namedepartment, numberstaff /*, staffcontrol.FindStaff(idmanager)*/);

            IOMethod.Instance.WriteData <DepartmentModel>(path, department);
            listDepartments.Add(department);
        }
 public void PrintDepartment(DepartmentModel department)
 {
     Console.WriteLine("\nMã bộ phận:\t" + department.idDepartment + "\nBộ phận:\t" + department.nameDepartment /*+ "\nMã trưởng phòng:\t" + department.manager.idNumber*/ + "\nSố lượng thành viên:\t" + department.numberStaff);
 }
 public StaffModel()
 {
     this.gender     = GenderType.Khong;
     this.department = default(DepartmentModel);
 }