using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using AdvertisingProfitControlData;

namespace AdvertsingProfitControl
{
    internal partial class AboutBox : Form
    {
        public AboutBox()
        {
            InitializeComponent();
            labelProductVerion.Text = $@"Advertising Profit Control Version: {Assembly.GetEntryAssembly().GetName().Version}";
            var db = new AdvertisingProfitControlDbContext();
            var version = db.Versions.SingleOrDefault(x => x.Id == 1);
            databaseVersionLabel.Text = version == null ? @"Database Version: N/A" : $@"Database Version: {version.VersionNumber}";
            reportGeneratingVersionLabel.Text = @"Report Generating Engine Version: " + ReportGenerator.Version;
        }
    }
}
