public static Loadoetallysingle BuildLoadoetallysingleFromRow(DataRow row) { Loadoetallysingle entity = new Loadoetallysingle(); entity.qtyreq = row.IsNull("qtyreq") ? decimal.Zero : row.Field <decimal>("qtyreq"); entity.unit = row.IsNull("unit") ? string.Empty : row.Field <string>("unit"); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.proddesc = row.IsNull("proddesc") ? string.Empty : row.Field <string>("proddesc"); entity.qtyact = row.IsNull("qtyact") ? decimal.Zero : row.Field <decimal>("qtyact"); entity.qtybf = row.IsNull("qtybf") ? decimal.Zero : row.Field <decimal>("qtybf"); entity.cUnitStock = row.IsNull("cUnitStock") ? string.Empty : row.Field <string>("cUnitStock"); entity.lUnitConv = row.Field <bool>("lUnitConv"); entity.lRandomMix = row.Field <bool>("lRandomMix"); entity.lMemoMix = row.Field <bool>("lMemoMix"); entity.lRecalc = row.Field <bool>("lRecalc"); entity.lBundleFl = row.Field <bool>("lBundleFl"); entity.btnmodifyenabled = row.Field <bool>("btnmodifyenabled"); entity.btnaddenabled = row.Field <bool>("btnaddenabled"); entity.btndeleteenabled = row.Field <bool>("btndeleteenabled"); entity.btncalculateenabled = row.Field <bool>("btncalculateenabled"); entity.qtyreqenabled = row.Field <bool>("qtyreqenabled"); entity.unitenabled = row.Field <bool>("unitenabled"); entity.qtyordenabled = row.Field <bool>("qtyordenabled"); entity.delayenabled = row.Field <bool>("delayenabled"); 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 UpdateRowFromLoadoetallysingle(ref DataRow row, Loadoetallysingle entity) { row.SetField("qtyreq", entity.qtyreq); row.SetField("unit", entity.unit); row.SetField("prod", entity.prod); row.SetField("proddesc", entity.proddesc); row.SetField("qtyact", entity.qtyact); row.SetField("qtybf", entity.qtybf); row.SetField("cUnitStock", entity.cUnitStock); row.SetField("lUnitConv", entity.lUnitConv); row.SetField("lRandomMix", entity.lRandomMix); row.SetField("lMemoMix", entity.lMemoMix); row.SetField("lRecalc", entity.lRecalc); row.SetField("lBundleFl", entity.lBundleFl); row.SetField("btnmodifyenabled", entity.btnmodifyenabled); row.SetField("btnaddenabled", entity.btnaddenabled); row.SetField("btndeleteenabled", entity.btndeleteenabled); row.SetField("btncalculateenabled", entity.btncalculateenabled); row.SetField("qtyreqenabled", entity.qtyreqenabled); row.SetField("unitenabled", entity.unitenabled); row.SetField("qtyordenabled", entity.qtyordenabled); row.SetField("delayenabled", entity.delayenabled); row.SetField("userfield", entity.userfield); }