public async Task Should_Save_AValidClientValue()
        {
            using (IDbConnection dbConnection = SqlExecutor.OpenNewDbConnection())
            {
                // Arrange
                IEnumerable <CLIENTES1> value = await dbConnection.GetAllAsync <CLIENTES1>();

                var         singleValue = value.FirstOrDefault();
                IClientData data        = await _clientDataServices.GetDoAsync(singleValue.NUMERO_CLI);

                ClientViewObject viewObjectClient = data.Value;
                Assert.AreEqual(viewObjectClient.NUMERO_CLI, singleValue.NUMERO_CLI);
                viewObjectClient.APELLIDO2 = "Zoppi";
                data.Value = viewObjectClient;
                // Act
                bool retValue = await _clientDataServices.SaveAsync(data);

                IClientData dataValue = await _clientDataServices.GetDoAsync(viewObjectClient.NUMERO_CLI);

                // Assert
                Assert.IsTrue(retValue);
                Assert.AreEqual(dataValue.Value.NUMERO_CLI, data.Value.NUMERO_CLI);
                Assert.AreEqual(dataValue.Value.APELLIDO2, viewObjectClient.APELLIDO2);
            }
        }
예제 #2
0
        ////////////////////////////////////////////////////////////////////////

        #region Private Methods
        #region Pseudo-Plugin Helper Methods
        private static _Cmdlets.Script GetScriptCmdlet(
            IClientData clientData,
            ref Result error
            )
        {
            if (clientData == null)
            {
                error = "invalid clientData";
                return(null);
            }

            _Cmdlets.Script result = null;

            object data = null;

            /* IGNORED */
            clientData = _Public.ClientData.UnwrapOrReturn(
                clientData, ref data);

            result = data as _Cmdlets.Script;

            if (result == null)
            {
                error = "clientData does not contain script cmdlet";
                return(null);
            }

            if (result.Disposed)
            {
                error = "script cmdlet is disposed";
                return(null);
            }

            return(result);
        }
예제 #3
0
        /// <summary>
        ///  ClientsInfoViewModel constructor.
        /// </summary>
        /// <param name="eventManager">Event manager</param>
        /// <param name="configurationService">Configuration service</param>
        /// <param name="dataServices">Data Service</param>
        /// <param name="manager">Region Manager</param>
        public ClientsInfoViewModel(IEventManager eventManager,
                                    IConfigurationService configurationService,
                                    IDataServices dataServices,
                                    IDialogService dialogService,
                                    IRegionManager manager,
                                    IInteractionRequestController controller) : base(eventManager, configurationService, dataServices, dialogService, manager, controller)
        {
            base.ConfigureAssist();

            ConfigurationService = configurationService;
            MailBoxHandler      += MessageHandler;
            IsVisible            = Visibility.Collapsed;
            EventManager.RegisterObserverSubsystem(MasterModuleConstants.ClientSubSystemName, this);
            InitVmCommands();
            ClientInfoRightRegionName = CreateNameRegion("RightRegion");
            DriverZoneRegionName      = CreateNameRegion("DriverZoneRegion");
            StateVisible           = true;
            _onBranchesPrimaryKey += ClientOnBranchesPrimaryKey;
            _onContactsPrimaryKey += ClientOnContactsPrimaryKey;
            _clientDataServices    = dataServices.GetClientDataServices();
            _clientData            = _clientDataServices.GetNewDo("0");
            eventHandler          += OnDriverUpdate;
            DefaultPageSize        = 50;
            ViewModelUri           = new Uri("karve://client/viewmodel?id=" + Guid.ToString());
            ActiveSubSystem();
            _initialized = false;
        }
