コード例 #1
0
 public int GetMemberID(HfmDimensionType argDimensionType, String argLabel)
 {
     try
     {
         if (!HfmDimension.memberIdDictionary[argDimensionType].ContainsKey(argLabel))
         {
             HsvMetadata  hsvMetadata = _HsvSession.Metadata as HsvMetadata;
             IHsvTreeInfo treeInfo    = (IHsvTreeInfo)hsvMetadata.Dimension[(short)argDimensionType];
             HfmDimension.memberIdDictionary[argDimensionType].Add(argLabel, treeInfo.GetItemID(argLabel));
         }
         return(HfmDimension.memberIdDictionary[argDimensionType][argLabel]);
     }
     catch (Exception ex)
     {
         throw new Exception(HfmCommon.GetHfmErrorMessage(ex.Message));
     }
 }
コード例 #2
0
 public String GetMemberLabel(HfmDimensionType argDimensionType, int argId)
 {
     try
     {
         if (!HfmDimension.memberLabelDictionary[argDimensionType].ContainsKey(argId))
         {
             HsvMetadata  hsvMetadata = _HsvSession.Metadata as HsvMetadata;
             IHsvTreeInfo treeInfo    = (IHsvTreeInfo)hsvMetadata.Dimension[(short)argDimensionType];
             String       sLabel      = String.Empty;
             treeInfo.GetLabel(argId, out sLabel);
             HfmDimension.memberLabelDictionary[argDimensionType].Add(argId, sLabel);
         }
         return(HfmDimension.memberLabelDictionary[argDimensionType][argId]);
     }
     catch (Exception ex)
     {
         throw new Exception(HfmCommon.GetHfmErrorMessage(ex.Message));
     }
 }
コード例 #3
0
 public int GetDefaultParentID(String argEntity)
 {
     try
     {
         if (!HfmDimension.memberIdDictionary[HfmDimensionType.Parent].ContainsKey(argEntity))
         {
             int           entityId       = GetMemberID(HfmDimensionType.Entity, argEntity);
             HFMwMetadata  hfmwMetadata   = _HFMwSession.metadata as HFMwMetadata;
             HFMwEntities  hfmwEntities   = hfmwMetadata.entities as HFMwEntities;
             HFMwDimension hfmwDimension  = hfmwEntities.dimension as HFMwDimension;
             int           parentEntityId = hfmwDimension.GetDefaultParent(entityId);
             memberIdDictionary[HfmDimensionType.Parent].Add(argEntity, parentEntityId);
         }
         return(memberIdDictionary[HfmDimensionType.Parent][argEntity]);
     }
     catch (Exception ex)
     {
         throw new Exception(HfmCommon.GetHfmErrorMessage(ex.Message));
     }
 }
コード例 #4
0
ファイル: HfmData.cs プロジェクト: sfuture/hfm4csharp
 public int[] GetMembersThatHaveData(Dictionary <HfmDimensionType, int> argMemberIDDictionary,
                                     HfmDimensionType argDimensionType, string argValue)
 {
     int[] retVal = new int[0];
     try
     {
         object data = null;
         if (string.IsNullOrEmpty(argValue))
         {
             _HsvSession.Data.GetMembersThatHaveData(argMemberIDDictionary[HfmDimensionType.Scenario]
                                                     , argMemberIDDictionary[HfmDimensionType.Year]
                                                     , argMemberIDDictionary[HfmDimensionType.Period]
                                                     , argMemberIDDictionary[HfmDimensionType.Entity]
                                                     , argMemberIDDictionary[HfmDimensionType.Parent]
                                                     , argMemberIDDictionary[HfmDimensionType.Value]
                                                     , argMemberIDDictionary[HfmDimensionType.Account]
                                                     , argMemberIDDictionary[HfmDimensionType.Icp]
                                                     , argMemberIDDictionary[HfmDimensionType.Custom1]
                                                     , argMemberIDDictionary[HfmDimensionType.Custom2]
                                                     , argMemberIDDictionary[HfmDimensionType.Custom3]
                                                     , argMemberIDDictionary[HfmDimensionType.Custom4]
                                                     , argDimensionType, true, null, out data);
             if (data != null)
             {
                 retVal = (int[])data;
             }
         }
         else
         {
             retVal = new int[] { MemberLabel2Id(argDimensionType, argValue) };
         }
     }
     catch (Exception ex)
     {
         throw new Exception(HfmCommon.GetHfmErrorMessage(ex.Message));
     }
     return(retVal);
 }
