Exemplo n.º 1
0
        protected virtual void Shipment_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            Shipment row         = (Shipment)e.NewRow;
            Shipment originalRow = (Shipment)e.Row;

            if (row.ShipmentType == ShipmentTypes.Single &&
                !sender.ObjectsEqual <Shipment.deliveryMaxDate>(row, originalRow))
            {
                if (row.DeliveryDate != null && row.DeliveryMaxDate != null &&
                    row.DeliveryMaxDate < row.DeliveryDate)
                {
                    row.DeliveryMaxDate = row.DeliveryDate;
                    sender.RaiseExceptionHandling <Shipment.deliveryMaxDate>(row, row.DeliveryMaxDate,
                                                                             new PXSetPropertyException("Specified value was too early.", PXErrorLevel.Warning));
                }
            }
            else if (row.ShipmentType == ShipmentTypes.Single &&
                     !sender.ObjectsEqual <Shipment.deliveryDate,
                                           Shipment.deliveryMaxDate>(row, originalRow))
            {
                if (row.DeliveryDate != null && row.DeliveryMaxDate != null &&
                    row.DeliveryDate > row.DeliveryMaxDate)
                {
                    sender.RaiseExceptionHandling <Shipment.deliveryDate>(row, row.DeliveryDate,
                                                                          new PXSetPropertyException("Delivery time expired."));
                    e.Cancel = true;
                }
            }
        }
Exemplo n.º 2
0
        protected virtual void ShipmentLine_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            ShipmentLine line         = (ShipmentLine)e.NewRow;
            ShipmentLine originalLine = (ShipmentLine)e.Row;
            Shipment     row          = Shipments.Current;

            if (row.ShipmentType != ShipmentTypes.Single &&
                !sender.ObjectsEqual <ShipmentLine.shipmentTime,
                                      ShipmentLine.shipmentMinTime,
                                      ShipmentLine.shipmentMaxTime>(line, originalLine))
            {
                if (line.ShipmentTime != null && line.ShipmentMinTime != null &&
                    line.ShipmentTime < line.ShipmentMinTime)
                {
                    sender.RaiseExceptionHandling <ShipmentLine.shipmentTime>(line, line.ShipmentTime,
                                                                              new PXSetPropertyException("Delivery Time is too early."));
                    e.Cancel = true;
                }
                if (line.ShipmentTime != null && line.ShipmentMaxTime != null &&
                    line.ShipmentTime > line.ShipmentMaxTime)
                {
                    line.ShipmentTime = line.ShipmentMaxTime;
                    sender.RaiseExceptionHandling <ShipmentLine.shipmentTime>(line, line.ShipmentTime,
                                                                              new PXSetPropertyException("Specified Delivery Time was too late.", PXErrorLevel.Warning));
                }
            }
        }
 public virtual void BranchAcctMapTo_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
 {
     if (!sender.ObjectsEqual <BranchAcctMapTo.fromAccountCD, BranchAcctMapTo.toAccountCD>(e.Row, e.NewRow))
     {
         e.Cancel = !ValidateDuplicateMap <BranchAcctMap.fromBranchID>(sender, MapTo.View, e.NewRow, e.Row);
     }
 }
Exemplo n.º 4
0
        protected virtual void Users_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            Users oldRow = e.Row as Users;
            Users row    = e.NewRow as Users;

            if (row == null || oldRow == null || oldRow.ContactID == null)
            {
                return;
            }

            if (row.Guest == true && oldRow.Guest != true)
            {
                if (contact.View.Ask(
                        MyMessages.EmployeeContactWouldBeCleared,
                        MessageButtons.YesNo) != WebDialogResult.Yes)
                {
                    e.Cancel = true;
                }
            }
            else if (row.Guest != true && oldRow.Guest == true)
            {
                if (contact.View.Ask(
                        MyMessages.ExternalUserContactWouldBeCleared,
                        MessageButtons.YesNo) != WebDialogResult.Yes)
                {
                    e.Cancel = true;
                }
            }
        }
        private void RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            var val      = (PropertyValue)e.NewRow;
            var oldValue = (PropertyValue)e.Row;

            val.Selected = val.Selected == true || (oldValue.Value != val.Value);
        }
