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