Beispiel #1
0
        public void GetSeller_FailCase()
        {
            var shipmentrepo = new ShipmentRepository(shipmentcontextmock.Object);
            var shipmentlist = shipmentrepo.GetShipment();

            Assert.AreNotEqual(2, shipmentlist.Count());
        }
Beispiel #2
0
        public void GetShipment_PassCase()
        {
            var shipmentrepo = new ShipmentRepository(shipmentcontextmock.Object);
            var shipmentlist = shipmentrepo.GetShipment();

            Assert.AreEqual(3, shipmentlist.Count());
        }
Beispiel #3
0
        /// <summary>
        /// convert bol to list model
        /// </summary>
        /// <param name="bol"></param>
        /// <returns></returns>
        public BillOfLadingViewModel ConvertToListView(BillOfLading bol)
        {
            BillOfLadingViewModel model = new BillOfLadingViewModel();

            var _shipmentRepository        = new ShipmentRepository();
            var _foundryDynamicsRepository = new FoundryDynamicsRepository();
            var _vesselRepository          = new VesselRepository();
            var _portRepository            = new PortRepository();

            var shipment        = _shipmentRepository.GetShipment(bol.ShipmentId);
            var dynamicsFoundry = _foundryDynamicsRepository.GetFoundry(bol.FoundryId);
            var vessel          = _vesselRepository.GetVessel((shipment != null) ? shipment.VesselId : Guid.Empty);
            var port            = _portRepository.GetPort((shipment != null) ? shipment.PortId : Guid.Empty);

            model.BillOfLadingId    = bol.BillOfLadingId;
            model.ShipmentId        = bol.ShipmentId;
            model.BolNumber         = (!string.IsNullOrEmpty(bol.Number)) ? bol.Number : "N/A";
            model.FoundryName       = (dynamicsFoundry != null) ? dynamicsFoundry.VENDSHNM : "N/A";
            model.Description       = (!string.IsNullOrEmpty(bol.Description)) ? bol.Description : "N/A";
            model.VesselName        = (vessel != null && !string.IsNullOrEmpty(vessel.Name)) ? vessel.Name : "N/A";
            model.PortName          = (port != null && !string.IsNullOrEmpty(port.Name)) ? port.Name : "N/A";
            model.DepartureDate     = (shipment != null && shipment.DepartureDate != null) ? shipment.DepartureDate : DateTime.MinValue;
            model.DepartureDateStr  = (shipment != null) ? shipment.DepartureDate.ToShortDateString() : "N/A";
            model.EstArrivalDate    = (shipment != null && shipment.EstArrivalDate != null) ? shipment.EstArrivalDate : DateTime.MinValue;
            model.EstArrivalDateStr = (shipment != null) ? shipment.EstArrivalDate.Value.ToShortDateString() : "N/A";
            model.HasBeenAnalyzed   = bol.HasBeenAnalyzed;
            model.CreatedDate       = bol.CreatedDate;

            if (_shipmentRepository != null)
            {
                _shipmentRepository.Dispose();
                _shipmentRepository = null;
            }
            if (_foundryDynamicsRepository != null)
            {
                _foundryDynamicsRepository.Dispose();
                _foundryDynamicsRepository = null;
            }
            if (_vesselRepository != null)
            {
                _vesselRepository.Dispose();
                _vesselRepository = null;
            }
            if (_portRepository != null)
            {
                _portRepository.Dispose();
                _portRepository = null;
            }

            return(model);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            ShipmentEntity    shipment    = new ShipmentEntity();
            ShipmentOutEntity shipmentout = new ShipmentOutEntity();

            if (String.IsNullOrWhiteSpace(txtShipment.Text) || String.IsNullOrWhiteSpace(txtShipment.Text))
            {
                MessageBox.Show("Bạn phải nhập mã đơn hàng để tìm kiếm", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            try
            {
                string input = txtShipment.Text.Trim().ToUpper();
                lblTitle.Text = input;
                // Shipment out
                shipmentout = _shipmentOutServices.GetByShipmentId(input);
                if (shipmentout != null)
                {
                    lblShipment.Text = "Thông tin xuất kho: " + shipmentout.MasterBillIdString + System.Environment.NewLine + shipmentout.BoxIdString + "(" + shipmentout.DateOut.ToString("d MMM yyyy") + ")";
                }
                // Shipment in
                shipment = _repositoryShipment.GetShipment(input);
                if (shipment != null)
                {
                    lblDelivery.Text = "Thông tin đơn hàng: " + shipment.Receiver + " - " + shipment.ReceiverTel + System.Environment.NewLine + "Địa chỉ: " + shipment.Address;
                }
                // Ecuss
                if (_shipmentOutServices.GetStatusCompletion(input))
                {
                    lblEcus.ForeColor = Color.Green;
                    lblEcus.Text      = "Đã thông quan.";
                }
                else
                {
                    lblEcus.ForeColor = Color.OrangeRed;
                    lblEcus.Text      = "Chưa thông quan.";
                }
            }
            catch (Exception ex)
            {
            }
        }