Exemplo n.º 6
0
        protected void UpateSiteLocation <Field, FieldResult>(PXCache cache, PXRowUpdatingEventArgs e)
            where Field : IBqlField
            where FieldResult : IBqlField
        {
            int?newValue = (int?)cache.GetValue <Field>(e.NewRow);
            int?value    = (int?)cache.GetValue <Field>(e.Row);

            if (value != newValue && e.ExternalCall == true)
            {
                INItemSite itemsite =
                    PXSelect <INItemSite,
                              Where <INItemSite.siteID, Equal <Required <INItemSite.siteID> > > > .SelectWindowed(this, 0, 1,
                                                                                                                  cache.GetValue <INSite.siteID>(e.Row));

                if (itemsite != null &&
                    site.Ask(Messages.Warning, Messages.SiteLocationOverride, MessageButtons.YesNo) == WebDialogResult.Yes)
                {
                    cache.SetValue <FieldResult>(e.NewRow, true);
                }
                else
                {
                    cache.SetValue <FieldResult>(e.NewRow, false);
                }
            }
        }
Exemplo n.º 7
0
        protected virtual void CASetup_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            CASetup row = (CASetup)e.NewRow;

            if (e.NewRow == null || row == null || row.TransitAcctId == null)
            {
                return;
            }

            CashAccount cashAccount =
                PXSelect <CashAccount, Where <CashAccount.accountID, Equal <Required <CASetup.transitAcctId> > > > .Select(
                    this, row.TransitAcctId);

            if (cashAccount == null)
            {
                return;
            }
            if (cashAccount.SubID != (int)row.TransitSubID)
            {
                Sub subAccount = PXSelect <Sub, Where <Sub.subID, Equal <Required <CASetup.transitSubID> > > > .Select(
                    this, row.TransitSubID);

                sender.RaiseExceptionHandling <CASetup.transitSubID>(row, subAccount.SubCD,
                                                                     new PXSetPropertyException(Messages.WrongSubIdForCashAccount));
            }
        }
Exemplo n.º 8
0
        protected virtual void CAEntryType_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            CAEntryType row = e.NewRow as CAEntryType;

            if (row.AccountID != null)
            {
                Account currentAcc = PXSelect <Account, Where <Account.accountID, Equal <Required <Account.accountID> > > > .Select(this, row.AccountID);

                if (currentAcc.IsCashAccount == true)
                {
                    CashAccount cashAccount = PXSelect <CashAccount, Where <CashAccount.accountID, Equal <Required <CashAccount.accountID> >,
                                                                            And <CashAccount.subID, Equal <Required <CashAccount.subID> >,
                                                                                 And <CashAccount.branchID, Equal <Required <CashAccount.branchID> > > > > > .Select(this, row.AccountID, row.SubID, row.BranchID);

                    if (cashAccount == null)
                    {
                        string branchCD = (string)PXSelectorAttribute.GetField(sender, row, typeof(CAEntryType.branchID).Name, row.BranchID, typeof(Branch.branchCD).Name);
                        sender.RaiseExceptionHandling <CAEntryType.branchID>(row, branchCD,
                                                                             new PXSetPropertyException(Messages.NoCashAccountForBranchAndSub, PXErrorLevel.Error));
                        string subCD = (string)PXSelectorAttribute.GetField(sender, row, typeof(CAEntryType.subID).Name, row.SubID, typeof(Sub.subCD).Name);
                        sender.RaiseExceptionHandling <CAEntryType.subID>(row, subCD,
                                                                          new PXSetPropertyException(Messages.NoCashAccountForBranchAndSub, PXErrorLevel.Error));
                        e.Cancel = true;
                        return;
                    }
                }
            }
        }
