/// <summary> /// Update a database row from a class /// </summary> public static void UpdateRowFromApspcopy(ref DataRow row, Apspcopy entity) { row.SetField("fromvendno", entity.fromvendno); row.SetField("tovendno", entity.tovendno); row.SetField("fromwhse", entity.fromwhse); row.SetField("towhse", entity.towhse); row.SetField("fromprodline", entity.fromprodline); row.SetField("toprodline", entity.toprodline); row.SetField("fromyear", entity.fromyear); row.SetField("toyear", entity.toyear); row.SetField("rowid", entity.rowid.ToByteArray()); row.SetField("userfield", entity.userfield); }
public static Apspcopy BuildApspcopyFromRow(DataRow row) { Apspcopy entity = new Apspcopy(); entity.fromvendno = row.IsNull("fromvendno") ? decimal.Zero : row.Field <decimal>("fromvendno"); entity.tovendno = row.IsNull("tovendno") ? decimal.Zero : row.Field <decimal>("tovendno"); entity.fromwhse = row.IsNull("fromwhse") ? string.Empty : row.Field <string>("fromwhse"); entity.towhse = row.IsNull("towhse") ? string.Empty : row.Field <string>("towhse"); entity.fromprodline = row.IsNull("fromprodline") ? string.Empty : row.Field <string>("fromprodline"); entity.toprodline = row.IsNull("toprodline") ? string.Empty : row.Field <string>("toprodline"); entity.fromyear = row.IsNull("fromyear") ? 0 : row.Field <int>("fromyear"); entity.toyear = row.IsNull("toyear") ? 0 : row.Field <int>("toyear"); entity.rowid = row.Field <byte[]>("rowid").ToStringEncoded(); entity.userfield = row.IsNull("userfield") ? string.Empty : row.Field <string>("userfield"); return(entity); }