예제 #1
0
        /// <summary>
        /// command specific implementation 
        /// </summary>
        internal override void commandImplementation()
        {
            ServiceVersionResponse myResponse = new ServiceVersionResponse();
            try
            {
                myResponse = WcsCli2CmConnectionManager.channel.GetServiceVersion();
            }
            catch (Exception ex)
            {
                SharedFunc.ExceptionOutput(ex);
                return;
            }

            if (myResponse == null)
            {
                Console.WriteLine(WcsCliConstants.serviceResponseEmpty);
                return;
            }

            if (myResponse.completionCode == Contracts.CompletionCode.Success)
            {
                Console.WriteLine("Chassis Manager Service version: " + myResponse.serviceVersion);
            }
            else if (myResponse.completionCode == Contracts.CompletionCode.Failure)
            {
                Console.WriteLine(WcsCliConstants.commandFailure);
            }
            else if (myResponse.completionCode == Contracts.CompletionCode.Timeout)
            {
                Console.WriteLine(WcsCliConstants.commandTimeout);
            }
            else
            {
                Console.WriteLine("Command failed with the completion code: {0}", myResponse.completionCode.ToString());
            }
        }
        /// <summary>
        /// Get Chassis Manager product version
        /// </summary>
        /// <returns>service product version</returns>
        public Contracts.ServiceVersionResponse GetServiceVersion()
        {
            Contracts.ServiceVersionResponse serviceVersion = new ServiceVersionResponse();
            Tracer.WriteUserLog("Invoked GetServiceVersion");
            Tracer.WriteInfo("Received GetServiceVersion");

            serviceVersion.serviceVersion = null;
            serviceVersion.completionCode = Contracts.CompletionCode.Unknown;
            serviceVersion.statusDescription = String.Empty;
            try
            {
                Assembly assembly = Assembly.GetExecutingAssembly();
                FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
                string version = fileVersionInfo.ProductVersion;
                serviceVersion.serviceVersion = version;
                serviceVersion.completionCode = Contracts.CompletionCode.Success;
            }
            catch (Exception ex)
            {
                serviceVersion.completionCode = Contracts.CompletionCode.Failure;
                serviceVersion.statusDescription = String.Format("GetServiceVersion failed with exception: {0}", ex.Message);
                Tracer.WriteError("GetServiceVersion failed with exception" + ex);
            }

            return serviceVersion;
        }
        /// <summary>
        /// command specific implementation 
        /// </summary>
        internal override void commandImplementation()
        {
            ServiceVersionResponse myResponse = new ServiceVersionResponse();
            try
            {
                myResponse = WcsCli2CmConnectionManager.channel.GetServiceVersion();
            }
            catch (Exception ex)
            {
                SharedFunc.ExceptionOutput(ex);
                return;
            }

            if (ResponseValidation.ValidateResponse(null, myResponse, false))
            {
                Console.WriteLine(WcsCliConstants.commandSuccess + " Chassis Manager Service version: " + myResponse.serviceVersion);
            }
        }