Exemplo n.º 9
0
        protected virtual void TaxRev_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            if (Tax.Current.TaxVendorID == null)
            {
                switch (((TaxRev)e.Row).TaxBucketID)
                {
                case -1:
                    ((TaxRev)e.Row).TaxType = "P";
                    break;

                case -2:
                    ((TaxRev)e.Row).TaxType = "S";
                    break;
                }
            }
            else if (((TaxRev)e.NewRow).TaxBucketID != null)
            {
                TaxBucket bucket = (TaxBucket)PXSelect <TaxBucket, Where <TaxBucket.vendorID, Equal <Current <Tax.taxVendorID> >, And <TaxBucket.bucketID, Equal <Required <TaxBucket.bucketID> > > > > .Select(this, ((TaxRev)e.NewRow).TaxBucketID);

                if (bucket != null)
                {
                    ((TaxRev)e.NewRow).TaxType = bucket.BucketType;
                }
            }

            object StartDate = ((TaxRev)e.NewRow).StartDate;
            object TaxType   = ((TaxRev)e.NewRow).TaxType;

            e.Cancel = UpdateRevisions(sender, (TaxRev)e.NewRow, PXSelect <TaxRev, Where <TaxRev.taxID, Equal <Current <Tax.taxID> >, And <TaxRev.taxType, Equal <Required <TaxRev.taxType> >, And <TaxRev.startDate, Equal <Required <TaxRev.startDate> > > > > > .Select(this, TaxType, StartDate), false);
        }
Exemplo n.º 10
0
        protected virtual void FieldValue_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            FieldValue val      = (FieldValue)e.NewRow;
            FieldValue oldValue = (FieldValue)e.Row;

            val.Selected = val.Selected == true || (oldValue.Value != val.Value);
        }
Exemplo n.º 11
0
        protected virtual void Account_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            if (e.NewRow == null)
            {
                return;
            }
            var account = (Account)e.NewRow;

            try
            {
                ValidateAccountGroupID(sender, account);
            }
            catch (PXSetPropertyException ex)
            {
                if (ex.ErrorLevel == PXErrorLevel.Error)
                {
                    PM.PMAccountGroup item = (PM.PMAccountGroup)PXSelectorAttribute.Select <Account.accountGroupID>(sender, account);
                    sender.RaiseExceptionHandling <Account.accountGroupID>(account, item.GroupCD, ex);
                }
                else
                {
                    sender.RaiseExceptionHandling <Account.accountGroupID>(account, account.AccountGroupID, ex);
                }
            }
        }
 protected virtual void KCSiteMaster_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
 {
     if (e.Row == null)
     {
         return;
     }
     KCSiteMaster row = (KCSiteMaster)e.Row;
 }
 protected virtual void EPActivityType_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
 {
     if (!sender.ObjectsEqual <EPActivityType.type>(e.Row, e.NewRow))
     {
         ValidateUsage(e.Row, epsetup, Messages.ActivityTypeUsageChanged);
         ValidateUsage(e.Row, Activities, Messages.ActivityTypeUsageChanged);
     }
 }
        protected virtual void ContractDetail_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            ContractDetail row = e.NewRow as ContractDetail;

            if (row != null)
            {
                ValidateUniqueness(sender, row, e);
            }
        }
        protected virtual void RowUpdating(PXCache cache, PXRowUpdatingEventArgs e)
        {
            if (cache.Graph.UnattendedMode)
            {
                return;
            }

            ValidatePeriodAndSources(cache, e.Row, e.NewRow, e.ExternalCall);
        }
Exemplo n.º 16
0
        public virtual void RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            var item = e.Row as ARRegister;

            if (item != null)
            {
                StatusSet(sender, item);
            }
        }
