Ejemplo n.º 1
0
        private static void TestClientProxy()
        {
            ClientProxy.ClientServiceClient cp = new ClientServiceClient();
            var clientResult = cp.GetClient(GetClientBy.ClientID, 1, null, null, true, true);

            MonitoringProxy.MonitoringServiceClient mp = new MonitoringServiceClient();

            List <RmsReportMonitoringRaw> lRawMessage = new List <RmsReportMonitoringRaw>();

            foreach (var mpd in clientResult.ListMonitoringProfileDevices)
            {
                var rawMessage = new RmsReportMonitoringRaw();
                rawMessage.ClientCode = clientResult.Client.ClientCode;
                rawMessage.DeviceCode = clientResult.ListDevices.First(d => d.DeviceId == mpd.DeviceId).DeviceCode;

                if (mpd.MonitoringProfileDeviceId != 16)
                {
                    rawMessage.Message = "OK";
                }
                else
                {
                    rawMessage.Message = "DEVICE_NOT_READY";
                }
                rawMessage.MessageDateTime           = DateTime.Now;
                rawMessage.MonitoringProfileDeviceId = mpd.MonitoringProfileDeviceId;

                lRawMessage.Add(rawMessage);
            }

            mp.AddMessages(lRawMessage);
        }
        /// <summary>
        /// Loads the client details.
        /// </summary>
        private void LoadClient()
        {
            ClientServiceClient serviceClient = null;
            try
            {

                if (_logonSettings.UserType == (int)DataConstants.UserType.ThirdParty && Request.QueryString["mydetails"] == "true")
                {
                    LoadContact();
                }
                else
                {
                    serviceClient = new ClientServiceClient();
                    _clientReturnValue = serviceClient.GetClient(_logonSettings.LogonId, _memberId, _organisationId);

                    if (_clientReturnValue.Success)
                    {
                        DisplayData();
                    }
                    else
                    {
                        throw new Exception(_clientReturnValue.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (serviceClient != null)
                {
                    if (serviceClient.State != System.ServiceModel.CommunicationState.Faulted)
                        serviceClient.Close();
                }
            }
        }