예제 #4
0
        ///////////////////////////////////////////////////////////////////////

        public override ReturnCode Terminate(
            Interpreter interpreter,
            IClientData clientData,
            ref Result result
            )
        {
            if (interpreter != null)
            {
                if (savedNotifyFlags != NotifyFlags.None)
                {
                    //
                    // NOTE: Remove the notify flags that we added to the
                    //       interpreter earlier.
                    //
                    interpreter.GlobalNotifyFlags &= ~savedNotifyFlags;
                    savedNotifyFlags = NotifyFlags.None;
                }

                ///////////////////////////////////////////////////////////////

                if (savedNotifyTypes != NotifyType.None)
                {
                    //
                    // NOTE: Remove the notify types that we added to the
                    //       interpreter earlier.
                    //
                    interpreter.GlobalNotifyTypes &= ~savedNotifyTypes;
                    savedNotifyTypes = NotifyType.None;
                }
            }

            ///////////////////////////////////////////////////////////////////

            return(base.Terminate(interpreter, clientData, ref result));
        }
예제 #5
0
        ///////////////////////////////////////////////////////////////////////

        public static ReturnCode Unload(
            AppDomain appDomain,
            IClientData clientData, /* NOT USED */
            ref Result error
            )
        {
            if (appDomain != null)
            {
                try
                {
                    AppDomain.Unload(appDomain); /* throw */

                    return(ReturnCode.Ok);
                }
                catch (Exception e)
                {
                    error = e;
                }
            }
            else
            {
                error = "invalid application domain";
            }

            //
            // NOTE: We do not really expect this method to fail;
            //       therefore, output a complaint about it.
            //
            DebugOps.Complain(ReturnCode.Error, error);

            return(ReturnCode.Error);
        }
예제 #6
0
        public ReturnCode Execute(Interpreter interpreter, IClientData clientData, ArgumentList arguments, ref Result result)
        {
            var infotagIdentifier = arguments[0];

            _logger.Info($"Execution infotag get {infotagIdentifier} command.");


            InfotagIdentifier infotag;

            if (!InfotagProvider.All.TryGetValue(infotagIdentifier, out infotag))
            {
                _logger.Error($"Infotag {infotagIdentifier} does not exist or is not implemented.");
                result = $"Infotag {infotagIdentifier} does not exist or is not implemented.";
                return(ReturnCode.Error);
            }

            if (!IsValidUse(infotag, ref result))
            {
                return(ReturnCode.Error);
            }

            IInfotagData data;

            if (!_infotagData.TryGetValue(infotagIdentifier, out data))
            {
                _logger.Warn($"Infotag does not contain any data of type {infotagIdentifier}.");
                result = string.Empty;
                return(ReturnCode.Ok);
            }

            _logger.Info($"Successfully get infotag {infotagIdentifier} data: {data.ToTclValue()}");
            result = data.ToTclValue();
            return(ReturnCode.Ok);
        }
예제 #7
0
파일: Core.cs 프로젝트: jdruin/F5Eagle
        ///////////////////////////////////////////////////////////////////////

        #region IExecute Members
        public virtual ReturnCode Execute(
            Interpreter interpreter,
            IClientData clientData,
            ArgumentList arguments,
            ref Result result
            )
        {
            ReturnCode code;
            Argument   value = null;
            Result     error = null;

            code = Execute(
                interpreter, clientData, arguments, ref value, ref error);

            if (code == ReturnCode.Ok)
            {
                result = value;
            }
            else
            {
                result = error;
            }

            return(code);
        }
예제 #8
0
파일: Default.cs 프로젝트: jdruin/F5Eagle
        ///////////////////////////////////////////////////////////////////////

        #region IPlugin Members
        /// <summary>
        ///   This method is called after <see cref="Initialize" />, if it was
        ///   successful.
        /// </summary>
        ///
        /// <param name="interpreter">
        ///   The interpreter context we are executing in.  This parameter may
        ///   be null.
        /// </param>
        ///
        /// <param name="clientData">
        ///   The extra data supplied to the <see cref="Initialize" /> method,
        ///   if any.
        /// </param>
        public virtual void PostInitialize(
            Interpreter interpreter,
            IClientData clientData
            )
        {
            // do nothing.
        }
