コード例 #1
0
        private static object GetPlugletDataType(X12BaseDataType dataType)
        {
            string dataTypeString = dataType == null ? string.Empty : dataType.ToString();

            if (string.IsNullOrWhiteSpace(dataTypeString) == false)
            {
                X12_IdDataType idDataType = dataType as X12_IdDataType;
                if (idDataType != null)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(dataTypeString);
                    if (idDataType.AllowedValues != null)
                    {
                        foreach (KeyValuePair <string, string> kvp in idDataType.AllowedValues)
                        {
                            if (!string.IsNullOrEmpty(kvp.Value))
                            {
                                Contingency contingency = idDataType.GetContingencies(kvp.Key);
                                if (contingency != null && contingency.ContingencyValues != null && contingency.ContingencyValues.Count > 0)
                                {
                                    sb.AppendFormat(" '{0}:{1}:Contingencies{{", kvp.Key, kvp.Value);
                                    sb.AppendFormat(string.Join(",", contingency.ContingencyValues));
                                    sb.AppendFormat("}}'");
                                }
                                else
                                {
                                    sb.AppendFormat(" '{0}:{1}'", kvp.Key, kvp.Value);
                                }
                            }
                        }
                    }
                    dataTypeString = sb.ToString();
                }
            }

            return(dataTypeString);
        }