public new IEnumerable SetDefault(PXAdapter adapter) { BranchBAccount acct = this.BAccount.Current; if (Locations.Current != null && acct != null && Locations.Current.LocationID != acct.DefLocationID) { acct.DefLocationID = Locations.Current.LocationID; this.BAccount.Update(acct); } return(adapter.Get()); }
protected virtual void BranchBAccount_RowDeleting(PXCache sender, PXRowDeletingEventArgs e) { BranchBAccount item = e.Row as BranchBAccount; if (item != null) { Ledger ledger = PXSelectJoin <Ledger, InnerJoin <Branch, On <Branch.branchID, Equal <Ledger.defBranchID> > >, Where <Branch.branchCD, Equal <Required <Branch.branchCD> > > > .Select(this, item.BranchBranchCD); if (ledger != null) { GLHistory hist = PXSelect <GLHistory, Where <GLHistory.ledgerID, Equal <Required <GLHistory.ledgerID> > > > .Select(this, ledger.LedgerID); if (hist != null) { throw new PXSetPropertyException(ErrorMessages.CantDeleteRecord); } } } }
public BranchMaint() { this.Employees.Cache.AllowInsert = false; this.Employees.Cache.AllowDelete = false; this.Employees.Cache.AllowUpdate = false; PXUIFieldAttribute.SetDisplayName(Caches[typeof(Contact)], typeof(Contact.salutation).Name, CR.Messages.Attention); PXUIFieldAttribute.SetEnabled <Contact.fullName>(Caches[typeof(Contact)], null); if (!PXAccess.FeatureInstalled <FeaturesSet.branch>()) { BranchBAccount br = PXSelectReadonly <BranchBAccount> .SelectWindowed(this, 0, 1); this.CurrentBAccount.Cache.AllowInsert = (br == null); this.CurrentBAccount.Cache.AllowDelete = (br == null); Next.SetVisible(false); Prev.SetVisible(false); Last.SetVisible(false); First.SetVisible(false); Insert.SetVisible(false); Delete.SetVisible(false); } }
protected virtual void BranchBAccount_Active_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { BranchBAccount item = e.Row as BranchBAccount; if (item != null && (bool?)e.NewValue == false) { Ledger ledger; if ((ledger = PXSelectJoin <Ledger, InnerJoin <Branch, On <Branch.branchID, Equal <Ledger.defBranchID> > >, Where <Branch.branchCD, Equal <Required <Branch.branchCD> > > > .SelectWindowed(this, 0, 1, item.BranchBranchCD)) != null) { throw new PXSetPropertyException(GL.Messages.BranchUsedWithLedger, ledger.LedgerCD); } IN.INSite site; if ((site = PXSelectJoin <IN.INSite, InnerJoin <Branch, On <Branch.branchID, Equal <IN.INSite.branchID> > >, Where <Branch.branchCD, Equal <Required <Branch.branchCD> > > > .SelectWindowed(this, 0, 1, item.BranchBranchCD)) != null) { throw new PXSetPropertyException(GL.Messages.BranchUsedWithSite, site.SiteCD); } FA.FixedAsset fa; if ((fa = PXSelectJoin <FA.FixedAsset, InnerJoin <Branch, On <Branch.branchID, Equal <FA.FixedAsset.branchID> > >, Where <Branch.branchCD, Equal <Required <Branch.branchCD> > > > .SelectWindowed(this, 0, 1, item.BranchBranchCD)) != null) { throw new PXSetPropertyException(GL.Messages.BranchUsedWithFixedAsset, fa.AssetCD); } } }