Hybrids
Hybrids are set in the Save() method of the BusinessObject. Hybrids should be using the proper HybridType-class .
For creating a new Hybrid class, the next steps should be followed (Example class: ART):
Add a new Hybrid value, in the HybridType-class
public enum HybridType
{
BEL,
PERS,
ART,
//....
}Create a new class HybridName, extending HybridBase, in the Hybrid class
public class HybridArt : HybridBase
{
private DataRow row;
private DataRow Rows;
{
get
{
if (row != null)
return row; // cached
var dt = Sql.SelectTable("select * from art where hybrid = '{0}'", this.Hybrid);
if (dt.Rows.Count > 0)
row = dt.Rows[0]; // cache it
return row;
}
}
public string ArtNr { get; private set; }
public override string InfoModuleId { get { return "modInfoArt"; } }
public HybridArt()
{ }
public HybridArt(string value)
: base(value)
{
if (this.Type != HybridType.ART)
throw new ArgumentException(string.Format("Hybrid type is invalid. Actual value: {0}, expected value: {1}", this.Type.ToString(), HybridType.ART.ToString()));
ArtNr = this.Keys[0].ToString();
}
public static HybridArt FromBarcode39Hybrid(string barcode39Hybrid)
{
return new HybridArt(barcode39Hybrid.Replace(Constants.HybridSeparatorInCode39, Framework.Constants.HybridSeparator, count: 1));
}
public override DataRow GetRow()
{
return Row;
}
public override string GetSearchString()
{
return Row != null
? Row["suchwort"].ToString()
: null;
}
}
Add hybrid-type to HybridExtensions
First in the GetHybrid-Method
Then in the ConvertBarcode39Hybrid -Method
The hybrid can be obtained using the Get() method from the HybridType-class, as followed:
Last updated