internal override void commandImplementation()
        {
            BladeResponse     myResponse  = new BladeResponse();
            AllBladesResponse myResponses = new AllBladesResponse();
            dynamic           myLimit     = null;
            dynamic           mySledId    = null;

            this.argVal.TryGetValue('l', out myLimit);

            try
            {
                if (this.argVal.ContainsKey('a'))
                {
                    myResponses = WcsCli2CmConnectionManager.channel.SetAllBladesPowerLimit((double)myLimit);
                }
                else if (this.argVal.ContainsKey('i'))
                {
                    this.argVal.TryGetValue('i', out mySledId);
                    myResponse = WcsCli2CmConnectionManager.channel.SetBladePowerLimit((int)mySledId, (double)myLimit);
                }
            }
            catch (Exception ex)
            {
                SharedFunc.ExceptionOutput(ex);
                return;
            }

            if ((this.argVal.ContainsKey('a') && myResponses == null) || myResponse == null)
            {
                Console.WriteLine(WcsCliConstants.serviceResponseEmpty);
                return;
            }

            if (this.argVal.ContainsKey('a'))
            {
                for (int index = 0; index < myResponses.bladeResponseCollection.Count(); index++)
                {
                    if (ResponseValidation.ValidateBladeResponse(myResponses.bladeResponseCollection[index].bladeNumber, null, myResponses.bladeResponseCollection[index], false))
                    {
                        Console.WriteLine(WcsCliConstants.commandSuccess + "Blade " + myResponses.bladeResponseCollection[index].bladeNumber + ": Power Limit Set");
                    }
                }
            }
            else
            {
                if (ResponseValidation.ValidateBladeResponse(myResponse.bladeNumber, null, myResponse, false))
                {
                    Console.WriteLine(WcsCliConstants.commandSuccess + "Blade " + myResponse.bladeNumber + ": Power Limit Set");
                }
            }
        }
Ejemplo n.º 2
0
        internal override void commandImplementation()
        {
            uint              sledId      = 1;
            BladeResponse     myResponse  = new BladeResponse();
            AllBladesResponse myResponses = new AllBladesResponse();

            try
            {
                if (this.argVal.ContainsKey('a'))
                {
                    myResponses = WcsCli2CmConnectionManager.channel.SetAllBladesPowerLimitOff();
                }
                else if (this.argVal.ContainsKey('i'))
                {
                    dynamic mySledId = null;
                    this.argVal.TryGetValue('i', out mySledId);
                    sledId     = (uint)mySledId;
                    myResponse = WcsCli2CmConnectionManager.channel.SetBladePowerLimitOff((int)mySledId);
                }
            }
            catch (Exception ex)
            {
                SharedFunc.ExceptionOutput(ex);
                return;
            }

            if ((this.argVal.ContainsKey('a') && myResponses == null) || myResponse == null)
            {
                Console.WriteLine(WcsCliConstants.serviceResponseEmpty);
                return;
            }

            if (this.argVal.ContainsKey('a'))
            {
                for (int index = 0; index < myResponses.bladeResponseCollection.Count(); index++)
                {
                    if (myResponses.bladeResponseCollection[index].completionCode == Contracts.CompletionCode.Success)
                    {
                        Console.WriteLine("Blade " + myResponses.bladeResponseCollection[index].bladeNumber + ": Power Limit Deactive");
                    }
                    else if (myResponse.completionCode == Contracts.CompletionCode.Unknown)
                    {
                        Console.WriteLine("Blade " + myResponses.bladeResponseCollection[index].bladeNumber + ": " + WcsCliConstants.bladeStateUnknown);
                    }
                    else
                    {
                        // Display error if other than success/unknown
                        Console.WriteLine("Blade " + myResponses.bladeResponseCollection[index].bladeNumber + " failed with completion code: " + myResponses.bladeResponseCollection[index].completionCode.ToString());
                    }
                }
            }
            else
            {
                if (myResponse.completionCode == Contracts.CompletionCode.Success)
                {
                    Console.WriteLine("Blade " + myResponse.bladeNumber + ": Power Limit Deactive");
                }
                else if (myResponse.completionCode == Contracts.CompletionCode.Unknown)
                {
                    Console.WriteLine("Blade " + myResponse.bladeNumber + ": " + WcsCliConstants.bladeStateUnknown);
                }
                else
                {
                    // Display error if other than success/unknown
                    Console.WriteLine("Blade " + myResponse.bladeNumber + ": " + myResponse.completionCode.ToString());
                }
            }
        }