当前位置: 首页>>代码示例>>C#>>正文


C# Oid.GetValues方法代码示例

本文整理汇总了C#中Oid.GetValues方法的典型用法代码示例。如果您正苦于以下问题:C# Oid.GetValues方法的具体用法?C# Oid.GetValues怎么用?C# Oid.GetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oid的用法示例。


在下文中一共展示了Oid.GetValues方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateOIDNodeFromResponse

        private static XmlNode CreateOIDNodeFromResponse(XmlDocument OwnerDocument, Oid oid)
        {
            XmlNode nodeOID = OwnerDocument.CreateElement("OID");
            nodeOID.Attributes.Append(OwnerDocument.CreateAttribute("Class.Name"));
            nodeOID.Attributes["Class.Name"].Value = oid.ClassName;

            XmlNode nodeOIDField = OwnerDocument.CreateElement("OID.Field");
            nodeOIDField.Attributes.Append(OwnerDocument.CreateAttribute("Value"));

            for (int It=0; It<oid.Fields.Count; It++)
            {
                nodeOIDField.Attributes["Value"].Value = oid.GetValues()[It].ToString();
                nodeOID.AppendChild(nodeOIDField.Clone());
            }
            return nodeOID;
        }
开发者ID:sgon1853,项目名称:UPM_MDD_Thesis,代码行数:16,代码来源:PrintToXML.cs

示例2: GetQueryXML

        /// <summary>
        /// Get the result after executing the queries of the report.
        /// </summary>
        /// <param name="oid">Root OID of the report.</param>
        /// <param name="nodeReport"></param>
        /// <returns>A XmlNode object with the XML result of the queries.</returns>
        public static XmlNode GetQueryXML(Oid oid, XmlNode nodeReport)
        {
            XmlNode nodeObject = null;
            XmlNode nodeRpt = null;
            if ((nodeReport != null) && (oid != null))
            {
                XmlNode nodeOIDProperties = null;

                nodeObject= XMLQuery.SelectObject(nodeReport, true);

                //Process OID
                nodeOIDProperties = XMLQuery.SelectProperties(nodeObject, false);

                DataTable rootInstance = Logics.Logic.ExecuteQueryInstance(Logics.Logic.Agent, oid, XMLQuery.DisplaySetFromNodeProperties(nodeOIDProperties));

                Dictionary<string, int> columNames = new Dictionary<string, int>();
                int i = 0;
                foreach (DataColumn column in rootInstance.Columns)
                {
                    columNames.Add(column.Caption, i);
                    i++;
                }
                SetValueOfNodeAttributeFromInstance(nodeOIDProperties, rootInstance.Rows[0], false, columNames);

                // Assing value to OID field.
                XmlNode nodeOID = XMLQuery.SelectOID(nodeObject, false);
                for(int it=0; it < oid.Fields.Count; it++)
                {
                    nodeOID.ChildNodes[it].Attributes["Value", string.Empty].Value = oid.GetValues()[it].ToString();
                }

                //Process Roles
                ProcessRoles(nodeOIDProperties, oid);

                //Create the root node, representing the report
                nodeRpt = nodeObject.OwnerDocument.CreateElement("Report");

                //Insert object in the root node
                nodeRpt.AppendChild(nodeObject);
            }
            return nodeRpt;
        }
开发者ID:sgon1853,项目名称:UPM_MDD_Thesis,代码行数:48,代码来源:PrintToXML.cs

示例3: OidFieldsToString

        /// <summary>
        /// Converts the Oid object fields into a string.
        /// </summary>
        /// <param name="oid">Oid object to convert.</param>
        /// <param name="separator">Separator character.</param>
        /// <returns>Oid object fields converted into a string.</returns>
        public static string OidFieldsToString(Oid oid, char separator)
        {
            StringBuilder lStringBuilder = new StringBuilder();

            if (oid != null)
            {
                // Get the Oid values.
                foreach (object lValue in oid.GetValues())
                {
                    lStringBuilder.Append(lValue.ToString());
                    lStringBuilder.Append(separator);
                }

                // Remove the last separator.
                if (lStringBuilder.Length > 0)
                {
                    lStringBuilder.Length--;
                }
            }

            // Oid converted.
            return lStringBuilder.ToString();
        }
