예제 #1
0
 public static TermStore CreateStore(string termName, Guid managedItemID)
 {
     TermStore termStore = new TermStore(termName, TermType.PlaceHolderAttachments);
     DataTable dtDocuments = Business.ManagedItem.GetManagedItemDocuments(managedItemID);
     if (dtDocuments.Rows.Count > 0)
     {
         foreach (DataRow drDocument in dtDocuments.Rows)
         {
             if (!(bool)drDocument[Data.DataNames._C_Deleted])
                 termStore.AddMultiValue(drDocument[Data.DataNames._C_DocumentName].ToString());
         }
     }
     return termStore;
 }
예제 #2
0
        public static TermStore CreateStore(string termName, XmlReader reader)
        {
            using (reader)
            {
                TermStore termStore = new TermStore(termName, TermType.Facility);
                bool termProcessed = false;
                bool abort = false;
                reader.Read();
                reader.Read();

                int loopCount = 0;

                ReadPastSubTree(reader, XMLNames._E_validateOn);

                while (!abort && !termProcessed)
                {
                    if (loopCount++ > TermStore.maxLoopCount)
                    {
                        throw new Exception(string.Format("CreateStore stopped at loopCount {0:D} for Facility term '{1}'", loopCount, termName));
                    }
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.EndElement:
                            abort = true;
                            break;

                        case XmlNodeType.Element:
                            switch (reader.Name)
                            {
                                case XMLNames._E_FacilityTypes:
                                case XMLNames._E_OwningFacilityIDs:
                                    reader.Skip();
                                    break;

                                case XMLNames._E_SelectedFacilityIDs:
                                    using (XmlReader facilityReader = reader.ReadSubtree())
                                    {
                                        while (facilityReader.Read())
                                        {
                                            switch (facilityReader.NodeType)
                                            {
                                                case XmlNodeType.Element:
                                                    switch (facilityReader.Name)
                                                    {
                                                        case XMLNames._E_FacilityID:
                                                            termStore.AddMultiValue(facilityReader.GetAttribute(XMLNames._A_ID));
                                                            break;

                                                        default:
                                                            break;
                                                    }
                                                    break;

                                                default:
                                                    break;
                                            }
                                        }
                                    }
                                    termProcessed = true;
                                    break;

                                default:
                                    //reader.Read();
                                    break;
                            }
                            break;

                        default:
                            break;
                    }
                }
                return termStore;
            }
        }
예제 #3
0
        public static TermStore CreateStore(string termName, XmlReader reader)
        {
            using (reader)
            {
                reader.Read();

                TermStore termStore = new TermStore(termName, TermType.Renewal);
                DisplayedDate displayedDateType = (DisplayedDate)Enum.Parse(typeof(DisplayedDate), reader.GetAttribute(XMLNames._A_DisplayedDate));

                bool effectiveDateProcessed = false;
                bool expirationDateProcessed = false;

                string value = string.Empty;

                reader.Read();

                ReadPastSubTree(reader, XMLNames._E_validateOn);

                int loopCount = 0;
                while (!(effectiveDateProcessed && expirationDateProcessed))
                {
                    if (loopCount++ > TermStore.maxLoopCount)
                    {
                        throw new Exception(string.Format("CreateStore stopped at loopCount {0:D} for Renewal term '{1}'", loopCount, termName));
                    }
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element:
                            switch (reader.Name)
                            {
                                case XMLNames._E_EffectiveDate:
                                    value = Utility.XMLHelper.SafeReadElementString(reader);
                                    if (displayedDateType == DisplayedDate.EffectiveDate)
                                    {
                                        termStore.AddMultiValue(value);
                                        expirationDateProcessed = true;
                                    }
                                    effectiveDateProcessed = true;
                                    break;

                                case XMLNames._E_ExpirationDate:
                                    value = Utility.XMLHelper.SafeReadElementString(reader);
                                    if (displayedDateType == DisplayedDate.ExpirationDate)
                                    {
                                        termStore.AddMultiValue(value);
                                        effectiveDateProcessed = true;
                                    }
                                    expirationDateProcessed = true;
                                    break;

                                default:
                                    reader.Read();
                                    break;
                            }
                            break;

                        default:
                            reader.Read();
                            break;
                    }
                }
                return termStore;
            }
        }
예제 #4
0
        public static TermStore CreateStore(string termName, XmlReader reader)
        {
            using (reader)
            {
                TermStore termStore = new TermStore(termName, TermType.PickList);
                bool abort = false;
                reader.Read();
                reader.Read();

                ReadPastSubTree(reader, XMLNames._E_validateOn);

                int loopCount = 0;
                while (!abort)
                {
                    if (loopCount++ > TermStore.maxLoopCount)
                    {
                        throw new Exception(string.Format("CreateStore stopped at loopCount {0:D} for PickList term '{1}'", loopCount, termName));
                    }
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.EndElement:
                            abort = true;
                            break;

                        case XmlNodeType.Element:
                            switch (reader.Name)
                            {
                                case XMLNames._E_ListItem:
                                    string selected = reader.GetAttribute(XMLNames._A_Selected);
                                    string value = Utility.XMLHelper.SafeReadElementString(reader);
                                    if (selected.Equals("True", StringComparison.OrdinalIgnoreCase))
                                    {
                                        termStore.AddMultiValue(value);
                                    }
                                    break;

                                default:
                                    reader.Read();
                                    break;
                            }
                            break;

                        default:
                            reader.Read();
                            break;
                    }
                }
                return termStore;
            }
        }