示例#1
0
        public override dynamic GetDimssionValue(AbstractCriteria ac, PropertyInfo propertyInfo)
        {
            dynamic ret = null;

            ret = CriteriaHelper.GetDimissionValueByUserData(ac, propertyInfo, roleType, userInfo);
            if (ret == null)
            {
                ret = base.GetDimssionValue(ac, propertyInfo);
            }
            return(ret);
        }
示例#2
0
        public static dynamic GetDimissionValueByUserData(AbstractCriteria ac, PropertyInfo propertyInfo, RoleType roleType, UserInfoDTO userInfo)
        {
            dynamic ret = null;

            var     attr  = (CriteriaPropertyAttribute)propertyInfo.GetCustomAttributes(typeof(CriteriaPropertyAttribute), false).FirstOrDefault();
            dynamic value = propertyInfo.GetValue(ac);

            if ((attr.Role == UserRole.Common &&
                 (roleType == RoleType.KDSAdmin || roleType == RoleType.KDSUser)) ||
                (attr.Role == UserRole.User && roleType == RoleType.KDSUser) ||
                (attr.Role == UserRole.Admin && roleType == RoleType.KDSAdmin)
                )
            {
                if (attr.UserFlag == UserData.CompanyID)
                {
                    int CompanyID = 0;
                    if (userInfo.CompanyID != null)
                    {
                        CompanyID = userInfo.CompanyID.Value;
                    }
                    dynamic defalutValue = new int[] { CompanyID };
                    if (attr.Conditions == CriteriaConditions.QueryKDSPermissionsCondition)
                    {
                        ret = GetDimissionValue(attr.Opration, value, defalutValue, attr.NoDataID);
                    }
                    else if (attr.Conditions == CriteriaConditions.KDSPermissionsCondition)
                    {
                        ret = defalutValue;
                    }
                }
                else if (attr.UserFlag == UserData.EmpID && attr.EntityID != 0)
                {
                    int EmpID = 0;
                    if (userInfo.EmpID != null)
                    {
                        EmpID = userInfo.EmpID.Value;
                    }
                    dynamic defaultValue = PermissionsConditionBL.GetWhereByEntityID(userInfo.UserID, attr, EmpID);

                    if (attr.Conditions == CriteriaConditions.QueryKDSPermissionsCondition)
                    {
                        ret = GetDimissionValue(attr.Opration, value, defaultValue, attr.NoDataID);
                    }
                    else if (attr.Conditions == CriteriaConditions.KDSPermissionsCondition)
                    {
                        ret = defaultValue;
                    }
                }
            }


            return(ret);
        }
示例#3
0
        public virtual dynamic GetDimssionValue(AbstractCriteria ac, PropertyInfo propertyInfo)
        {
            dynamic ret   = null;
            var     attr  = (CriteriaPropertyAttribute)propertyInfo.GetCustomAttributes(typeof(CriteriaPropertyAttribute), false).FirstOrDefault();
            dynamic value = propertyInfo.GetValue(ac);

            if (attr.UserFlag == UserData.Normal && !string.IsNullOrEmpty(attr.DefaultValue))
            {
                dynamic defaultValue;
                if (attr.Opration == CriteriaOprations.Eq)
                {
                    defaultValue = attr.DefaultValue;
                }
                else
                {
                    defaultValue = CriteriaHelper.GetDimissionValueByInt(attr.DefaultValue).ToArray();
                }


                switch (attr.Conditions)
                {
                case CriteriaConditions.BusinessCondition:
                    ret = defaultValue;
                    break;

                case CriteriaConditions.KBPBusinessCondition:
                    if ((attr.Role == UserRole.Common &&
                         (roleType == RoleType.KBPAdmin || roleType == RoleType.KBPUser)) ||
                        (attr.Role == UserRole.User && roleType == RoleType.KBPUser) ||
                        (attr.Role == UserRole.Admin && roleType == RoleType.KBPAdmin)
                        )
                    {
                        ret = defaultValue;
                    }
                    break;

                case CriteriaConditions.KDSBusinessCondition:
                    if ((attr.Role == UserRole.Common &&
                         (roleType == RoleType.KDSAdmin || roleType == RoleType.KDSUser)) ||
                        (attr.Role == UserRole.User && roleType == RoleType.KDSUser) ||
                        (attr.Role == UserRole.Admin && roleType == RoleType.KDSAdmin)
                        )
                    {
                        ret = defaultValue;
                    }
                    break;

                case CriteriaConditions.QueryBusinessCondition:
                    ret = CriteriaHelper.GetDimissionValue(attr.Opration, value, defaultValue, attr.NoDataID);
                    break;

                case CriteriaConditions.QueryKBPBusinessCondition:
                    if ((attr.Role == UserRole.Common &&
                         (roleType == RoleType.KBPAdmin || roleType == RoleType.KBPUser)) ||
                        (attr.Role == UserRole.User && roleType == RoleType.KBPUser) ||
                        (attr.Role == UserRole.Admin && roleType == RoleType.KBPAdmin)
                        )
                    {
                        ret = CriteriaHelper.GetDimissionValue(attr.Opration, value, defaultValue, attr.NoDataID);
                    }

                    else if ((attr.Role == UserRole.Common &&
                              (roleType == RoleType.KDSAdmin || roleType == RoleType.KDSUser)) ||
                             (attr.Role == UserRole.User && roleType == RoleType.KDSUser) ||
                             (attr.Role == UserRole.Admin && roleType == RoleType.KDSAdmin)
                             )
                    {
                        ret = value;
                    }
                    break;

                case CriteriaConditions.QueryKDSBusinessCondition:
                    if ((attr.Role == UserRole.Common &&
                         (roleType == RoleType.KDSAdmin || roleType == RoleType.KDSUser)) ||
                        (attr.Role == UserRole.User && roleType == RoleType.KDSUser) ||
                        (attr.Role == UserRole.Admin && roleType == RoleType.KDSAdmin)
                        )
                    {
                        ret = CriteriaHelper.GetDimissionValue(attr.Opration, value, defaultValue, attr.NoDataID);
                    }

                    else if ((attr.Role == UserRole.Common &&
                              (roleType == RoleType.KBPAdmin || roleType == RoleType.KBPUser)) ||
                             (attr.Role == UserRole.User && roleType == RoleType.KBPUser) ||
                             (attr.Role == UserRole.Admin && roleType == RoleType.KBPAdmin)
                             )
                    {
                        ret = value;
                    }
                    break;


                default:
                    break;
                }
            }



            return(ret);
        }