예제 #9
0
파일: Pool.cs 프로젝트: jdruin/F5Eagle
        public override ReturnCode Execute(
            Interpreter interpreter,
            IClientData clientData,
            ArgumentList arguments,
            ref Result result
            )
        {
            ReturnCode code = ReturnCode.Ok;

            if (interpreter != null)
            {
                if (arguments != null)
                {
                    result = arguments[1];
                }
                else
                {
                    result = "invalid argument list";
                    code   = ReturnCode.Error;
                }
            }
            else
            {
                result = "invalid interpreter";
                code   = ReturnCode.Error;
            }

            return(code);
        }
예제 #10
0
        public ReturnCode Execute(Eagle._Components.Public.Interpreter interpreter, IClientData clientData, ArgumentList arguments, ref Result result)
        {
            result = "Executing log disconnect.";
            _logger.Info(result.String);

            return(ReturnCode.Ok);
        }
예제 #11
0
        public DataSource(FileType fileType)
        {
            IDataFactory factory;

            switch (fileType)
            {
            case FileType.File1:
                factory     = new DataFromFile1();
                _clientdata = factory.CreateClientData();
                break;

            case FileType.File2:
                factory     = new DataFromFile2();
                _clientdata = factory.CreateClientData();
                break;

            case FileType.File3:
                factory     = new DataFromFile3();
                _clientdata = factory.CreateClientData();
                break;

            default:
                throw new ApplicationException("Source inconnue " + fileType);
            }
        }
예제 #12
0
 public PackageData(
     string name,
     string group,
     string description,
     IClientData clientData,
     string indexFileName,
     string provideFileName,
     PackageFlags flags,
     Version loaded,
     VersionStringDictionary ifNeeded,
     long token
     )
 {
     this.kind            = IdentifierKind.PackageData;
     this.id              = AttributeOps.GetObjectId(this);
     this.name            = name;
     this.group           = group;
     this.description     = description;
     this.indexFileName   = indexFileName;
     this.provideFileName = provideFileName;
     this.flags           = flags;
     this.clientData      = clientData;
     this.loaded          = loaded;
     this.ifNeeded        = ifNeeded;
     this.token           = token;
 }
예제 #13
0
        protected override ReturnCode ExecuteInternal(Interpreter interpreter, IClientData clientData, ArgumentList arguments, ref Result result)
        {
            if (arguments == null || (arguments.Count < 3))
            {
                result = Utility.WrongNumberOfArguments(this, 1, arguments, "leg_command command_param");

                return(ReturnCode.Error);
            }

            ILegCommand legCommand = null;

            if (!ResolveLegCommand(arguments, ref legCommand, ref result))
            {
                ErrorLogger.Error(result.String);
                return(ReturnCode.Error);
            }

            if (!legCommand.ValidateArguments(arguments, ref result))
            {
                ErrorLogger.Error(result);
                return(ReturnCode.Error);
            }

            return(legCommand.Execute(interpreter, clientData, arguments, ref result));
        }
예제 #14
0
        ///////////////////////////////////////////////////////////////////////

        //
        // NOTE: For use by InteractiveOps.Commands._break() and
        //       Engine.CheckBreakpoints() only.
        //
        internal InteractiveLoopData(
            ReturnCode code,
            BreakpointType breakpointType,
            string breakpointName,
            IToken token,
            ITraceInfo traceInfo,
            EngineFlags engineFlags,
            SubstitutionFlags substitutionFlags,
            EventFlags eventFlags,
            ExpressionFlags expressionFlags,
            HeaderFlags headerFlags,
            IClientData clientData,
            ArgumentList arguments
            )
            : this()
        {
            this.code              = code;
            this.breakpointType    = breakpointType;
            this.breakpointName    = breakpointName;
            this.token             = token;
            this.traceInfo         = traceInfo;
            this.engineFlags       = engineFlags;
            this.substitutionFlags = substitutionFlags;
            this.eventFlags        = eventFlags;
            this.expressionFlags   = expressionFlags;
            this.headerFlags       = headerFlags;
            this.clientData        = clientData;
            this.arguments         = arguments;
        }