コード例 #5
0
ファイル: HfmData.cs プロジェクト: sfuture/hfm4csharp
        public void SetCells(DataTable argDataTable)
        {
            try
            {
                int      Count         = argDataTable.Rows.Count;
                int[]    varalScenario = new int[Count];
                int[]    varalYear     = new int[Count];
                int[]    varalPeriod   = new int[Count];
                int[]    varalView     = new int[Count];
                int[]    varalEntity   = new int[Count];
                int[]    varalParent   = new int[Count];
                int[]    varalValue    = new int[Count];
                int[]    varalAccount  = new int[Count];
                int[]    varalICP      = new int[Count];
                int[]    varalCustom1  = new int[Count];
                int[]    varalCustom2  = new int[Count];
                int[]    varalCustom3  = new int[Count];
                int[]    varalCustom4  = new int[Count];
                double[] varalData     = new double[Count];
                bool[]   varaIsNoData  = new bool[Count];
                for (int i = 0; i < Count; i++)
                {
                    DataRow dataRow = argDataTable.Rows[i];
                    varalScenario[i] = MemberLabel2Id(HfmDimensionType.Scenario, dataRow);
                    varalYear[i]     = MemberLabel2Id(HfmDimensionType.Year, dataRow);
                    varalPeriod[i]   = MemberLabel2Id(HfmDimensionType.Period, dataRow);
                    varalView[i]     = MemberLabel2Id(HfmDimensionType.View, dataRow);
                    varalEntity[i]   = MemberLabel2Id(HfmDimensionType.Entity, dataRow);
                    //varalParent[i] = MemberLabel2Id(HfmDimensionType.Parent, dataRow);
                    varalValue[i]   = MemberLabel2Id(HfmDimensionType.Value, dataRow);
                    varalAccount[i] = MemberLabel2Id(HfmDimensionType.Account, dataRow);
                    varalICP[i]     = MemberLabel2Id(HfmDimensionType.Icp, dataRow);
                    varalCustom1[i] = MemberLabel2Id(HfmDimensionType.Custom1, dataRow);
                    varalCustom2[i] = MemberLabel2Id(HfmDimensionType.Custom2, dataRow);
                    varalCustom3[i] = MemberLabel2Id(HfmDimensionType.Custom3, dataRow);
                    varalCustom4[i] = MemberLabel2Id(HfmDimensionType.Custom4, dataRow);
                    if ("1".Equals(dataRow["DELETED"]))
                    {
                        varalData[i]    = 0;
                        varaIsNoData[i] = true;
                    }
                    else
                    {
                        varalData[i]    = double.Parse(dataRow["VALUE"].ToString());
                        varaIsNoData[i] = false;
                    }
                }
                object pvaralStatus;
                _HsvSession.Data.SetCells2(varalScenario, varalYear, varalPeriod, varalView, varalEntity, varalParent, varalValue, varalAccount, varalICP, varalCustom1, varalCustom2, varalCustom3, varalCustom4, varalData, varaIsNoData, out pvaralStatus);

                for (int i = 0; i < Count; i++)
                {
                    DataRow dataRow = argDataTable.Rows[i];
                    if ((((int[])pvaralStatus)[i] & (int)tagCALCSTATUSLOWBITS.CELLSTATUS_NODATA) ==
                        (int)tagCALCSTATUSLOWBITS.CELLSTATUS_NODATA)
                    {
                        dataRow["STATE"] = -1;
                    }
                    else
                    {
                        dataRow["STATE"] = ((Int32[])pvaralStatus)[i];
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(HfmCommon.GetHfmErrorMessage(ex.Message));
            }
        }
コード例 #6
0
ファイル: HfmData.cs プロジェクト: sfuture/hfm4csharp
        public void GetCells(DataTable argDataTable)
        {
            try
            {
                if (argDataTable == null || argDataTable.Rows.Count == 0)
                {
                    return;
                }
                int    Count                 = argDataTable.Rows.Count;
                int[]  varalScenario         = new int[Count];
                int[]  varalYear             = new int[Count];
                int[]  varalPeriod           = new int[Count];
                int[]  varalView             = new int[Count];
                int[]  varalEntity           = new int[Count];
                int[]  varalParent           = new int[Count];
                int[]  varalValue            = new int[Count];
                int[]  varalAccount          = new int[Count];
                int[]  varalICP              = new int[Count];
                int[]  varalCustom1          = new int[Count];
                int[]  varalCustom2          = new int[Count];
                int[]  varalCustom3          = new int[Count];
                int[]  varalCustom4          = new int[Count];
                var    hfmDimension          = this.HfmSession.GetDimension();
                string entityFieldName       = HfmDimensionTypeHelper.GetDimensionFieldName(HfmDimensionType.Entity);
                string entityParentFieldName = HfmDimensionTypeHelper.GetDimensionFieldName(HfmDimensionType.Parent);
                for (int i = 0; i < Count; i++)
                {
                    DataRow dataRow = argDataTable.Rows[i];
                    varalScenario[i] = MemberLabel2Id(HfmDimensionType.Scenario, dataRow);
                    varalYear[i]     = MemberLabel2Id(HfmDimensionType.Year, dataRow);
                    varalPeriod[i]   = MemberLabel2Id(HfmDimensionType.Period, dataRow);
                    varalView[i]     = MemberLabel2Id(HfmDimensionType.View, dataRow);
                    varalEntity[i]   = MemberLabel2Id(HfmDimensionType.Entity, dataRow);
                    string entityLabel = dataRow[entityFieldName].ToString();
                    string parentLabel = dataRow[entityParentFieldName].ToString();
                    if (!string.IsNullOrEmpty(parentLabel))
                    {
                        varalParent[i] = MemberLabel2Id(HfmDimensionType.Entity, parentLabel);
                    }
                    else
                    {
                        varalParent[i] = hfmDimension.GetDefaultParentID(entityLabel);
                    }

                    varalValue[i]   = MemberLabel2Id(HfmDimensionType.Value, dataRow);
                    varalAccount[i] = MemberLabel2Id(HfmDimensionType.Account, dataRow);
                    varalICP[i]     = MemberLabel2Id(HfmDimensionType.Icp, dataRow);
                    varalCustom1[i] = MemberLabel2Id(HfmDimensionType.Custom1, dataRow);
                    varalCustom2[i] = MemberLabel2Id(HfmDimensionType.Custom2, dataRow);
                    varalCustom3[i] = MemberLabel2Id(HfmDimensionType.Custom3, dataRow);
                    varalCustom4[i] = MemberLabel2Id(HfmDimensionType.Custom4, dataRow);
                }
                object pvaradData   = null;
                object pvaralStatus = null;

                _HsvSession.Data.GetCells(varalScenario, varalYear, varalPeriod, varalView, varalEntity, varalParent,
                                          varalValue, varalAccount, varalICP, varalCustom1, varalCustom2, varalCustom3, varalCustom4,
                                          out pvaradData, out pvaralStatus);

                for (int i = 0; i < Count; i++)
                {
                    DataRow dataRow = argDataTable.Rows[i];
                    dataRow["VALUE"] = ((double[])pvaradData)[i];
                    if ((((int[])pvaralStatus)[i] & (int)tagCALCSTATUSLOWBITS.CELLSTATUS_NODATA) ==
                        (int)tagCALCSTATUSLOWBITS.CELLSTATUS_NODATA)
                    {
                        dataRow["STATE"] = -1;
                    }
                    else
                    {
                        dataRow["STATE"] = ((Int32[])pvaralStatus)[i];
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(HfmCommon.GetHfmErrorMessage(ex.Message));
            }
        }
コード例 #7
0
        public List <DimensionMember> EnumAccountMembers()
        {
            List <DimensionMember> memberList = EnumMembers2(HfmDimensionType.Account);

            try
            {
                var    hsvMetadata = _HsvSession.Metadata as IHsvMetadata;
                var    hsvAccounts = hsvMetadata.Accounts as IHsvAccounts;
                bool   boolOutValue;
                int    intOutValue;
                short  shortOutValue;
                string strOutValue;
                foreach (var member in memberList)
                {
                    hsvAccounts.GetAccountType(member.MemberID, out shortOutValue);
                    member.AccountType = shortOutValue;

                    hsvAccounts.IsCalculated(member.MemberID, out boolOutValue);
                    member.IsCalculated = boolOutValue;

                    hsvAccounts.IsConsolidated(member.MemberID, out boolOutValue);
                    member.IsConsolidated = boolOutValue;

                    hsvAccounts.IsICP(member.MemberID, out boolOutValue);
                    member.IsICP = boolOutValue;

                    hsvAccounts.GetPlugAccount(member.MemberID, out intOutValue);
                    member.PlugAcct = GetMemberLabel(HfmDimensionType.Account, intOutValue);

                    hsvAccounts.GetTopMemberOfValidCustom1Hierarchy(member.MemberID, out intOutValue);
                    member.Custom1TopMember = GetMemberLabel(HfmDimensionType.Custom1, intOutValue);

                    hsvAccounts.GetTopMemberOfValidCustom2Hierarchy(member.MemberID, out intOutValue);
                    member.Custom2TopMember = GetMemberLabel(HfmDimensionType.Custom2, intOutValue);;

                    hsvAccounts.GetTopMemberOfValidCustom3Hierarchy(member.MemberID, out intOutValue);
                    member.Custom3TopMember = GetMemberLabel(HfmDimensionType.Custom3, intOutValue);;

                    hsvAccounts.GetTopMemberOfValidCustom4Hierarchy(member.MemberID, out intOutValue);
                    member.Custom4TopMember = GetMemberLabel(HfmDimensionType.Custom4, intOutValue);;

                    hsvAccounts.GetNumDecimalPlaces(member.MemberID, out shortOutValue);
                    member.NumDecimalPlaces = shortOutValue;

                    hsvAccounts.UsesLineItems(member.MemberID, out boolOutValue);
                    member.UsesLineItems = boolOutValue;

                    hsvAccounts.GetXBRLTags(member.MemberID, out strOutValue);
                    member.XBRLTags = strOutValue;

                    hsvAccounts.GetICPTopMember(member.MemberID, out intOutValue);
                    member.ICPTopMember = GetMemberLabel(HfmDimensionType.Account, intOutValue);

                    hsvAccounts.GetCalcAttribute(member.MemberID, out strOutValue);
                    member.CalcAttribute = strOutValue;

                    hsvAccounts.GetSubmissionGroup(member.MemberID, ref intOutValue);
                    member.SubmissionGroup = intOutValue;

                    hsvAccounts.GetUserDefined1(member.MemberID, out strOutValue);
                    member.UserDefined1 = strOutValue;

                    hsvAccounts.GetUserDefined2(member.MemberID, out strOutValue);
                    member.UserDefined2 = strOutValue;

                    hsvAccounts.GetUserDefined3(member.MemberID, out strOutValue);
                    member.UserDefined3 = strOutValue;

                    hsvAccounts.GetSecurityClassID(member.MemberID, out intOutValue);
                    member.SecurityClass = intOutValue;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(HfmCommon.GetHfmErrorMessage(ex.Message));
            }
            return(memberList);
        }