public static Aretcm BuildAretcmFromRow(DataRow row) { Aretcm entity = new Aretcm(); entity.amount = row.IsNull("amount") ? decimal.Zero : row.Field <decimal>("amount"); entity.applyamt = row.IsNull("applyamt") ? decimal.Zero : row.Field <decimal>("applyamt"); entity.lastapplyamt = row.IsNull("lastapplyamt") ? decimal.Zero : row.Field <decimal>("lastapplyamt"); entity.custno = row.IsNull("custno") ? decimal.Zero : row.Field <decimal>("custno"); entity.discamt = row.IsNull("discamt") ? decimal.Zero : row.Field <decimal>("discamt"); entity.lastdiscamt = row.IsNull("lastdiscamt") ? decimal.Zero : row.Field <decimal>("lastdiscamt"); entity.discdt = row.Field <DateTime?>("discdt"); entity.disputefl = row.Field <bool>("disputefl"); entity.duedt = row.Field <DateTime?>("duedt"); entity.invno = row.IsNull("invno") ? 0 : row.Field <int>("invno"); entity.invsuf = row.IsNull("invsuf") ? 0 : row.Field <int>("invsuf"); entity.odiscamt = row.IsNull("odiscamt") ? decimal.Zero : row.Field <decimal>("odiscamt"); entity.period = row.IsNull("period") ? 0 : row.Field <int>("period"); entity.piffl = row.Field <bool>("piffl"); entity.recno = row.IsNull("recno") ? 0 : row.Field <long>("recno"); entity.refer = row.IsNull("refer") ? string.Empty : row.Field <string>("refer"); entity.seqno = row.IsNull("seqno") ? 0 : row.Field <int>("seqno"); entity.cSCIndicator = row.IsNull("cSCIndicator") ? string.Empty : row.Field <string>("cSCIndicator"); entity.lUnearnedfl = row.Field <bool>("lUnearnedfl"); entity.userfield = row.IsNull("userfield") ? string.Empty : row.Field <string>("userfield"); return(entity); }
/// <summary> /// Update a database row from a class /// </summary> public static void UpdateRowFromAretcm(ref DataRow row, Aretcm entity) { row.SetField("amount", entity.amount); row.SetField("applyamt", entity.applyamt); row.SetField("lastapplyamt", entity.lastapplyamt); row.SetField("custno", entity.custno); row.SetField("discamt", entity.discamt); row.SetField("lastdiscamt", entity.lastdiscamt); row.SetField("discdt", entity.discdt); row.SetField("disputefl", entity.disputefl); row.SetField("duedt", entity.duedt); row.SetField("invno", entity.invno); row.SetField("invsuf", entity.invsuf); row.SetField("odiscamt", entity.odiscamt); row.SetField("period", entity.period); row.SetField("piffl", entity.piffl); row.SetField("recno", entity.recno); row.SetField("refer", entity.refer); row.SetField("seqno", entity.seqno); row.SetField("cSCIndicator", entity.cSCIndicator); row.SetField("lUnearnedfl", entity.lUnearnedfl); row.SetField("userfield", entity.userfield); }