public void Start()
        {
            var input = "";

            while (input?.ToLower() != "exit")
            {
                //Handle Command
                var userId  = Guid.NewGuid();
                var addUser = new RegisterUser(
                    userId,
                    "Billy",
                    "Bob",
                    "*****@*****.**"
                    );

                CommandPublisher.Publish(addUser);
                Console.WriteLine(Environment.NewLine + "press enter to update name");
                Console.ReadLine();
                var changeName = new ChangeName(
                    userId,
                    "Finn",
                    "Bob"
                    );

                CommandPublisher.Publish(changeName);
                input = Console.ReadLine();
            }
        }
Beispiel #2
0
        public void showNewNamePanel(object sender, EventArgs e)
        {
            string     folderRutaPadre = _carpeta.ruta.Split('/')[0] + "/";
            ChangeName cn = null;

            if (_carpetaPadre == null)
            {
                cn = new ChangeName(folderRutaPadre, true);
                cn.setDescripcion(_carpeta.desc);
                cn.checkGeneros(_carpeta.generos);
            }
            else
            {
                cn = new ChangeName(folderRutaPadre, false);
            }

            cn.setName(_carpeta.nombre);

            cn.setImg(_carpeta.img);

            cn.ShowDialog();
            if (cn.getNewName() != null)
            {
                if (_carpetaPadre == null)
                {
                    changeName(cn.getNewName(), cn.getDescripcion(), cn.getDirImg(), cn.getGeneros());
                }
                else
                {
                    changeName(cn.getNewName(), cn.getDirImg());
                }
            }
        }
        public Task <Command> Post(ChangeName request)
        {
            var command = request.ConvertTo <Domain.Authentication.Users.Commands.ChangeName>();

            command.UserId = Profile.UserId;

            return(_bus.Send("domain", command).IsCommand <Command>());
        }
Beispiel #4
0
 private void OnNameTextBoxKeyDown(KeyEvent args)
 {
     if (args.Key == Key.Enter)
     {
         ChangeName.Raise();
         args.Handled = true;
     }
 }
Beispiel #5
0
        /// <summary>
        /// Hangfire job to send Change Status message to One stop.
        /// </summary>
        public async Task SendChangeNameRest(PerformContext hangfireContext, string licenceGuidRaw, string queueItemId)
        {
            IDynamicsClient dynamicsClient = DynamicsSetupUtil.SetupDynamics(_configuration);

            if (hangfireContext != null)
            {
                hangfireContext.WriteLine("Starting OneStop REST ChangeName Job.");
            }

            string licenceGuid = Utils.ParseGuid(licenceGuidRaw);

            //prepare soap content
            var req     = new ChangeName();
            var licence = dynamicsClient.GetLicenceByIdWithChildren(licenceGuid);

            if (hangfireContext != null && licence != null)
            {
                hangfireContext.WriteLine($"Got Licence {licenceGuid}.");
            }

            if (licence == null)
            {
                if (hangfireContext != null)
                {
                    hangfireContext.WriteLine($"Unable to get licence {licenceGuid}.");
                }

                if (Log.Logger != null)
                {
                    Log.Logger.Error($"Unable to get licence {licenceGuid}.");
                }
            }
            else
            {
                var innerXML = req.CreateXML(licence);

                if (Log.Logger != null)
                {
                    Log.Logger.Information(innerXML);
                }

                if (hangfireContext != null)
                {
                    hangfireContext.WriteLine(innerXML);
                }

                //send message to Onestop hub
                var outputXML = await _onestopRestClient.ReceiveFromPartner(innerXML);

                UpdateQueueItemForSend(dynamicsClient, hangfireContext, queueItemId, innerXML, outputXML);

                if (hangfireContext != null)
                {
                    hangfireContext.WriteLine(outputXML);
                    hangfireContext.WriteLine("End of OneStop REST ChangeName  Job.");
                }
            }
        }
Beispiel #6
0
 private void UserControl_KeyDown_1(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         ProcessName.Visibility = Visibility.Visible;
         ChangeName.UpdateLayout();
         ChangeName.Visibility = Visibility.Hidden;
     }
 }
Beispiel #7
0
        public void When_editing_a_game_that_not_found_then_a_domain_exception_should_be_thrown()
        {
            var gamesRepository = Substitute.For <IGamesRepository>();

            var changeName = new ChangeName(gamesRepository);

            Func <Task> action = async() => await changeName.Execute(0, "Test", default);

            action.Should().Throw <DomainException>().WithMessage(Game.NOT_FOUND);
        }
