示例#1
0
        // GET: WorkingdaySupplementConfiguraion (Default-Exception)
        public ActionResult Index()
        {
            WorkingdaySupplementConfigurationViewModel supplementConfigurationViewModel = new WorkingdaySupplementConfigurationViewModel();
            List <RoleModel> listRole = new List <RoleModel>();
            var responseRoles         = _roleService.GetRole();

            if (responseRoles != null)
            {
                var resultRoles = JsonConvert.DeserializeObject <HrmResultModel <RoleModel> >(responseRoles);
                if (!CheckPermission(resultRoles))
                {
                    //return to access denied
                }
                else
                {
                    listRole = resultRoles.Results;
                }
            }
            supplementConfigurationViewModel.Roles     = JsonConvert.DeserializeObject <List <dynamic> >(JsonConvert.SerializeObject(listRole));
            supplementConfigurationViewModel.ListRoles = JsonConvert.DeserializeObject <List <RoleModel> >(JsonConvert.SerializeObject(listRole));
            //get data for gereral-right
            var resultTableConfig = this._tableConfigService.GetTableConfigByTableName(TableConfig.WorkingdaySupplementConfiguration);
            var tableConfigDetail = JsonConvert.DeserializeObject <HrmResultModel <TableConfigModel> >(resultTableConfig);

            if (!CheckPermission(tableConfigDetail))
            {
                //return to Access Denied
            }
            else
            {
                var dataTableConfig = new TableViewModel();
                if (tableConfigDetail.Results.FirstOrDefault() != null)
                {
                    dataTableConfig = JsonConvert.DeserializeObject <TableViewModel>(tableConfigDetail.Results.FirstOrDefault().ConfigData);
                    var param = new BasicParamModel()
                    {
                        FilterField = supplementConfigurationViewModel.ListRoles[0].Id.ToString(),
                        PageNumber  = 1,
                        PageSize    = dataTableConfig.ItemsPerPage,
                        LanguageId  = _languageId,
                        DbName      = CurrentUser.DbName
                    };
                    dataTableConfig.TableConfigName        = TableConfig.WorkingdaySupplementConfiguration;
                    supplementConfigurationViewModel.Table = RenderTable(dataTableConfig, param, TableName.TableWorkingdaySupplementConfiguration);
                }
            }
            supplementConfigurationViewModel.RoleId = supplementConfigurationViewModel.ListRoles[0].Id;
            return(View(supplementConfigurationViewModel));
        }
示例#2
0
        public ActionResult GetApprovedBySaff(string listApprovedSaffs)
        {
            WorkingdaySupplementConfigurationViewModel supplementConfigurationViewModel = new WorkingdaySupplementConfigurationViewModel();
            var response = this._workingDaySupplementConfigurationExceptionService.GetApprovedBySaff(listApprovedSaffs);

            if (response != null)
            {
                var result = JsonConvert.DeserializeObject <HrmResultModel <dynamic> >(response);
                if (!CheckPermission(result))
                {
                    //return to Access Denied
                }
                else
                {
                    supplementConfigurationViewModel.ListApprovedByStaffs = result.Results;
                    var result_01 = JsonConvert.DeserializeObject <HrmResultModel <StaffModel> >(response);


                    var listGroup = new List <LongTypeModel>();
                    listGroup.Add(new LongTypeModel()
                    {
                        Value = MasterDataId.SupplementConfigurationStatusAprove
                    });
                    listGroup.Add(new LongTypeModel()
                    {
                        Value = MasterDataId.SupplementConfigurationActions
                    });
                    var listGropuId              = MapperHelper.MapList <LongTypeModel, LongType>(listGroup);
                    var resultMasterData         = this._masterDataService.GetAllMasterDataByListGroupId(listGropuId);
                    var responseMasterDataDetail = JsonConvert.DeserializeObject <HrmResultModel <dynamic> >(resultMasterData);
                    if (!CheckPermission(responseMasterDataDetail))
                    {
                        //return to Access Denied
                    }
                    else
                    {
                        supplementConfigurationViewModel.SupplementConfigurationStatusApprove = responseMasterDataDetail.Results.Where(m => m.GroupId == MasterDataId.SupplementConfigurationStatusAprove).ToList();
                    }
                    supplementConfigurationViewModel.SupplementConfiguration.PrevStatus = 0;
                    if (result_01.Results.Select(m => m.NextRequestStatusId).ToList().Count() > 0)
                    {
                        supplementConfigurationViewModel.SupplementConfiguration.PrevStatus = int.Parse(result_01.Results.Select(m => m.NextRequestStatusId).FirstOrDefault());
                    }
                }
            }
            return(PartialView(UrlHelpers.View("~/Administration/Views/WorkingdaySupplementConfiguration/_AddSupplementConfigurationExceptionBody.cshtml"), supplementConfigurationViewModel));
        }
