Exemplo n.º 1
0
        internal CubeLevel(CubeHierarchy AHierarchy, CubeHierarchy ASourceHierarchy)
        {
            FCubeHierarchy   = AHierarchy;
            FSourceHierarchy = ASourceHierarchy;

            if (SourceHierarchy != null)
            {
                FDisplayName = SourceHierarchy.DisplayName;
                FUniqueName  = SourceHierarchy.UniqueName;

                if (AHierarchy.Dimension.Cube.GetProductID() == RadarUtils.GetCurrentDesktopProductID())
                {
                    FUniqueName += "1";
                }

                FDescription    = SourceHierarchy.Description;
                FBIMembersType  = SourceHierarchy.BIMembersType;
                FInfoAttributes = SourceHierarchy.InfoAttributes.Clone();
                FFormatString   = SourceHierarchy.FormatString;
            }
            else
            {
                FDisplayName    = AHierarchy.DisplayName;
                FUniqueName     = AHierarchy.UniqueName;
                FDescription    = AHierarchy.Description;
                FBIMembersType  = AHierarchy.BIMembersType;
                FInfoAttributes = AHierarchy.InfoAttributes.Clone();
                FFormatString   = AHierarchy.FormatString;
            }
        }
        internal static string GetBIFormatMask(BIMembersType biType)
        {
            switch (biType)
            {
            case BIMembersType.ltTimeDayOfMonth:
            {
                return("d");
            }

            case BIMembersType.ltTimeDayOfWeekLong:
            {
                return("dddd");
            }

            case BIMembersType.ltTimeDayOfWeekShort:
            {
                return("ddd");
            }

            case BIMembersType.ltTimeHour:
            {
                return("H");
            }

            case BIMembersType.ltTimeMinute:
            {
                return("m");
            }

            case BIMembersType.ltTimeMonthLong:
            {
                return("MMMM");
            }

            case BIMembersType.ltTimeMonthShort:
            {
                return("MMM");
            }

            case BIMembersType.ltTimeSecond:
            {
                return("s");
            }

            case BIMembersType.ltTimeYear:
            {
                return("YYYY");
            }

            default:
            {
                return("");
            }
            }
        }
Exemplo n.º 3
0
        internal CubeLevel(CubeHierarchy AHierarchy, CubeHierarchy ASourceHierarchy,
                           string displayName, string description, string uniqueName)
        {
            FCubeHierarchy   = AHierarchy;
            FSourceHierarchy = ASourceHierarchy;

            FDisplayName = displayName;
            FDescription = description;
            FUniqueName  = uniqueName;
            if (FSourceHierarchy != null)
            {
                FBIMembersType  = FSourceHierarchy.BIMembersType;
                FLevelType      = FSourceHierarchy.FTypeOfMembers;
                FInfoAttributes = SourceHierarchy.InfoAttributes.Clone();
                FFormatString   = SourceHierarchy.FormatString;
            }
            else
            {
                FBIMembersType  = FCubeHierarchy.BIMembersType;
                FLevelType      = FCubeHierarchy.FTypeOfMembers;
                FInfoAttributes = FCubeHierarchy.InfoAttributes.Clone();
                FFormatString   = FCubeHierarchy.FormatString;
            }
        }
        internal static void DateToMemberName(DateTime date, BIMembersType biType, out double rank, out string memberName)
        {
            switch (biType)
            {
            case BIMembersType.ltTimeDayOfMonth:
            {
                rank       = (new DateTime(date.Year, date.Month, date.Day)).ToOADate();
                memberName = date.Day.ToString();
                break;
            }

            case BIMembersType.ltTimeDayOfWeekLong:
            {
                memberName = date.ToString("dddd", CultureInfo.CurrentUICulture);
                rank       = (new DateTime(date.Year, date.Month, date.Day)).ToOADate();
                break;
            }

            case BIMembersType.ltTimeDayOfWeekShort:
            {
                memberName = date.ToString("ddd", CultureInfo.CurrentUICulture);
                rank       = (new DateTime(date.Year, date.Month, date.Day)).ToOADate();
                break;
            }

            case BIMembersType.ltTimeDayOfYear:
            {
                memberName = date.DayOfYear.ToString();
                rank       = (new DateTime(date.Year, date.Month, date.Day)).ToOADate();
                break;
            }

            case BIMembersType.ltTimeHalfYear:
            {
                int i = (date.Month < 7) ? 1 : 2;
                rank       = date.Year + (i - 1.0) / 2;
                memberName = String.Format(GetResStr("rsHYString"), i);
                break;
            }

            case BIMembersType.ltTimeHour:
            {
                rank       = (new DateTime(date.Year, date.Month, date.Day, date.Hour, 0, 0)).ToOADate();
                memberName = date.Hour.ToString();
                break;
            }

            case BIMembersType.ltTimeMinute:
            {
                rank       = (new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, 0)).ToOADate();
                memberName = date.Minute.ToString();
                break;
            }

            case BIMembersType.ltTimeMonthLong:
            {
                rank       = (new DateTime(date.Year, date.Month, 1)).ToOADate();
                memberName = date.ToString("MMMM", CultureInfo.CurrentUICulture);
                break;
            }

            case BIMembersType.ltTimeMonthNumber:
            {
                rank       = (new DateTime(date.Year, date.Month, 1)).ToOADate();
                memberName = date.Month.ToString();
                break;
            }

            case BIMembersType.ltTimeMonthShort:
            {
                rank       = (new DateTime(date.Year, date.Month, 1)).ToOADate();
                memberName = date.ToString("MMM", CultureInfo.CurrentUICulture);
                break;
            }

            case BIMembersType.ltTimeQuarter:
            {
                int i = ((date.Month - 1) / 3) + 1;
                rank       = date.Year + (i - 1.0) / 4;
                memberName = String.Format(GetResStr("rsQuarterString"), i);
                break;
            }

            case BIMembersType.ltTimeSecond:
            {
                rank       = (new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second)).ToOADate();
                memberName = date.Second.ToString();
                break;
            }

            case BIMembersType.ltTimeWeekOfYear:
            {
                int i = ((date.DayOfYear - 1) / 7) + 1;
                rank       = (new DateTime(date.Year, date.Month, date.Day)).ToOADate();
                memberName = i.ToString();
                break;
            }

            case BIMembersType.ltTimeYear:
            {
                rank       = date.Year;
                memberName = date.Year.ToString();
                break;
            }

            default:
            {
                throw new Exception("Cannot format this BIType: " + biType);
            }
            }
        }