Beispiel #1
0
        public void Add_NullCountry_ReturnsNullAndDoesNotInsert()
        {
            var result = _countryRepository.Add(null);

            Check.That(result).IsNull();
            Check.That(_countryRepository.All()).CountIs(0);
        }
Beispiel #2
0
        public ListCollection <CountryData> List(int take, int skip, string language)
        {
            var data = _countries.All(language);

            return(new ListCollection <CountryData>
            {
                Data = data.Skip(skip).Take(take).ToArray(),
                Groups = null,
                Total = data.Length
            });
        }
        //been updated with th
        // GET: Persona/Create
        public async Task <IActionResult> Create()
        {
            IEnumerable <Country> listcountries = await _countryRepository.All();

            //IEnumerable<State> liststates = await _stateRepository.All();
            //IEnumerable<City> listcities = await _cityRepository.All();

            //this is a model fo persona fisica
            PersonaFormViewModel personaVModel = new PersonaFormViewModel(new SelectList(listcountries, "Id", "Name"));

            //personaVModel.TypoPersona = CustomEnums.TypoPersonaEnum.Juridica;
            personaVModel.StatusCliente = CustomEnums.TypoStatusClienteEnum.Pending; //set up new cliente to status pendi

            //PersonaFormViewModel juridicaVModel = new PersonaFormViewModel(new SelectList(listcountries, "Id", "Name"));
            //ViewData["CityId"] = new SelectList(_context.Cities, "Id", "Name");
            return(View(personaVModel));
        }
Beispiel #4
0
        private void BindCountries()
        {
            var senderId = _senders.GetByUserId(_identity.Id);

            Debug.Assert(senderId != null);

            var countries = _senders.GetCountries(senderId.Value);

            ViewBag.Countries = _countries.All(_identity.Language)
                                .Where(x => countries.Contains(x.Id))
                                .ToDictionary(x => x.Id, x => x.Name);
        }
        private void BindBag(long?applicationId, long clientId)
        {
            ViewBag.ClientId = clientId;

            ViewBag.ApplicationId = applicationId;

            if (applicationId.HasValue)
            {
                var data = _applications.Get(applicationId.Value);

                ViewBag.ApplicationNumber = data.DisplayNumber;
            }

            ViewBag.Countries = _countries.All(_identity.Language).ToDictionary(x => x.Id, x => x.Name);
        }
