Beispiel #1
0
        public bool FixDepartments()
        {
            // Wait for the strategy system to get loaded
            if (StrategySystem.Instance == null)
            {
                return(false);
            }

            // Go and find the config class
            FieldInfo configField = typeof(StrategySystem).GetFields(BindingFlags.Instance | BindingFlags.NonPublic).
                                    Where(fi => fi.FieldType == typeof(StrategySystemConfig)).First();
            StrategySystemConfig config = (StrategySystemConfig)configField.GetValue(StrategySystem.Instance);

            DepartmentConfig gene    = null;
            DepartmentConfig wernher = null;

            // Re-order stuff
            if (wernher != null)
            {
                config.Departments.Remove(wernher);
                config.Departments.Insert(0, wernher);
            }
            if (gene != null)
            {
                config.Departments.Remove(gene);
                config.Departments.Insert(0, gene);
            }

            return(true);
        }
Beispiel #2
0
        public void SetObjectDeadline(DepartmentConfig config)
        {
            var res = GetUnitOfWork().DepartmentConfigRepository.Get().Any(a => a.DepartmentId == config.DepartmentId);

            if (res)
            {
                throw new Exception("This Department already set it's deadline.");
            }
            if (config.Id != Guid.Empty)
            {
                config.UpdatedBy   = CreatedBy;
                config.UpdatedDate = DateTime.Now;
                GetUnitOfWork().DepartmentConfigRepository.Update(config);
            }
            else
            {
                config.CreatedBy   = CreatedBy;
                config.CreatedDate = DateTime.Now;
                config.Id          = Guid.NewGuid();
                GetUnitOfWork().DepartmentConfigRepository.Insert(config);
            }

            UpdateEmployeeForObjective(config);
            GetUnitOfWork().Save();
        }
Beispiel #3
0
        private void UpdateEmployeeForAppraisal(DepartmentConfig config)
        {
            var employees =
                GetUnitOfWork()
                .EmployeeRepository.Get()
                .Where(a => a.Section.DeparmentId == config.DepartmentId)
                .ToList();

            foreach (var employee in employees)
            {
                employee.SelfAppraisalDeadline = config.SelfAppraisalDeadline;
                employee.UpdatedBy             = CreatedBy;
                employee.UpdatedDate           = DateTime.Now;
                GetUnitOfWork().EmployeeRepository.Update(employee);
            }
        }
 public IHttpActionResult UpdateAppraisalDeadline([FromBody] DepartmentConfig config)
 {
     try
     {
         if (config == null)
         {
             return(BadRequest(ActionMessage.NullOrEmptyMessage));
         }
         AdminActivities activity = new AdminActivities(new UnitOfWork());
         activity.CreatedBy = User.Identity.GetUserName();
         activity.UpdateAppraisalDeadline(config);
         return(Ok(ActionMessage.SaveMessage));
     }
     catch (Exception EX_NAME)
     {
         return(BadRequest(EX_NAME.Message));
     }
 }
        public bool FixDepartments()
        {
            // Wait for the strategy system to get loaded
            if (StrategySystem.Instance == null)
            {
                return(false);
            }

            // Go and find the config class
            FieldInfo configField = typeof(StrategySystem).GetFields(BindingFlags.Instance | BindingFlags.NonPublic).
                                    Where(fi => fi.FieldType == typeof(StrategySystemConfig)).First();
            StrategySystemConfig config = (StrategySystemConfig)configField.GetValue(StrategySystem.Instance);

            // Find the departments
            DepartmentConfig gene    = null;
            DepartmentConfig wernher = null;

            foreach (DepartmentConfig department in config.Departments)
            {
                // Save Gene and Wernher so we can do a reorg
                if (department.AvatarPrefab.name == "Instructor_Gene")
                {
                    gene = department;
                }
                else if (department.AvatarPrefab.name == "Instructor_Wernher")
                {
                    wernher = department;
                }
            }

            // Re-order stuff
            if (wernher != null)
            {
                config.Departments.Remove(wernher);
                config.Departments.Insert(0, wernher);
            }
            if (gene != null)
            {
                config.Departments.Remove(gene);
                config.Departments.Insert(0, gene);
            }

            return(true);
        }
        public bool FixDepartments()
        {
            // Wait for the strategy system to get loaded
            if (StrategySystem.Instance == null)
            {
                return(false);
            }

            // Find the departments
            DepartmentConfig gene    = null;
            DepartmentConfig wernher = null;

            foreach (DepartmentConfig department in StrategySystem.Instance.SystemConfig.Departments)
            {
                // Save Gene and Wernher so we can do a reorg
                if (department.AvatarPrefab != null)
                {
                    if (department.AvatarPrefab.name == "Instructor_Gene")
                    {
                        gene = department;
                    }
                    else if (department.AvatarPrefab.name == "Instructor_Wernher")
                    {
                        wernher = department;
                    }
                }
            }

            // Re-order stuff
            if (wernher != null)
            {
                StrategySystem.Instance.SystemConfig.Departments.Remove(wernher);
                StrategySystem.Instance.SystemConfig.Departments.Insert(0, wernher);
            }
            if (gene != null)
            {
                StrategySystem.Instance.SystemConfig.Departments.Remove(gene);
                StrategySystem.Instance.SystemConfig.Departments.Insert(0, gene);
            }

            return(true);
        }
Beispiel #7
0
        public void SetAppraisalDeadline(DepartmentConfig configs)
        {
            DepartmentConfig config = GetUnitOfWork().DepartmentConfigRepository.Get()
                                      .Where(d => d.DepartmentId == configs.DepartmentId)
                                      .OrderByDescending(a => a.CreatedDate)
                                      .FirstOrDefault();

            if (config != null)
            {
                config.UpdatedBy             = CreatedBy;
                config.UpdatedDate           = DateTime.Now;
                config.SelfAppraisalDeadline = configs.SelfAppraisalDeadline;
                GetUnitOfWork().DepartmentConfigRepository.Update(config);
                UpdateEmployeeForAppraisal(config);
            }
            else
            {
                throw new Exception("Job objective deadline is not set yet");
            }
            GetUnitOfWork().Save();
        }
Beispiel #8
0
 public void Init(Config config)
 {
     this.config        = config;
     departmentConfig   = config.departmentConfig;
     ucDiets.StringList = departmentConfig.Diets;
 }
 ConfigUpdate(Config config)
 {
     this.config = config;
     depConfig   = config.departmentConfig;
 }