예제 #15
0
 public HostData(
     string name,
     string group,
     string description,
     IClientData clientData,
     string typeName,
     Interpreter interpreter,
     ResourceManager resourceManager,
     string profile,
     bool useAttach,
     bool noColor,
     bool noTitle,
     bool noIcon,
     bool noProfile,
     bool noCancel
     )
 {
     this.kind            = IdentifierKind.HostData;
     this.id              = AttributeOps.GetObjectId(this);
     this.name            = name;
     this.group           = group;
     this.description     = description;
     this.clientData      = clientData;
     this.typeName        = typeName;
     this.interpreter     = interpreter;
     this.resourceManager = resourceManager;
     this.profile         = profile;
     this.useAttach       = useAttach;
     this.noColor         = noColor;
     this.noTitle         = noTitle;
     this.noIcon          = noIcon;
     this.noProfile       = noProfile;
     this.noCancel        = noCancel;
 }
예제 #16
0
파일: ResultOps.cs 프로젝트: jdruin/F5Eagle
        ///////////////////////////////////////////////////////////////////////

        public static void CleanupSynchronized(
            Result synchronizedResult
            )
        {
            if (synchronizedResult != null)
            {
                lock (synchronizedResult)
                {
                    //
                    // NOTE: Grab the client data (the event wait handle).
                    //
                    IClientData clientData = synchronizedResult.ClientData;

                    if (clientData != null)
                    {
                        EventWaitHandle @event =
                            clientData.Data as EventWaitHandle;

                        if (@event != null)
                        {
                            ThreadOps.CloseEvent(ref @event);
                        }
                    }
                }
            }
        }
예제 #17
0
 public PolicyData(
     string name,
     string group,
     string description,
     IClientData clientData,
     string typeName,
     string methodName,
     BindingFlags bindingFlags,
     MethodFlags methodFlags,
     PolicyFlags policyFlags,
     IPlugin plugin,
     long token
     )
 {
     this.kind         = IdentifierKind.PolicyData;
     this.id           = AttributeOps.GetObjectId(this);
     this.name         = name;
     this.group        = group;
     this.description  = description;
     this.clientData   = clientData;
     this.typeName     = typeName;
     this.methodName   = methodName;
     this.bindingFlags = bindingFlags;
     this.methodFlags  = methodFlags;
     this.policyFlags  = policyFlags;
     this.plugin       = plugin;
     this.token        = token;
 }
예제 #18
0
파일: ResultOps.cs 프로젝트: jdruin/F5Eagle
        ///////////////////////////////////////////////////////////////////////

        public static bool WaitSynchronized(
            Result synchronizedResult,
            int milliseconds
            )
        {
            EventWaitHandle @event = null;

            if (synchronizedResult != null)
            {
                lock (synchronizedResult)
                {
                    //
                    // NOTE: Grab the client data (the event wait handle).
                    //
                    IClientData clientData = synchronizedResult.ClientData;

                    if (clientData != null)
                    {
                        @event = clientData.Data as EventWaitHandle;
                    }
                }
            }

            if (@event != null)
            {
                return(ThreadOps.WaitEvent(@event, milliseconds));
            }

            return(false);
        }
예제 #19
0
        ///////////////////////////////////////////////////////////////////////

        private static ReturnCode ToClass2(
            Interpreter interpreter,
            Type type,                     /* NOT USED */
            string text,
            OptionDictionary options,      /* NOT USED */
            CultureInfo cultureInfo,       /* NOT USED */
            IClientData clientData,        /* NOT USED */
            ref MarshalFlags marshalFlags, /* NOT USED */
            ref object value,              /* Sample.Class2 */
            ref Result error
            )
        {
            long     token   = 0;
            ICommand command = null;

            if (interpreter.GetCommand(
                    text, LookupFlags.NoWrapper, ref token, ref command,
                    ref error) == ReturnCode.Ok)
            {
                value = command;
                return(ReturnCode.Ok);
            }

            return(ReturnCode.Error);
        }