Beispiel #6
0
        private void BindBag(long?applicationId, ClientData client)
        {
            ViewBag.ClientNic = client.Nic;

            ViewBag.ClientId = client.ClientId;

            ViewBag.ApplicationId = applicationId;

            if (applicationId.HasValue)
            {
                var data = _applications.Get(applicationId.Value);

                ViewBag.ApplicationNumber = data.DisplayNumber;
            }

            ViewBag.Countries = _countries.All(_identity.Language).ToDictionary(x => x.Id, x => x.Name);

            ViewBag.Senders = _senders.GetAll().OrderBy(x => x.Name).ToDictionary(x => (long?)x.EntityId, x => x.Name);

            ViewBag.Forwarders = _forwarders.GetAll().OrderBy(x => x.Name).ToDictionary(x => (long?)x.Id, x => x.Name);

            ViewBag.Carriers = _carriers.GetAll().OrderBy(x => x.Name).ToDictionary(x => (long?)x.Id, x => x.Name);
        }
        public ApplicationListItem[] Map(ApplicationData[] data, string language)
        {
            var appIds   = data.Select(x => x.Id).ToArray();
            var stateIds = data.Select(x => x.StateId).ToArray();

            var countries         = _countries.All(language).ToDictionary(x => x.Id, x => x.Name);
            var states            = _states.Get(language, stateIds);
            var stateAvailability = _stateFilter.GetStateAvailabilityToSet();
            var calculations      = _applications.GetCalculations(appIds);
            var cps           = _files.GetInfo(appIds, ApplicationFileType.CP);
            var deliveryBills = _files.GetInfo(appIds, ApplicationFileType.DeliveryBill);
            var invoices      = _files.GetInfo(appIds, ApplicationFileType.Invoice);
            var packings      = _files.GetInfo(appIds, ApplicationFileType.Packing);
            var otherFiles    = _files.GetInfo(appIds, ApplicationFileType.Other);
            var swifts        = _files.GetInfo(appIds, ApplicationFileType.Swift);
            var torg12        = _files.GetInfo(appIds, ApplicationFileType.Torg12);
            var t1            = _files.GetInfo(appIds, ApplicationFileType.T1);
            var ex1           = _files.GetInfo(appIds, ApplicationFileType.Ex1);
            var cities        = _cities.All(language).ToDictionary(x => x.Id, x => x.Name);

            return(data.Select(x => new ApplicationListItem
            {
                CountryName = countries[x.CountryId],
                State = new ApplicationStateModel
                {
                    StateId = x.StateId,
                    StateName = states[x.StateId].LocalizedName
                },
                CanClose = x.StateId == _stateConfig.CargoOnTransitStateId,
                CanSetState = stateAvailability.Contains(x.StateId),
                AddressLoad = x.AddressLoad,
                Id = x.Id,
                FactoryName = x.FactoryName,
                Invoice = x.Invoice,
                MarkName = x.MarkName,
                Volume = x.Volume,
                Count = x.Count,
                AirWaybill = x.AirWaybill,
                Characteristic = x.Characteristic,
                ClientLegalEntity = x.ClientLegalEntity,
                ClientNic = x.ClientNic,
                ClientId = x.ClientId,
                CreationTimestamp = x.CreationTimestamp,
                DateInStock = x.DateInStock,
                DateOfCargoReceipt = x.DateOfCargoReceipt,
                FactoryContact = x.FactoryContact,
                FactoryEmail = x.FactoryEmail,
                FactoryPhone = x.FactoryPhone,
                StateChangeTimestamp = x.StateChangeTimestamp,
                StateId = x.StateId,
                TermsOfDelivery = x.TermsOfDelivery,
                TransitAddress = x.TransitAddress,
                CarrierName = x.CarrierName,
                CarrierContact = x.CarrierContact,
                CarrierAddress = x.CarrierAddress,
                CarrierPhone = x.CarrierPhone,
                TransitId = x.TransitId,
                TransitCity = cities[x.TransitCityId],
                TransitDeliveryTypeString = x.TransitDeliveryType.ToLocalString(),
                TransitMethodOfTransitString = x.TransitMethodOfTransit.ToLocalString(),
                TransitPhone = x.TransitPhone,
                TransitRecipientName = x.TransitRecipientName,
                TransitReference = x.TransitReference,
                TransitWarehouseWorkingTime = x.TransitWarehouseWorkingTime,
                WarehouseWorkingTime = x.WarehouseWorkingTime,
                Weight = x.Weight,
                MethodOfDeliveryId = (int)x.MethodOfDelivery,
                IsPickup = x.IsPickup,
                TransitMethodOfTransitId = (int)x.TransitMethodOfTransit,
                Value = x.Value,
                CurrencyId = (int)x.CurrencyId,
                AirWaybillId = x.AirWaybillId,
                PickupCost = x.GetAdjustedPickupCost(),
                FactureCost = x.GetAdjustedFactureCost(),
                FactureCostEx = x.GetAdjustedFactureCostEx(),
                ScotchCost = x.GetAdjustedScotchCost(),
                SenderName = x.SenderName,
                ForwarderName = x.ForwarderName,
                SenderScotchCost = x.SenderScotchCost,
                TariffPerKg = x.TariffPerKg,
                TransitCost = x.GetAdjustedTransitCost(),
                ForwarderTransitCost = x.TransitCost,
                CanSetTransitCost = !calculations.ContainsKey(x.Id),
                CPFiles = cps.ContainsKey(x.Id) ? cps[x.Id].ToArray() : null,
                DeliveryBillFiles = deliveryBills.ContainsKey(x.Id) ? deliveryBills[x.Id].ToArray() : null,
                InvoiceFiles = invoices.ContainsKey(x.Id) ? invoices[x.Id].ToArray() : null,
                PackingFiles = packings.ContainsKey(x.Id) ? packings[x.Id].ToArray() : null,
                OtherFiles = otherFiles.ContainsKey(x.Id) ? otherFiles[x.Id].ToArray() : null,
                SwiftFiles = swifts.ContainsKey(x.Id) ? swifts[x.Id].ToArray() : null,
                Torg12Files = torg12.ContainsKey(x.Id) ? torg12[x.Id].ToArray() : null,
                T1Files = t1.ContainsKey(x.Id) ? t1[x.Id].ToArray() : null,
                Ex1Files = ex1.ContainsKey(x.Id) ? ex1[x.Id].ToArray() : null,
                DisplayNumber = x.GetApplicationDisplay(),
                DaysInWork = x.GetDaysInWork(),
                CreationTimestampLocalString = LocalizationHelper.GetDate(x.CreationTimestamp, CultureProvider.GetCultureInfo()),
                StateChangeTimestampLocalString =
                    LocalizationHelper.GetDate(x.StateChangeTimestamp, CultureProvider.GetCultureInfo()),
                DateOfCargoReceiptLocalString =
                    x.DateOfCargoReceipt.HasValue
                                                ? LocalizationHelper.GetDate(x.DateOfCargoReceipt.Value, CultureProvider.GetCultureInfo())
                                                : null,
                DateInStockLocalString =
                    x.DateInStock.HasValue ? LocalizationHelper.GetDate(x.DateInStock.Value, CultureProvider.GetCultureInfo()) : null,
                MethodOfDeliveryLocalString = x.MethodOfDelivery.ToLocalString(),
                ValueString = GetValueString(x.Value, x.CurrencyId),
                MRN = x.MRN,
                CountInInvoce = x.CountInInvoce,
                DocumentWeight = x.DocumentWeight
            }).ToArray());
        }
