当前位置: 首页>>代码示例>>C#>>正文


C# Cargo类代码示例

本文整理汇总了C#中Cargo的典型用法代码示例。如果您正苦于以下问题:C# Cargo类的具体用法?C# Cargo怎么用?C# Cargo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Cargo类属于命名空间,在下文中一共展示了Cargo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: toCargoRoutingDTO

        public void toCargoRoutingDTO()
        {
            var origin = L.HONGKONG;
            var destination = L.LONGBEACH;
            var cargo = new Cargo(new TrackingId("XYZ"), new RouteSpecification(origin, destination, DateTime.Now));

            var itinerary = new Itinerary(
                Leg.DeriveLeg(SampleVoyages.pacific1, L.HONGKONG, L.TOKYO),
                Leg.DeriveLeg(SampleVoyages.pacific1, L.TOKYO, L.LONGBEACH)
                );

            cargo.AssignToRoute(itinerary);

            var dto = DTOAssembler.toDTO(cargo);

            Assert.AreEqual(2, dto.getLegs().Count());

            LegDTO legDTO = dto.getLegs().ElementAt(0);
            Assert.AreEqual("PAC1", legDTO.getVoyageNumber());
            Assert.AreEqual("CNHKG", legDTO.getFrom());
            Assert.AreEqual("JNTKO", legDTO.getTo());

            legDTO = dto.getLegs().ElementAt(1);
            Assert.AreEqual("PAC1", legDTO.getVoyageNumber());
            Assert.AreEqual("JNTKO", legDTO.getFrom());
            Assert.AreEqual("USLBG", legDTO.getTo());
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:27,代码来源:DTOAssemblerTest.cs

示例2: NaoCadastraComNomeVazio

 public void NaoCadastraComNomeVazio()
 {
     Cargo cargo = new Cargo(12, "", 'I');
     CargoRepositorio cargoRep = new CargoRepositorio();
     bool cadastrar = cargoRep.AdicionarCargo(cargo);
     Assert.AreEqual(true, cadastrar);
 }
开发者ID:estervincensi,项目名称:Urna,代码行数:7,代码来源:CargoRepositorioTest.cs

示例3: toDTO

        internal static CargoRoutingDTO toDTO(Cargo cargo)
        {
            var itinerary = cargo.Itinerary;

            var legDTOList = new List<LegDTO>();
            if(itinerary != null)
            {
                var legs = itinerary.Legs;

                legDTOList = new List<LegDTO>(legs.Count());
                foreach(Leg leg in legs)
                {
                    var legDTO = new LegDTO(
                      leg.Voyage.VoyageNumber.Value,
                      leg.LoadLocation.UnLocode.Value,
                      leg.UnloadLocation.UnLocode.Value,
                      leg.LoadTime,
                      leg.UnloadTime);
                    legDTOList.Add(legDTO);
                }
            }

            return new CargoRoutingDTO(
              cargo.TrackingId.Value,
              cargo.RouteSpecification.Origin.UnLocode.Value,
              cargo.RouteSpecification.Destination.UnLocode.Value,
              cargo.RouteSpecification.ArrivalDeadline,
              cargo.RoutingStatus == RoutingStatus.MISROUTED,
              legDTOList
            );
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:31,代码来源:DTOAssembler.cs

示例4: DeletarCargo

 public void DeletarCargo()
 {
     Cargo cargo = new Cargo(100, "Presidente", 'I');
     CargoRepositorio cargoRep = new CargoRepositorio();
     bool delete = cargoRep.DeletarCargo(5);
     Assert.AreEqual(true, delete);
 }
开发者ID:estervincensi,项目名称:Urna,代码行数:7,代码来源:CargoRepositorioTest.cs

示例5: OnTriggerEnter

    void OnTriggerEnter(Collider otherObject)
    {
        Debug.Log(string.Format("Ore collided with {0} at {1}", otherObject.name, Time.time));

        if (otherObject.name == "Player")
        {
            Cargo ore = new Cargo(Cargo.CargoType.Ore);

            //different OreTypes are worth different amounts
            switch (ActiveOreType)
            {
            case OreType.Green:
                ore.Quantity = 1;
                break;
            case OreType.Blue:
                ore.Quantity = 2;
                break;
            case OreType.Red:
                ore.Quantity = 3;
                break;
            case OreType.Yellow:
                ore.Quantity = 5;
                break;
            }

            otherObject.SendMessage("PickupCargo", ore);
            Destroy(gameObject);
        }
    }
开发者ID:GennrichJ,项目名称:EventHorizon,代码行数:29,代码来源:OreScript.cs

示例6: cadastrarCargo

 public Boolean cadastrarCargo(Cargo objCargo)
 {
     objCargo.Codigo = obtemNovoId();
     try
     {
         if (!temDuplicidade(objCargo, "Cadastrar"))
         {
             db = ServidorSingleton.obterServidor().OpenClient();
             db.Store(objCargo);
             db.Commit();
             return true;
         }
         else {
             return false;
         }
     }
     catch(Exception e)
     {
         throw new Exception("Erro cadastrando o cargo :" + e.Message);
     }
     finally {
         db.Close();
         db.Dispose();
     }
 }
开发者ID:fbsharp,项目名称:Projetos,代码行数:25,代码来源:CargoDAO.cs

示例7: FuncionarioBuilder

 private FuncionarioBuilder()
 {
     _usuario = UsuarioBuilder.DadoUmUsuario().Build();
     _departamento = DepartamentoBuilder.DadoUmDepartamento().Build();
     _cargo = CargoBuilder.DadoUmCargo().Build();
     _programa = ProgramaBuilder.DadoUmPrograma().Build();
 }
开发者ID:SyedArifulIslamEmon,项目名称:SystemsHealthManagement,代码行数:7,代码来源:FuncionarioBuilder.cs

示例8: CargoTest

 public void CargoTest()
 {
     Cargo cargo = new Cargo(23, "Cargo");
     Assert.AreEqual("Cargo", cargo.Nome);
     Assert.AreEqual(23, cargo.IdCargo);
     Assert.AreEqual('\0', cargo.Situacao);
 }
开发者ID:JulioCROliveira,项目名称:UrnaBackend,代码行数:7,代码来源:CargoTests.cs

示例9: TestCalculatePossibleRoutes

        public void TestCalculatePossibleRoutes()
        {
            var trackingId = new TrackingId("ABC");
            var routeSpecification = new RouteSpecification(SampleLocations.HONGKONG,
                                                                           SampleLocations.HELSINKI, DateTime.Now);
            var cargo = new Cargo(trackingId, routeSpecification);

            voyageRepositoryMock.Setup(v => v.Find(It.IsAny<VoyageNumber>())).Returns(SampleVoyages.CM002);

            IList<Itinerary> candidates = externalRoutingService.FetchRoutesForSpecification(routeSpecification);
            Assert.IsNotNull(candidates);

            foreach (Itinerary itinerary in candidates)
            {
                IList<Leg> legs = itinerary.Legs;
                Assert.IsNotNull(legs);
                Assert.IsFalse(legs.IsEmpty());

                // Cargo origin and start of first leg should match
                Assert.AreEqual(cargo.Origin, legs[0].LoadLocation);

                // Cargo final destination and last leg stop should match
                Location lastLegStop = legs[legs.Count - 1].UnloadLocation;
                Assert.AreEqual(cargo.RouteSpecification.Destination, lastLegStop);

                for (int i = 0; i < legs.Count - 1; i++)
                {
                    // Assert that all legs are connected
                    Assert.AreEqual(legs[i].UnloadLocation, legs[i + 1].LoadLocation);
                }
            }

            voyageRepositoryMock.Verify();
        }
开发者ID:chandmk,项目名称:esddd,代码行数:34,代码来源:ExternalRoutingServiceTest.cs

示例10: CargoTest

 public void CargoTest()
 {
     Cargo cargo = new Cargo("Cargo", 'A');
     Assert.AreEqual("Cargo", cargo.Nome);
     Assert.AreEqual(0, cargo.IdCargo);
     Assert.AreEqual('A', cargo.Situacao);
 }
开发者ID:angelo5014,项目名称:UrnaBackend,代码行数:7,代码来源:CargoTests.cs

示例11: updateCargo

        public void updateCargo()
        {
            TrackingId trackingId = trackingIdFactory.nextTrackingId();
            RouteSpecification routeSpecification = new RouteSpecification(L.HONGKONG,
                L.GOTHENBURG,
                DateTime.Parse("2009-10-15"));

            Cargo cargo = new Cargo(trackingId, routeSpecification);
            cargoRepository.store(cargo);

            HandlingEvent handlingEvent = handlingEventFactory.createHandlingEvent(DateTime.Parse("2009-10-01 14:30"),
                cargo.TrackingId,
                V.HONGKONG_TO_NEW_YORK.VoyageNumber,
                L.HONGKONG.UnLocode,
                HandlingActivityType.LOAD,
                new OperatorCode("ABCDE"));

            handlingEventRepository.store(handlingEvent);

            Assert.That(handlingEvent.Activity, Is.Not.EqualTo(cargo.MostRecentHandlingActivity));

            cargoUpdater.updateCargo(handlingEvent.SequenceNumber);

            Assert.That(handlingEvent.Activity, Is.EqualTo(cargo.MostRecentHandlingActivity));
            Assert.True(handlingEvent.Activity != cargo.MostRecentHandlingActivity);

            systemEvents.AssertWasCalled(se => se.notifyOfCargoUpdate(cargo));
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:28,代码来源:CargoUpdaterTest.cs

示例12: AdicionarCargo

        public bool AdicionarCargo(Cargo cargo)
        {
            bool podeCadastrar = PodeCadastrar(cargo);
            bool verificarNome = VerificarNomeNuloOuVazio(cargo);
            if (podeCadastrar && !Eleicao.Iniciou)
            {
                if (verificarNome)
                {
                    string connectionString = ConfigurationManager.ConnectionStrings["URNA"].ConnectionString;
                    using (TransactionScope transacao = new TransactionScope())
                    using (IDbConnection connection = new SqlConnection(connectionString))
                    {
                        IDbCommand comando = connection.CreateCommand();
                        comando.CommandText =
                            "INSERT INTO Cargo (Nome, Situacao) values(@paramNome, @paramSituacao)";
                        comando.AddParameter("@paramNome", cargo.Nome);
                        comando.AddParameter("@paramSituacao", cargo.Situacao);
                        connection.Open();
                        comando.ExecuteNonQuery();
                        transacao.Complete();
                        connection.Close();
                    }
                }
                return true;

            }
            else
            {
                return false;
            }
        }
开发者ID:estervincensi,项目名称:Urna,代码行数:31,代码来源:CargoRepositorio.cs

示例13: CadastrarCargo

 public void CadastrarCargo()
 {
     Cargo cargo = new Cargo(6, "Deputado", 'A');
     CargoRepositorio cargoRep = new CargoRepositorio();
     bool cadastro = cargoRep.AdicionarCargo(cargo);
     Assert.AreEqual(true, cadastro);
 }
开发者ID:estervincensi,项目名称:Urna,代码行数:7,代码来源:CargoRepositorioTest.cs

示例14: Store

        public void Store(Cargo cargo)
        {
            cargoCollection.Save(cargo);

            // Delete-orphan does not seem to work correctly when the parent is a component
            //Session.CreateSQLQuery("delete from Leg where cargo_id = null").ExecuteUpdate();
        }
开发者ID:chandmk,项目名称:esddd,代码行数:7,代码来源:CargoRepositoryMongo.cs

示例15: NaoAlteraCargoPraAtivoComEleicaoAberta

 public void NaoAlteraCargoPraAtivoComEleicaoAberta()
 {
     Cargo cargo = new Cargo(42, "Sindico", 'A');
     CargoRepositorio cargoRep = new CargoRepositorio();
     bool altera = cargoRep.AtivarCargo(1);
     Assert.AreEqual(false, altera);
 }
开发者ID:estervincensi,项目名称:Urna,代码行数:7,代码来源:CargoRepositorioTest.cs


注:本文中的Cargo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。