예제 #20
0
        public override ReturnCode Execute(
            Interpreter interpreter,
            IClientData clientData,
            ArgumentList arguments,
            ref Result result
            )
        {
            if ((arguments == null) || (arguments.Count != 2))
            {
                result = Utility.WrongNumberOfArguments(
                    this, 1, arguments, "message");

                return(ReturnCode.Error);
            }

            try
            {
                interpreter.Host.WriteResult(ReturnCode.Ok, arguments[1], true);
            }
            catch (Exception exception)
            {
                Log.Error("Script error ", exception);
                result = "Error on command execution " + exception.Message;
            }
            return(ReturnCode.Ok);
        }
예제 #21
0
        public override ReturnCode Execute(
            Interpreter interpreter,
            IClientData clientData,
            ArgumentList arguments,
            ref Result result
            )
        {
            if ((arguments == null) || (arguments.Count < 2))
            {
                result = Utility.WrongNumberOfArguments(
                    this, 1, arguments, "command");

                return ReturnCode.Error;
            }

            try
            {
                var processor = new CommandLineProcessor();
                var o = processor.Pharse(arguments.Select(argument => (string) argument).Skip(1).ToArray());
                if (!(o is string) && o is IEnumerable)
                    result = new StringList(o);
                else
                {
                    result = o == null ? "" : new Variant(o).ToString();
                }
            }
            catch (Exception exception)
            {
                Log.Error("Script error ", exception);
                result = "Error on command execution " + exception.Message;
            }
            return ReturnCode.Ok;
        }
예제 #22
0
 public ScriptEventArgs(
     long id,
     NotifyType types,
     NotifyFlags flags,
     Interpreter interpreter,
     IClientData clientData,
     ArgumentList arguments,
     Result result,
     ScriptException exception,
     InterruptType interruptType,
     string resourceName,
     ResourceManager resourceManager,
     params object[] messageArgs
     )
     : base(null, id, resourceName, messageArgs)
 {
     this.notifyTypes     = types;
     this.notifyFlags     = flags;
     this.interpreter     = interpreter;
     this.clientData      = clientData;
     this.arguments       = arguments;
     this.result          = result;
     this.exception       = exception;
     this.interruptType   = interruptType;
     this.resourceManager = resourceManager;
 }
예제 #23
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IExecute Members
        public override ReturnCode Execute(
            Interpreter interpreter,
            IClientData clientData,
            ArgumentList arguments,
            ref Result result
            )
        {
            ReturnCode code = ReturnCode.Ok;

            if (interpreter != null)
            {
                if (arguments != null)
                {
                    if (arguments.Count == 1)
                    {
                        try
                        {
                            string name = Utility.FormatId(
                                Characters.Period.ToString(), this.Name,
                                interpreter.NextId());

                            IMutableAnyPair <Thread, Toplevel> anyPair =
                                new MutableAnyPair <Thread, Toplevel>(true);

                            anyPair.X = new Thread(delegate()
                            {
                                anyPair.Y = new Toplevel(interpreter, name);
                                anyPair.Y.ShowDialog();
                            });

                            anyPair.X.Start();

                            result = name;
                        }
                        catch (Exception e)
                        {
                            result = e;
                            code   = ReturnCode.Error;
                        }
                    }
                    else
                    {
                        result = "wrong # args: should be \"toplevel\"";
                        code   = ReturnCode.Error;
                    }
                }
                else
                {
                    result = "invalid argument list";
                    code   = ReturnCode.Error;
                }
            }
            else
            {
                result = "invalid interpreter";
                code   = ReturnCode.Error;
            }

            return(code);
        }
