Ejemplo n.º 1
0
        private void saveM11()
        {
            // DomainMap
            System.Xml.XmlNodeList nodes = getFieldNodes(this.FieldGrid.SelectedIndex + 1);
            if (nodes != null)
            {
                DataGrid grid = this.Method11Grid as DataGrid;
                if (grid == null)
                {
                    return;
                }
                try
                {
                    string method = getMethodVal();
                    nodes[0].SelectSingleNode("Method").InnerText = method;
                    trimNodes(nodes, 3);
                    System.Xml.XmlNode noder = nodes[0].SelectSingleNode(method);
                    if (noder == null)
                    {
                        noder = _xml.CreateElement(method);
                        nodes[0].AppendChild(noder);
                    }
                    noder.RemoveAll();
                    for (int s = 0; s < grid.Items.Count; s++)
                    {
                        object       values = grid.Items[s];
                        DomainMapRow row    = grid.Items.GetItemAt(s) as DomainMapRow;
                        if (row != null)
                        {
                            System.Xml.XmlNode snode = _xml.CreateElement("sValue");
                            if (row.SourceSelectedItem > -1) // there may not be a selection
                            {
                                snode.InnerText = row.Source[row.SourceSelectedItem].Id;
                                noder.AppendChild(snode);
                                snode           = _xml.CreateElement("sLabel");
                                snode.InnerText = row.Source[row.SourceSelectedItem].Tooltip;
                                noder.AppendChild(snode);
                            }
                            else
                            {
                                snode.InnerText = _noneField;
                                noder.AppendChild(snode);
                                snode           = _xml.CreateElement("sLabel");
                                snode.InnerText = _noneField;
                                noder.AppendChild(snode);
                            }
                            System.Xml.XmlNode tnode = _xml.CreateElement("tValue");
                            tnode.InnerText = row.Target[row.TargetSelectedItem].Id;
                            noder.AppendChild(tnode);

                            tnode           = _xml.CreateElement("tLabel");
                            tnode.InnerText = row.Target[row.TargetSelectedItem].Tooltip;
                            noder.AppendChild(tnode);
                        }
                    }
                    saveFieldGrid();
                }
                catch { }
            }
        }
Ejemplo n.º 2
0
        private void saveM3()
        {
            // Value Map
            System.Xml.XmlNodeList nodes = getFieldNodes(this.FieldGrid.SelectedIndex + 1);
            if (nodes != null)
            {
                DataGrid grid = this.Method3Grid as DataGrid;
                if (grid == null)
                {
                    return;
                }

                try
                {
                    string method = getMethodVal();
                    nodes[0].SelectSingleNode("Method").InnerText = method;
                    //DataGridRow row0 = (DataGridRow)Method3Grid.ItemContainerGenerator.ContainerFromIndex(0);
                    //TextBox txt = ((TextBox)Method3Grid.Columns[0].GetCellContent(row0));
                    trimNodes(nodes, 3);
                    System.Xml.XmlNode noder = nodes[0].SelectSingleNode(method);
                    if (noder == null)
                    {
                        noder = _xml.CreateElement(method);
                        nodes[0].AppendChild(noder);
                    }
                    noder.RemoveAll();
                    for (int s = 0; s < grid.Items.Count; s++)
                    {
                        object      values = grid.Items[s];
                        ValueMapRow row    = grid.Items.GetItemAt(s) as ValueMapRow;
                        if (row != null)
                        {
                            System.Xml.XmlNode snode = _xml.CreateElement("sValue");
                            snode.InnerText = row.Source;
                            noder.AppendChild(snode);
                            System.Xml.XmlNode tnode = _xml.CreateElement("tValue");
                            tnode.InnerText = row.Target;
                            noder.AppendChild(tnode);
                        }
                    }
                    System.Xml.XmlNode othnode = _xml.CreateElement("Otherwise");
                    string             oth     = Method3Otherwise.Text;
                    if (oth.StartsWith("\n ") || oth.Equals(""))
                    {
                        oth = "None";
                    }
                    othnode.InnerText = oth;
                    noder.AppendChild(othnode);
                    saveFieldGrid();
                }
                catch { }
            }
        }
Ejemplo n.º 3
0
        System.Xml.XmlNode GetProviderNode(string rootAddress, System.Xml.XmlNode serviceNode)
        {
            System.Xml.XmlNode provider = null;
            if (serviceNode.HasChildNodes)
            {
                serviceNode.RemoveAll();
                //foreach (System.Xml.XmlNode item in serviceNode.ChildNodes)
                //{

                //foreach (System.Xml.XmlNode node in item.ChildNodes)
                //{
                //    if (node.Name != "RootAddress") continue;
                //    var tmp = Convert.ToString(node.InnerText);
                //    if (!tmp.StartsWith(this.RootAddress, StringComparison.InvariantCultureIgnoreCase) || string.IsNullOrEmpty(tmp))
                //        continue;
                //    provider = item;
                //    break;
                //}
                //if (provider != null)
                //    break;
                //}
            }
            if (provider == null)
            {
                provider = serviceNode.OwnerDocument.CreateElement("ServiceProvider", serviceNode.OwnerDocument.DocumentElement.NamespaceURI);

                var node = provider.OwnerDocument.CreateElement("RootAddress", serviceNode.OwnerDocument.DocumentElement.NamespaceURI);
                provider.AppendChild(node);
                node = provider.OwnerDocument.CreateElement("DataServiceAddress", serviceNode.OwnerDocument.DocumentElement.NamespaceURI);
                provider.AppendChild(node);
                node = provider.OwnerDocument.CreateElement("ApplicationPackageAddress", serviceNode.OwnerDocument.DocumentElement.NamespaceURI);
                provider.AppendChild(node);

                if (serviceNode.HasChildNodes)
                {
                    serviceNode.InsertBefore(provider, serviceNode.FirstChild);
                }
                else
                {
                    serviceNode.AppendChild(provider);
                }
            }
            return(provider);
        }