Example #1
0
        /// <summary>
        /// 確認是否已實作網站
        /// </summary>
        /// <param name="muID"></param>
        /// <returns></returns>
        private bool CheckIsMadeSite(string muID)
        {
            string        msg             = string.Empty;
            MenuDataModel menu            = this.GetMenuByID(muID);
            string        controllerName  = menu.MenuPathController;
            string        actionName      = menu.MenuPathAction;
            var           controllerNames = PublicStaticMethod.GetControllerNames();
            bool          hasController   = controllerNames.Any(a => a.Key == controllerName);
            bool          hasAction       = hasController ? controllerNames[controllerName].Any(a => a == actionName) : false;

            if (muID.Length == 1)
            {
                if (!hasController)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            if (!hasController || !hasAction)
            {
                return(false);
            }
            return(true);
        }
Example #2
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);
        }
Example #3
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);
        }