Esempio n. 1
0
        /// <summary>
        ///     Saves Extended Data for the specified element.
        /// </summary>
        /// <param name="wmsNode">The WFM object being processed (Work Request, Design, Work Location, or Compatible Unit).</param>
        /// <param name="edmNode">The "EDM" XML element from the design XML that corresponds to the WFM object.</param>
        public virtual void WriteEDMFromXML(IMMWMSNode wmsNode, IXMLDOMNode edmNode)
        {
            if (_EdmRepository == null || edmNode == null)
            {
                return;
            }

            // If design not valid exit.
            if (!this.IsValid(wmsNode))
            {
                return;
            }

            // Remove any existing Extended Data rows, if necessary.
            if (!_IsDeleted)
            {
                // Delete all the EDM data from the Work Request, Design, Work Locaiton and CUs associated with the current design id.
                this.Delete(_ID);

                // Update the flag.
                _IsDeleted = true;
            }

            // Iterate through each of the Extended Data properties associated with the node and save non Site-Condition EDM to EDM tables.
            IXMLDOMNodeList nodelist = edmNode.selectNodes("EDMPROP");

            foreach (IXMLDOMNode node in nodelist)
            {
                EDM edm = new EDM();
                edm.Name  = node.attributes.getNamedItem("Name").text;
                edm.Value = node.text;
                edm.Type  = node.attributes.getNamedItem("Type").text;

                if (_EdmRepository.Type.Equals(edm.Type, StringComparison.OrdinalIgnoreCase))
                {
                    this.Save(wmsNode, edm);
                }
            }

            // Use the OOTB component to save Site Condition info.
            _WmsExtendedData.WriteEDMFromXML(wmsNode, edmNode);
        }
Esempio n. 2
0
        private void btnReplace_Click(object sender, EventArgs e)
        {
            string find    = txtFind.Text;
            string replace = txtReplace.Text;

            InfoPath.Application app   = Globals.ThisAddIn.Application;
            IXMLDOMNodeList      nodes = app.ActiveWindow.XDocument.DOM.documentElement.selectNodes("/descendant::*");

            foreach (IXMLDOMNode node in nodes)
            {
                if (node.nodeType == DOMNodeType.NODE_ELEMENT)
                {
                    if (node.childNodes.length == 1)
                    {
                        string tmpValue = node.text;
                        if (tmpValue.Length > 0)
                        {
                            node.text = tmpValue.Replace(find, replace);
                        }
                    }
                }
            }
        }
        public bool Save_before(ref IXMLDOMDocument2 domhead, ref IXMLDOMDocument2 dombody, ref string errMsg)
        {
            MomCallContext  currentMomCallContext = MomCallContextCache.Instance.CurrentMomCallContext;
            clsLogin        clsLogin = (clsLogin)currentMomCallContext.U8Login;
            IXMLDOMNodeList headval  = domhead.selectNodes("//rs:data/z:row");
            IXMLDOMNodeList bodyval  = dombody.selectNodes("//rs:data/z:row");

            string csocode = "", ddate = "", ccuscode = "", ccusname = "";
            string cinvcode = "", iquantity = "", iunitprice = "", cinvname = "";

            wl.WriteLogs("-------head start ------" + domhead.xml + "-----head end ------------");

            wl.WriteLogs("-------body start ------" + dombody.xml + "-----body end ------------");

            //销售订单头信息
            foreach (IXMLDOMElement item in headval)
            {
                csocode  = item.attributes.getNamedItem("csocode").nodeValue.ToString();
                ddate    = item.attributes.getNamedItem("ddate").nodeValue.ToString();
                ccuscode = item.attributes.getNamedItem("ccuscode").nodeValue.ToString();
                ccusname = item.attributes.getNamedItem("ccusname").nodeValue.ToString();
            }


            //销售订单行信息
            foreach (IXMLDOMElement item in bodyval)
            {
                cinvcode   = item.attributes.getNamedItem("cinvcode").nodeValue.ToString();
                iquantity  = item.attributes.getNamedItem("iquantity").nodeValue.ToString();
                iunitprice = item.attributes.getNamedItem("iunitprice").nodeValue.ToString();
                cinvname   = item.attributes.getNamedItem("cinvname").nodeValue.ToString();
            }

            MessageBox.Show("订单头信息:" + csocode + "-" + ddate + "-" + ccuscode + "-" + ccusname + "\r\n" + "订单行信息:行记录数为" + bodyval.length.ToString() + " ; " + cinvcode + "-" + iquantity + "-" + iunitprice + "-" + cinvname);

            return(true);
        }
Esempio n. 4
0
        public void OnSaveRequest(SaveEvent e)
        {
            //1. Validation
            //Most of  validations are completed by the validation rule in design mode
            //a. Validate the SubmitAnswers button
            //1)There is one SubmitAnswers button on the active pages
            //2)There is only one SubmitAnswers button on the active pages
            //3)That page must be the last page
            IXMLDOMNodeList endQuizPages = this.thisXDocument.DOM.selectNodes("//Complete/Page[@IsActive='true' and .//SubmitAnswers]");

            //1) no SubmitAnswers control
            if (endQuizPages.length == 0)
            {
                this.thisXDocument.UI.Alert("This form contains the following validation errors:\n\nThere is no SubmitAnswers control, this control must be on the last active page.\n");
                e.ReturnStatus = true;
                return;
            }
            //2) More that 1 SubmitAnswers control
            else if (endQuizPages.length > 1)
            {
                this.thisXDocument.UI.Alert("This form contains the following validation errors:\n\nSubmitAnswers control is on more than one active pages, this control can only be on the last active page.\n");
                e.ReturnStatus = true;
                return;
            }
            //One SubmitAnswers control
            else
            {
                IXMLDOMNode endControlPage = endQuizPages[0];
                //3) Is this page the last active page?
                IXMLDOMNodeList followingSiblingPages = endControlPage.selectNodes("following-sibling::Page[@IsActive='true']");
                if (followingSiblingPages.length > 0)
                {
                    this.thisXDocument.UI.Alert("This form contains the following validation errors:\n\nSubmitAnswers control is on other active page, this control can only be on the last active page.\n");
                    e.ReturnStatus = true;
                    return;
                }
            }

            //2. Set the quiz ID as the default new file name
            if (e.IsSaveAs || this.thisXDocument.IsNew)
            {
                IXMLDOMNode node = this.thisXDocument.DOM.selectSingleNode("//Summary/@ID");
                this.thisXDocument.UI.SetSaveAsDialogFileName(node.text);
            }

            //3. If the form is modified, set the last modified data
            if (!this.thisXDocument.IsNew)
            {
                IXMLDOMNode lastModifiedBy   = this.thisXDocument.DOM.selectSingleNode("//Summary/LastModifiedBy");
                IXMLDOMNode lastModifiedDate = this.thisXDocument.DOM.selectSingleNode("//Summary/LastModifiedDate");

                lastModifiedBy.text = System.Environment.UserName;

                //Determine whether the xsi:nil attribute is set for this
                //element. If so, remove the xsi:nil attributes so that
                //the value can be set.
                if (lastModifiedDate.attributes.getNamedItem("xsi:nil") != null)
                {
                    lastModifiedDate.attributes.removeNamedItem("xsi:nil");
                }
                lastModifiedDate.text = DateTime.Now.ToString("s");
            }


            e.IsCancelled = e.PerformSaveOperation();

            // Write the code to be run after saving here.
            e.ReturnStatus = true;
        }