Ejemplo n.º 1
0
 private void wcf_ClientGetGridFiltersCompleted(IAsyncResult ar)
 {
     try
     {
         WCF.GetGridFiltersResponse rsWCF = ((WCF.SettingsContractClient)ar.AsyncState).EndGetGridFilters(ar);
         Merge(rsWCF.GridFiltersCD, false, MissingSchemaAction.Ignore);
         ClientGetGridFiltersCompleted(this, new EventArgs());
     }
     catch { }
 }
Ejemplo n.º 2
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);
        }