コード例 #1
0
        /// <summary>
        /// edit package to exists line
        /// </summary>
        private void EditPackageToExistingLine()
        {
            if (SelectedPackage != 0) // template package
            {
                _lineManager.EditPackage(Number, PackageTemplates.SingleOrDefault(p => p.PackageId == SelectedPackage));
            }
            else // custom package
            {
                string error = ValidateFields();
                if (error != null)
                {
                    MessageBox.Show(error);
                    return;
                }
                Package package = CreateCustomPackage();

                Package newPackage = _lineManager.EditPackage(Number, package);
                if (newPackage != null)
                {
                    Friends friends = CreatePackageFriends();

                    if (newPackage.Friends != null)
                    {
                        _lineManager.EditFriends(newPackage.PackageId, Friends ? friends : null);
                    }
                    else if (Friends) // if the friends check box is true
                    {
                        _lineManager.AddFriends(newPackage.PackageId, friends);
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Update the view with selected package details
 /// </summary>
 private void HandlePackageSelect()
 {
     if (SelectedPackage != null)
     {
         string number = Number;
         Clear();
         Number = number;
         if (SelectedPackage != 0) // template package
         {
             Package package = PackageTemplates.FirstOrDefault(p => p.PackageId == SelectedPackage);
             DisplayPackage(package);
         }
     }
 }
コード例 #3
0
        // ctor
        public LineViewModel(IFrameNavigationService navigationService)
        {
            _navigationService = navigationService;
            _currentCustomer   = (Customer)_navigationService.Parameter;//?
            _lineManager       = new LineManager((Customer)_navigationService.Parameter);

            InitCommands();

            CustomerLines    = new ObservableCollection <Line>(_lineManager.GetCustomerLines());
            PackageTemplates = _lineManager.GetPackageTemplates();
            PackageTemplates.Add(new Package()
            {
                PackageName = "Custom package", PackageId = 0
            });
            LineWithoutPackage = true;
        }