Exemplo n.º 17
0
        protected virtual void INLotSerClass_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            INLotSerClass row = (INLotSerClass)e.NewRow;

            if (row.LotSerTrackExpiration != true && row.LotSerIssueMethod == INLotSerIssueMethod.Expiration &&
                row.LotSerTrack != INLotSerTrack.NotNumbered && row.LotSerAssign != INLotSerAssign.WhenUsed)
            {
                throw new PXSetPropertyException(Messages.LotSerTrackExpirationInvalid, typeof(INLotSerClass.lotSerIssueMethod).Name);
            }
        }
        protected virtual void GLConsolSetup_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            var setup = (GLConsolSetup)e.NewRow;

            if (setup.PasteFlag == true && string.IsNullOrEmpty(setup.SegmentValue))
            {
                sender.RaiseExceptionHandling <GLConsolSetup.segmentValue>(e.NewRow, setup.SegmentValue,
                                                                           new PXSetPropertyException(Messages.ConsolidationSegmentValueMayNotBeEmpty));
                e.Cancel = true;
            }
        }
Exemplo n.º 19
0
        protected virtual void CSCalendar_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            CSCalendar calendar = (CSCalendar)e.NewRow;

            if (calendar == null)
            {
                return;
            }

            CalendarHelper.EnsureUnpaidTimeValid(calendar);
        }
        protected virtual void RQRequisitionLine_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            RQRequisitionLine    row    = e.Row as RQRequisitionLine;
            RQRequisitionLineExt rowext = row.GetExtension <RQRequisitionLineExt>();

            if (rowext.PreventUpdate == true)
            {
                e.Cancel             = true;
                rowext.PreventUpdate = false;
            }
        }
Exemplo n.º 21
0
        protected virtual void POSetupApproval_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            POSetupApproval row    = (POSetupApproval)e.Row;
            POSetupApproval newRow = (POSetupApproval)e.NewRow;

            if (row != null && newRow != null && row != newRow &&
                (row.OrderType != newRow.OrderType || row.AssignmentMapID != newRow.AssignmentMapID))
            {
                e.Cancel = !ValidateDuplicates(sender, newRow, row);
            }
        }
Exemplo n.º 22
0
        protected virtual void CurrencyRate_RowUpdating(PXCache cache, PXRowUpdatingEventArgs e)
        {
            CurrencyRate cr = e.NewRow as CurrencyRate;

            if (cr.CuryEffDate == null)
            {
                cr.CuryEffDate = DateTime.Now;
            }

            if (cr.FromCuryID != null && cr.ToCuryID != null && String.Compare(cr.FromCuryID, cr.ToCuryID, true) == 0)
            {
                throw new PXException(Messages.DestShouldDifferFromOrig);
            }
            if (cr.CuryRate != null)
            {
                if (Math.Round((decimal)(cr.CuryRate), 8) == 0)
                {
                    throw new PXException(Messages.CuryRateCantBeZero);
                }
                cr.RateReciprocal = Math.Round((decimal)(1 / cr.CuryRate), 8);
                if (((CurrencyInfo)cr).CheckRateVariance(cache))
                {
                    cache.RaiseExceptionHandling <CurrencyRate.curyRate>(cr, cr.CuryRate, new PXSetPropertyException(Messages.RateVarianceExceeded, PXErrorLevel.Warning));
                }
            }
            if (cr.FromCuryID != null &&
                cr.CuryRateType != null &&
                cr.CuryRateType != null &&
                cr.CuryEffDate != null &&
                cr.CuryRate != null)
            {
                CurrencyRate existRate = PXSelectReadonly <CurrencyRate,
                                                           Where <CurrencyRate.toCuryID, Equal <Required <CurrencyRate.toCuryID> >,
                                                                  And <CurrencyRate.fromCuryID, Equal <Required <CurrencyRate.fromCuryID> >,
                                                                       And <CurrencyRate.curyRateType, Equal <Required <CurrencyRate.curyRateType> >,
                                                                            And <CurrencyRate.curyEffDate, Equal <Required <CurrencyRate.curyEffDate> > > > > >,
                                                           OrderBy <Desc <CurrencyRate.curyEffDate> > > .Select(cache.Graph, cr.ToCuryID, cr.FromCuryID, cr.CuryRateType, cr.CuryEffDate);


                if (existRate != null)
                {
                    if (CuryRateRecordsEntry.Locate(existRate) == null)
                    {
                        CurrencyRate newExistRate = (CurrencyRate)CuryRateRecordsEntry.Cache.CreateCopy(existRate);
                        newExistRate.CuryRate       = cr.CuryRate;
                        newExistRate.CuryMultDiv    = cr.CuryMultDiv;
                        newExistRate.RateReciprocal = cr.RateReciprocal;
                        CuryRateRecordsEntry.Delete(cr);
                        CuryRateRecordsEntry.Update(newExistRate);
                    }
                    cache.RaiseExceptionHandling <CurrencyRate.curyRate>(cr, cr.CuryRate, new PXSetPropertyException(Messages.SuchRateTypeAlreadyExist, PXErrorLevel.Warning));
                }
            }
        }
 protected virtual void EPActivityFilter_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
 {
     if (Activity.Cache.IsDirty && Filter.View.Ask(ActionsMessages.ConfirmationMsg, MessageButtons.YesNo) != WebDialogResult.Yes)
     {
         e.Cancel = true;
     }
     else
     {
         Activity.Cache.Clear();
     }
 }
