Exemplo n.º 1
0
        /// <summary>
        /// Client callable code to get PriorityTypeCodes.
        /// </summary>
        /// <param name="async">Call asynchronously.</param>
        /// <returns>True if get is successful</returns>
        public bool ClientGetPriorityTypeCodes(bool async)
        {
            if (UseWcfService)
            {
                try
                {
                    WCF.IssuesContractClient        svWCF = new WCF.IssuesContractClient();
                    WCF.GetPriorityTypeCodesRequest rqWCF = new WCF.GetPriorityTypeCodesRequest();

                    if (async)
                    {
                        svWCF.BeginGetPriorityTypeCodes(rqWCF, wcf_ClientGetPriorityTypeCodesCompleted, svWCF);
                        return(true);
                    }
                    else
                    {
                        WCF.GetPriorityTypeCodesResponse rsWCF = svWCF.GetPriorityTypeCodes(rqWCF);
                        Merge(rsWCF.CodesCD, false, MissingSchemaAction.Ignore);
                        PrepareDataAfterGet();
                        return(true);
                    }
                }
                catch { UseWcfService = false; }                 // ignore if not responding
            }
            if (UseAsmxService)
            {
                try
                {
                    ASMX.IssuesServiceASMX           svASMX = new ASMX.IssuesServiceASMX();
                    ASMX.GetPriorityTypeCodesRequest rqASMX = new ASMX.GetPriorityTypeCodesRequest();

                    if (async)
                    {
                        svASMX.GetPriorityTypeCodesCompleted += asmx_ClientGetPriorityTypeCodesCompleted;
                        svASMX.GetPriorityTypeCodesAsync(rqASMX);
                        return(true);
                    }
                    else
                    {
                        ASMX.GetPriorityTypeCodesResponse rsASMX = svASMX.GetPriorityTypeCodes(rqASMX);
                        Merge(rsASMX.CodesCD, false, MissingSchemaAction.Ignore);
                        PrepareDataAfterGet();
                        return(true);
                    }
                }
                catch { UseAsmxService = false; }                 // ignore if not responding
            }
            if (UseClientServer)
            {
                try
                {
                    Merge(GetPriorityTypeCodes(), false, MissingSchemaAction.Ignore);
                    PrepareDataAfterGet();
                    return(true);
                }
                catch { UseClientServer = false; }                 // ignore if not responding
            }

            return(false);
        }
Exemplo n.º 2
0
 private void wcf_ClientGetPriorityTypeCodesCompleted(IAsyncResult ar)
 {
     WCF.GetPriorityTypeCodesResponse rsWCF = ((WCF.IssuesContractClient)ar.AsyncState).EndGetPriorityTypeCodes(ar);
     Merge(rsWCF.CodesCD.PriorityTypes, false, MissingSchemaAction.Ignore);
     PrepareDataAfterGet();
     ClientGetPriorityTypeCodesCompleted(this, new EventArgs());
 }