protected override void PreliminaryFieldUpdating(PXCache s, PXFieldUpdatingEventArgs e, string fieldName) { var matrix = (EntryMatrix)e.Row; if (matrix == null) { return; } bool?newValue = (bool?)e.NewValue; matrix.AllSelected = newValue; for (int i = 0; i < matrix.InventoryIDs?.Length; i++) { if (matrix.InventoryIDs[i] == null) { matrix.Selected[i] = newValue; } } if (matrix.IsPreliminary == true) { foreach (EntryMatrix row in Matrix.Cache.Cached.Cast <EntryMatrix>().Where(row => row.IsPreliminary != true)) { Matrix.Cache.SetValueExt(row, fieldName, newValue); } Matrix.View.RequestRefresh(); } }
protected virtual void StartDateFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { PMTimeActivityFilter rowFilter = Filter.Current; EPActivityApprove row = (EPActivityApprove)e.Row; if (rowFilter == null || e.NewValue == null) { return; } DateTime?newValue = null; DateTime valFromString; if (e.NewValue is string && DateTime.TryParse((string)e.NewValue, sender.Graph.Culture, System.Globalization.DateTimeStyles.None, out valFromString)) { newValue = valFromString; } if (e.NewValue is DateTime) { newValue = (DateTime)e.NewValue; } if (newValue != null) { int weekId = PXWeekSelector2Attribute.GetWeekID(this, newValue.Value.Date); if (weekId < rowFilter.FromWeek || weekId > rowFilter.TillWeek) { sender.RaiseExceptionHandling <EPActivityApprove.date>(row, e.NewValue, new PXSetPropertyException(Messages.StartDateOutOfRange)); e.Cancel = true; } } }
public override void FieldUpdating(PXCache cache, PXFieldUpdatingEventArgs args) { if (args.NewValue != null) { var noteId = complianceDocumentEntityHelper.GetNoteId(cache.Graph, (string)args.NewValue); if (noteId != null) { var oldReferenceId = (Guid?)cache.GetValue(args.Row, _FieldOrdinal); var reference = InsertComplianceDocumentReference(cache, args, noteId); args.NewValue = reference.ComplianceDocumentReferenceId; TryDeleteReference(cache, oldReferenceId); } else { ComplianceDocument doc = args.Row as ComplianceDocument; args.NewValue = cache.GetValue(doc, _FieldName); args.Cancel = true; } } else { DeleteExistingReference(cache, (ComplianceDocument)args.Row); } }
public override void SubstituteKeyFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { BAccountR baccount = null; if (e.NewValue != null) { baccount = PXSelect <BAccountR, Where <BAccountR.acctCD, Equal <Required <BAccountR.acctCD> > > > . SelectWindowed(sender.Graph, 0, 1, e.NewValue); if (baccount != null) { e.NewValue = baccount.BAccountID; e.Cancel = true; } else if (e.NewValue.GetType() == typeof(Int32)) { baccount = PXSelect <BAccountR, Where <BAccountR.bAccountID, Equal <Required <BAccountR.bAccountID> > > > . SelectWindowed(sender.Graph, 0, 1, e.NewValue); } if (baccount == null) { throw new PXSetPropertyException(PXMessages.LocalizeFormat(ErrorMessages.ValueDoesntExist, _FieldName, e.NewValue)); } } }
public override void FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { string attributeID; if (e.NewValue is DateTime) { e.NewValue = Convert.ToString(e.NewValue, CultureInfo.InvariantCulture); } SurveyAnswer row = e.Row as SurveyAnswer; if (row != null) { attributeID = row.AttributeID; } else { attributeID = null; } string str = attributeID; if (!string.IsNullOrWhiteSpace(str) && e.NewValue != null && MultiSelectAttributes.Contains(str)) { Dictionary <string, short> item = AttributesWithValues[str]; IEnumerable <string> strs = from val in (e.NewValue as string).Split(new char[] { ',' }) where !string.IsNullOrEmpty(val) select val; e.NewValue = string.Join(",", from val in item where strs.Contains <string>(val.Key) orderby val.Value, val.Key select val.Key); } base.FieldUpdating(sender, e); }
protected virtual void EPCustomWeek_StartDate_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (e.NewValue != null) { e.NewValue = GetBeginOfDate((DateTime)e.NewValue); } }
public override void SubstituteKeyFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { //base.SubstituteKeyFieldUpdating(sender, e); InventoryItem inventoryItem = null; if (e.NewValue != null) { inventoryItem = PXSelect <InventoryItem, Where <InventoryItem.inventoryCD, Equal <Required <InventoryItem.inventoryCD> > > > .SelectWindowed(sender.Graph, 0, 1, e.NewValue); if (inventoryItem == null) { inventoryItem = PXSelect <InventoryItem, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .SelectWindowed(sender.Graph, 0, 1, e.NewValue); } } if (inventoryItem != null) { e.NewValue = inventoryItem.InventoryID; e.Cancel = true; } else if (e.NewValue != null) { throw new PXSetPropertyException(PXMessages.LocalizeFormat(ErrorMessages.ValueDoesntExist, _FieldName, e.NewValue)); } }
public void FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (e.NewValue != null) { e.NewValue = ((DateTime)e.NewValue).AddMonths(1); } }
protected virtual void AttributeValueFieldUpdating(int attributeNumber, PXFieldUpdatingEventArgs e) { AdditionalAttributes row = e.Row as AdditionalAttributes; if (row == null) { return; } string newValue = e.NewValue as string; if (attributeNumber < row.Values?.Length && row.Descriptions[attributeNumber] != newValue) { var attributeDetail = (CSAttributeDetail) new PXSelect <CSAttributeDetail, Where <CSAttributeDetail.attributeID, Equal <Required <CSAttributeDetail.attributeID> >, And <CSAttributeDetail.valueID, Equal <Required <CSAttributeDetail.valueID> > > > >(Base) .Select(AdditionalAttributes.Current.AttributeIdentifiers[attributeNumber], newValue); if (attributeDetail == null) { throw new RowNotFoundException(Base.Caches <CSAttributeDetail>(), AdditionalAttributes.Current.AttributeIdentifiers[attributeNumber], newValue); } row.Values[attributeNumber] = attributeDetail.ValueID; row.Descriptions[attributeNumber] = attributeDetail.Description; } }
protected override void FieldUpdatingImpl(int attributeNumber, PXCache s, PXFieldUpdatingEventArgs e, string fieldName) { var matrix = (EntryMatrix)e.Row; if (matrix == null) { return; } if (attributeNumber < matrix.Selected?.Length) { bool?newValue = (bool?)e.NewValue; matrix.Selected[attributeNumber] = newValue; if (matrix.IsPreliminary == true) { foreach (EntryMatrix row in Matrix.Cache.Cached.Cast <EntryMatrix>().Where(row => row.IsPreliminary != true)) { if (row.InventoryIDs[attributeNumber] == null) { row.Selected[attributeNumber] = newValue; } } Matrix.View.RequestRefresh(); } } }
protected virtual void Account_COAOrder_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (IsCOAOrderVisible == false && e.Row != null && string.IsNullOrEmpty(((Account)e.Row).Type) == false) { e.NewValue = Convert.ToInt16(AccountType.COAOrderOptions[(int)GLSetup.Current.COAOrder].Substring(AccountType.Ordinal(((Account)e.Row).Type), 1)); } }
public void FieldUpdating(PXCache cache, PXFieldUpdatingEventArgs args) { if (IsGraphApplicable(cache.Graph) && !IsAnyFieldUpdated(cache, args.Row)) { cache.SetStatus(args.Row, PXEntryStatus.Notchanged); } }
protected virtual void GLConsolSetup_Url_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (e.NewValue is string && ((string)e.NewValue).EndsWith("/Main.aspx", StringComparison.OrdinalIgnoreCase)) { e.NewValue = ((string)e.NewValue).Substring(0, ((string)e.NewValue).Length - 9); } }
protected virtual void Users_OverrideADRoles_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { Users user = (Users)e.Row; bool oldval = user.OverrideADRoles == true; bool newval = e.NewValue != null?Convert.ToBoolean(e.NewValue) : false; if (oldval != newval && !newval && user.Source == PXUsersSourceListAttribute.ActiveDirectory && RolesByUser.SelectSingle() != null) { if (UserList.Ask(PX.Objects.CR.Messages.Confirmation, PXMessages.LocalizeFormatNoPrefixNLA(PX.Objects.CR.Messages.DeleteLocalRoles, user.Username), MessageButtons.YesNo, MessageIcon.Warning) != WebDialogResult.Yes) { e.NewValue = true; e.Cancel = true; } else { //delete UsersInRoles records if overridead is disabled. foreach (UsersInRoles role in RolesByUser.Select()) { RolesByUser.Delete(role); } } } }
public void NoteFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (!String.IsNullOrEmpty(e.NewValue as string)) { //The change will only be visible after reloading the record since the note panel caches it... e.NewValue = e.NewValue + $" (added {DateTime.Now.ToString()} by {PXAccess.GetUserLogin()})\n"; } }
public override void FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (e.NewValue is DateTime) { e.NewValue = Convert.ToString(e.NewValue, CultureInfo.InvariantCulture); } base.FieldUpdating(sender, e); }
public override void SubstituteKeyFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (e.NewValue == null || GUID.TryParse(e.NewValue.ToString(), out Guid _)) { return; } base.SubstituteKeyFieldUpdating(sender, e); }
protected virtual void INItemXRef_BAccountID_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (e.Row != null && e.NewValue == null && ((INItemXRef)e.Row).AlternateType != INAlternateType.VPN && ((INItemXRef)e.Row).AlternateType != INAlternateType.CPN) { e.NewValue = (int)0; e.Cancel = true; } }
protected virtual void Dimension_Validate_FieldUpdating(PXCache cache, PXFieldUpdatingEventArgs e) { PXBoolAttribute.ConvertValue(e); if (e.NewValue != null) { e.NewValue = !((bool)e.NewValue); } }
protected virtual void GLBudgetTree_SubMask_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (e.NewValue != null) { PXStringState strState = (PXStringState)sender.GetStateExt(null, typeof(GLBudgetTree.subID).Name); e.NewValue = ((string)e.NewValue).PadRight(strState.InputMask.Length - 1, '?').Replace(' ', '?'); } }
public virtual void FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (e.NewValue != null && e.NewValue is string && !e.Cancel) { string strValue = (string)e.NewValue; int fieldLengthBeforeNormalize = strValue.Length; e.NewValue = Regex.Replace(strValue.Trim(), @"\s+", " ").PadRight(fieldLengthBeforeNormalize, ' '); } }
protected virtual void KCTaxManagement_StateId_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { KCTaxManagement row = (KCTaxManagement)e.Row; if (row != null && e != null && e.NewValue != null) { e.NewValue = e.NewValue.ToString().ToUpper(); } }
public virtual void CRCase_UsrInternalComment_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (e.Row == null) { return; } sender.SetValue <CRCaseExt.usrInternalCommentByName>(e.Row, Base.Accessinfo.UserName); }
protected virtual void CAEntryType_ReferenceID_FieldUpdating(PXCache cache, PXFieldUpdatingEventArgs e) { CAEntryType eType = (CAEntryType)e.Row; if (eType.Module == GL.BatchModule.CA || moduleChanged) { e.NewValue = null; } }
protected virtual void CurrencyRate_FromCuryID_FieldUpdating(PXCache cache, PXFieldUpdatingEventArgs e) { CuryRateFilter crf = Filter.Current as CuryRateFilter; if (e.NewValue != null && crf.ToCurrency != null && String.Compare((string)e.NewValue, crf.ToCurrency, true) == 0) { cache.RaiseExceptionHandling("FromCuryID", e.Row, e.NewValue, new PXSetPropertyException(Messages.DestShouldDifferFromOrig)); cache.SetStatus(e.Row, PXEntryStatus.Notchanged); } }
private ComplianceDocumentReference InsertComplianceDocumentReference(PXCache cache, PXFieldUpdatingEventArgs args, Guid?noteId) { var keys = ((string)args.NewValue).Split(','); var type = keys[0].Trim(); var refNumber = keys[1].Trim(); var reference = InsertComplianceDocumentReference(cache.Graph, ComplianceReferenceTypeHelper.GetKeyByValue(itemType, type), refNumber, noteId); return(reference); }
public override void SubstituteKeyFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { if (object.Equals(EmptyComponentCD, e.NewValue)) { e.NewValue = DRScheduleDetail.EmptyComponentID; } else { base.SubstituteKeyFieldUpdating(sender, e); } }
public virtual void FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { // suppress PXDimensionSelectorAttribute.FieldUpdating to prevent wrong conversion // from not set value BAccountID = 0: surrogate key may be erroneously interpreted as natural key var crossItem = (INItemXRef)e.Row; if (crossItem?.AlternateType == null || crossItem.AlternateType.IsIn(INAlternateType.CPN, INAlternateType.VPN)) { SelectorAttribute.FieldUpdating(sender, e); } }
protected virtual void SOOrderType_Template_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { SOOrderType row = (SOOrderType)e.Row; if (row == null) { return; } if (sender.GetStatus(row) == PXEntryStatus.Inserted && row.OrderType == (string)e.NewValue) { e.NewValue = null; } }
private void UpdateFileNames <TEntity, TField>(PXCache eventCache, PXFieldUpdatingEventArgs args) where TEntity : class where TField : IBqlField { var noteFileIds = args.NewValue as Guid[]; var entity = args.Row as TEntity; var entityType = (string)eventCache.GetValue <TField>(entity); if (entityType == POOrderType.RegularSubcontract && noteFileIds?.Length > 0) { UpdateFileNames(noteFileIds); } }