/// <summary>
        ///
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public IList <MonthlyOperationGridRoleSettingsProxy> GetMonthlyOperationGridRoleSettings(decimal roleId)
        {
            try
            {
                IList <MonthlyOperationGridRoleSettingsProxy> MonthlyOperationGridRoleSettingsProxyList = new List <MonthlyOperationGridRoleSettingsProxy>();
                MonthlyOperationGridRoleSettings monthlyOperationGridRoleSettings = NHSession.QueryOver <MonthlyOperationGridRoleSettings>()
                                                                                    .Where(x => x.Role.ID == roleId)
                                                                                    .SingleOrDefault();
                if (monthlyOperationGridRoleSettings == null)
                {
                    foreach (GridRoleSettings setting in Enum.GetValues(typeof(GridRoleSettings)))
                    {
                        MonthlyOperationGridRoleSettingsProxy monthlyOperationGridRoleSettingsProxy = new MonthlyOperationGridRoleSettingsProxy();
                        monthlyOperationGridRoleSettingsProxy.ID         = 0;
                        monthlyOperationGridRoleSettingsProxy.RoleID     = roleId;
                        monthlyOperationGridRoleSettingsProxy.ViewState  = true;
                        monthlyOperationGridRoleSettingsProxy.GridColumn = setting.ToString();
                        monthlyOperationGridRoleSettingsProxy.Exist      = false;
                        MonthlyOperationGridRoleSettingsProxyList.Add(monthlyOperationGridRoleSettingsProxy);
                    }
                }
                else
                {
                    foreach (PropertyInfo pInfo in typeof(MonthlyOperationGridRoleSettings).GetProperties())
                    {
                        foreach (GridRoleSettings setting in Enum.GetValues(typeof(GridRoleSettings)))
                        {
                            if (pInfo.Name == setting.ToString())
                            {
                                MonthlyOperationGridRoleSettingsProxy monthlyOperationGridRoleSettingsProxy = new MonthlyOperationGridRoleSettingsProxy();
                                monthlyOperationGridRoleSettingsProxy.ID         = monthlyOperationGridRoleSettings.ID;
                                monthlyOperationGridRoleSettingsProxy.RoleID     = monthlyOperationGridRoleSettings.Role.ID;
                                monthlyOperationGridRoleSettingsProxy.ViewState  = (bool)pInfo.GetValue(monthlyOperationGridRoleSettings, null);
                                monthlyOperationGridRoleSettingsProxy.GridColumn = pInfo.Name;
                                monthlyOperationGridRoleSettingsProxy.Exist      = true;
                                MonthlyOperationGridRoleSettingsProxyList.Add(monthlyOperationGridRoleSettingsProxy);
                            }
                        }
                    }
                }

                return(MonthlyOperationGridRoleSettingsProxyList);
            }
            catch (Exception ex)
            {
                LogException(ex, "BRole", "GetMonthlyOperationGridRoleSettings");
                throw ex;
            }
        }
Пример #2
0
        private IList <MonthlyOperationGridRoleSettingsProxy> GetLocalResource(IList <MonthlyOperationGridRoleSettingsProxy> MonthlyOperationGridRoleSettingsProxyList)
        {
            IList <MonthlyOperationGridRoleSettingsProxy> monthlyOperationGridRoleSettingsProxyList = new List <MonthlyOperationGridRoleSettingsProxy>();

            foreach (MonthlyOperationGridRoleSettingsProxy setting in MonthlyOperationGridRoleSettingsProxyList)
            {
                MonthlyOperationGridRoleSettingsProxy monthlyOperationGridRoleSettingsProxy = new MonthlyOperationGridRoleSettingsProxy();
                monthlyOperationGridRoleSettingsProxy.ID         = setting.ID;
                monthlyOperationGridRoleSettingsProxy.RoleID     = setting.RoleID;
                monthlyOperationGridRoleSettingsProxy.GridColumn = GetLocalResourceObject(setting.GridColumn).ToString();
                monthlyOperationGridRoleSettingsProxy.ViewState  = setting.ViewState;
                monthlyOperationGridRoleSettingsProxy.Exist      = setting.Exist;
                monthlyOperationGridRoleSettingsProxyList.Add(monthlyOperationGridRoleSettingsProxy);
            }
            return(monthlyOperationGridRoleSettingsProxyList);
        }