public EditPackageDialog(Package package, bool bCreateNew) : base() { InitializeComponent(); InitializeDialogPanel(true/*bModal*/, x_Name); base.Closed += OnDialogClosed; m_Title = x_Title; m_ParentSearch = null; m_DataGrid = x_DataGrid; m_ListControl = x_ListControl; m_Prev = x_Prev; m_Next = x_Next; m_RootPackageOrig = package; m_RootPackage = m_RootPackageOrig.DeepClone(); m_bCreateNew = bCreateNew; if (m_bCreateNew) { ProfileDate startProfileDate = ProfileCode.StartOfPlan.ToProfileDate();// or App.Model.ProfileHolder.Profile.StartProfileDate, or DateTime.Now.ToJulian() ProfileDate endProfileDate = ProfileCode.EndOfPlan.ToProfileDate();// or App.Model.ProfileHolder.Profile.EndProfileDate; m_RootPackage.SetDates(startProfileDate, endProfileDate); m_RootPackage.MustHaveATransaction(); } m_TitleFormat = (m_bCreateNew ? "Add" : "Edit") + " the '{0}' spending source"; }
public DatabasePackageDialog(Package package) : base() { InitializeComponent(); InitializeDialogPanel(true/*bModal*/, x_Name); base.Closed += OnDialogClosed; m_Title = x_Title; m_ParentSearch = x_ParentSearch; m_DataGrid = x_DataGrid; m_ListControl = x_ListControl; m_Prev = x_Prev; m_Next = x_Next; if (package == null) { m_bCreateNew = true; m_RootPackageOrig = null; m_RootPackage = Package.CreateDefault(); m_RootPackage.MustHaveATransaction(); } else { m_bCreateNew = false; m_RootPackageOrig = package; m_RootPackage = package.DeepClone(); } m_TitleFormat = (m_bCreateNew ? "Add a new database package" : "Edit the '{0}' database package"); }