예제 #24
0
        ///////////////////////////////////////////////////////////////////////

        private static bool HasData(
            IClientData clientData,
            ref object data
            )
        {
            //
            // NOTE: If the IClientData instance is null or equals our reserved
            //       "empty" instance, then it contains no actual data.
            //
            if ((clientData == null) ||
                Object.ReferenceEquals(clientData, Empty))
            {
                return(false);
            }

            //
            // NOTE: If this a "plain old" IClientData instance of the default
            //       type and it contains null data, we know there is no actual
            //       data in it.
            //
            object localData = clientData.Data;

            if ((clientData.GetType() == typeof(ClientData)) &&
                (localData == null))
            {
                return(false);
            }

            //
            // NOTE: Otherwise, we must assume it contains actual data.
            //
            data = localData;
            return(true);
        }
예제 #25
0
        internal AsynchronousContext(
            int threadId,
            EngineMode engineMode,
            Interpreter interpreter,
            string text,
            EngineFlags engineFlags,
            SubstitutionFlags substitutionFlags,
            EventFlags eventFlags,
            ExpressionFlags expressionFlags,
            AsynchronousCallback callback,
            IClientData clientData
            )
        {
            this.threadId = threadId;

            this.engineMode        = engineMode;
            this.interpreter       = interpreter;
            this.text              = text;
            this.engineFlags       = engineFlags;
            this.substitutionFlags = substitutionFlags;
            this.eventFlags        = eventFlags;
            this.expressionFlags   = expressionFlags;
            this.callback          = callback;
            this.clientData        = clientData;
        }
예제 #26
0
 public RecordedMethodTelemetry(string documentationCommentId, string id, DateTime timestamp, IClientData clientData)
 {
     DocumentationCommentId = documentationCommentId ?? throw new ArgumentNullException(nameof(documentationCommentId));
     Id         = id;
     Timestamp  = timestamp;
     ClientData = clientData;
 }
예제 #27
0
파일: Script.cs 프로젝트: jdruin/F5Eagle
        ///////////////////////////////////////////////////////////////////////

        public static IScript Create(
            string name,
            string group,
            string description,
            string type,
            string text,
            string fileName,
            int startLine,
            int endLine,
            bool viaSource,
            DateTime timeStamp,
            EngineMode engineMode,
            ScriptFlags scriptFlags,
            EngineFlags engineFlags,
            SubstitutionFlags substitutionFlags,
            EventFlags eventFlags,
            ExpressionFlags expressionFlags,
            IClientData clientData
            )
        {
            return(PrivateCreate(
                       Guid.Empty, name, group, description, type, text, fileName,
                       startLine, endLine, viaSource,
#if XML
                       XmlBlockType.None, timeStamp, null, null,
#endif
                       engineMode, scriptFlags, engineFlags, substitutionFlags,
                       eventFlags, expressionFlags, clientData));
        }
예제 #28
0
        private Delegate @delegate; // NOTE: No property, use Invoke().
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        public NativeDelegate(
            string name,
            string group,
            string description,
            IClientData clientData,
            Interpreter interpreter,
            CallingConvention callingConvention,
            Type returnType,
            TypeList parameterTypes,
            Type type,
            IModule module,
            string functionName,
            IntPtr address,
            long token
            )
        {
            this.kind              = IdentifierKind.NativeDelegate;
            this.id                = Guid.Empty;
            this.name              = name;
            this.group             = group;
            this.description       = description;
            this.clientData        = clientData;
            this.interpreter       = interpreter;
            this.callingConvention = callingConvention;
            this.returnType        = returnType;
            this.parameterTypes    = parameterTypes;
            this.type              = type;
            this.module            = module;
            this.functionName      = functionName;
            this.address           = address;
            this.token             = token;
        }
