public virtual void ValidateLeadTime(PXCache sender, PXRowSelectedEventArgs e) { RQBiddingVendor row = (RQBiddingVendor)e.Row; if (row == null) { return; } RQBiddingVendorExt rowExt = row.GetExtension <RQBiddingVendorExt>(); bool isErr = false; if (row.CuryTotalQuoteExtCost > Decimal.Zero) { if (rowExt.UsrLeadTime != null && rowExt.UsrLeadTime == 0) { sender.RaiseExceptionHandling <RQBiddingVendorExt.usrLeadTime>(e.Row, rowExt.UsrLeadTime, new PXSetPropertyException("Lead Time Must Be Greater Than Zero")); isErr = true; } if (!isErr) { sender.RaiseExceptionHandling <RQBiddingVendorExt.usrLeadTime>(e.Row, null, null); } } }
protected virtual void RQBiddingVendor_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { RQBiddingVendor row = (RQBiddingVendor)e.Row; if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Delete) { return; } RQBiddingVendorExt rowExt = row.GetExtension <RQBiddingVendorExt>(); RQRequisition req = PXSelect <RQRequisition, Where <RQRequisition.reqNbr, Equal <Required <RQRequisition.reqNbr> > > > .Select(Base, row.ReqNbr); RQRequisitionExt reqExt = req.GetExtension <RQRequisitionExt>(); if (reqExt.UsrPurchMethod == 2) { return; } if (row.CuryTotalQuoteExtCost > Decimal.Zero) { if (rowExt.UsrLeadTime == Decimal.Zero) { if (sender.RaiseExceptionHandling <RQBiddingVendorExt.usrLeadTime>(e.Row, rowExt.UsrLeadTime, new PXSetPropertyException(LeadTimeCannotBeZero, typeof(RQBiddingVendorExt.usrLeadTime).Name))) { throw new PXRowPersistingException(typeof(RQBiddingVendorExt.usrLeadTime).Name, null, LeadTimeCannotBeZero, typeof(RQBiddingVendorExt.usrLeadTime).Name); } } if (string.IsNullOrEmpty(rowExt.UsrIncoterm)) { if (sender.RaiseExceptionHandling <RQBiddingVendorExt.usrIncoterm>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrIncoterm).Name))) { throw new PXRowPersistingException(typeof(RQBiddingVendorExt.usrIncoterm).Name, null, ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrIncoterm).Name); } } if (rowExt.UsrRefDueDate == null) { if (sender.RaiseExceptionHandling <RQBiddingVendorExt.usrRefDueDate>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrRefDueDate).Name))) { throw new PXRowPersistingException(typeof(RQBiddingVendorExt.usrRefDueDate).Name, null, ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrRefDueDate).Name); } } if (rowExt.UsrLeadFrom == null) { if (sender.RaiseExceptionHandling <RQBiddingVendorExt.usrLeadFrom>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrLeadFrom).Name))) { throw new PXRowPersistingException(typeof(RQBiddingVendorExt.usrLeadFrom).Name, null, ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrLeadFrom).Name); } } } }
protected virtual void RQBiddingVendor_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e) { RQBiddingVendor row = (RQBiddingVendor)e.Row; RQBiddingVendorExt rowExt = row.GetExtension <RQBiddingVendorExt>(); RQRequisition req = PXSelect <RQRequisition, Where <RQRequisition.reqNbr, Equal <Required <RQRequisition.reqNbr> > > > .Select(Base, row.ReqNbr); RQRequisitionExt reqExt = req.GetExtension <RQRequisitionExt>(); if (req.CustomerID == null) { rowExt.UsrLeadTime = 30; } }
protected virtual void RQBiddingVendor_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { RQBiddingVendor row = (RQBiddingVendor)e.Row; if (row == null) { return; } RQBiddingVendorExt rowExt = row.GetExtension <RQBiddingVendorExt>(); bool bidExists = row.CuryTotalQuoteExtCost > Decimal.Zero == true; RQRequisition req = PXSelect <RQRequisition, Where <RQRequisition.reqNbr, Equal <Required <RQRequisition.reqNbr> > > > .Select(Base, row.ReqNbr); RQRequisitionExt reqExt = req.GetExtension <RQRequisitionExt>(); if (bidExists) { if (req.CustomerID != null || reqExt.UsrPurchMethod != 2) { if (req.CustomerID != null) { PXDefaultAttribute.SetPersistingCheck <RQBiddingVendorExt.usrIncoterm>(sender, row, bidExists ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); } PXDefaultAttribute.SetPersistingCheck <RQBiddingVendorExt.usrLeadFrom>(sender, row, bidExists ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <RQBiddingVendorExt.usrLeadTime>(sender, row, bidExists ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <RQBiddingVendorExt.usrRefDueDate>(sender, row, bidExists ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); } } //ValidateLeadTime(sender, e); }