示例#4
0
        public override dynamic GetDimssionValue(AbstractCriteria ac, PropertyInfo propertyInfo)
        {
            dynamic ret   = null;
            var     attr  = (CriteriaPropertyAttribute)propertyInfo.GetCustomAttributes(typeof(CriteriaPropertyAttribute), false).FirstOrDefault();
            dynamic value = propertyInfo.GetValue(ac);

            if (attr.UserFlag == UserData.Normal && attr.EntityID != 0)
            {
                dynamic defaultValue = PermissionsConditionBL.GetWhereByEntityID(userInfo.UserID, attr);

                switch (attr.Conditions)
                {
                case CriteriaConditions.PermissionsCondition:
                    ret = defaultValue;
                    break;

                case CriteriaConditions.KBPPermissionsCondition:
                    if ((attr.Role == UserRole.Common &&
                         (roleType == RoleType.KBPAdmin || roleType == RoleType.KBPUser)) ||
                        (attr.Role == UserRole.User && roleType == RoleType.KBPUser) ||
                        (attr.Role == UserRole.Admin && roleType == RoleType.KBPAdmin)
                        )
                    {
                        ret = defaultValue;
                    }
                    break;


                case CriteriaConditions.KDSPermissionsCondition:
                    if ((attr.Role == UserRole.Common &&
                         (roleType == RoleType.KDSAdmin || roleType == RoleType.KDSUser)) ||
                        (attr.Role == UserRole.User && roleType == RoleType.KDSUser) ||
                        (attr.Role == UserRole.Admin && roleType == RoleType.KDSAdmin)
                        )
                    {
                        ret = defaultValue;
                    }
                    break;


                case CriteriaConditions.QueryPermissionsCondition:
                    ret = CriteriaHelper.GetDimissionValue(attr.Opration, value, defaultValue, attr.NoDataID);
                    break;


                case CriteriaConditions.QueryKBPPermissionsCondition:
                    if ((attr.Role == UserRole.Common &&
                         (roleType == RoleType.KBPAdmin || roleType == RoleType.KBPUser)) ||
                        (attr.Role == UserRole.User && roleType == RoleType.KBPUser) ||
                        (attr.Role == UserRole.Admin && roleType == RoleType.KBPAdmin)
                        )
                    {
                        ret = CriteriaHelper.GetDimissionValue(attr.Opration, value, defaultValue, attr.NoDataID);
                    }

                    else if ((attr.Role == UserRole.Common &&
                              (roleType == RoleType.KDSAdmin || roleType == RoleType.KDSUser)) ||
                             (attr.Role == UserRole.User && roleType == RoleType.KDSUser) ||
                             (attr.Role == UserRole.Admin && roleType == RoleType.KDSAdmin)
                             )
                    {
                        ret = value;
                    }
                    break;



                case CriteriaConditions.QueryKDSPermissionsCondition:
                    if ((attr.Role == UserRole.Common &&
                         (roleType == RoleType.KDSAdmin || roleType == RoleType.KDSUser)) ||
                        (attr.Role == UserRole.User && roleType == RoleType.KDSUser) ||
                        (attr.Role == UserRole.Admin && roleType == RoleType.KDSAdmin)
                        )
                    {
                        ret = CriteriaHelper.GetDimissionValue(attr.Opration, value, defaultValue, attr.NoDataID);
                    }

                    else if ((attr.Role == UserRole.Common &&
                              (roleType == RoleType.KBPAdmin || roleType == RoleType.KBPUser)) ||
                             (attr.Role == UserRole.User && roleType == RoleType.KBPUser) ||
                             (attr.Role == UserRole.Admin && roleType == RoleType.KBPAdmin)
                             )
                    {
                        ret = value;
                    }
                    break;

                default: break;
                }
            }
            if (ret == null)
            {
                ret = base.GetDimssionValue(ac, propertyInfo);
            }
            return(ret);
        }
示例#5
0
 public dynamic UserRoleSetValue(AbstractCriteria ac, PropertyInfo property)
 {
     return(strategy.GetDimssionValue(ac, property));
 }
示例#6
0
 public dynamic GetDimssionValue(AbstractCriteria ac, PropertyInfo propertyInfo)
 {
     return(null);
 }