Ejemplo n.º 1
0
        /*private SiebelAnswer()
         * {
         *  errorMessage = "";
         *  invokeMethodResult = null;
         *  functionResult = null;
         * }*/

        /// <summary>
        /// For succesful result
        /// </summary>
        /// <param name="InvokeMethodResult">property set it returned from invoke Method. It include FunctionResult</param>
        /// <param name="FunctionResult">result of function</param>
        public SiebelAnswer(SiebelWrapper.PropertySet InvokeMethodResult, SiebelWrapper.PropertySet FunctionResult)
        {
            isError            = false;
            invokeMethodResult = InvokeMethodResult;
            functionResult     = FunctionResult;
            errorMessage       = "";
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Siebel return is error
 /// </summary>
 /// <param name="InvokeMethodResult">property set it returned from invoke Method. It include FunctionResult</param>
 /// <param name="ErrorMessage">Message for user</param>
 public SiebelAnswer(SiebelWrapper.PropertySet InvokeMethodResult, string ErrorMessage)
 {
     isError            = true;
     invokeMethodResult = InvokeMethodResult;
     functionResult     = null;
     errorMessage       = ErrorMessage;
 }
        private void SetPs(TreeNode node, SiebelWrapper.PropertySet ps)
        {
            //SiebProperty prop = new SiebProperty( ps.GetType(), ps.GetValue(), SiebProperty.PropertyType.PropertySet);
            SiebProperty prop     = new SiebProperty(ps.PsType, ps.PsValue, SiebProperty.PropertyType.PropertySet);
            string       propName = "";

            prop.ToTreeNode(node);
            //for (int i = 0; i < ps.GetPropertyCount(); i++)
            for (int i = 0; i < ps.PropertyCount; i++)
            {
                if (i == 0)
                {
                    propName = ps.GetFirstProperty();
                }
                else
                {
                    propName = ps.GetNextProperty();
                }
                //node.Nodes.Add(new SiebProperty(propName, ps.GetProperty(propName)).ToTreeNode());
                node.Nodes.Add(new SiebProperty(propName, ps.Property(propName)).ToTreeNode());
            }
            //for (int i = 0; i < ps.GetChildCount(); i++)
            for (int i = 0; i < ps.ChildCount; i++)
            {
                //SIEBELHTMLLib.SiebelPropertySet n = ps.GetChild(i);
                SiebelWrapper.PropertySet n = ps.GetChild(i);
                TreeNode tn = new TreeNode();
                SetPs(tn, n);
                node.Nodes.Add(tn);
            }
        }
        private void GetPs(ref SiebelWrapper.PropertySet mainPs, TreeNode node, bool namesWitoutValues)
        {
            SiebProperty siebProp = (SiebProperty)node.Tag;

            SiebelWrapper.PropertySet ps = new SiebelWrapper.PropertySet();
            if (siebProp.Type == SiebProperty.PropertyType.PropertySet)
            {
                //ps.SetPsType(siebProp.Name);
                ps.PsType = siebProp.Name;
                if (!namesWitoutValues)
                {
                    ps.PsValue = siebProp.Value;
                }
                foreach (TreeNode n in node.Nodes)
                {
                    GetPs(ref ps, n, namesWitoutValues);
                }
                mainPs.AddChild(ps);
            }
            else
            if (namesWitoutValues)
            {
                //mainPs.SetProperty(siebProp.Name, "");
                mainPs.Property(siebProp.Name, "");
            }

            //mainPs.
            else
            {
                //mainPs.SetProperty(siebProp.Name, siebProp.Value);
                mainPs.Property(siebProp.Name, siebProp.Value);
            }
        }
        private void RunFunction()
        {
            SiebelWrapper sw = new SiebelWrapper();

            SiebelWrapper.PropertySet ips = new SiebelWrapper.PropertySet();
            SiebelAnswer answer;

            GetPs(ref ips, tvIps.Nodes[0], false);

            //ops = sw.InvokeMethod(txtService.Text, txtFunction.Text, ips);
            answer = sw.InvokeMethod(txtService.Text, txtFunction.Text, ips.GetChild(0));

            tvOps.Nodes[0].Nodes.Clear();
            (new SiebProperty("", "", SiebProperty.PropertyType.PropertySet)).ToTreeNode(tvOps.Nodes[0]);
            tvLog.Nodes[0].Nodes.Clear();
            SetPs(tvLog.Nodes[0], answer.InvokeMethodResult);
            tvLog.ExpandAll();

            if (answer.IsError)
            {
                MessageBox.Show(answer.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                SetPs(tvOps.Nodes[0], answer.FunctionResult);
                tvOps.ExpandAll();
                txtService.AutoCompleteCustomSource.Add(txtService.Text);
                txtFunction.AutoCompleteCustomSource.Add(txtFunction.Text);
            }
        }
/// <summary>
/// return xml document, it contain bsName, function name and ips,
/// </summary>
/// <returns></returns>
        private XmlDocument SaveContextToXML()
        {
            XmlDocument doc = new XmlDocument();
            XmlNode     n   = doc.CreateElement("RunBS");

            SiebelWrapper.PropertySet ips = new SiebelWrapper.PropertySet();

            XmlNode attr = doc.CreateAttribute("BsName");

            attr.Value = this.txtService.Text;
            n.Attributes.SetNamedItem(attr);

            attr       = doc.CreateAttribute("BsFunction");
            attr.Value = this.txtFunction.Text;
            n.Attributes.SetNamedItem(attr);

            SiebelWrapper sw = new SiebelWrapper();

            GetPs(ref ips, tvIps.Nodes[0], false);
            string xmlStr = sw.PsToXml(ips);

            XmlDocument resp = new XmlDocument();

            resp.LoadXml(xmlStr);

            attr = doc.CreateElement("PS");

            //attr.InnerXml = resp.DocumentElement.InnerXml;
            attr.InnerXml = resp.DocumentElement.OuterXml;
            n.AppendChild(attr);

            doc.AppendChild(n);
            return(doc);
        }
        private void SetPs(TreeNode t, string Xml)
        {
            SiebelWrapper sw = new SiebelWrapper();

            SiebelWrapper.PropertySet ps = sw.PsFromXml(Xml);


            //string xmlStr = sw.PsToXml(ips);
        }