Beispiel #1
0
        //# __________ PROTOCOL :: PRIVATE __________ #//
        public bool UpdateCart()
        {
            String originAirportCode = VmAirportData.Default.AirportCode;
            String identifier = NormalizeIdentifier();
            if(
               VmProperties.Default.ShouldStripAirportCodeOutOfNestCartIdentifier() &&
               identifier.StartsWith(originAirportCode) )
                identifier = identifier.Substring(originAirportCode.Length);

            String destinationAirportCode = "";
            if( ShouldCollectDestinationAirportCode() ) destinationAirportCode = (String)_destinationAirportCodeCB.SelectedItem;

            String flightNumber = "";
            if( ShouldCollectFlightNumber() ) flightNumber = (String)_flightNumberCB.SelectedItem;
            if( JwUtility.IsEmpty(flightNumber) ) flightNumber = null;

            if( ! Engine.ValidateCartDoesNotExist(
                originAirportCode,
                identifier,
                destinationAirportCode,
                flightNumber) )
            {
                // kludge (err) - language
                VmApplication.Default.ShowNotification("This Cart has already been created.  Please open it instead.");
                return false;
            }

            VmCart c = Engine.Cart;
            if( c == null)
            {
                c = new VmCart();
                Engine.Cart = c;
            }
            c.OriginAirportCode = originAirportCode;
            c.Identifier = identifier;
            c.DestinationAirportCode = destinationAirportCode;
            c.FlightNumber = flightNumber;
            c.Note = _noteTB.Text;

            return true;
        }
 //# __________ PROTOCOL :: PUBLIC __________ #//
 public void ClearEngine()
 {
     Cart = new VmCart();
 }
Beispiel #3
0
 public VmCart ReplaceCart( VmCart cart)
 {
     VmAirportData.Default.AirportOutputData.CartNestFile.Replace(cart);
     return cart;
 }
Beispiel #4
0
        public VmCart _AddCart(
            String originAirportCode,
            String identifier,
            String destinationAirportCode,
            String flightNumber,
            String note,
            String breakdownLocationCode)
        {
            int nestId = _CreateNest(VmNestType.CART);

            VmCart nest = new VmCart();
            nest.Id                     = nestId;
            nest.OriginAirportCode      = originAirportCode;
            nest.Identifier             = identifier;
            nest.DestinationAirportCode = destinationAirportCode;
            nest.FlightNumber           = flightNumber;
            nest.Note                   = note;
            nest.BreakDownLocationCode  = breakdownLocationCode;
            VmAirportData.Default.AirportOutputData.CartNestFile.Append(nest);
            _AddNest(nest);
            return nest;
        }
        //# __________ PROTOCOL :: PRIVATE __________ #//
        public bool UpdateCart()
        {
            String originAirportCode = VmAirportData.Default.AirportCode;
            String identifier = _identifierTB.Text;

            if( ! VmProperties.Default.ShouldAllowKnownTagTypesAsGeneralData() && VmTag.IsKnownTagType(identifier) )
            {
                // kludge (err) - language
                VmApplication.Default.ShowNotification("You have recorded an item rather than the cart identifier.");
                return false;
            }

            if(
               VmProperties.Default.ShouldStripAirportCodeOutOfNestCartIdentifier() &&
               identifier.StartsWith(originAirportCode) )
                identifier = identifier.Substring(originAirportCode.Length);

            String destinationAirportCode = "";
            if( ShouldCollectDestinationAirportCode() ) destinationAirportCode = _destinationAirportSearchableComboBox.GetSelectedValue();

            String flightNumber = "";
            if( ShouldCollectFlightNumber() ) flightNumber = (String)_flightNumberCB.SelectedItem;
            if( JwUtility.IsEmpty(flightNumber) ) flightNumber = null;

            /*

            if( ! Engine.ValidateCartDoesNotExist(
                originAirportCode,
                identifier,
                destinationAirportCode,
                flightNumber) )
            {
                // kludge (err) - language
                VmApplication.Default.ShowNotification("This Cart has already been created.  Please open it instead.");
                return false;
            }
            */

            VmCart c = Engine.Cart;
            if( c == null)
            {
                c = new VmCart();
                Engine.Cart = c;
            }
            c.OriginAirportCode = originAirportCode;
            c.Identifier = identifier;
            c.DestinationAirportCode = destinationAirportCode;
            c.FlightNumber = flightNumber;
            c.Note = _noteTB.Text;

            return true;
        }