Beispiel #8
0
        public WebGameQuery(
            IPlayerRepository playerRepository,
            IPlanetRepository planetRepository,
            ICountryRepository countryRepository,
            ICityRepository cityRepository
            )
        {
            Field <PlayerType>(
                "player",
                arguments: new QueryArguments(new QueryArgument <StringGraphType> {
                Name = "pseudo"
            }),
                resolve: context => playerRepository.Get(context.GetArgument <string>("pseudo")));

            Field <PlayerType>(
                "randomPlayer",
                resolve: context => playerRepository.GetRandom());

            Field <ListGraphType <PlayerType> >(
                "players",
                resolve: context => playerRepository.All());

            Field <PlanetType>(
                "planet",
                arguments: new QueryArguments(new QueryArgument <StringGraphType> {
                Name = "name"
            }),
                resolve: context => planetRepository.Get(context.GetArgument <string>("name")));

            Field <PlanetType>(
                "randomPlanet",
                resolve: context => planetRepository.GetRandom());

            Field <ListGraphType <PlanetType> >(
                "planets",
                resolve: context => planetRepository.All());

            Field <CountryType>(
                "country",
                arguments: new QueryArguments(new QueryArgument <StringGraphType> {
                Name = "name"
            }),
                resolve: context => countryRepository.Get(context.GetArgument <string>("name")));

            Field <CountryType>(
                "randomCountry",
                resolve: context => countryRepository.GetRandom());

            Field <ListGraphType <CountryType> >(
                "countries",
                resolve: context => countryRepository.All());


            Field <CityType>(
                "cityByName",
                arguments: new QueryArguments(new QueryArgument <StringGraphType> {
                Name = "name"
            }),
                resolve: context => cityRepository.Get(context.GetArgument <string>("name")));

            Field <CityType>(
                "cityById",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),
                resolve: context => cityRepository.GetById(context.GetArgument <int>("id")));

            Field <CityType>(
                "randomCity",
                resolve: context => cityRepository.GetRandom());

            Field <ListGraphType <CityType> >(
                "cities",
                resolve: context => cityRepository.All());
        }
