public static Apeelookupresults BuildApeelookupresultsFromRow(DataRow row) { Apeelookupresults entity = new Apeelookupresults(); entity.apstatus = row.IsNull("apstatus") ? string.Empty : row.Field <string>("apstatus"); entity.vendno = row.IsNull("vendno") ? decimal.Zero : row.Field <decimal>("vendno"); entity.vendnotesfl = row.IsNull("vendnotesfl") ? string.Empty : row.Field <string>("vendnotesfl"); entity.vendname = row.IsNull("vendname") ? string.Empty : row.Field <string>("vendname"); entity.invoiceno = row.IsNull("invoiceno") ? string.Empty : row.Field <string>("invoiceno"); entity.invoicenotesfl = row.IsNull("invoicenotesfl") ? string.Empty : row.Field <string>("invoicenotesfl"); entity.invoicedate = row.Field <DateTime?>("invoicedate"); entity.transtype = row.IsNull("transtype") ? string.Empty : row.Field <string>("transtype"); entity.amount = row.IsNull("amount") ? decimal.Zero : row.Field <decimal>("amount"); entity.currencyty = row.IsNull("currencyty") ? string.Empty : row.Field <string>("currencyty"); entity.duedate = row.Field <DateTime?>("duedate"); entity.discdate = row.Field <DateTime?>("discdate"); entity.disc = row.IsNull("disc") ? decimal.Zero : row.Field <decimal>("disc"); entity.refer = row.IsNull("refer") ? string.Empty : row.Field <string>("refer"); entity.apetRowid = row.Field <byte[]>("apet-rowid").ToStringEncoded(); entity.sapbvRowid = row.Field <byte[]>("sapbv-rowid").ToStringEncoded(); entity.jrnlno = row.IsNull("jrnlno") ? 0 : row.Field <int>("jrnlno"); entity.setno = row.IsNull("setno") ? 0 : row.Field <int>("setno"); 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 UpdateRowFromApeelookupresults(ref DataRow row, Apeelookupresults entity) { row.SetField("apstatus", entity.apstatus); row.SetField("vendno", entity.vendno); row.SetField("vendnotesfl", entity.vendnotesfl); row.SetField("vendname", entity.vendname); row.SetField("invoiceno", entity.invoiceno); row.SetField("invoicenotesfl", entity.invoicenotesfl); row.SetField("invoicedate", entity.invoicedate); row.SetField("transtype", entity.transtype); row.SetField("amount", entity.amount); row.SetField("currencyty", entity.currencyty); row.SetField("duedate", entity.duedate); row.SetField("discdate", entity.discdate); row.SetField("disc", entity.disc); row.SetField("refer", entity.refer); row.SetField("apet-rowid", entity.apetRowid.ToByteArray()); row.SetField("sapbv-rowid", entity.sapbvRowid.ToByteArray()); row.SetField("jrnlno", entity.jrnlno); row.SetField("setno", entity.setno); row.SetField("userfield", entity.userfield); }