コード例 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            WcfKernelService.KernelServiceClient krnsrv = new WcfKernelService.KernelServiceClient();

            using (new OperationContextScope(krnsrv.InnerChannel))
            {
                HttpRequestMessageProperty req = new HttpRequestMessageProperty();

                if (this.rbtnNormalSession.Checked)
                {
                    req.Headers.Add("SessionID", this.sessionId);
                }
                else
                {
                    this.AddOneTimeSessionHeaders(req.Headers);
                }

                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = req;

                try
                {
                    krnsrv.DeleteBusinessObject(
                        @"<root>
                            <type>" + this.cboxType.SelectedItem.ToString() + @"</type>
                            <id>" + this.txtBoxId.Text + @"</id>
                         </root>");
                }
                catch (Exception ex)
                {
                    krnsrv.Close();
                    MessageBoxForm.Show(ex.Message);
                }
            }
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            WcfKernelService.KernelServiceClient krnsrv = new WcfKernelService.KernelServiceClient();

            using (new OperationContextScope(krnsrv.InnerChannel))
            {
                HttpRequestMessageProperty req = new HttpRequestMessageProperty();

                if (this.rbtnNormalSession.Checked)
                {
                    req.Headers.Add("SessionID", this.sessionId);
                }
                else
                {
                    this.AddOneTimeSessionHeaders(req.Headers);
                }

                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = req;

                try
                {
                    MessageBoxForm.Show(krnsrv.SaveBusinessObject(this.xml));
                }
                catch (Exception ex)
                {
                    krnsrv.Close();
                    MessageBoxForm.Show(ex.Message);
                }
            }
        }
コード例 #3
0
        private void btnCustom_Click(object sender, EventArgs e)
        {
            WcfKernelService.KernelServiceClient krnsrv = new WcfKernelService.KernelServiceClient();

            using (new OperationContextScope(krnsrv.InnerChannel))
            {
                HttpRequestMessageProperty req = new HttpRequestMessageProperty();

                if (this.rbtnNormalSession.Checked)
                {
                    req.Headers.Add("SessionID", this.sessionId);
                }
                else
                {
                    this.AddOneTimeSessionHeaders(req.Headers);
                }

                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = req;

                string methodName = cboxMethodName.Text;

                MethodInfo mi = krnsrv.GetType().GetMethod(methodName);

                bool hasInput  = mi.GetParameters().Length != 0;
                bool hasOutput = mi.ReturnType != typeof(void);

                if (hasOutput && hasInput)
                {
                    MessageBoxForm.Show(mi.Invoke(krnsrv, new object[] { this.xml }).ToString());
                }
                else if (hasOutput && !hasInput)
                {
                    MessageBoxForm.Show(mi.Invoke(krnsrv, null).ToString());
                }
                else if (!hasOutput && hasInput)
                {
                    mi.Invoke(krnsrv, new object[] { this.xml });
                }
                else
                {
                    mi.Invoke(krnsrv, null);
                }

                krnsrv.Close();
            }
        }
コード例 #4
0
        private void btnCreateNewBO_Click(object sender, EventArgs e)
        {
            WcfKernelService.KernelServiceClient krnsrv = new WcfKernelService.KernelServiceClient();

            using (new OperationContextScope(krnsrv.InnerChannel))
            {
                HttpRequestMessageProperty req = new HttpRequestMessageProperty();

                if (this.rbtnNormalSession.Checked)
                {
                    req.Headers.Add("SessionID", this.sessionId);
                }
                else
                {
                    this.AddOneTimeSessionHeaders(req.Headers);
                }

                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = req;

                try
                {
                    XDocument param = XDocument.Parse("<root/>");
                    param.Root.Add(new XElement("type", this.cboxType.SelectedItem));

                    if (this.txtBoxTemplate.Text.Length != 0)
                    {
                        param.Root.Add(new XElement("template", this.txtBoxTemplate.Text));
                    }

                    if (this.txtBoxSource.Text.Length != 0)
                    {
                        param.Root.Add(XElement.Parse(this.txtBoxSource.Text));
                    }

                    this.xml = krnsrv.CreateNewBusinessObject(param.ToString(SaveOptions.DisableFormatting));
                }
                catch (Exception ex)
                {
                    krnsrv.Close();
                    MessageBoxForm.Show(ex.Message);
                }
            }
        }
コード例 #5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            WcfKernelService.KernelServiceClient krnsrv = new WcfKernelService.KernelServiceClient();

            try
            {
                XDocument xml = XDocument.Parse(String.Format(CultureInfo.InvariantCulture,
                                                              "<root><username>{0}</username><password>{1}</password><language>{2}</language><profile>{3}</profile></root>",
                                                              this.txtBoxUser.Text, this.txtBoxPassword.Text, this.txtBoxLanguage.Text, this.txtBoxProfile.Text));

                string retXml = krnsrv.LogOn(xml.ToString(SaveOptions.DisableFormatting));

                xml            = XDocument.Parse(retXml);
                this.sessionId = xml.Root.Element("sessionId").Value;
                MessageBoxForm.Show(xml.ToString());
            }
            catch (Exception ex)
            {
                MessageBoxForm.Show(ex.Message);
            }

            krnsrv.Close();
        }
コード例 #6
0
        private void btnExecuteCustomProc_Click(object sender, EventArgs e)
        {
            WcfKernelService.KernelServiceClient krnsrv = new WcfKernelService.KernelServiceClient();

            using (new OperationContextScope(krnsrv.InnerChannel))
            {
                HttpRequestMessageProperty req = new HttpRequestMessageProperty();

                if (this.rbtnNormalSession.Checked)
                {
                    req.Headers.Add("SessionID", this.sessionId);
                }
                else
                {
                    this.AddOneTimeSessionHeaders(req.Headers);
                }

                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = req;

                // MessageBoxForm.Show(new StreamReader( krnsrv.ExecuteCustomProcedureStream(this.txtBoxCustomProcName.Text, "364EBB10-A744-4A76-AD6F-E764BC9827BD", "@commercialDocumentHeaderId") ).ReadToEnd());

                krnsrv.Close();
            }
        }