Exemplo n.º 1
0
 public EmployeeShiftViewModel Put(Guid id, [FromBody] EmployeeShiftViewModel employeeShift)
 {
     employeeShift.Id = id;
     return(_employeeShiftService.UpdateViewModel(employeeShift));
 }
Exemplo n.º 2
0
        public EmployeeShift()
        {
            InitializeComponent();
            GridAttendance.Visibility = Visibility.Collapsed;
            _viewModel      = (EmployeeShiftViewModel)LayoutRoot.DataContext;
            DataContext     = _viewModel;
            _viewModel.Code = LoggedUserInfo.Code;
            _viewModel.GetPoisition(LoggedUserInfo.Code);
            _viewModel.GetEmpTransportationLine(LoggedUserInfo.Code);
            _viewModel.PremCompleted += (s, sv) =>
            {
                //if (_viewModel.CustomePermissions.SingleOrDefault(x => x.Code == "DisableManualAttendance") != null)
                //{
                //    DisableManualAttendance = false;
                //}
                //else
                //{
                //  DisableManualAttendance = true;

                //}

                if (_viewModel.CustomePermissions.SingleOrDefault(x => x.Code == "NoDayLimit") != null)
                {
                    _viewModel.NoDayLimit = true;
                }

                if (_viewModel.CustomePermissions.SingleOrDefault(x => x.Code == "NoDayLimitApproval") != null)
                {
                    _viewModel.NoDayLimitApproval = true;
                }

                if (_viewModel.CustomePermissions.SingleOrDefault(x => x.Code == "AttFilePost") != null)
                {
                    AttendanceFileGrid.Columns.SingleOrDefault(x => x.SortMemberPath == "Status").Visibility =
                        Visibility.Visible;
                    _viewModel.AttFileStatusVisibility = Visibility.Visible;
                }
                else
                {
                    AttendanceFileGrid.Columns.SingleOrDefault(x => x.SortMemberPath == "Status").Visibility =
                        Visibility.Collapsed;
                }
                var employeeShiftTabForm =
                    _viewModel.CustomePermissions.SingleOrDefault(x => x.Code == "EmployeeShiftTabForm");

                if (employeeShiftTabForm != null)
                {
                    _viewModel.EmpShiftAllowAdd =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == employeeShiftTabForm.Iserial).AllowNew ?? false;
                    _viewModel.EmpShiftAllowUpdate =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == employeeShiftTabForm.Iserial).AllowUpdate ?? false;
                    _viewModel.EmpShiftAllowDelete =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == employeeShiftTabForm.Iserial).AllowDelete ?? false
                            ? Visibility.Visible
                            : Visibility.Collapsed;
                }
                var vacationTabForm = _viewModel.CustomePermissions.SingleOrDefault(x => x.Code == "VacationTabForm");

                if (vacationTabForm != null)
                {
                    _viewModel.VacationAllowAdd =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == vacationTabForm.Iserial).AllowNew ?? false;
                    _viewModel.VacationAllowUpdate =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == vacationTabForm.Iserial).AllowUpdate ?? false;
                    _viewModel.VacationAllowDelete =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == vacationTabForm.Iserial).AllowDelete ?? false
                            ? Visibility.Visible
                            : Visibility.Collapsed;
                }
                var excuseTabForm = _viewModel.CustomePermissions.SingleOrDefault(x => x.Code == "ExcuseTabForm");

                if (excuseTabForm != null)
                {
                    _viewModel.ExcuseAllowAdd =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == excuseTabForm.Iserial).AllowNew ?? false;
                    _viewModel.ExcuseAllowUpdate =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == excuseTabForm.Iserial).AllowUpdate ?? false;
                    _viewModel.ExcuseAllowDelete =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == excuseTabForm.Iserial).AllowDelete ?? false
                            ? Visibility.Visible
                            : Visibility.Collapsed;
                }
                var missionTabForm = _viewModel.CustomePermissions.SingleOrDefault(x => x.Code == "MissionTabForm");

                if (missionTabForm != null)
                {
                    _viewModel.MissionAllowAdd =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == missionTabForm.Iserial).AllowNew ?? false;
                    _viewModel.MissionAllowUpdate =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == missionTabForm.Iserial).AllowUpdate ?? false;
                    _viewModel.MissionAllowDelete =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == missionTabForm.Iserial).AllowDelete ?? false
                            ? Visibility.Visible
                            : Visibility.Collapsed;
                }
                var attFileTabForm = _viewModel.CustomePermissions.SingleOrDefault(x => x.Code == "AttFileTabForm");

                if (attFileTabForm != null)
                {
                    _viewModel.AttFileAllowAdd =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == attFileTabForm.Iserial).AllowNew ?? false;
                    _viewModel.AttFileAllowUpdate =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == attFileTabForm.Iserial).AllowUpdate ?? false;
                    _viewModel.AttFileAllowDelete =
                        LoggedUserInfo.WFM_UserJobPermissions.SingleOrDefault(
                            x => x.TblPermission == attFileTabForm.Iserial).AllowDelete ?? false
                            ? Visibility.Visible
                            : Visibility.Collapsed;
                }
            };
        }
Exemplo n.º 3
0
 public EmployeeShiftViewModel Post([FromBody] EmployeeShiftViewModel employeeShift)
 {
     return(_employeeShiftService.CreateViewModel(employeeShift));
 }