1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Controls;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace PRSDesktop
- {
- /// <summary>
- /// Interaction logic for QuoteProposals.xaml
- /// </summary>
- public partial class QuoteProposals : UserControl, IQuotePage, IPanel<Quote>
- {
- public QuoteProposals()
- {
- InitializeComponent();
- }
- public bool IsReady { get; set; }
- public event DataModelUpdateEvent OnUpdateDataModel;
- public void CreateToolbarButtons(IPanelHost host)
- {
- }
- public string SectionName => "Quote Proposals";
- public DataModel DataModel(Selection selected)
- {
- var ids = Proposals.ExtractValues(x => x.ID, selected).ToArray();
- return new QuoteProposalDataModel(new Filter<QuoteProposal>(x => x.ID).InList(ids));
- }
- public void Heartbeat(TimeSpan time)
- {
- }
- public void Refresh()
- {
- Details.Refresh(false, true);
- }
- public Dictionary<string, object[]> Selected()
- {
- return new Dictionary<string, object[]>();
- }
- public void Setup()
- {
- Proposals.Refresh(true, false);
- Details.Refresh(true, false);
- Proposals.OnSelectItem += Proposals_OnSelectItem;
- }
- public void Shutdown()
- {
- }
- public Guid ParentID
- {
- get => Proposals.ParentID;
- set
- {
- Proposals.ParentID = value;
- Details.QuoteID = value;
- Details.ProposalID = value;
- }
- }
- private void Proposals_OnSelectItem(object sender, DynamicGridSelectionEventArgs e)
- {
- var row = e.Rows?.FirstOrDefault();
- Details.ProposalID = row != null ? row.Get<QuoteProposal, Guid>(x => x.ID) : CoreUtils.FullGuid;
- }
- }
- }
|