Exemplo n.º 24
0
        protected virtual void CATransfer_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            CATransfer transfer    = (CATransfer)e.Row;
            CATransfer newTransfer = (CATransfer)e.NewRow;

            if ((newTransfer.TranOut != transfer.TranOut) ||
                (newTransfer.InCuryID != transfer.InCuryID) ||
                (newTransfer.InAccountID != transfer.InAccountID))
            {
                CalculateTranIn(newTransfer);
            }
        }
        protected virtual void Dimension_RowUpdating(PXCache cache, PXRowUpdatingEventArgs e)
        {
            Dimension newRow    = (Dimension)e.NewRow;
            Dimension currow    = (Dimension)Header.Current;
            int       maxLength = PXDimensionAttribute.GetMaxLength(currow.DimensionID);

            if (newRow.Length > maxLength)
            {
                cache.RaiseExceptionHandling <Dimension.length>(e.Row, newRow.Length,
                                                                new PXSetPropertyException <Dimension.length>(Messages.DimensionLengthOutOfRange));
            }
        }
        protected virtual void RQRequestClassItem_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            this.Classes.Cache.SetStatus(this.Classes.Cache.Current, PXEntryStatus.Updated);
            RQRequestClassItem row    = (RQRequestClassItem)e.Row;
            RQRequestClassItem newRow = (RQRequestClassItem)e.NewRow;

            if (row != null && newRow != null && row != newRow &&
                (row.ReqClassID != newRow.ReqClassID || row.InventoryID != newRow.InventoryID))
            {
                e.Cancel = !ValidateDuplicates(sender, newRow, row);
            }
        }
Exemplo n.º 27
0
            public void RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
            {
                CurrencyInfo info = e.Row as CurrencyInfo;

                if (info != null && info._IsReadOnly == true)
                {
                    e.Cancel = true;
                }
                else
                {
                    currencyInfoDirty = sender.IsDirty;
                }
            }
Exemplo n.º 28
0
        protected virtual void APPayment_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            APPayment row = e.NewRow as APPayment;

            if (row != null && row.Selected == true)
            {
                PXFieldState state = (PXFieldState)sender.GetStateExt <APPayment.extRefNbr>(row);
                if (state != null && !string.IsNullOrEmpty(state.Error))
                {
                    row.Selected = false;
                }
            }
        }
