Ejemplo n.º 1
0
 private void wcf_ClientGetIssuesCompleted(IAsyncResult ar)
 {
     WCF.GetIssuesResponse rsWCF = ((WCF.IssuesContractClient)ar.AsyncState).EndGetIssues(ar);
     Merge(rsWCF.IssuesCD, false, MissingSchemaAction.Ignore);
     PrepareDataAfterGet();
     ClientGetIssuesCompleted(this, new EventArgs());
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Client callable code to get Issues.
        /// </summary>
        /// <param name="async">Call asynchronously.</param>
        /// <returns>True if get is successful</returns>
        public bool ClientGetIssues(bool async)
        {
            if (UseWcfService)
            {
                try
                {
                    WCF.IssuesContractClient svWCF = new WCF.IssuesContractClient();
                    WCF.GetIssuesRequest     rqWCF = new WCF.GetIssuesRequest();

                    if (async)
                    {
                        string ping = svWCF.Ping();
                        if (String.IsNullOrEmpty(ping))
                        {
                            throw new Exception("WCF is offline.");
                        }

                        svWCF.BeginGetIssues(rqWCF, wcf_ClientGetIssuesCompleted, svWCF);
                        return(true);
                    }
                    else
                    {
                        WCF.GetIssuesResponse rsWCF = svWCF.GetIssues(rqWCF);
                        Merge(rsWCF.IssuesCD, false, MissingSchemaAction.Ignore);
                        PrepareDataAfterGet();
                        return(true);
                    }
                }
                catch { UseWcfService = false; }                 // ignore if not responding
            }
            if (UseAsmxService)
            {
                try
                {
                    ASMX.IssuesServiceASMX svASMX = new ASMX.IssuesServiceASMX();
                    ASMX.GetIssuesRequest  rqASMX = new ASMX.GetIssuesRequest();

                    if (async)
                    {
                        svASMX.GetIssuesCompleted += asmx_ClientGetIssuesCompleted;
                        svASMX.GetIssuesAsync(rqASMX);
                        return(true);
                    }
                    else
                    {
                        ASMX.GetIssuesResponse rsASMX = svASMX.GetIssues(rqASMX);
                        Merge(rsASMX.IssuesCD, false, MissingSchemaAction.Ignore);
                        PrepareDataAfterGet();
                        return(true);
                    }
                }
                catch { UseAsmxService = false; }                 // ignore if not responding
            }
            if (UseClientServer)
            {
                try
                {
                    Merge(GetIssues(), false, MissingSchemaAction.Ignore);
                    PrepareDataAfterGet();
                    return(true);
                }
                catch { UseClientServer = false; }                 // ignore if not responding
            }

            return(false);
        }