public static Loadusagehistorysingle BuildLoadusagehistorysingleFromRow(DataRow row) { Loadusagehistorysingle entity = new Loadusagehistorysingle(); entity.reportno = row.IsNull("reportno") ? 0 : row.Field <int>("reportno"); entity.whse = row.IsNull("whse") ? string.Empty : row.Field <string>("whse"); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.unit = row.IsNull("unit") ? string.Empty : row.Field <string>("unit"); entity.unitconv = row.IsNull("unitconv") ? decimal.Zero : row.Field <decimal>("unitconv"); entity.qtyonhand = row.IsNull("qtyonhand") ? decimal.Zero : row.Field <decimal>("qtyonhand"); entity.qtyreserved = row.IsNull("qtyreserved") ? decimal.Zero : row.Field <decimal>("qtyreserved"); entity.qtycommitted = row.IsNull("qtycommitted") ? decimal.Zero : row.Field <decimal>("qtycommitted"); entity.qtyonorder = row.IsNull("qtyonorder") ? decimal.Zero : row.Field <decimal>("qtyonorder"); entity.qtyreceived = row.IsNull("qtyreceived") ? decimal.Zero : row.Field <decimal>("qtyreceived"); entity.qtybackord = row.IsNull("qtybackord") ? decimal.Zero : row.Field <decimal>("qtybackord"); entity.qtydemand = row.IsNull("qtydemand") ? decimal.Zero : row.Field <decimal>("qtydemand"); entity.qtynow = row.IsNull("qtynow") ? decimal.Zero : row.Field <decimal>("qtynow"); entity.qtyfuture = row.IsNull("qtyfuture") ? decimal.Zero : row.Field <decimal>("qtyfuture"); entity.invavaildays = row.IsNull("invavaildays") ? decimal.Zero : row.Field <decimal>("invavaildays"); entity.firstmergedate = row.Field <DateTime?>("firstmergedate"); entity.lastmergedate = row.Field <DateTime?>("lastmergedate"); entity.secure = row.IsNull("secure") ? 0 : row.Field <int>("secure"); entity.icswRowID = row.Field <byte[]>("icswRowID").ToStringEncoded(); entity.icswuRowid = row.Field <byte[]>("icswuRowid").ToStringEncoded(); 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 UpdateRowFromLoadusagehistorysingle(ref DataRow row, Loadusagehistorysingle entity) { row.SetField("reportno", entity.reportno); row.SetField("whse", entity.whse); row.SetField("prod", entity.prod); row.SetField("unit", entity.unit); row.SetField("unitconv", entity.unitconv); row.SetField("qtyonhand", entity.qtyonhand); row.SetField("qtyreserved", entity.qtyreserved); row.SetField("qtycommitted", entity.qtycommitted); row.SetField("qtyonorder", entity.qtyonorder); row.SetField("qtyreceived", entity.qtyreceived); row.SetField("qtybackord", entity.qtybackord); row.SetField("qtydemand", entity.qtydemand); row.SetField("qtynow", entity.qtynow); row.SetField("qtyfuture", entity.qtyfuture); row.SetField("invavaildays", entity.invavaildays); row.SetField("firstmergedate", entity.firstmergedate); row.SetField("lastmergedate", entity.lastmergedate); row.SetField("secure", entity.secure); row.SetField("icswRowID", entity.icswRowID.ToByteArray()); row.SetField("icswuRowid", entity.icswuRowid.ToByteArray()); row.SetField("userfield", entity.userfield); }