예제 #1
0
        public override void Selected(NSIndexPath indexPath)
        {
            InstallTypeBadgeElement selectedElement = (this.Root[0].Elements[indexPath.Row] as InstallTypeBadgeElement);
            InstallationType        insType         = selectedElement.ThisInstall;

            SaveInstallTypeToDatabase(insType.ID);

            jivc.AddPartsRangeToList(insType.PartsLink);
            jivc.GoChooseSaleOptions();

            // find if the database contains a roof install sale option
            InstallationType roofIns = InstallTypesDVC.dbInstallTypes.FindLast(
                delegate(InstallationType ins)
                { return(ins.Name == "Roof"); });

            // if it does, we must check if roof installation was chosen by the user
            if (roofIns != null)
            {
                // if a roof installation has been chosen, an extra fee must be applied to the job
                if (insType.ID == roofIns.ID)
                {
                    jivc.dvcSO.SaveOptionToDatabase(11);
                    jivc.dvcSO.ApplyExtraFeeForSaleOption(11);
                }
            }

            // base.Selected (indexPath);
        }
예제 #2
0
        public override void Selected(NSIndexPath indexPath)
        {
            ProductBadgeElement element = (this.Root[0].Elements[indexPath.Row] as ProductBadgeElement);
            Product             product = element.ThisProduct;

            jivc.AddPartsRangeToList(product.PartsLink);
            jivc.GoChooseInstallType();
        }
예제 #3
0
        public override void Selected(NSIndexPath indexPath)
        {
            if (indexPath.Section == 0)
            {
                SaveSaleOptionsToDatabase();
                jivc.InstallDataGathered();
            }
            else
            {
                SaleOptionBadgeElement element = (this.Root[indexPath.Section].Elements[indexPath.Row] as SaleOptionBadgeElement);
                SaleOption             option  = element.ThisOption;
                if (indexPath.Section == 1)
                {
                    // A tap model is selected

                    // Tap models act as a radiogroup, this means we will have to find the option that was selected previously and "unselect" it
                    foreach (SaleOptionBadgeElement _element in Root[indexPath.Section])
                    {
                        if (_element.Accessory != UITableViewCellAccessory.None)
                        {
                            // exclude the part(s) associated with this option from the parts list
                            SaleOption _option = _element.ThisOption;
                            if (_option.PartLink != 0)
                            {
                                jivc.PartRemoved(Convert.ToInt32(_option.PartLink));
                            }

                            // remove the "tick" from the element
                            _element.Accessory = UITableViewCellAccessory.None;

                            // invoke the routines to remove customer surcharge and extra fee
                            RemoveSurchargeForSaleOption(_option.ID);
                            RemoveExtraFeeForSaleOption(_option.ID);
                        }
                    }

                    // add the part(s) associated with the option selected by user to the list
                    jivc.PartChosen(Convert.ToInt32(option.PartLink));
                    jivc.ReloadData();
                    // "tick" the chosen element
                    element.Accessory = UITableViewCellAccessory.Checkmark;

                    // invoke the routines to apply customer surcharge and extra fee
                    ApplySurchargeForSaleOption(option.ID);
                    ApplyExtraFeeForSaleOption(option.ID);
                }
                else                 // non-tap option was selected
                {
                    // check if it was selected already
                    if (element.Accessory != UITableViewCellAccessory.None)
                    {
                        // the option was selected previously, it must be "unselected" now
                        element.Accessory = UITableViewCellAccessory.None;
                        if (option.PartLink != 0)
                        {
                            jivc.RemovePartsRangeFromList(option.PartLink);
                        }

                        RemoveSurchargeForSaleOption(option.ID);
                        RemoveExtraFeeForSaleOption(option.ID);
                    }
                    else
                    {
                        // the option was not selected, apply the appropriate changes
                        element.Accessory = UITableViewCellAccessory.Checkmark;
                        if (option.PartLink != 0)
                        {
                            jivc.AddPartsRangeToList(option.PartLink);
                        }

                        ApplySurchargeForSaleOption(option.ID);
                        ApplyExtraFeeForSaleOption(option.ID);

                        // Console.WriteLine (String.Format ("Fee: {0}, Price: {1}", SaleOptionsDVC.jrt.CurrentJob.EmployeeFee, SaleOptionsDVC.jrt.CurrentJob.MoneyToCollect));
                    }
                }
            }
            this.ReloadData();
            base.Selected(indexPath);
        }