public static Loadpolinenonstockresults BuildLoadpolinenonstockresultsFromRow(DataRow row) { Loadpolinenonstockresults entity = new Loadpolinenonstockresults(); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.proddesc1 = row.IsNull("proddesc1") ? string.Empty : row.Field <string>("proddesc1"); entity.proddesc2 = row.IsNull("proddesc2") ? string.Empty : row.Field <string>("proddesc2"); entity.prodcat = row.IsNull("prodcat") ? string.Empty : row.Field <string>("prodcat"); entity.prodcatdesc = row.IsNull("prodcatdesc") ? string.Empty : row.Field <string>("prodcatdesc"); entity.price = row.IsNull("price") ? decimal.Zero : row.Field <decimal>("price"); entity.foreigncost = row.IsNull("foreigncost") ? decimal.Zero : row.Field <decimal>("foreigncost"); entity.weight = row.IsNull("weight") ? decimal.Zero : row.Field <decimal>("weight"); entity.exchgrate = row.IsNull("exchgrate") ? decimal.Zero : row.Field <decimal>("exchgrate"); entity.cubes = row.IsNull("cubes") ? decimal.Zero : row.Field <decimal>("cubes"); entity.currencyty = row.IsNull("currencyty") ? string.Empty : row.Field <string>("currencyty"); entity.shortdesc = row.IsNull("shortdesc") ? string.Empty : row.Field <string>("shortdesc"); entity.prodcathidden = row.Field <bool>("prodcathidden"); entity.ncnr = row.IsNull("ncnr") ? string.Empty : row.Field <string>("ncnr"); entity.dutyrate = row.IsNull("dutyrate") ? decimal.Zero : row.Field <decimal>("dutyrate"); entity.tariffcd = row.IsNull("tariffcd") ? string.Empty : row.Field <string>("tariffcd"); entity.countryoforigin = row.IsNull("countryoforigin") ? string.Empty : row.Field <string>("countryoforigin"); entity.upcid = row.IsNull("upcid") ? string.Empty : row.Field <string>("upcid"); 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 UpdateRowFromLoadpolinenonstockresults(ref DataRow row, Loadpolinenonstockresults entity) { row.SetField("prod", entity.prod); row.SetField("proddesc1", entity.proddesc1); row.SetField("proddesc2", entity.proddesc2); row.SetField("prodcat", entity.prodcat); row.SetField("prodcatdesc", entity.prodcatdesc); row.SetField("price", entity.price); row.SetField("foreigncost", entity.foreigncost); row.SetField("weight", entity.weight); row.SetField("exchgrate", entity.exchgrate); row.SetField("cubes", entity.cubes); row.SetField("currencyty", entity.currencyty); row.SetField("shortdesc", entity.shortdesc); row.SetField("prodcathidden", entity.prodcathidden); row.SetField("ncnr", entity.ncnr); row.SetField("dutyrate", entity.dutyrate); row.SetField("tariffcd", entity.tariffcd); row.SetField("countryoforigin", entity.countryoforigin); row.SetField("upcid", entity.upcid); row.SetField("userfield", entity.userfield); }