Beispiel #8
0
        public void ChangeName()
        {
            var product = this.GetProduct(name: "prd1");
            var newName = "prd3";
            var cmd     = new ChangeName(newName);

            product.ChangeName(cmd);

            product.Name.Should().Be(newName);
        }
Beispiel #9
0
        public MainWindowModel()
        {
            ServerResult = "Haven't talked to the server yet...";

            var firstAndLastFilled = this.WhenAnyValue(vm => vm.FirstName, vm => vm.LastName,
                                                       (f, l) => !string.IsNullOrWhiteSpace(f) && !string.IsNullOrWhiteSpace(l));

            ChangeName = ReactiveCommand.CreateAsyncTask(firstAndLastFilled, _ => PretendToCallTheServer());
            ChangeName.Subscribe(r => ServerResult = r);
        }
Beispiel #10
0
        private void Button_ChangeName(object sender, RoutedEventArgs e)
        {
            string path = ChangeName.GetPath();

            //if (!System.IO.Directory.Exists(path))
            //    return;

            //CppToCSharp.Instance.ChangeTabFold(path);
            ImgOperate.Instance.ChangeAllFileToShader(path);
            //ImgOperate.Instance.ClassifyFile(path);
        }
        public PersonViewModel()
        {
            _fullName = this.WhenAnyValue(vm => vm.FirstName, vm => vm.LastName, (f, l) => string.Format("{0} {1}", f, l))
                        .ToProperty(this, vm => vm.FullName);

            var firstAndLastFilled = this.WhenAnyValue(vm => vm.FirstName, vm => vm.LastName,
                                                       (f, l) => !string.IsNullOrWhiteSpace(f) && !string.IsNullOrWhiteSpace(l));

            ChangeName = ReactiveCommand.CreateAsyncTask(firstAndLastFilled, _ => PretendToCallTheServer());
            ChangeName.Subscribe(r => ServerResult = r);
        }
Beispiel #12
0
        public void ChangeName(ChangeName cmd)
        {
            if (new NameSpec(cmd.Name).IsSatisfy() == false)
            {
                throw new NameIsEmptyException();
            }

            this.Name         = cmd.Name;
            this.ModifiedDate = DateTimeOffset.Now;

            this.ApplyEvent(new ProductNameChanged(this.Id, this.Name, this.ModifiedDate.Value));
        }
Beispiel #13
0
        public IActionResult ChangeName(Guid streamId, string name)
        {
            var changeName = new ChangeName {
                Id = Guid.NewGuid(), Name = name
            };

            using (var session = this.database.GetDocumentStore().LightweightSession())
            {
                session.Events.Append(streamId, changeName);
                session.SaveChanges();
            }
            return(Redirect("/home/index"));
        }
Beispiel #14
0
 public bool Handle(ChangeName cmd)
 {
     try{
         var user = _repo.Load <User>(cmd.UserId);
         user.ChangeName(cmd.FirstName, cmd.LastName);
         _repo.Save(user);
     }
     catch (Exception _)//todo:try harder
     {
         return(false);
     }
     return(true);
 }
Beispiel #15
0
        public async Task When_editing_a_game_with_a_name_valid_then_the_game_should_be_edited()
        {
            var gamesRepository = Substitute.For <IGamesRepository>();
            var changeName      = new ChangeName(gamesRepository);

            var game = Game.Create(NAME).WithId(ID);

            gamesRepository.Find(ID, default).Returns(Task.FromResult(game));
            gamesRepository.AnyAsync(Arg.Any <Expression <Func <Game, bool> > >(), default).Returns(Task.FromResult(false));

            await changeName.Execute(game.Id, "Name2", default);

            game.Name.Should().Be("Name2");
        }
Beispiel #16
0
        public IActionResult AddUser(string name)
        {
            var personCreated = new PersonCreated();
            var nameChanged   = new ChangeName {
                Name = name
            };

            using (var session = this.database.GetDocumentStore().LightweightSession())
            {
                session.Events.StartStream <Person>(Guid.NewGuid(), personCreated, nameChanged);
                session.SaveChanges();
            }
            return(Redirect("/home/index"));
        }
Beispiel #17
0
        public void When_editing_a_game_with_existing_name_then_a_domain_exception_should_be_thrown()
        {
            var gamesRepository = Substitute.For <IGamesRepository>();
            var changeName      = new ChangeName(gamesRepository);

            var game = Game.Create(NAME).WithId(ID);

            gamesRepository.Find(ID, default).Returns(Task.FromResult(game));
            gamesRepository.AnyAsync(Arg.Any <Expression <Func <Game, bool> > >(), default).Returns(Task.FromResult(true));

            Func <Task> action = async() => await changeName.Execute(ID, "Name2", default);

            action.Should().Throw <DomainException>().WithMessage(Game.NAME_MUST_UNIQUE);
        }