开发者ID:sgon1853,项目名称:UPM_MDD_Thesis,代码行数:29,代码来源:UtilFunctions.cs

示例4: GetText2Title

        /// <summary>
        /// Returns the extra text to be added to the title in the target scenario
        /// Text will identify to the selected instance
        /// </summary>
        /// <param name="alias">Class or role alias</param>
        /// <param name="oid">Selected intance Oid</param>
        /// <param name="displaySet">Attributes to be shown</param>
        /// <returns></returns>
        public static string GetText2Title(string scenarioAlias, string instanceAlias, Oid oid, string displaySet)
        {
            // Retuned text will have next structure:
            //	  scenarioAlias. instanceAlias: oidValues - displaySetValues

            string title = "";

            if (!scenarioAlias.Equals(""))
            {
                title = scenarioAlias;
            }

            if (!instanceAlias.Equals(""))
            {
                if (!title.Equals(""))
                    title += ". ";

                title += instanceAlias + ": ";
            }

            try
            {
                if (oid != null)
                {
                    string oidString = "";
                    foreach (object value in oid.GetValues())
                    {
                        if (!oidString.Equals(""))
                            oidString += " ";

                        oidString += value.ToString();
                    }

                    title += oidString;

                    // Get the information from the selected instance
                    if (!displaySet.Equals(""))
                    {
                        string missingDisplaySet = ReturnMissingAttributes(oid.ExtraInfo, displaySet);

                        string displaySetText = "";
                        string[] attributes = displaySet.Split(',');
                        try
                        {
                            DataTable dataTable = null;
                            if (!missingDisplaySet.Equals(""))
                            {
                                dataTable = Logics.Logic.ExecuteQueryInstance(Logics.Logic.Agent, oid, missingDisplaySet);
                                if (dataTable != null)
                                {
                                    if (oid.ExtraInfo != null)
                                        oid.ExtraInfo.Merge(dataTable);
                                    else
                                        oid.ExtraInfo = dataTable;
                                }
                            }
                            if (oid.ExtraInfo != null && oid.ExtraInfo.Rows.Count > 0)
                            {
                                DataRow row = oid.ExtraInfo.Rows[0];
                                foreach (string attribute in attributes)
                                {
                                    if (!displaySetText.Equals(""))
                                        displaySetText += " ";

                                    if (row[attribute].GetType() != typeof(System.DBNull))
                                    {
                                        if (row[attribute].GetType() == typeof(System.DateTime))
                                        {
                                            DateTime dateTime = (DateTime)row[attribute];
                                            if (dateTime.Hour == 0 && dateTime.Minute == 0 && dateTime.Second == 0)
                                            {
                                                displaySetText += dateTime.ToShortDateString();
                                            }
                                            else
                                            {
                                                displaySetText += dateTime.ToString();
                                            }
                                        }
                                        else
                                        {
                                            displaySetText += row[attribute].ToString();
                                        }
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                        if (!displaySetText.Equals(""))
                            title += " - " + displaySetText;
                    }
//.........这里部分代码省略.........
开发者ID:sgon1853,项目名称:UPM_MDD_Thesis,代码行数:101,代码来源:UtilFunctions.cs

示例5: ProcessRelationship

        /// <summary>
        /// Gets the related instances according to the information in the DataRelation object. 
        /// </summary>
        /// <param name="dataSet">DataSet that is filled with the retrieved instances.</param>
        /// <param name="relation">DataRelation to be processed.</param>
        /// <param name="oid">Oid related.</param>
        /// <param name="asParent">Indicate if the relation is processed as Parent or not.</param>
        /// <returns>A DataTable with the related instances.</returns>
        private static DataTable ProcessRelationship(DataSet dataSet, DataRelation relation, Oid oid, bool asParent)
        {
            string lRelatedClass = relation.ExtendedProperties["RELATEDCLASS"] as string;
            if (lRelatedClass == null || lRelatedClass == "")
            {
                object[] lArgs = new object[1];
                lArgs[0] = "RELATEDCLASS";
                string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_ERROR_DATASET_DEFINITION, LanguageConstantValues.L_ERROR_DATASET_DEFINITION, lArgs);
                throw new Exception(lErrorMessage);
            }

            string lInvRole = relation.ExtendedProperties["INVERSEROLE"] as string;
            if (lInvRole == null || lInvRole == "")
            {
                object[] lArgs = new object[1];
                lArgs[0] = "INVERSEROLE";
                string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_ERROR_DATASET_DEFINITION, LanguageConstantValues.L_ERROR_DATASET_DEFINITION, lArgs);
                throw new Exception(lErrorMessage);
            }

            string lRelatedClassDataTable = relation.ExtendedProperties["RELATEDCLASSDATATABLE"] as string;
            if (lRelatedClassDataTable == null || lRelatedClassDataTable == "")
            {
                object[] lArgs = new object[1];
                lArgs[0] = "RELATEDCLASSDATATABLE";
                string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_ERROR_DATASET_DEFINITION, LanguageConstantValues.L_ERROR_DATASET_DEFINITION, lArgs);
                throw new Exception(lErrorMessage);
            }

            DataTable lRelatedTable = GetDataTable(dataSet, lRelatedClassDataTable);
            DataTable lTable = null;
            if (asParent)
            {
                lTable = relation.ChildTable;
            }
            else
            {
                lTable = relation.ParentTable;
            }

            // Add the info about the related object.
            Dictionary<string, Oid> linkItems = new Dictionary<string, Oid>(StringComparer.CurrentCultureIgnoreCase);
            linkItems.Add(lInvRole, oid);
            DataTable lRspRole = null;
            string lDisplaySet = GetDisplaySet(lRelatedTable);
            try
            {
                lRspRole = Logics.Logic.Adaptor.ExecuteQueryRelated(
                    Logics.Logic.Agent, lRelatedClass, linkItems, lDisplaySet, "", null, 0);
            }
            catch (Exception e)
            {
                object[] lArgs = new object[2];
                lArgs[0] = lTable.TableName;
                lArgs[1] = lInvRole;
                string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_ERROR_DATASET_QUERYRELATED, LanguageConstantValues.L_ERROR_DATASET_QUERYRELATED, lArgs);
                throw new Exception(lErrorMessage, e);
            }
            lRelatedTable.Merge(lRspRole);

            // If it is a MM relationship.
            string lMMTableName = relation.ExtendedProperties["MMTABLENAME"] as string;
            if (lMMTableName != "")
            {
                // Manage MM relationship.
                DataTable lMMTable = GetDataTable(dataSet, lMMTableName);

                object[] lRowData = new object[lTable.PrimaryKey.Length + lRelatedTable.PrimaryKey.Length];
                foreach (DataRow lRow in lRspRole.Rows)
                {
                    int i = 0;
                    foreach (object lOidField in oid.GetValues())
                    {
                        lRowData.SetValue(lOidField, i);
                        i++;
                    }
                    Oid lOid = Adaptor.ServerConnection.GetOid(lRspRole, lRow);
                    foreach (object lOidField in lOid.GetValues())
                    {
                        lRowData.SetValue(lOidField, i);
                        i++;
                    }

                    // Add the row into the MM table.
                    try
                    {
                        if (!lMMTable.Rows.Contains(lRowData))
                        {
                            lMMTable.Rows.Add(lRowData);
                        }
                    }
                    catch{ }
//.........这里部分代码省略.........
开发者ID:sgon1853,项目名称:UPM_MDD_Thesis,代码行数:101,代码来源:PrintToDataSets.cs

示例6: OIDFields

        private static object OIDFields(Oid TheOID, object WordDocument)
        {
            object Colletion;
            Colletion = WordDocument.GetType().InvokeMember("OIDColletion",BindingFlags.InvokeMethod,null,WordDocument,null);

            object[] Parameters;
            Parameters = new Object[4];

            Parameters[1] = System.Reflection.Missing.Value;	//[Key]
            Parameters[2] = System.Reflection.Missing.Value;	//[Before]
            Parameters[3] = System.Reflection.Missing.Value;	//[After]

            foreach (object field in TheOID.GetValues())
            {
                Parameters[0] = field;
                Colletion.GetType().InvokeMember("Add",BindingFlags.InvokeMethod,null,Colletion,Parameters);
            }
            return Colletion;
        }
开发者ID:sgon1853,项目名称:UPM_MDD_Thesis,代码行数:19,代码来源:Word.Automation.cs


注:本文中的Oid.GetValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。