Beispiel #9
0
        private IDictionary <string, string> GetTextLocalizedData(ApplicationData application, string language,
                                                                  CultureInfo culture)
        {
            var state        = _states.Get(language, application.StateId).Select(x => x.Value).FirstOrDefault();
            var countryName  = _countries.All(language).First(x => x.Id == application.CountryId).Name;
            var cityName     = _cities.All(language).First(x => x.Id == application.TransitCityId).Name;
            var value        = LocalizationHelper.GetValueString(application.Value, application.CurrencyId, culture);
            var deliveryBill = _files.GetNames(application.Id, ApplicationFileType.DeliveryBill).Select(x => x.Name).ToArray();
            var invoice      = _files.GetNames(application.Id, ApplicationFileType.Invoice).Select(x => x.Name).ToArray();
            var packing      = _files.GetNames(application.Id, ApplicationFileType.Packing).Select(x => x.Name).ToArray();
            var swift        = _files.GetNames(application.Id, ApplicationFileType.Swift).Select(x => x.Name).ToArray();
            var torg12       = _files.GetNames(application.Id, ApplicationFileType.Torg12).Select(x => x.Name).ToArray();
            var t1           = _files.GetNames(application.Id, ApplicationFileType.T1).Select(x => x.Name).ToArray();
            var ex1          = _files.GetNames(application.Id, ApplicationFileType.Ex1).Select(x => x.Name).ToArray();

            var localizedData = new Dictionary <string, string>();

            Add(localizedData, "AddressLoad", application.AddressLoad);
            Add(localizedData, "FactoryName", application.FactoryName);
            Add(localizedData, "Id", application.Id.ToString(culture));
            Add(localizedData, "Count", application.Count.HasValue ? application.Count.Value.ToString(culture) : null);
            Add(localizedData, "MarkName", application.MarkName);
            Add(localizedData, "Invoice", application.Invoice);
            Add(localizedData, "CountryName", countryName);
            Add(localizedData, "CreationTimestamp", LocalizationHelper.GetDate(application.CreationTimestamp, culture));
            Add(localizedData, "Value", value);
            Add(localizedData, "Weight", application.Weight.HasValue ? application.Weight.Value.ToString(culture) : null);
            Add(localizedData, "AirWaybill", application.AirWaybill);
            Add(localizedData, "AirWaybillDateOfArrival",
                LocalizationHelper.GetDate(application.AirWaybillDateOfArrival, culture));
            Add(localizedData, "AirWaybillDateOfDeparture",
                LocalizationHelper.GetDate(application.AirWaybillDateOfDeparture, culture));
            Add(localizedData, "AirWaybillGTD", application.AirWaybillGTD);
            Add(localizedData, "Characteristic", application.Characteristic);
            Add(localizedData, "ClientNic", application.ClientNic);
            Add(localizedData, "DateOfCargoReceipt", LocalizationHelper.GetDate(application.DateOfCargoReceipt, culture));
            Add(localizedData, "DaysInWork", application.GetDaysInWork().ToString(culture));
            Add(localizedData, "DeliveryBillFiles", string.Join(", ", deliveryBill));
            Add(localizedData, "DeliveryType", LocalizationHelper.GetDeliveryType(application.TransitDeliveryType, culture));
            Add(localizedData, "DisplayNumber", application.GetApplicationDisplay());
            Add(localizedData, "FactoryContact", application.FactoryContact);
            Add(localizedData, "FactoryEmail", application.FactoryEmail);
            Add(localizedData, "FactoryPhone", application.FactoryPhone);
            Add(localizedData, "InvoiceFiles", string.Join(", ", invoice));
            Add(localizedData, "LegalEntity", application.ClientLegalEntity);
            Add(localizedData, "Pickup",
                application.IsPickup
                                                ? Alicargo.Core.Resources.Entities.ResourceManager.GetString("Pickup", culture)
                                                : "");
            Add(localizedData, "MethodOfDelivery", LocalizationHelper.GetMethodOfDelivery(application.MethodOfDelivery, culture));
            Add(localizedData, "MethodOfTransit",
                LocalizationHelper.GetMethodOfTransit(application.TransitMethodOfTransit, culture));
            Add(localizedData, "PackingFiles", string.Join(", ", packing));
            Add(localizedData, "StateChangeTimestamp", LocalizationHelper.GetDate(application.StateChangeTimestamp, culture));
            Add(localizedData, "StateName", state != null ? state.LocalizedName : null);
            Add(localizedData, "SwiftFiles", string.Join(", ", swift));
            Add(localizedData, "TermsOfDelivery", application.TermsOfDelivery);
            Add(localizedData, "Torg12Files", string.Join(", ", torg12));
            Add(localizedData, "T1Files", string.Join(", ", t1));
            Add(localizedData, "Ex1Files", string.Join(", ", ex1));
            Add(localizedData, "TransitAddress", application.TransitAddress);
            Add(localizedData, "CarrierName", application.CarrierName);
            Add(localizedData, "CarrierContact", application.CarrierContact);
            Add(localizedData, "CarrierAddress", application.CarrierAddress);
            Add(localizedData, "CarrierPhone", application.CarrierPhone);
            Add(localizedData, "CarrierEmail", application.CarrierEmail);
            Add(localizedData, "TransitCity", cityName);
            Add(localizedData, "TransitPhone", application.TransitPhone);
            Add(localizedData, "TransitRecipientName", application.TransitRecipientName);
            Add(localizedData, "TransitReference", application.TransitReference);
            Add(localizedData, "TransitWarehouseWorkingTime", application.TransitWarehouseWorkingTime);
            Add(localizedData, "Volume", application.Volume.ToString("N2", culture));
            Add(localizedData, "WarehouseWorkingTime", application.WarehouseWorkingTime);
            Add(localizedData, "SenderName", application.SenderName);
            Add(localizedData, "SenderContact", application.SenderContact);
            Add(localizedData, "SenderPhone", application.SenderPhone);
            Add(localizedData, "SenderAddress", application.SenderAddress);
            Add(localizedData, "SenderEmail", application.SenderEmail);
            Add(localizedData, "ForwarderName", application.ForwarderName);
            Add(localizedData, "CountInInvoce", application.CountInInvoce.ToString());
            Add(localizedData, "DocumentWeight", application.DocumentWeight.ToString());
            Add(localizedData, "MRN", application.MRN);

            return(localizedData);
        }
Beispiel #10
0
        private void BindBag()
        {
            var countries = _countries.All(_identity.Language);

            ViewBag.Countries = countries;
        }