Esempio n. 1
0
        private void populateSystems(ObservableCollection <TECTypical> typicals)
        {
            ObservableCollection <SystemSummaryItem> systemItems = new ObservableCollection <SystemSummaryItem>();

            foreach (TECTypical typical in typicals)
            {
                SystemSummaryItem summaryItem = new SystemSummaryItem(typical, bid.Parameters, bid.Duration);
                summaryItem.Estimate.PropertyChanged += (sender, e) =>
                {
                    if (e.PropertyName == "TotalPrice")
                    {
                        RaisePropertyChanged("SystemTotal");
                    }
                };
                systemItems.Add(summaryItem);
            }
            Systems = systemItems;
            RaisePropertyChanged("SystemTotal");
        }
Esempio n. 2
0
 private void changed(TECChangedEventArgs e)
 {
     if (e.Value is TECTypical typical)
     {
         if (e.Change == Change.Add)
         {
             SystemSummaryItem summaryItem = new SystemSummaryItem(typical, bid.Parameters);
             summaryItem.Estimate.PropertyChanged += (sender, args) =>
             {
                 if (args.PropertyName == "TotalPrice")
                 {
                     RaisePropertyChanged("SystemTotal");
                 }
             };
             Systems.Add(summaryItem);
         }
         else if (e.Change == Change.Remove)
         {
             SystemSummaryItem toRemove = null;
             foreach (var item in Systems)
             {
                 if (item.Typical == typical)
                 {
                     toRemove = item;
                     break;
                 }
             }
             if (toRemove != null)
             {
                 Systems.Remove(toRemove);
             }
         }
         RaisePropertyChanged("SystemTotal");
     }
     else if (e.Sender is TECBid)
     {
         if (e.Change == Change.Add)
         {
             if (e.Value is TECController || e.Value is TECPanel)
             {
                 ScopeSummaryItem summaryItem = new ScopeSummaryItem(e.Value as TECScope, bid.Parameters);
                 summaryItem.Estimate.PropertyChanged += (sender, args) =>
                 {
                     if (args.PropertyName == "TotalPrice")
                     {
                         RaisePropertyChanged("RiserTotal");
                     }
                 };
                 Riser.Add(summaryItem);
             }
             else if (e.Value is TECMisc misc)
             {
                 ScopeSummaryItem summaryItem = new ScopeSummaryItem(misc, bid.Parameters);
                 summaryItem.Estimate.PropertyChanged += (sender, args) =>
                 {
                     if (args.PropertyName == "TotalPrice")
                     {
                         RaisePropertyChanged("MiscTotal");
                     }
                 };
                 Misc.Add(summaryItem);
             }
         }
         else if (e.Change == Change.Remove)
         {
             if (e.Value is TECController || e.Value is TECPanel)
             {
                 removeFromCollection(Riser, e.Value as TECScope);
             }
             else if (e.Value is TECMisc misc)
             {
                 removeFromCollection(Misc, misc);
             }
         }
         if (e.PropertyName == "Duration")
         {
             populateAll(bid);
             setupExtraLaborEstimate(bid);
         }
         RaisePropertyChanged("RiserTotal");
         RaisePropertyChanged("MiscTotal");
     }
 }