コード例 #1
0
        public Consignment Map_ConsignmentDataModel_ToViewModel(Consignment_DataModel _consignment, List <Invoice_Header> result_invoiceHeaders)
        {
            DateTime dtCustomsBooked = Convert.ToDateTime(_consignment.Customs_Entered);
            DateTime dtBookedInDate  = Convert.ToDateTime(_consignment.Booked_In_Date);
            DateTime dtETAatPort     = Convert.ToDateTime(_consignment.ETA_At_Port);

            int  _deliveryStatus = calculationHandler.Return_ConsignmentDeliveryStatus_ToInt(_consignment);
            bool _orderInTransit = calculationHandler.Return_IsOrderInTransit_ToBool(_consignment);

            Consignment result = new Consignment()
            {
                Consignment_Number          = _consignment.Consignment_Number,
                Inland_Depot                = _consignment.Inland_Depot,
                Carrier_Code                = _consignment.Carrier_Code,
                Transport_Company           = _consignment.Ship_Nameetruck_plat,
                Customs_Booked              = dtCustomsBooked,
                Booked_In_Date              = dtBookedInDate,
                ETA_At_Port                 = dtETAatPort,
                Consignment_Delivery_Status = _deliveryStatus,
                Invoice_Headers             = result_invoiceHeaders,
                Supplier_Name               = _consignment.Supplier_Name,
                Order_In_Transit            = _orderInTransit
            };

            return(result);
        }
コード例 #2
0
        public int Return_ConsignmentDeliveryStatus_ToInt(Consignment_DataModel _consignment)
        {
            int result = 0;

            bool allDelivered   = false;
            bool customsEntered = false;
            bool ETAExceeded    = false;

            var _etaAtPort          = DateTime.MinValue;
            var _bookedInDate       = DateTime.MinValue;
            var _customsEnteredDate = DateTime.MinValue;

            DateTime.TryParse(_consignment.ETA_At_Port, out _etaAtPort);
            DateTime.TryParse(_consignment.Booked_In_Date, out _bookedInDate);
            DateTime.TryParse(_consignment.Customs_Entered, out _customsEnteredDate);

            if (_bookedInDate > DateTime.MinValue && _bookedInDate <= DateTime.Now)
            {
                allDelivered = true;
            }
            else if (_customsEnteredDate > DateTime.MinValue)
            {
                customsEntered = true;
            }
            else if (_etaAtPort <= DateTime.Now.Date)
            {
                ETAExceeded = true;
            }

            result = Return_StatusCodeFromBooleans_ToInt(allDelivered, customsEntered, ETAExceeded);

            return(result);
        }
コード例 #3
0
        private List <Invoice_Header> Return_InvoiceHeaders_ToList(Consignment_DataModel _consignment)
        {
            var result = new List <Invoice_Header>();

            IEnumerable <InvoiceHeader_DataModel> _invoiceHdrDataModel = performLookup.Return_ConsignmentInvoiceHeaders_ToDataModel(_consignment.Consignment_Number);

            if (_invoiceHdrDataModel != null)
            {
                foreach (InvoiceHeader_DataModel _invoiceHeader in _invoiceHdrDataModel)
                {
                    List <Invoice_Detail> result_invoiceDetails = Return_InvoiceDetails_ToList(_invoiceHeader);

                    Invoice_Header _newHeader = viewModelAdapter.Map_InvoiceHeaderDataModel_ToViewModel(_invoiceHeader, result_invoiceDetails);

                    result.Add(_newHeader);
                }
            }

            return(result);
        }
コード例 #4
0
        public bool Return_IsOrderInTransit_ToBool(Consignment_DataModel _consignment)
        {
            bool result = false;

            var _etaAtPort          = DateTime.MinValue;
            var _bookedInDate       = DateTime.MinValue;
            var _customsEnteredDate = DateTime.MinValue;

            DateTime.TryParse(_consignment.ETA_At_Port, out _etaAtPort);
            DateTime.TryParse(_consignment.Booked_In_Date, out _bookedInDate);
            DateTime.TryParse(_consignment.Customs_Entered, out _customsEnteredDate);

            if (_customsEnteredDate > DateTime.MinValue)
            {
                if (_bookedInDate == DateTime.MinValue || _bookedInDate > DateTime.Now.Date)
                {
                    result = true;
                }
            }

            return(result);
        }