예제 #1
0
        private async void button2_Click(object sender, EventArgs e)
        {
            var client = new MethodInvokerServiceClient();
            var result = await client.InvokeServiceMethodAsync(new ServiceMethodInvokerParams {
                DatabaseHandle = DbName,
                Operator       = "Administrator",
                Password       = "",
                ServiceName    = ServiceName,
                MethodName     = "EksportujCennik",
                MethodArgs     = new Dictionary <string, object> {
                    { "tsvContent", textBox1.Text }
                }
            });

            textBox1.Text = "";
            if (result.IsException)
            {
                MessageBox.Show(this, result.ExceptionMessage, "Eksport cennika", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show(this, "Wysyłanie cennika do serwisu zakończone", "Eksport cennika", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
        }
        internal void Invoke(IRequestInfo requestInfo)
        {
            var client  = new MethodInvokerServiceClient();
            var @params = CreateServiceParams(
                requestInfo.MethodName,
                requestInfo.MethodArgs);

            var result = client.InvokeServiceMethod(@params);

            Trace.WriteLine(result.ResultInstance, "XML");
            Trace.WriteLine(
                requestInfo.ResultProcessor?.Process(result),
                "List");
        }
예제 #3
0
        private async void button1_Click(object sender, EventArgs e)
        {
            var client = new MethodInvokerServiceClient();
            var result = await client.InvokeServiceMethodAsync(new ServiceMethodInvokerParams {
                DatabaseHandle = DbName,
                Operator       = "Administrator",
                Password       = "",
                ServiceName    = ServiceName,
                MethodName     = "ImportujCennik",
                MethodArgs     = new Dictionary <string, object>()
            });

            if (result.IsException)
            {
                textBox1.ForeColor = Color.DarkRed;
                textBox1.Text      = "-- Błąd wywołania metody serwisu --";
            }
            else
            {
                textBox1.ForeColor = Color.DarkGreen;
                textBox1.Text      = result.ResultInstance.ToString();
                button2.Enabled    = true;
            }
        }