14 Artikeldaten
01 Anzahl Artikel lesen
using System.Linq;
using System.Windows.Forms;
using Eplan.EplApi.MasterData;
using Eplan.EplApi.Scripting;
class _14_Artikeldaten_01_Anzahl_Artikel_lesen
{
[Start]
public void Function()
{
MDPartsManagement mdPartsManagement = new MDPartsManagement();
int partCount;
using (MDPartsDatabase database = mdPartsManagement.OpenDatabase())
{
partCount = database.Parts
.Count(obj => obj.ProductSubGroup ==
MDPartsDatabaseItem.Enums.ProductSubGroup
.MotorOverloadSwitch);
}
MessageBox.Show("Anzahl Motorschutzschalter: " + partCount);
}
}
02 Eigenschaften verändern
using Eplan.EplApi.MasterData;
using Eplan.EplApi.Scripting;
using System.Linq;
class _14_Artikeldaten_02_Eigenschaften_veraendern
{
[Start]
public void Function()
{
MDPartsManagement mdPartsManagement = new MDPartsManagement();
using (MDPartsDatabase database = mdPartsManagement.OpenDatabase())
{
var parts = database.Parts
.Where(obj => obj.ProductSubGroup ==
MDPartsDatabaseItem.Enums.ProductSubGroup
.MotorOverloadSwitch);
foreach (MDPart part in parts)
{
part.Properties.ARTICLE_DESCR1 = "Motorschutzschalter";
}
}
}
}