Exemple #1
0
        public MenuListResultModel GetMenuList(MenuListFilterModel filterModel)
        {
            MenuListResultModel result = new MenuListResultModel();

            try
            {
                var menuList = this.PorDB.PTMenu.Select(s => new MenuListDataModel()
                {
                    MenuID             = s.MUID,
                    ParentMenuID       = s.MUPID,
                    MenuName           = s.MU_NM,
                    MenuStatus         = (bool)s.ACT_FG,
                    MenuDisplayStatus  = (bool)s.MENU_FG,
                    BuildUserADAccount = s.BUD_USRID,
                    BuildDate          = s.BUD_DTM,
                })
                               .Where(
                    s => filterModel.FilterType == MenuListFilterType.MainMenuList ?
                    s.MenuID.Length == 1 :
                    s.ParentMenuID == filterModel.QueryString
                    )
                               .ToList();

                menuList.ForEach(f =>
                {
                    f.SubMenuCount = this.MathSubMenuCount(f.MenuID);
                    f.BuildDateStr = f.BuildDate.To10CharString();
                    f.IsMade       = this.CheckIsMadeSite(f.MenuID);
                });
                //Filter
                //menuList = this.ProcessFilterCondition(filterModel.FilterTargetEnum, filterModel.QueryString, empList);

                int currentPage = filterModel.CurrentPage;
                int pageSize    = Convert.ToInt32(PublicStaticMethod.GetConfigAppSetting("DefaultPageSize"));
                result.Data = menuList.ToPagedList(currentPage, pageSize);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Exemple #2
0
        public MemberListResultModel GetMemberList(MemberListFilterModel filterModel)
        {
            MemberListResultModel result = new MemberListResultModel();

            try
            {
                var empList = this.PorDB.Employee.Select(s => new MemberListDataModel()
                {
                    EmpID              = s.EmployeeID,
                    EmpName            = s.EmployeeName,
                    DepCode            = s.DepartmentID_FK,
                    Disable            = s.Disabled,
                    ADAccount          = s.ADAccount,
                    BuildUserADAccount = s.Creator,
                    BuildDate          = s.CreateDate,
                    GenderCode         = s.SexType,
                    NationalityCode    = s.NationalType
                }).ToList();

                empList.ForEach(f =>
                {
                    f.DepName         = this.GetDepartmentNameByID(f.DepCode);
                    f.BuildDateStr    = f.BuildDate.To10CharString();
                    f.NationalityName = this.TranslateNationNationCode(f.NationalityCode);
                    f.GenderDesc      = this.GetGenderDescriptionByCode(f.GenderCode);
                }
                                );
                //Filter
                empList = this.ProcessFilterCondition(filterModel.FilterTargetEnum, filterModel.QueryString, empList);

                int currentPage = filterModel.CurrentPage;
                int pageSize    = Convert.ToInt32(PublicStaticMethod.GetConfigAppSetting("DefaultPageSize"));
                result.Data = empList.ToPagedList(currentPage, pageSize);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }