Esempio n. 1
0
 /// <remarks/>
 public void GetPartyByGTINAsync(GetPartyByGTIN GetPartyByGTIN1) {
     this.GetPartyByGTINAsync(GetPartyByGTIN1, null);
 }
Esempio n. 2
0
 /// <remarks/>
 public void GetPartyByGTINAsync(GetPartyByGTIN GetPartyByGTIN1, object userState) {
     if ((this.GetPartyByGTINOperationCompleted == null)) {
         this.GetPartyByGTINOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetPartyByGTINOperationCompleted);
     }
     this.InvokeAsync("GetPartyByGTIN", new object[] {
                 GetPartyByGTIN1}, this.GetPartyByGTINOperationCompleted, userState);
 }
Esempio n. 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            //            _gtin = "6271021090002";

            if (string.IsNullOrEmpty(_gtin))
            {
                textBox3.Text = "no barcode available";
                return;
            }

            button1.Enabled = false;
            button2.Enabled = false;
            button3.Enabled = false;
            textBox3.Text = "";

            Application.DoEvents();

            router service = new router();
            service.PreAuthenticate = false;
            gepirRequestHeader header = new gepirRequestHeader();
            header.requesterGln = "1000000000009";  //GS1 US Customer Service GLN
            //6270000000001	GS1 Kuwait
            header.cascade = 9;
            service.gepirRequestHeaderValue = header;

            //service.GetItemByGTINCompleted += new GetItemByGTINCompletedEventHandler(service_GetItemByGTINCompleted);
            //service.GepirVersion2Completed += new GepirVersion2CompletedEventHandler(service_GepirVersion2Completed);

            GetItemByGTIN itemParam = new GetItemByGTIN();
            itemParam.requestedGtin = _gtin; // "6271021090002";
            itemParam.requestedLanguages = new string[] { "en" };
            itemParam.version = 3;
            //param.version = 7600001001001;

            GetPartyByGTIN partyParam = new GetPartyByGTIN();

            partyParam.requestedGtin = new string[] { _gtin };  // "6271021090002"
            partyParam.requestedLanguages = new string[] { "en" };

            service.UseDefaultCredentials = true;

            try
            {
                //gepirItem item = service.GetItemByGTIN(itemParam);

                gepirParty party = service.GetPartyByGTIN(partyParam);

                //string text = iterateThroughAllProperties(party);

                partyDataLineType dl = party.partyDataLine[0];

                StringBuilder sb = new StringBuilder();

                if (dl.partyName != null)
                {
                    sb.Append("Party Name: " + dl.partyName);
                    sb.Append(Environment.NewLine);
                }

                if (dl.streetAddress != null && dl.streetAddress[0] != null)
                {
                    sb.Append("Street Address: " + dl.streetAddress[0]);
                    sb.Append(Environment.NewLine);
                }

                if (dl.pOBoxNumber != null)
                {
                    sb.Append("PO Box Number: " + dl.pOBoxNumber);
                    sb.Append(Environment.NewLine);

                }

                if (dl.postalCode != null)
                {
                    sb.Append("Postal Code: " + dl.postalCode);
                    sb.Append(Environment.NewLine);
                }

                if (dl.city != null)
                {
                    sb.Append("City: " + dl.city);
                    sb.Append(Environment.NewLine);
                }

                if (dl.countryISOCode != null)
                    sb.Append("Country: " + dl.countryISOCode);

                if (sb.ToString() != "")
                {
                    textBox3.Text = sb.ToString();
                }
                else
                    textBox3.Text = "no information found";

            }
            catch (System.Web.Services.Protocols.SoapException sex)
            {
                String errorMessage = sex.Message;
                if (sex.Detail != null)
                {
                    System.Xml.XmlNode node = sex.Detail.SelectSingleNode("error");
                    if (node != null)
                    {
                        toolStripStatusLabelError.Text = node.Attributes["errorMessage"].Value;
                        //errorMessage = node.Attributes["errorMessage"].Value;
                    }
                }

                toolStripStatusLabelError.Text = errorMessage;
                toolStripStatusLabelError.ForeColor = Color.Black;
                //throw new Exception(errorMessage);
            }

            //textBox3.Select(0, 0);
            HideCaret(textBox3);
            button1.Enabled = true;
            button2.Enabled = true;
            button3.Enabled = true;

            button1.Focus();
        }