Beispiel #18
0
    protected override void Init()
    {
        _instance = this;

        nicknameInput = transform.Find("NicknameInput").GetComponent <UIInput>();
        tipsLab       = transform.Find("TipsLab").GetComponent <UILabel>();
        diamondSp     = transform.Find("DiamondSp").GetComponent <UISprite>();

        sureBtn.onClick   = OnSureBtn;
        canCelBtn.onClick = OnCancelBtn;
        randomBtn.onClick = OnRandomClick;
        if (FSDataNodeTable <PlayerNameNode> .GetSingleton().DataNodeList.Count > 0)
        {
            nodeDic = FSDataNodeTable <PlayerNameNode> .GetSingleton().DataNodeList;

            foreach (var nameLists in nodeDic)
            {
                playerData.GetInstance().selfData.nameList.Add(nameLists.Value);
            }
        }
        nicknameInput.value = playerData.GetInstance().selfData.playeName;
    }
Beispiel #19
0
 public void Apply(ChangeName nameChanged)
 {
     this.Name = nameChanged.Name;
 }
Beispiel #20
0
        /// <summary>
        /// Hangfire job to send Change Status message to One stop.
        /// </summary>
        public async Task SendChangeNameRest(PerformContext hangfireContext, string licenceGuidRaw, string queueItemId, bool isTransfer)
        {
            IDynamicsClient dynamicsClient = DynamicsSetupUtil.SetupDynamics(_configuration);

            if (hangfireContext != null)
            {
                hangfireContext.WriteLine("Starting OneStop REST ChangeName Job.");
            }

            string licenceGuid = Utils.ParseGuid(licenceGuidRaw);

            //prepare soap content
            var req     = new ChangeName();
            var licence = dynamicsClient.GetLicenceByIdWithChildren(licenceGuid);

            if (hangfireContext != null && licence != null)
            {
                hangfireContext.WriteLine($"Got Licence {licenceGuid}.");
            }

            if (licence == null || licence.AdoxioEstablishment == null)
            {
                if (hangfireContext != null)
                {
                    hangfireContext.WriteLine($"Unable to get licence {licenceGuid}.");
                }

                if (Log.Logger != null)
                {
                    Log.Logger.Error($"Unable to get licence {licenceGuid}.");
                }
            }
            else
            {
                string targetBusinessNumber = null;

                ChangeNameType changeNameType = ChangeNameType.ChangeName;
                if (isTransfer && !string.IsNullOrEmpty(licence._adoxioProposedownerValue))
                {
                    changeNameType = ChangeNameType.Transfer;
                    var targetOwner = dynamicsClient.GetAccountById(licence._adoxioProposedownerValue);
                    if (targetOwner != null)
                    {
                        targetBusinessNumber = targetOwner.Accountnumber;
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(licence._adoxioThirdpartyoperatoridValue))
                    {
                        changeNameType = ChangeNameType.ThirdPartyOperator;
                    }
                }

                var innerXml = req.CreateXML(licence, changeNameType, targetBusinessNumber);

                innerXml = _onestopRestClient.CleanXML(innerXml);

                if (Log.Logger != null)
                {
                    Log.Logger.Information(innerXml);
                }

                if (hangfireContext != null)
                {
                    hangfireContext.WriteLine(innerXml);
                }

                //send message to Onestop hub
                var outputXML = await _onestopRestClient.ReceiveFromPartner(innerXml);

                UpdateQueueItemForSend(dynamicsClient, hangfireContext, queueItemId, innerXml, outputXML);

                if (hangfireContext != null)
                {
                    hangfireContext.WriteLine(outputXML);
                    hangfireContext.WriteLine("End of OneStop REST ChangeName  Job.");
                }
            }
        }
 public void OnChangeName(ChangeNameEventArgs e)
 {
     ChangeName?.Invoke(this, e);
     Console.WriteLine("El nombre anterior fui {0} y el nuevo nombre es {1}", e.OldName, e.NewName);
 }
Beispiel #22
0
 private void OnChangeNameClick()
 {
     ChangeName?.Invoke(this, -1);
 }
Beispiel #23
0
 private void ProcessName_MouseDoubleClick_1(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     ProcessName.Visibility = Visibility.Hidden;
     ChangeName.Visibility  = Visibility.Visible;
     ChangeName.Focus();
 }