/// <summary> /// Build a class from a database row /// </summary> public static Icamap BuildIcamapFromRow(DataRow row) { var entity = BuildIcamapBaseFromRow <Icamap>(row); if (entity != null) { var childRowP_DefaultDataFields = row.GetChildRows("P_DefaultDataFields").FirstOrDefault(); if (childRowP_DefaultDataFields != null) { entity.icamapAddflds = (IcamapAddflds)SetKeyFields(entity, IcamapAddflds.BuildIcamapAddfldsFromRow(childRowP_DefaultDataFields), "cono,reportno,whse,prod", "cono,reportno,whse,prod"); } } return(entity); }
/// <summary> /// Update a database row from a class /// </summary> public static void UpdateRowFromIcamapAddflds(ref DataRow row, IcamapAddflds entity) { row.SetField("cono", entity.cono); row.SetField("reportno", entity.reportno); row.SetField("whse", entity.whse); row.SetField("prod", entity.prod); row.SetField("notesfl", entity.notesfl); row.SetField("descrip", entity.descrip); row.SetField("origmethod", entity.origmethod); row.SetField("usagegoal", entity.usagegoal); row.SetField("usagerate", entity.usagerate); row.SetField("percent", entity.percent); row.SetField("newmethod", entity.newmethod); row.SetField("icamapRowID", entity.icamapRowID.ToByteArray()); row.SetField("userfield", entity.userfield); }
public static IcamapAddflds BuildIcamapAddfldsFromRow(DataRow row) { IcamapAddflds entity = new IcamapAddflds(); entity.cono = row.IsNull("cono") ? 0 : row.Field <int>("cono"); entity.reportno = row.IsNull("reportno") ? 0 : row.Field <int>("reportno"); entity.whse = row.IsNull("whse") ? string.Empty : row.Field <string>("whse"); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.notesfl = row.IsNull("notesfl") ? string.Empty : row.Field <string>("notesfl"); entity.descrip = row.IsNull("descrip") ? string.Empty : row.Field <string>("descrip"); entity.origmethod = row.IsNull("origmethod") ? string.Empty : row.Field <string>("origmethod"); entity.usagegoal = row.IsNull("usagegoal") ? decimal.Zero : row.Field <decimal>("usagegoal"); entity.usagerate = row.IsNull("usagerate") ? decimal.Zero : row.Field <decimal>("usagerate"); entity.percent = row.IsNull("percent") ? decimal.Zero : row.Field <decimal>("percent"); entity.newmethod = row.IsNull("newmethod") ? string.Empty : row.Field <string>("newmethod"); entity.icamapRowID = row.Field <byte[]>("icamapRowID").ToStringEncoded(); entity.userfield = row.IsNull("userfield") ? string.Empty : row.Field <string>("userfield"); return(entity); }