Beispiel #1
0
        public ActionResult GeneralnformationAndDetailSalary(int tabActive = 0)
        {
            GeneralnformationAndSalaryViewModel generalnformationAndDetailSalary_vm = new GeneralnformationAndSalaryViewModel();

            generalnformationAndDetailSalary_vm.ActiveTab = 1;

            switch (generalnformationAndDetailSalary_vm.ActiveTab)
            {
                #region

            case 0:
            {
                break;
            }

                #endregion
            case 1:
            {
                var resultTableConfig = this._tableConfigService.GetTableConfigByTableName(TableConfig.Salary);
                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 = "",
                            PageNumber  = 1,
                            PageSize    = dataTableConfig.ItemsPerPage,
                            LanguageId  = _languageId,
                            DbName      = CurrentUser.DbName
                        };
                        dataTableConfig.TableConfigName = TableConfig.Salary;
                        dataTableConfig.TableDataUrl    = TableUrl.TableSalary;
                        generalnformationAndDetailSalary_vm.Salary.Table = RenderTable(dataTableConfig, param, TableName.TableSalary);
                    }
                }
                break;
            }
            }


            return(View(generalnformationAndDetailSalary_vm));
        }
Beispiel #2
0
        public ActionResult SalaryPaySlip()
        {
            GeneralnformationAndSalaryViewModel generalnformationAndDetailSalary_vm = new GeneralnformationAndSalaryViewModel();

            generalnformationAndDetailSalary_vm.Month   = DateTime.Now.Month;
            generalnformationAndDetailSalary_vm.Year    = DateTime.Now.Year;
            generalnformationAndDetailSalary_vm.StaffId = 0;

            var resultTableConfig = this._tableConfigService.GetTableConfigByTableName(TableConfig.Salary);
            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 = "",
                        PageNumber  = 1,
                        StringJson  = "{Month:" + DateTime.Now.Month + ",Year:" + DateTime.Now.Year + ",StaffId:" + 0 + ",OrganizationId:" + 0 + "}",
                        PageSize    = dataTableConfig.ItemsPerPage,
                        LanguageId  = _languageId,
                        DbName      = CurrentUser.DbName
                    };
                    dataTableConfig.TableConfigName = TableConfig.Salary;
                    dataTableConfig.TableDataUrl    = TableUrl.TableSalary;
                    generalnformationAndDetailSalary_vm.Salary.Table = RenderTable(dataTableConfig, param, TableName.TableSalary);
                }
            }
            var lstStaff = _staffService.GetStaffByParentId(CurrentUser.UserId);

            if (lstStaff != null)
            {
                var resultStaff = JsonConvert.DeserializeObject <HrmResultModel <StaffModel> >(lstStaff);
                if (!CheckPermission(resultStaff))
                {
                    //return to Access Denied
                }
                else
                {
                    if (resultStaff.Results.Count() > 0)
                    {
                        foreach (var item in resultStaff.Results)
                        {
                            var stringFormat = item.OrganizationId.ToString() + ";" + DataType.Organization + ";OrganizationName";
                            item.Name = item.Name + " - " + _localizationService.GetLocalizedData(stringFormat).ToString();
                        }
                        generalnformationAndDetailSalary_vm.Staffs = JsonConvert.DeserializeObject <List <dynamic> >(JsonConvert.SerializeObject(resultStaff.Results));
                    }
                }
            }

            var responseOrganization = _organizationService.GetOrganizationByParentId(CurrentUser.UserId);

            if (responseOrganization != null)
            {
                var resultOrganization = JsonConvert.DeserializeObject <HrmResultModel <OrganizationModel> >(responseOrganization);
                if (!CheckPermission(resultOrganization))
                {
                    //return to Access Denied
                }
                else
                {
                    generalnformationAndDetailSalary_vm.Organizations = JsonConvert.DeserializeObject <List <dynamic> >(JsonConvert.SerializeObject(resultOrganization.Results));
                }
            }
            return(View(generalnformationAndDetailSalary_vm));
        }