Exemplo n.º 1
0
 public static Model.Context.TASK MapTaskDTOToEntity(Model.DTO.Core.Task.Task dto)
 {
     Model.Context.TASK obj_entity = new Context.TASK()
     {
         ID        = dto.Id,
         MODULE_ID = dto.Module.Id,
         RECORD_ID = dto.RecordId,
         STATUS_ID = dto.Status.Id,
         NAME      = dto.Name,
         ADDRESS   = dto.Address
     };
     return(obj_entity);
 }
Exemplo n.º 2
0
        private bool CheckAccess(Model.DTO.Appraisal.Appraisal appraisal, int taskId)
        {
            bool boo_has_access = false;

            Model.DTO.Core.Task.Task obj_task = Model.PMSModel.GetTaskById(taskId);
            if (obj_task != null)
            {
                if (obj_task.RecordId != appraisal.Id)
                {
                    boo_has_access = false;
                }
                else if (!Lib.Utility.Common.IsNullOrEmptyList(obj_task.Owners))
                {
                    var var_owners = obj_task.Owners.Where(rec => rec.EmployeeId == CurrentUser.Id);

                    if (!Lib.Utility.Common.IsNullOrEmptyList(var_owners))
                    {
                        boo_has_access = true;
                    }
                }
            }

            return(boo_has_access);
        }
Exemplo n.º 3
0
        public bool CheckAccessAndSetViewMode(Model.DTO.Appraisal.Appraisal appraisal, int taskId)
        {
            bool boo_has_access = false;

            if (taskId > 0)
            {
                // if current user is owner of task, input mode
                // if current user is not user of task, redirect to stage1/keyperformanceindicator/0/appraisalId

                Model.DTO.Core.Task.Task obj_task = Model.PMSModel.GetTaskById(taskId);

                if (obj_task != null)
                {
                    // check if task id is for appraisal

                    if (obj_task.RecordId != appraisal.Id)
                    {
                        boo_has_access = false;
                    }
                    else if (!Lib.Utility.Common.IsNullOrEmptyList(obj_task.Owners))
                    {
                        var var_owners = obj_task.Owners.Where(rec => rec.EmployeeId == CurrentUser.Id);

                        if (!Lib.Utility.Common.IsNullOrEmptyList(var_owners))
                        {
                            boo_has_access = true;
                            if (obj_task.Status.Id == Model.PMSConstants.STATUS_CORE_ID_OPEN)
                            {
                                boo_view_only = false;
                            }
                            else
                            {
                                boo_view_only = true;
                            }
                        }
                        else
                        {
                            boo_view_only  = true;
                            boo_has_access = CheckAccessRights(appraisal);
                        }
                    }
                    else
                    {
                        boo_view_only  = true;
                        boo_has_access = CheckAccessRights(appraisal);
                    }

                    // if current user is owner of task, and task is incomplete, do nothing
                    // if current user is owner of task and task is completed, got to view mode
                    // if current user is not owner of task, go to view mode
                }
                else
                {
                    boo_view_only  = true;
                    boo_has_access = CheckAccessRights(appraisal);
                }
            }
            else
            {
                boo_view_only  = true;
                boo_has_access = CheckAccessRights(appraisal);
            }

            return(boo_has_access);
        }
Exemplo n.º 4
0
        public static Model.DTO.Core.Task.Task CreateTasksForCycleStageChange(Model.DTO.Appraisal.Appraisal appraisal)
        {
            Model.DTO.Core.Task.Task obj_task = new Model.DTO.Core.Task.Task()
            {
                Module = new Model.DTO.Core.Master.Module() { Id = Model.PMSConstants.MODULE_ID_PMS },
                Status = new Model.DTO.Core.Master.Status() { Id = Model.PMSConstants.STATUS_CORE_ID_OPEN },
                RecordId = appraisal.Id
            };

            if (appraisal.Stage.Id == Model.PMSConstants.STAGE_ID_GOAL_SETTING)
            {
                obj_task.Name = "Submission of performance appraisal.";
                obj_task.Address = "/Stage1/KeyPerformanceIndicators";
            }
            else if (appraisal.Stage.Id == Model.PMSConstants.STAGE_ID_PROGRESS_REVIEW)
            {
                obj_task.Name = "Submission of performance appraisal for progress review.";
                obj_task.Address = "/Stage2/KeyPerformanceIndicators";
            }
            else if (appraisal.Stage.Id == Model.PMSConstants.STAGE_ID_FINAL_YEAR)
            {
                obj_task.Name = "Submission of performance appraisal for final year review.";
                obj_task.Address = "/Stage3/KeyPerformanceIndicators";
            }

            obj_task.AddOwner(Model.Mappers.CoreMapper.MapEmployeeDTOToOwnerDTO(appraisal.Employee));
            return obj_task;
        }
Exemplo n.º 5
0
        public static Model.DTO.Core.Task.Task CreateNewTaskForAppraisal(int appraisalId, int statusId, string name, string address, Model.DTO.Core.Task.Owner owner)
        {
            Model.DTO.Core.Task.Task obj_task = new Model.DTO.Core.Task.Task()
            {
                Module = new Model.DTO.Core.Master.Module() { Id = Model.PMSConstants.MODULE_ID_PMS },
                RecordId = appraisalId,
                Status = new Model.DTO.Core.Master.Status() { Id = statusId },
                Name = name,
                Address = address
            };

            if (owner != null)
            {
                obj_task.AddOwner(owner);
            }
            return obj_task;
        }