void AssociatedObject_RowValidating(object sender, RowValidatingEventArgs args)
        {
            var data = args.RowData as BranchesDto;

            if (data == null)
            {
                args.ErrorMessages.Add("General", "Invalid insert");
                args.IsValid = false;
                return;
            }


            long codeValue = Convert.ToInt64(data.BranchId);

            if (codeValue <= 0)
            {
                args.ErrorMessages.Add("ErrorCode", "Code no valido");
                args.IsValid = false;
            }


            if (lastChangedObject == null)
            {
                lastChangedObject = data;
            }
            Dictionary <string, object> objectName = new Dictionary <string, object>();

            objectName["DataObject"]    = ControlExt.GetDataSource(AssociatedObject);
            objectName["ChangedValue"]  = data;
            objectName["PreviousValue"] = new BranchesDto(lastChangedObject);
        }
Beispiel #2
0
        internal override async Task SetBranchProvince(ProvinciaDto p, BranchesDto b)
        {
            IDictionary <string, object> ev = SetBranchProvince(p, b, DataObject, DataObject.BranchesDto);

            // send the opportune event where it is needed.
            await GridChangedNotification <BranchesDto, cliDelega>(ev,
                                                                   _onBranchesPrimaryKey, DataSubSystem.ClientSubsystem).ConfigureAwait(false);
        }
        /// <summary>
        ///  Set Branch province
        /// </summary>
        /// <param name="province">It allows the province branch.</param>
        /// <param name="branchesDto">It allows the branches dto.</param>
        internal override async Task SetBranchProvince(ProvinciaDto province, BranchesDto branchesDto)
        {
            // set the base event dictionary
            IDictionary <string, object> ev = SetBranchProvince(province, branchesDto, DataObject, DataObject.BranchesDto);

            // send the opportune event where it is needed.
            await GridChangedNotification <BranchesDto, COMI_DELEGA>(ev,
                                                                     _onBranchesPrimaryKey, DataSubSystem.CommissionAgentSubystem).ConfigureAwait(false);
        }
Beispiel #4
0
        internal override async Task SetBranchProvince(ProvinciaDto p, BranchesDto b)
        {
            var currentObject = DataObject as ISupplierData;

            if (currentObject != null)
            {
                var ev = SetBranchProvince(p, b, DataObject, currentObject.BranchesDto);
                await GridChangedNotification <BranchesDto, ProDelega>(ev, _onBranchesPrimaryKey, DataSubSystem.SupplierSubsystem).ConfigureAwait(false);
            }
        }
        public void Should_Answer_OnProvince_Assist_Correctly()
        {
            var dto = new BranchesDto();

            viewModel.DelegationProvinceMagnifierCommand.Execute(dto);
            var branches = viewModel.BranchesDto;
            var b        = branches.Where(x => x.BranchId == dto.BranchId);

            Assert.AreEqual(b, dto);
        }
Beispiel #6
0
        internal override async Task SetBranchProvince(ProvinciaDto province, BranchesDto branch)
        {
            IList <BranchesDto> branchList = new List <BranchesDto>();
            var ev = CreateGridEvent <ProvinciaDto, BranchesDto>(province,
                                                                 branch,
                                                                 branchList, new DelegateCommand <object>((_branchesDto) =>
            {
                _showExecuted = true;
            }));
            await Task.Delay(1);

            EventDictionary = ev;
        }
Beispiel #7
0
        public void Should_Execute_ProvinceMagnifier()
        {
            // arrange
            var param            = new BranchesDto();
            var raisedOnceChange = false;

            // act
            _commissionAgentInfoViewModel.DelegationProvinceMagnifierCommand.Execute(param);
            _commissionAgentInfoViewModel.PropertyChanged += delegate(object sender, System.ComponentModel.PropertyChangedEventArgs e)
            {
                raisedOnceChange = true;
            };
            // assert.
            Assert.NotNull(_commissionAgentInfoViewModel.DataObject);
            Assert.IsTrue(raisedOnceChange);
            Assert.NotNull(_commissionAgentInfoViewModel.DataObject.ProvinceDto);
            Assert.GreaterOrEqual(_commissionAgentInfoViewModel.DataObject.ProvinceDto.Count(), 0);
        }
Beispiel #8
0
 private void ClientOnBranchesPrimaryKey(ref BranchesDto primaryKey)
 {
     primaryKey.BranchKeyId = PrimaryKeyValue;
 }
 internal override Task SetBranchProvince(ProvinciaDto p, BranchesDto b)
 {
     throw new System.NotImplementedException();
 }
