public void Should_Show_Assist_ProvinceMagnifier() { // arrange IInteractionRequestController controller = _unityContainer.Resolve <IInteractionRequestController>(); AssistMockViewModel assistMockViewModel = new AssistMockViewModel(_eventManager.Object, _configurationService.Object, _dataServices.Object, _dialogService.Object, _regionManager.Object, controller); Assert.NotNull(assistMockViewModel.SelectedProvince); IList <ProvinceViewObject> provinciaDto = new List <ProvinceViewObject>() { new ProvinceViewObject() { Code = "192", Name = "Barcelona" }, new ProvinceViewObject() { Code = "200", Name = "Madrid" } }; // act assistMockViewModel.LaunchBranches.Execute(provinciaDto); ProvinceViewObject provinceViewObject = assistMockViewModel.SelectedProvince; // assert Assert.True(provinciaDto.Contains(provinceViewObject)); }
/// <summary> /// Set Branch province /// </summary> /// <param name="province">It allows the province branch.</param> /// <param name="branchesViewObject">It allows the branches viewObject.</param> internal override async Task SetBranchProvince(ProvinceViewObject province, BranchesViewObject branchesViewObject) { // set the base event dictionary IDictionary <string, object> ev = SetBranchProvince(province, branchesViewObject, DataObject, DataObject.BranchesDto); // send the opportune event where it is needed. await GridChangedNotification <BranchesViewObject, COMI_DELEGA>(ev, _onBranchesPrimaryKey, DataSubSystem.CommissionAgentSubystem).ConfigureAwait(false); }
internal override async Task SetBranchProvince(ProvinceViewObject p, BranchesViewObject b) { var currentObject = DataObject as ISupplierData; if (currentObject != null) { var ev = SetBranchProvince(p, b, DataObject, currentObject.BranchesDto); await GridChangedNotification <BranchesViewObject, ProDelega>(ev, _onBranchesPrimaryKey, DataSubSystem.SupplierSubsystem).ConfigureAwait(false); } }
internal override async Task SetBranchProvince(ProvinceViewObject province, BranchesViewObject branch) { IList <BranchesViewObject> branchList = new List <BranchesViewObject>(); var ev = CreateGridEvent <ProvinceViewObject, BranchesViewObject>(province, branch, branchList, new DelegateCommand <object>((_branchesDto) => { _showExecuted = true; })); await Task.Delay(1); EventDictionary = ev; }
/// <summary> /// Adjust branch witj province. /// </summary> /// <param name="branchesDtos">Branches in London.</param> /// <param name="provinciaDtos">Provincia in London.</param> private void AdjustBranchWithProvince(ref IEnumerable <BranchesViewObject> branchesDtos, IEnumerable <ProvinceViewObject> provinciaDtos) { IList <BranchesViewObject> listOfBranches = branchesDtos.ToList(); for (int i = 0; i < listOfBranches.Count(); ++i) { var tmp = listOfBranches[i].Province.Code; IEnumerable <ProvinceViewObject> tmpProvince = provinciaDtos.Where(x => (tmp == x.Code)); ProvinceViewObject viewObject = tmpProvince.FirstOrDefault(); if (viewObject != null) { listOfBranches[i].Province.Name = viewObject.Name; listOfBranches[i].Province.Country = viewObject.Country; } } branchesDtos = listOfBranches; }
private void OnProvinceAssist() { IList <ProvinceViewObject> provinceDto = new List <ProvinceViewObject>() { new ProvinceViewObject() { Code = "2892", Name = "Provincia" }, new ProvinceViewObject() { Code = "2891", Name = "Provincia1" } }; Controller.ShowAssistView <ProvinceViewObject>("Province", provinceDto, "Code, Name"); if (Controller.SelectionState == SelectionState.OK) { ProvinceViewObject viewObject = Controller.SelectedItem as ProvinceViewObject; SelectedProvince = viewObject; } }
internal override Task SetBranchProvince(ProvinceViewObject p, BranchesViewObject b) { throw new System.NotImplementedException(); }
public async Task Should_Update_SupplierBranches() { // arrange var suppliers = await _supplierDataServices.GetSupplierAsyncSummaryDo(); SupplierSummaryViewObject supplierSummaryViewObject = suppliers.FirstOrDefault(); if (supplierSummaryViewObject != null) { var id = supplierSummaryViewObject.Codigo; var province = new ProvinceViewObject(); province.Name = "Barcelona"; province.Code = "08"; province.Country = "Spain"; Random rand = new Random(); var branches = new List <BranchesViewObject>() { new BranchesViewObject() { BranchKeyId = id, BranchId = (rand.Next() % 5000).ToString(), Branch = "EAE", ProvinceSource = province, City = "Barcelona", Address = "Calle Rocafort 137", Address2 = "Calle Arago 65", Email = "*****@*****.**", Notes = "MyNotes", Fax = "+33889381982" }, new BranchesViewObject() { BranchKeyId = id, BranchId = (rand.Next() % 5000).ToString(), Branch = "Scala", ProvinceSource = province, City = "Barcelona", Address = "Calle Rocafort 189", Address2 = "Calle Arago 123", Email = "*****@*****.**", Notes = "MyNotes", Fax = "+33889381982" }, new BranchesViewObject() { BranchKeyId = id, BranchId = (rand.Next() % 5000).ToString(), Branch = "Scala", ProvinceSource = province, City = "Barcelona", Address = "Calle Rocafort 189", Address2 = "Calle Arago 123", Email = "*****@*****.**", Notes = "MyNotes", Fax = "+33889381982" } }; var dataObject = await _supplierDataServices.GetAsyncSupplierDo(id); Assert.NotNull(dataObject); dataObject.BranchesDto = dataObject.BranchesDto.Union(branches); //act bool retValue = await _supplierDataServices.Save(dataObject); // assert. Assert.IsTrue(retValue); var savedObject = await _supplierDataServices.GetAsyncSupplierDo(id); var currentObject = savedObject.BranchesDto.Intersect(branches); Assert.AreEqual(currentObject.Count(), branches.Count()); } }