Exemplo n.º 29
0
        protected virtual void TaxRev_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            TaxRev oldTaxRev = e.Row as TaxRev;
            TaxRev newTaxRev = e.NewRow as TaxRev;

            if (newTaxRev == null)
            {
                return;
            }

            if (Tax.Current.TaxVendorID == null)
            {
                if (oldTaxRev == null)
                {
                    return;
                }

                switch (oldTaxRev.TaxBucketID)
                {
                case -1:
                    oldTaxRev.TaxType = "P";
                    break;

                case -2:
                    oldTaxRev.TaxType = "S";
                    break;
                }
            }
            else if (newTaxRev.TaxBucketID != null)
            {
                TaxBucket bucket = (TaxBucket)
                                   PXSelect <TaxBucket,
                                             Where <TaxBucket.vendorID, Equal <Current <Tax.taxVendorID> >,
                                                    And <TaxBucket.bucketID, Equal <Required <TaxBucket.bucketID> > > > >
                                   .Select(this, newTaxRev.TaxBucketID);

                if (bucket != null)
                {
                    newTaxRev.TaxType = bucket.BucketType;
                }
            }

            var summary =
                PXSelect <TaxRev,
                          Where <TaxRev.taxID, Equal <Current <Tax.taxID> >,
                                 And <TaxRev.taxType, Equal <Required <TaxRev.taxType> >,
                                      And <TaxRev.startDate, Equal <Required <TaxRev.startDate> > > > > >
                .Select(this, newTaxRev.TaxType, newTaxRev.StartDate);

            e.Cancel = UpdateRevisions(sender, newTaxRev, summary, false);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Handles the CA transaction detail row updating event.
        /// </summary>
        /// <param name="tranDetailsCache">The transaction details cache.</param>
        /// <param name="e">Row updating event arguments.</param>
        public static void OnCATranDetailRowUpdatingEvent(PXCache tranDetailsCache, PXRowUpdatingEventArgs e)
        {
            ICATranDetail oldTranDetail = e.Row as ICATranDetail;
            ICATranDetail newTranDetail = e.NewRow as ICATranDetail;

            if (newTranDetail == null || tranDetailsCache == null)
            {
                return;
            }

            UpdateNewTranDetailCuryTranAmtOrCuryUnitPrice(tranDetailsCache, oldTranDetail, newTranDetail);

            if (newTranDetail.AccountID == null)
            {
                return;
            }

            Account currentAcc = PXSelect <Account,
                                           Where <Account.accountID, Equal <Required <Account.accountID> > > > .
                                 Select(tranDetailsCache.Graph, newTranDetail.AccountID);

            if (currentAcc?.IsCashAccount != true)
            {
                return;
            }

            CashAccount cashAccount = GetCashAccount(tranDetailsCache.Graph,
                                                     newTranDetail.AccountID,
                                                     newTranDetail.SubID,
                                                     newTranDetail.BranchID,
                                                     doSearchWithSubsetsOfArgs: false);

            if (cashAccount == null)
            {
                PXSetPropertyException exception = new PXSetPropertyException(Messages.NoCashAccountForBranchAndSub, PXErrorLevel.Error);
                string branchCD = (string)PXSelectorAttribute.GetField(tranDetailsCache,
                                                                       newTranDetail,
                                                                       nameof(ICATranDetail.BranchID),
                                                                       newTranDetail.BranchID,
                                                                       typeof(Branch.branchCD).Name);
                string subCD = (string)PXSelectorAttribute.GetField(tranDetailsCache,
                                                                    newTranDetail,
                                                                    nameof(ICATranDetail.SubID),
                                                                    newTranDetail.SubID,
                                                                    typeof(Sub.subCD).Name);

                tranDetailsCache.RaiseExceptionHandling(nameof(ICATranDetail.BranchID), newTranDetail, branchCD, exception);
                tranDetailsCache.RaiseExceptionHandling(nameof(ICATranDetail.SubID), newTranDetail, subCD, exception);
                e.Cancel = true;
            }
        }