예제 #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);
        }
예제 #2
0
        /// <summary>
        /// Client callable code to Delete/Insert/Update Issues
        /// </summary>
        /// <returns>True if update is successful. If False, check for RowErrors.</returns>
        public bool ClientUpdateIssues(bool async)
        {
            PrepareDataBeforeUpdate();

            IssuesCD updatedIssues = new IssuesCD();

            updatedIssues.Merge(Tables["Issues"].Select("", "", DataViewRowState.Deleted), false, MissingSchemaAction.Ignore);
            updatedIssues.Merge(Tables["Issues"].Select("", "", DataViewRowState.Added), false, MissingSchemaAction.Ignore);
            updatedIssues.Merge(Tables["Issues"].Select("", "", DataViewRowState.ModifiedCurrent), false, MissingSchemaAction.Ignore);

            if (updatedIssues.Issues.Rows.Count > 0)
            {
                if (UseWcfService)
                {
                    try
                    {
                        WCF.IssuesContractClient svWCF = new WCF.IssuesContractClient();
                        WCF.UpdateIssuesRequest  rqWCF = new WCF.UpdateIssuesRequest();
                        rqWCF.IssuesCD = new IssuesServiceWCF.IssuesCD();
                        rqWCF.IssuesCD.Merge(updatedIssues, false, MissingSchemaAction.Ignore);

                        if (async)
                        {
                            string ping = svWCF.Ping();
                            if (String.IsNullOrEmpty(ping))
                            {
                                throw new Exception("WCF is offline.");
                            }
                            svWCF.BeginUpdateIssues(rqWCF, wcf_ClientUpdateIssuesCompleted, svWCF);
                            return(true);
                        }
                        else
                        {
                            WCF.UpdateIssuesResponse rsWCF = svWCF.UpdateIssues(rqWCF);
                            Merge(rsWCF.IssuesCD, false, MissingSchemaAction.Ignore);
                            PrepareDataAfterUpdate();
                            return(true);
                        }
                    }
                    catch { UseWcfService = false; }                     // ignore if not responding
                }
                if (UseAsmxService)
                {
                    try
                    {
                        ASMX.IssuesServiceASMX   svASMX = new ASMX.IssuesServiceASMX();
                        ASMX.UpdateIssuesRequest rqASMX = new ASMX.UpdateIssuesRequest();
                        rqASMX.IssuesCD = new IssuesServiceASMX.IssuesCD();
                        rqASMX.IssuesCD.Merge(updatedIssues, false, MissingSchemaAction.Ignore);

                        if (async)
                        {
                            svASMX.UpdateIssuesCompleted += asmx_ClientUpdateIssuesCompleted;
                            svASMX.UpdateIssuesAsync(rqASMX);
                            return(true);
                        }
                        else
                        {
                            ASMX.UpdateIssuesResponse rsASMX = svASMX.UpdateIssues(rqASMX);
                            Merge(rsASMX.IssuesCD, false, MissingSchemaAction.Ignore);
                            PrepareDataAfterUpdate();
                            return(true);
                        }
                    }
                    catch { UseAsmxService = false; }                     // ignore if not responding
                }
                if (UseClientServer)
                {
                    try
                    {
                        Merge(UpdateIssues(updatedIssues), false, MissingSchemaAction.Ignore);
                        PrepareDataAfterUpdate();
                        return(true);
                    }
                    catch { UseClientServer = false; }                     // ignore if not responding
                }
            }

            return(false);
        }
예제 #3
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);
        }