Beispiel #10
0
        /// <summary>
        ///  Move the mapping to a single mapper.DRY Principle. Dont repeat yourself.
        /// </summary>
        public void InitializeMapping()
        {
            var mapperConfiguration = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <SupplierPoco, SupplierDto>();
                cfg.CreateMap <SupplierDto, SupplierPoco>();
                cfg.CreateMap <CU1, AccountDto>().ConvertUsing(src =>
                {
                    var accountDto         = new AccountDto();
                    accountDto.Codigo      = src.CODIGO;
                    accountDto.Description = src.DESCRIP;
                    accountDto.Cuenta      = src.CC;
                    return(accountDto);
                }

                                                               );
                cfg.CreateMap <AccountDto, CU1>().ConvertUsing(src =>
                {
                    var accountDto     = new CU1();
                    accountDto.CODIGO  = src.Codigo;
                    accountDto.DESCRIP = src.Description;
                    return(accountDto);
                }

                                                               );

                cfg.CreateMap <BanksDto, BANCO>().ConstructUsing(src =>
                {
                    var bankDto     = new BANCO();
                    bankDto.CODBAN  = src.Code;
                    bankDto.NOMBRE  = src.Name;
                    bankDto.SWIFT   = src.Swift;
                    bankDto.USUARIO = src.Usuario;
                    bankDto.ULTMODI = src.LastModification;
                    return(bankDto);
                }
                                                                 );
                cfg.CreateMap <DIVISAS, CurrencyDto>();
                cfg.CreateMap <MESES, MonthsDto>();

                cfg.CreateMap <FORMAS, PaymentFormDto>();
                cfg.CreateMap <SupplierPoco, PROVEE1>().ConvertUsing <PocoToProvee1>();
                cfg.CreateMap <SupplierPoco, PROVEE2>().ConvertUsing <PocoToProvee2>();
                cfg.CreateMap <ProvinciaDto, PROVINCIA>().ConvertUsing(src =>
                {
                    var provincia    = new PROVINCIA();
                    provincia.SIGLAS = src.Code;
                    provincia.PROV   = src.Name;
                    return(provincia);
                });
                cfg.CreateMap <IDIOMAS, LanguageDto>().ConvertUsing(src =>
                {
                    var language    = new LanguageDto();
                    language.Nombre = src.NOMBRE;
                    language.Codigo = Convert.ToString(src.CODIGO);
                    return(language);
                });
                cfg.CreateMap <BANCO, BanksDto>().ConvertUsing(
                    src =>
                {
                    var banks              = new BanksDto();
                    banks.Code             = src.CODBAN;
                    banks.Name             = src.NOMBRE;
                    banks.Swift            = src.SWIFT;
                    banks.LastModification = src.ULTMODI;
                    banks.Usuario          = src.USUARIO;
                    return(banks);
                }
                    );

                cfg.CreateMap <ProDelega, BranchesDto>().ConvertUsing(src =>
                {
                    var branchesDto           = new BranchesDto();
                    branchesDto.BranchId      = src.cldIdDelega;
                    branchesDto.Address       = src.cldDireccion1;
                    branchesDto.Address2      = src.cldDireccion2;
                    branchesDto.Branch        = src.cldDelegacion;
                    branchesDto.City          = src.cldPoblacion;
                    branchesDto.Email         = src.cldEMail;
                    branchesDto.Phone         = src.cldTelefono1;
                    branchesDto.Phone2        = src.cldTelefono2;
                    branchesDto.BranchKeyId   = src.cldIdCliente;
                    branchesDto.Province      = new ProvinciaDto();
                    branchesDto.Province.Code = src.cldIdProvincia;
                    return(branchesDto);
                });

                cfg.CreateMap <ProContactos, ContactsDto>().ConvertUsing(src =>
                {
                    var contactDto               = new ContactsDto();
                    contactDto.Email             = src.ccoMail;
                    contactDto.LastMod           = src.ULTMODI;
                    contactDto.ContactId         = src.ccoIdContacto;
                    contactDto.ContactName       = src.ccoContacto;
                    contactDto.Fax               = src.ccoFax;
                    contactDto.Movil             = src.ccoMovil;
                    contactDto.CurrentDelegation = src.ccoIdDelega;
                    contactDto.Telefono          = src.ccoTelefono;
                    contactDto.Responsability    = src.ccoCargo;
                    contactDto.ContactsKeyId     = src.ccoIdCliente;

                    return(contactDto);
                });

                cfg.CreateMap <Country, CountryDto>().ConvertUsing(src =>
                {
                    var country         = new CountryDto();
                    country.Code        = src.SIGLAS;
                    country.CountryName = src.PAIS;
                    return(country);
                });

                // _vehicleMapper.Map<IEnumerable<PICTURES>, IEnumerable<PictureDto>>(pictureResult);
                cfg.CreateMap <PROVINCIA, ProvinciaDto>().ConvertUsing(src =>
                {
                    var provinciaDto  = new ProvinciaDto();
                    provinciaDto.Code = src.SIGLAS;
                    provinciaDto.Name = src.PROV;
                    return(provinciaDto);
                });
            });

            _supplierMapper = mapperConfiguration.CreateMapper();
        }
Beispiel #11
0
 private void ProviderInfoViewModel__onBranchesPrimaryKey(ref BranchesDto primaryKey)
 {
     primaryKey.BranchKeyId = PrimaryKeyValue;
 }
 private void CommissionAgentInfoViewModel__onBranchesPrimaryKey(ref BranchesDto primaryKey)
 {
     primaryKey.Code        = PrimaryKeyValue;
     primaryKey.BranchKeyId = PrimaryKeyValue;
 }