コード例 #1
0
        private void ReadDataSource(XmlNode dataNode, IPolicyObjectCollection<IDataSource> dataSourceCollection)
        {
            if (dataNode.Name != "DataSource")
                return;

            dataSourceCollection.Add(new XmlDataSourceReader(dataNode).Read());
        }
コード例 #2
0
 public XmlDataElementsWriter(XmlNode xmlParentNode, IDataElement dataElement)
     : base(xmlParentNode)
 {
     m_dataElements = new PolicyObjectCollection<IDataElement>();
     m_dataElements.Add(dataElement);
 }
コード例 #3
0
 /// <summary>
 /// Adds actions from the selected rows in the DataGridView
 /// </summary>
 /// <param name="dataGridView">The DataGridView to process</param>
 /// <param name="actions">Collection to which the actions will be added</param>
 private void GetSelectedActionsFromDataGridView(DataGridView dataGridView, IPolicyObjectCollection<IAction> actions)
 {
     foreach (DataGridViewRow row in dataGridView.Rows)
     {
         DataGridViewCheckBoxCell checkBoxCell = (DataGridViewCheckBoxCell)row.Cells[0];
         if (checkBoxCell.Value == checkBoxCell.TrueValue)
         {
             if (row.Cells[1].Tag is IAction)
             {
                 actions.Add(row.Cells[1].Tag);
             }
             else
             {
                 throw new ArgumentException("Unexpected object type in cell tag");
             }
         }
     }
 }
コード例 #4
0
        private void ReadDataItem(XmlNode dataNode, DataType dataType, IPolicyObjectCollection<IDataItem> dataItemCollection)
        {
            if (dataNode.Name != "DataItem")
                return;

            dataItemCollection.Add(new XmlDataItemReader(dataNode, dataType).Read());                
        }
コード例 #5
0
        private void ReadRoutingTable(IPolicyObjectCollection<IRoutingTable> routingTables)
        {
            string nodeName = m_routingNode.Name;

            List<string> exclusions = new List<string>();
            exclusions.Add("id");
            exclusions.Add("name");
            exclusions.Add("type");
            exclusions.Add("resolve");
            exclusions.Add("readonly");

            bool routingsReadOnly = PolicyUtilities.IsReadOnly(m_routingNode);

            IRoutingItemCollections entireAddressGroup = m_calalogueReader.LocationsCollection;

            XmlAttributeCollection attributes = m_routingNode.Attributes;
            Guid guid = new Guid(attributes.GetNamedItem(exclusions[0]).InnerText);
            IPolicyLanguageItem name = LanguageItemFactory.Create(attributes.GetNamedItem(exclusions[1]).InnerText);
            ChannelType type = TypeConverters.GetChannelType(attributes.GetNamedItem(exclusions[2]).InnerText);
            bool routingTableReadOnly = PolicyUtilities.IsReadOnly(m_routingNode);

            RoutingTable routingTable = RoutingTableFactory.Instance.Create(type, guid, name, routingTableReadOnly) as RoutingTable;

            XmlNode resolveAttribute = attributes.GetNamedItem(exclusions[3]);
            string customResolve = (null == resolveAttribute) ? "" : resolveAttribute.InnerText;
            if (!string.IsNullOrEmpty(customResolve))
            {
                routingTable[resolveAttribute.Name].Value = resolveAttribute.Value;
            }
            new XmlCustomAttributesReader(routingTable, attributes, exclusions).Read();

            XmlNodeList senderGroupNode = m_routingNode.SelectNodes("./Sources/*");
            if (null != senderGroupNode)
            {
                routingTable.Sources = ReadAddressGroup(senderGroupNode, entireAddressGroup, routingTableReadOnly);
                if (0 != routingTable.Sources.Count)
                {
                    foreach (IRoutingItemCollection source in routingTable.Sources)
                    {
                        if ("true" == source["DefaultGroup"].Value.ToLower(CultureInfo.InvariantCulture))
                        {
                            routingTable.DefaultSource = source;
                            break;
                        }
                    }
                }
            }

            XmlNodeList recipientGroupNode = m_routingNode.SelectNodes("./Destinations/*");
            if (null != recipientGroupNode)
            {
                routingTable.Destinations = ReadAddressGroup(recipientGroupNode, entireAddressGroup, routingTableReadOnly);
                if (0 != routingTable.Destinations.Count)
                {
                    foreach (IRoutingItemCollection recipients in routingTable.Destinations)
                    {
                        if ("true" == recipients["DefaultGroup"].Value.ToLower(CultureInfo.InvariantCulture))
                        {
                            routingTable.DefaultDestination = recipients;
                            break;
                        }
                    }
                }
            }

            routingTable.Offline = ReadOfflineNode(routingTableReadOnly);

            XmlNode matrixCellsNode = m_routingNode.SelectSingleNode("./RoutingMatrixCells");
            bool cellsReadOnly = PolicyUtilities.IsReadOnly(matrixCellsNode);

            // Now build the matrix relationships... i.e. The Cells...
            XmlNodeList matrixCellNodes = m_routingNode.SelectNodes("./RoutingMatrixCells/*");
            if (matrixCellNodes != null)
                AddMatrixCells(matrixCellNodes, routingTable, cellsReadOnly);

            routingTables.Add(routingTable);
        }