示例#3
0
        public ActionResult AddWorkingdaySupplementConfiguration(long id = 0, long roleId = 0)
        {
            WorkingdaySupplementConfigurationViewModel supplementConfigurationViewModel = new WorkingdaySupplementConfigurationViewModel();
            var listGroup = new List <LongTypeModel>();

            listGroup.Add(new LongTypeModel()
            {
                Value = MasterDataId.SupplementConfigurationStatusAprove
            });
            listGroup.Add(new LongTypeModel()
            {
                Value = MasterDataId.SupplementConfigurationActions
            });
            var listGropuId              = MapperHelper.MapList <LongTypeModel, LongType>(listGroup);
            var resultMasterData         = this._masterDataService.GetAllMasterDataByListGroupId(listGropuId);
            var responseMasterDataDetail = JsonConvert.DeserializeObject <HrmResultModel <dynamic> >(resultMasterData);

            if (!CheckPermission(responseMasterDataDetail))
            {
                //return to Access Denied
            }
            else
            {
                supplementConfigurationViewModel.SupplementConfigurationStatusApprove = responseMasterDataDetail.Results.Where(m => m.GroupId == MasterDataId.SupplementConfigurationStatusAprove).ToList();
                supplementConfigurationViewModel.SupplementConfigurationActions       = responseMasterDataDetail.Results.Where(m => m.GroupId == MasterDataId.SupplementConfigurationActions).ToList();
            }
            if (id != 0)
            {
                var responseSupplement = _workingDaySupplementConfigurationService.GetSupplementConfigurationById(id);
                if (responseSupplement != null)
                {
                    var resultSupplement = JsonConvert.DeserializeObject <HrmResultModel <WorkingdaySupplementConfigurationModel> >(responseSupplement);
                    if (!CheckPermission(resultSupplement))
                    {
                        //return to Access Denied
                    }
                    else
                    {
                        supplementConfigurationViewModel.SupplementConfiguration = resultSupplement.Results.FirstOrDefault();
                    }
                }
            }
            supplementConfigurationViewModel.SupplementConfiguration.RequesterId = roleId;
            return(PartialView(UrlHelpers.TemplateAdmin("WorkingdaySupplementConfiguration", "_AddSupplementConfiguration.cshtml"), supplementConfigurationViewModel));
        }
示例#4
0
        public ActionResult AddWorkingdaySupplementConfigurationException(long id = 0)
        {
            WorkingdaySupplementConfigurationViewModel supplementConfigurationViewModel = new WorkingdaySupplementConfigurationViewModel();
            var listGroup = new List <LongTypeModel>();

            listGroup.Add(new LongTypeModel()
            {
                Value = MasterDataId.SupplementConfigurationStatusAprove
            });
            listGroup.Add(new LongTypeModel()
            {
                Value = MasterDataId.SupplementConfigurationActions
            });
            var listGropuId              = MapperHelper.MapList <LongTypeModel, LongType>(listGroup);
            var resultMasterData         = this._masterDataService.GetAllMasterDataByListGroupId(listGropuId);
            var responseMasterDataDetail = JsonConvert.DeserializeObject <HrmResultModel <dynamic> >(resultMasterData);

            if (!CheckPermission(responseMasterDataDetail))
            {
                //return to Access Denied
            }
            else
            {
                //supplementConfigurationViewModel.SupplementConfigurationStatusApprove = responseMasterDataDetail.Results.Where(m => m.GroupId == MasterDataId.SupplementConfigurationStatusAprove).ToList();
            }
            var responseStaffs = this._workingDaySupplementConfigurationExceptionService.GetApprovedSaff();

            if (responseStaffs != null)
            {
                var resultStaffs = JsonConvert.DeserializeObject <HrmResultModel <dynamic> >(responseStaffs);
                if (!CheckPermission(resultStaffs))
                {
                    //return to Access Denied
                }
                else
                {
                    supplementConfigurationViewModel.ListStaffs           = resultStaffs.Results;
                    supplementConfigurationViewModel.ListApprovedByStaffs = resultStaffs.Results;
                }
            }
            return(PartialView(UrlHelpers.TemplateAdmin("WorkingdaySupplementConfiguration", "_AddSupplementConfigurationException.cshtml"), supplementConfigurationViewModel));
        }