public TransactionItem(TransactionList parentList, string description, decimal price) : this(parentList) { Description = description; Price = price; AfterConstructor(); }
protected override void LoadSubClass() { if (Transactions == null) { Transactions = new TransactionList(this, "Transactions"); } //assumption we're taking with caching with Sponsor entities in particular: // the corresponding sproc returns the whole household of sponsor + dependent clients records // and also the "household" (sponsor) address/phone record // then this lookup method returns a cached model of the specific type // and the GUI can then pull what it needs off that object via basic properties //the specified GUID passed in is for the Sponsor's *Sponsor*table* RowGUID Fields = EntityLookup(GUID, "Sponsor", "Sponsor_s"); var sponsorTable = DsCache.Tables["Sponsor"]; sponsorTable.Columns["DutyPhoneDSN1"].AllowDBNull = false; //sucks to have to fix these but they're 'generated' from a real field so they lose their NOT NULL metadata sponsorTable.Columns["DutyPhoneDSN2"].AllowDBNull = false; ClientTable.ColumnChanged += ClientTableColumnChanged; ClientTable.RowChanged += ClientTableRowChanged; UTAPFields = RowLookup("Sponsor_UTAP", GUID); //create the logical lookup field for SuspensionTaxOffice via Sponsor.SuspensionTaxOfficeId to Office.TaxOfficeId DsCache.AddRelation("SuspensionTaxOffice", DsCache.Tables["TaxOffice"].Columns["TaxOfficeId"], sponsorTable.Columns["SuspensionTaxOfficeId"]); if (!sponsorTable.Columns.Contains("SuspensionTaxOffice")) { sponsorTable.Columns.Add("SuspensionTaxOffice", typeof(string), "Parent(SuspensionTaxOffice).Office"); } //map the parent-child relationships hanging off Sponsor ... DataColumn sponsorTableRowGUID = sponsorTable.Columns["RowGUID"]; //SponsorTable tweaks: if (!sponsorTable.Columns.Contains("CanSellForms")) { sponsorTable.Columns.Add("CanSellForms", typeof(bool), "Active AND ISNULL(SuspensionExpiry, #1/1/01#) = #1/1/01#"); sponsorTable.Columns["Active"].ReadOnly = true; //block access to this field from the UI, elsewhere in this class we temporarily open it up to make validated changes (see CheckClientActiveRules method) } //Dependents: DsCache.AddRelation("Sponsor_Client", sponsorTableRowGUID, ClientTable.Columns["SponsorGUID"]); HouseMembers = Fields.CreateChildView("Sponsor_Client"); HouseMembers.Sort = "IsSponsor desc, IsSpouse desc, LName, FName"; //if brand new sponsor, add a default row to fill out for convenience if (HouseMembers.Count == 0) { AddMember(); } //set ShowDeactive to true, if there's not an Active Sponsor ShowDeactiveMembers = !HouseMembers[0].Field <bool>("Active") || !HouseMembers[0].Field <bool>("IsSponsor"); if (!ClientTable.Columns.Contains("IsSponsorOrSpouse")) { ClientTable.Columns.Add("IsSponsorOrSpouse", typeof(bool), "IsSponsor OR IsSpouse"); ClientTable.Columns["Active"].ReadOnly = true; //block access to this field from the UI, elsewhere in this class we temporarily open it up to make validated changes (see CheckClientActiveRules method) } //TaxForms: DsCache.AddRelation("Sponsor_TaxForm", sponsorTableRowGUID, DsCache.Tables["Sponsor_TaxForm"].Columns["SponsorGUID"]); RefreshTaxFormsList(false); //Remarks: var remarkTable = DsCache.Tables["Sponsor_Remark"]; DsCache.AddRelation("Sponsor_Remark", sponsorTableRowGUID, remarkTable.Columns["SponsorGUID"]); SponsorRemarks = Fields.CreateChildView("Sponsor_Remark"); ShowDeletedRemarks = false; RemarkModel.CommonRemarkTableSettings(SponsorRemarks); SponsorRemarks.Table.RowChanged += SponsorRemarksRowChanged; SponsorRemarks.Table.ColumnChanging += SponsorRemarksColumnChanging; _potentialClientMatchesBgWorker.OnExecute = PotentialMatchesSearchExecute; _potentialClientMatchesBgWorker.OnCompleted = PotentialMatchesSearchCompleted; }
protected TransactionItem(TransactionList parentList) { ParentList = parentList; PendingAction = "Go"; }