protected virtual void _(Events.RowSelected <FSModelComponent> e) { if (e.Row == null) { return; } FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row; EnableDisable_FSModelComponent(e.Cache, fsModelComponentRow); }
protected void FSModelComponent_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row; EnableDisable_FSModelComponent(cache, fsModelComponentRow); }
/// <summary> /// Reset the values on the 'Components' grid and loads the Component registers from the selected 'ItemClass' for the current 'InventoryItem' ('StockItem'). /// </summary> public virtual void ResetValuesFromItemClass(PXCache cache, InventoryItem inventoryItemRow, int?itemClassID) { if (PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false) { return; } if (inventoryItemRow != null && inventoryItemRow.ItemClassID != null) { using (var ts = new PXTransactionScope()) { INItemClass inItemClassRow = PXSelect <INItemClass, Where < INItemClass.itemClassID, Equal <Required <INItemClass.itemClassID> > > > .Select(Base, itemClassID); FSxEquipmentModelTemplate fsxEquipmentModelTemplateRow = Base.ItemClass.Cache.GetExtension <FSxEquipmentModelTemplate>(inItemClassRow); FSxEquipmentModel fsxEquipmentModelRow = cache.GetExtension <FSxEquipmentModel>(inventoryItemRow); var fsModelTemplateComponentSet = PXSelect <FSModelTemplateComponent, Where < FSModelTemplateComponent.modelTemplateID, Equal <Required <FSModelTemplateComponent.modelTemplateID> >, And <FSModelTemplateComponent.active, Equal <True> > > > .Select(Base, itemClassID); fsxEquipmentModelRow.EQEnabled = fsxEquipmentModelTemplateRow.EQEnabled; fsxEquipmentModelRow.EquipmentItemClass = fsxEquipmentModelTemplateRow.EquipmentItemClass; fsxEquipmentModelRow.ModelType = fsxEquipmentModelTemplateRow.DfltModelType; foreach (FSModelComponent fsModelComponentRow in ModelComponents.Select()) { ModelComponents.Delete(fsModelComponentRow); } foreach (FSModelTemplateComponent fsModelTemplateComponentRow in fsModelTemplateComponentSet) { if (fsxEquipmentModelTemplateRow.EQEnabled == true) { FSModelComponent fsModelComponentRow = new FSModelComponent(); fsModelComponentRow.Active = fsModelTemplateComponentRow.Active; fsModelComponentRow.ComponentID = fsModelTemplateComponentRow.ComponentID; fsModelComponentRow.Descr = fsModelTemplateComponentRow.Descr; fsModelComponentRow.ClassID = fsModelTemplateComponentRow.ClassID; fsModelComponentRow.Optional = fsModelTemplateComponentRow.Optional; fsModelComponentRow.Qty = fsModelTemplateComponentRow.Qty; ModelComponents.Cache.Insert(fsModelComponentRow); } } ts.Complete(); } } }
/// <summary> /// Manages the <c>SetEnabled</c> attribute for the <c>componentCD</c>, <c>descr</c>, <c>vendorWarrantyDuration</c>, <c>vendorID</c> and <c>cpnyWarrantyDuration</c> fields of the <c>FSModelComponent</c> DAC. /// </summary> private void EnableDisable_FSModelComponent(PXCache cache, FSModelComponent fsModelComponentRow) { if (fsModelComponentRow.ComponentID != null) { bool enableLineByActive = fsModelComponentRow.Active == true; PXUIFieldAttribute.SetEnabled <FSModelComponent.componentID>(cache, fsModelComponentRow, enableLineByActive); PXUIFieldAttribute.SetEnabled <FSModelComponent.descr>(cache, fsModelComponentRow, enableLineByActive); PXUIFieldAttribute.SetEnabled <FSModelComponent.classID>(cache, fsModelComponentRow, fsModelComponentRow.ClassID == null); PXUIFieldAttribute.SetEnabled <FSModelComponent.requireSerial>(cache, fsModelComponentRow, enableLineByActive); } }
/// <summary> /// Manages the <c>SetEnabled</c> attribute for the <c>componentCD</c>, <c>descr</c>, <c>vendorWarrantyDuration</c>, <c>vendorID</c> and <c>cpnyWarrantyDuration</c> fields of the <c>FSModelComponent</c> DAC. /// </summary> public virtual void EnableDisable_FSModelComponent(PXCache cache, FSModelComponent fsModelComponentRow) { if (PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false) { return; } if (fsModelComponentRow.ComponentID != null) { bool enableLineByActive = fsModelComponentRow.Active == true; PXUIFieldAttribute.SetEnabled <FSModelComponent.componentID>(cache, fsModelComponentRow, enableLineByActive); PXUIFieldAttribute.SetEnabled <FSModelComponent.descr>(cache, fsModelComponentRow, enableLineByActive); PXUIFieldAttribute.SetEnabled <FSModelComponent.classID>(cache, fsModelComponentRow, fsModelComponentRow.ClassID == null); PXUIFieldAttribute.SetEnabled <FSModelComponent.requireSerial>(cache, fsModelComponentRow, enableLineByActive); } }
protected virtual void FSModelComponent_RowInserting(PXCache cache, PXRowInsertingEventArgs e) { if (e.Row == null) { return; } FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row; FSModelComponent fsModelComponentRow_InDB = PXSelect <FSModelComponent, Where < FSModelComponent.componentID, Equal <Required <FSModelComponent.componentID> >, And < FSModelComponent.modelID, Equal <Current <InventoryItem.inventoryID> > > > > .SelectWindowed(Base, 0, 1, fsModelComponentRow.ComponentID); if (fsModelComponentRow_InDB != null) { cache.RaiseExceptionHandling <FSModelComponent.componentID> (e.Row, fsModelComponentRow.ComponentID, new PXException(TX.Error.ID_ALREADY_USED)); } }
protected virtual void FSModelComponent_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { if (e.Row == null) { return; } FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row; if (fsModelComponentRow.InventoryID != null) { InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(Base, fsModelComponentRow.InventoryID); FSxEquipmentModel fsxEquipmentModelTemplate = PXCache <InventoryItem> .GetExtension <FSxEquipmentModel>(inventoryItemRow); fsModelComponentRow.CpnyWarrantyValue = fsxEquipmentModelTemplate.CpnyWarrantyValue; fsModelComponentRow.CpnyWarrantyType = fsxEquipmentModelTemplate.CpnyWarrantyType; fsModelComponentRow.VendorWarrantyValue = fsxEquipmentModelTemplate.VendorWarrantyValue; fsModelComponentRow.VendorWarrantyType = fsxEquipmentModelTemplate.VendorWarrantyType; fsModelComponentRow.VendorID = inventoryItemRow.PreferredVendorID; } }
protected virtual void _(Events.RowInserting <FSModelComponent> e) { if (e.Row == null || PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false) { return; } FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row; FSModelComponent fsModelComponentRow_InDB = PXSelect <FSModelComponent, Where < FSModelComponent.componentID, Equal <Required <FSModelComponent.componentID> >, And < FSModelComponent.modelID, Equal <Current <InventoryItem.inventoryID> > > > > .SelectWindowed(Base, 0, 1, fsModelComponentRow.ComponentID); if (fsModelComponentRow_InDB != null) { e.Cache.RaiseExceptionHandling <FSModelComponent.componentID> (e.Row, fsModelComponentRow.ComponentID, new PXException(TX.Error.ID_ALREADY_USED)); } }
protected virtual void _(Events.FieldUpdated <FSModelComponent, FSModelComponent.inventoryID> e) { if (e.Row == null || PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false) { return; } FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row; if (fsModelComponentRow.InventoryID != null) { InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(Base, fsModelComponentRow.InventoryID); FSxEquipmentModel fsxEquipmentModelTemplate = PXCache <InventoryItem> .GetExtension <FSxEquipmentModel>(inventoryItemRow); fsModelComponentRow.CpnyWarrantyValue = fsxEquipmentModelTemplate.CpnyWarrantyValue; fsModelComponentRow.CpnyWarrantyType = fsxEquipmentModelTemplate.CpnyWarrantyType; fsModelComponentRow.VendorWarrantyValue = fsxEquipmentModelTemplate.VendorWarrantyValue; fsModelComponentRow.VendorWarrantyType = fsxEquipmentModelTemplate.VendorWarrantyType; fsModelComponentRow.VendorID = inventoryItemRow.PreferredVendorID; } }
protected virtual void FSModelComponent_ComponentID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { if (e.Row == null) { return; } FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row; if (fsModelComponentRow.ComponentID != null) { FSModelTemplateComponent fsModelTemplateComponentRow = PXSelect <FSModelTemplateComponent, Where < FSModelTemplateComponent.componentID, Equal <Required <FSModelTemplateComponent.componentID> > > > .Select(Base, fsModelComponentRow.ComponentID); fsModelComponentRow.Active = fsModelTemplateComponentRow.Active; fsModelComponentRow.ComponentID = fsModelTemplateComponentRow.ComponentID; fsModelComponentRow.Descr = fsModelTemplateComponentRow.Descr; fsModelComponentRow.ClassID = fsModelTemplateComponentRow.ClassID; fsModelComponentRow.Optional = fsModelTemplateComponentRow.Optional; fsModelComponentRow.Qty = fsModelTemplateComponentRow.Qty; } }
protected virtual void _(Events.FieldUpdated <FSModelComponent, FSModelComponent.componentID> e) { if (e.Row == null || PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false) { return; } FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row; if (fsModelComponentRow.ComponentID != null) { FSModelTemplateComponent fsModelTemplateComponentRow = PXSelect <FSModelTemplateComponent, Where < FSModelTemplateComponent.componentID, Equal <Required <FSModelTemplateComponent.componentID> > > > .Select(Base, fsModelComponentRow.ComponentID); fsModelComponentRow.Active = fsModelTemplateComponentRow.Active; fsModelComponentRow.ComponentID = fsModelTemplateComponentRow.ComponentID; fsModelComponentRow.Descr = fsModelTemplateComponentRow.Descr; fsModelComponentRow.ClassID = fsModelTemplateComponentRow.ClassID; fsModelComponentRow.Optional = fsModelTemplateComponentRow.Optional; fsModelComponentRow.Qty = fsModelTemplateComponentRow.Qty; } }