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)); } } }
public virtual IEnumerable Up(PXAdapter adapter) { FSCustomFieldAppointment fsCustomFieldAppointmentRow = (FSCustomFieldAppointment)CustomFieldAppointmentRecords.Cache.Current; PXResultset <FSCustomFieldAppointment> bqlResultSet = CustomFieldAppointmentRecords.Select(); if (bqlResultSet != null && bqlResultSet.Count > 1) { int currentCustomFieldAppointmentIndex = (int)fsCustomFieldAppointmentRow.Position; if (currentCustomFieldAppointmentIndex > 0) { FSCustomFieldAppointment fsCustomFieldAppointmentRow_Previous = (FSCustomFieldAppointment)bqlResultSet[currentCustomFieldAppointmentIndex - 1]; fsCustomFieldAppointmentRow.Position = fsCustomFieldAppointmentRow_Previous.Position; fsCustomFieldAppointmentRow_Previous.Position = currentCustomFieldAppointmentIndex; CustomFieldAppointmentRecords.Update(fsCustomFieldAppointmentRow); CustomFieldAppointmentRecords.Update(fsCustomFieldAppointmentRow_Previous); } } return(adapter.Get()); }
public IEnumerable moveDown(PXAdapter adapter) { RUTROTWorkType currentRow = WorkTypes.Current; if(currentRow!=null) { RUTROTWorkType nextRow = PXSelect<RUTROTWorkType, Where<RUTROTWorkType.rUTROTType, Equal<Required<RUTROTWorkType.rUTROTType>>, And<RUTROTWorkType.position, Greater<Required<RUTROTWorkType.position>>>>, OrderBy<Asc<RUTROTWorkType.position>>>.SelectWindowed(this, 0, 1, currentRow.RUTROTType, currentRow.Position); if (nextRow != null) { int? tempPosition = nextRow.Position; nextRow.Position = null; WorkTypes.Update(nextRow); nextRow.Position = currentRow.Position; currentRow.Position = tempPosition; currentRow = WorkTypes.Update(currentRow); WorkTypes.Update(nextRow); WorkTypes.Cache.ActiveRow = currentRow; } } return adapter.Get(); }
protected virtual void _(Events.RowSelected <ServiceContractsByRouteFilter> e) { if (e.Row == null) { return; } //The SortingIndex gets updated foreach (FSScheduleRoute fsScheduleRouteRow in ServiceContracts.Select()) { switch (Filter.Current.WeekDay) { case ID.WeekDays.ANYDAY: if (fsScheduleRouteRow.SortingIndex != int.Parse(fsScheduleRouteRow.GlobalSequence)) { fsScheduleRouteRow.SortingIndex = int.Parse(fsScheduleRouteRow.GlobalSequence); ServiceContracts.Update(fsScheduleRouteRow); } break; case ID.WeekDays.SUNDAY: if (fsScheduleRouteRow.SortingIndex != int.Parse(fsScheduleRouteRow.SequenceSunday)) { fsScheduleRouteRow.SortingIndex = int.Parse(fsScheduleRouteRow.SequenceSunday); ServiceContracts.Update(fsScheduleRouteRow); } break; case ID.WeekDays.MONDAY: if (fsScheduleRouteRow.SortingIndex != int.Parse(fsScheduleRouteRow.SequenceMonday)) { fsScheduleRouteRow.SortingIndex = int.Parse(fsScheduleRouteRow.SequenceMonday); ServiceContracts.Update(fsScheduleRouteRow); } break; case ID.WeekDays.TUESDAY: if (fsScheduleRouteRow.SortingIndex != int.Parse(fsScheduleRouteRow.SequenceTuesday)) { fsScheduleRouteRow.SortingIndex = int.Parse(fsScheduleRouteRow.SequenceTuesday); ServiceContracts.Update(fsScheduleRouteRow); } break; case ID.WeekDays.WEDNESDAY: if (fsScheduleRouteRow.SortingIndex != int.Parse(fsScheduleRouteRow.SequenceWednesday)) { fsScheduleRouteRow.SortingIndex = int.Parse(fsScheduleRouteRow.SequenceWednesday); ServiceContracts.Update(fsScheduleRouteRow); } break; case ID.WeekDays.THURSDAY: if (fsScheduleRouteRow.SortingIndex != int.Parse(fsScheduleRouteRow.SequenceThursday)) { fsScheduleRouteRow.SortingIndex = int.Parse(fsScheduleRouteRow.SequenceThursday); ServiceContracts.Update(fsScheduleRouteRow); } break; case ID.WeekDays.FRIDAY: if (fsScheduleRouteRow.SortingIndex != int.Parse(fsScheduleRouteRow.SequenceFriday)) { fsScheduleRouteRow.SortingIndex = int.Parse(fsScheduleRouteRow.SequenceFriday); ServiceContracts.Update(fsScheduleRouteRow); } break; case ID.WeekDays.SATURDAY: if (fsScheduleRouteRow.SortingIndex != int.Parse(fsScheduleRouteRow.SequenceSaturday)) { fsScheduleRouteRow.SortingIndex = int.Parse(fsScheduleRouteRow.SequenceSaturday); ServiceContracts.Update(fsScheduleRouteRow); } break; } } }