コード例 #1
0
// ReSharper disable RedundantNameQualifier
        private void asmx_ClientGetGridFiltersCompleted(object sender, ASMX.GetGridFiltersCompletedEventArgs e)
// ReSharper restore RedundantNameQualifier
        {
            try
            {
                ASMX.GetGridFiltersResponse rsASMX = e.Result;
                Merge(rsASMX.GridFiltersCD, false, MissingSchemaAction.Ignore);
                ClientGetGridFiltersCompleted(this, new EventArgs());
            }
            catch { }
        }
コード例 #2
0
        /// <summary>
        ///  Client callable code to get all GridFilters async
        /// </summary>
        public void ClientGetGridFiltersAsync(string userName, string gridName)
        {
            if (UseWcfService)
            {
                try
                {
                    var svWCF = new WCF.SettingsContractClient();
                    svWCF.Ping();

                    var rqWCF = new WCF.GetGridFiltersRequest {
                        UserName = userName, GridName = gridName
                    };

                    svWCF.BeginGetGridFilters(rqWCF, wcf_ClientGetGridFiltersCompleted, svWCF);
                }
                catch { UseWcfService = false; }                 // ignore if not responding
            }
            if (UseAsmxService)
            {
                try
                {
                    var svASMX = new ASMX.SettingsServiceASMX();

// ReSharper disable RedundantNameQualifier
                    var rqASMX = new ASMX.GetGridFiltersRequest {
                        UserName = userName, GridName = gridName
                    };
// ReSharper restore RedundantNameQualifier

                    svASMX.GetGridFiltersCompleted += asmx_ClientGetGridFiltersCompleted;
                    svASMX.GetGridFiltersAsync(rqASMX);
                }
                catch { UseAsmxService = false; }                 // ignore if not responding
            }
            if (UseClientServer)
            {
                try
                {
                    DataSet result = GetGridFilters(userName, gridName);
// ReSharper disable RedundantNameQualifier
                    var rs = new ASMX.GetGridFiltersResponse {
                        GridFiltersCD = new ASMX.GridFiltersCD()
                    };
// ReSharper restore RedundantNameQualifier
                    rs.GridFiltersCD.Merge(result, false, MissingSchemaAction.Ignore);
// ReSharper disable RedundantNameQualifier
                    var e = new ASMX.GetGridFiltersCompletedEventArgs(new object[] { rs }, null, false, null);
// ReSharper restore RedundantNameQualifier
                    asmx_ClientGetGridFiltersCompleted(this, e);
                }
                catch { UseClientServer = false; }                 // ignore if not responding
            }
        }
コード例 #3
0
        /// <summary>
        /// Client callable code to get GridFilters.
        /// </summary>
        /// <returns>True if get is successful</returns>
        public bool ClientGetGridFilters(string userName, string gridName)
        {
            if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(gridName))
            {
                throw new Exception("The UserName and/or GridName is null or empty.");
            }

            if (UseWcfService)
            {
                try
                {
                    var svWCF = new WCF.SettingsContractClient();
                    var rqWCF = new WCF.GetGridFiltersRequest {
                        UserName = userName, GridName = gridName
                    };

                    WCF.GetGridFiltersResponse rsWCF = svWCF.GetGridFilters(rqWCF);
                    Merge(rsWCF.GridFiltersCD, false, MissingSchemaAction.Ignore);
                    return(true);
                }
                catch { UseWcfService = false; }                 // ignore if not responding
            }
            if (UseAsmxService)
            {
                try
                {
                    var svASMX = new ASMX.SettingsServiceASMX();
// ReSharper disable RedundantNameQualifier
                    var rqASMX = new ASMX.GetGridFiltersRequest {
                        UserName = userName, GridName = gridName
                    };
// ReSharper restore RedundantNameQualifier

                    ASMX.GetGridFiltersResponse rsASMX = svASMX.GetGridFilters(rqASMX);
                    Merge(rsASMX.GridFiltersCD, false, MissingSchemaAction.Ignore);
                    return(true);
                }
                catch { UseAsmxService = false; }                 // ignore if not responding
            }
            if (UseClientServer)
            {
                try
                {
                    Merge(GetGridFilters(userName, gridName));
                    return(true);
                }
                catch { UseClientServer = false; }                 // ignore if not responding
            }

            return(false);
        }