예제 #29
0
 public OperatorData(
     string name,
     string group,
     string description,
     IClientData clientData,
     string typeName,
     Lexeme lexeme,
     int operands,
     TypeList types,
     OperatorFlags flags,
     IPlugin plugin,
     long token
     )
 {
     this.kind        = IdentifierKind.OperatorData;
     this.id          = AttributeOps.GetObjectId(this);
     this.name        = name;
     this.group       = group;
     this.description = description;
     this.clientData  = clientData;
     this.typeName    = typeName;
     this.lexeme      = lexeme;
     this.operands    = operands;
     this.types       = types;
     this.flags       = flags;
     this.plugin      = plugin;
     this.token       = token;
 }
예제 #30
0
        protected override ReturnCode ExecuteInternal(Interpreter interpreter, IClientData clientData, ArgumentList arguments, ref Result result)
        {
            InternalLogger.Info("Executing Infotag command.");
            InternalLogger.Debug($"Parameters: {string.Join(", ", arguments.Select(a => $"{a.Name}: {a.Value}"))}");

            if (arguments.Count < 2)
            {
                result = Utility.WrongNumberOfArguments(this, 2, arguments, string.Empty);
                ResultLogger.Error($"Incorrect number of arguments: {arguments.Count} for command infotag.");
                return(ReturnCode.Error);
            }

            var subCommand = arguments[0];

            if (subCommand == _infotagGet.Name)
            {
                return(_infotagGet.Execute(interpreter, clientData, arguments, ref result));
            }
            if (subCommand == _infotagSet.Name)
            {
                return(_infotagSet.Execute(interpreter, clientData, arguments, ref result));
            }

            ErrorLogger.Error($"Incorrect subcommand argument: {subCommand}");
            result = $"Incorrect subcommand argument: {subCommand}";
            return(ReturnCode.Error);
        }
        public async Task Should_Insert_A_NewClient()
        {
            using (IDbConnection dbConnection = SqlExecutor.OpenNewDbConnection())
            {
                IEnumerable <CLIENTES1> value = await dbConnection.GetPagedAsync <CLIENTES1>(1, 10);

                var         singleValue = value.FirstOrDefault();
                IClientData data        = await _clientDataServices.GetDoAsync(singleValue.NUMERO_CLI);

                ClientViewObject viewObjectClient = data.Value;
                var         identifier            = _clientDataServices.GetNewId();
                IClientData newClient             = _clientDataServices.GetNewDo(identifier);
                newClient.Value.NOMBRE    = "Giorgio";
                newClient.Value.APELLIDO1 = "Zoppi";
                newClient.Value.APELLIDO2 = "Pietra";
                bool retValue = await _clientDataServices.SaveAsync(newClient);

                Assert.IsTrue(retValue);
                IClientData newClientData = await _clientDataServices.GetDoAsync(newClient.Value.NUMERO_CLI);

                // assert
                ClientViewObject viewObject = newClientData.Value;
                Assert.AreEqual(viewObject.NUMERO_CLI, newClient.Value.NUMERO_CLI);
                Assert.AreEqual(viewObject.NOMBRE, newClient.Value.NOMBRE);
                Assert.AreEqual(viewObject.APELLIDO1, newClient.Value.APELLIDO1);
                Assert.AreEqual(viewObject.APELLIDO2, newClient.Value.APELLIDO2);
            }
        }
예제 #32
0
        public override ReturnCode Execute(
            Interpreter interpreter,
            IClientData clientData,
            ArgumentList arguments,
            ref Result result
            )
        {
            if ((arguments == null) || (arguments.Count != 2))
            {
                result = Utility.WrongNumberOfArguments(
                    this, 1, arguments, "message");

                return ReturnCode.Error;
            }

            try
            {
                interpreter.Host.WriteResult(ReturnCode.Ok, arguments[1], true);
            }
            catch (Exception exception)
            {
                Log.Error("Script error ", exception);
                result = "Error on command execution " + exception.Message;
            }
            return ReturnCode.Ok;
        }