public static Poitcheader BuildPoitcheaderFromRow(DataRow row) { Poitcheader entity = new Poitcheader(); entity.orderno = row.IsNull("orderno") ? 0 : row.Field <int>("orderno"); entity.ordersuf = row.IsNull("ordersuf") ? 0 : row.Field <int>("ordersuf"); entity.lineno = row.IsNull("lineno") ? 0 : row.Field <int>("lineno"); entity.ordertype = row.IsNull("ordertype") ? string.Empty : row.Field <string>("ordertype"); entity.inquirefl = row.Field <bool>("inquirefl"); entity.functionname = row.IsNull("functionname") ? string.Empty : row.Field <string>("functionname"); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.units = row.IsNull("units") ? string.Empty : row.Field <string>("units"); entity.whse = row.IsNull("whse") ? string.Empty : row.Field <string>("whse"); entity.custno = row.IsNull("custno") ? decimal.Zero : row.Field <decimal>("custno"); entity.shipto = row.IsNull("shipto") ? string.Empty : row.Field <string>("shipto"); entity.price = row.IsNull("price") ? decimal.Zero : row.Field <decimal>("price"); entity.bundleid = row.IsNull("bundleid") ? string.Empty : row.Field <string>("bundleid"); entity.adjfactor = row.IsNull("adjfactor") ? decimal.Zero : row.Field <decimal>("adjfactor"); entity.bundlefl = row.Field <bool>("bundlefl"); entity.memomixfl = row.Field <bool>("memomixfl"); entity.qtyact = row.IsNull("qtyact") ? decimal.Zero : row.Field <decimal>("qtyact"); entity.qtybf = row.IsNull("qtybf") ? decimal.Zero : row.Field <decimal>("qtybf"); entity.qtyreq = row.IsNull("qtyreq") ? decimal.Zero : row.Field <decimal>("qtyreq"); entity.proddesc = row.IsNull("proddesc") ? string.Empty : row.Field <string>("proddesc"); entity.randommixfl = row.Field <bool>("randommixfl"); entity.recalcfl = row.Field <bool>("recalcfl"); entity.unit = row.IsNull("unit") ? string.Empty : row.Field <string>("unit"); entity.unitconvfl = row.Field <bool>("unitconvfl"); entity.unitstock = row.IsNull("unitstock") ? string.Empty : row.Field <string>("unitstock"); entity.onhandlf = row.IsNull("onhandlf") ? decimal.Zero : row.Field <decimal>("onhandlf"); entity.availlf = row.IsNull("availlf") ? decimal.Zero : row.Field <decimal>("availlf"); entity.onorderlf = row.IsNull("onorderlf") ? decimal.Zero : row.Field <decimal>("onorderlf"); entity.onhandbf = row.IsNull("onhandbf") ? decimal.Zero : row.Field <decimal>("onhandbf"); entity.availbf = row.IsNull("availbf") ? decimal.Zero : row.Field <decimal>("availbf"); entity.onorderbf = row.IsNull("onorderbf") ? decimal.Zero : row.Field <decimal>("onorderbf"); entity.qtyreqenabled = row.Field <bool>("qtyreqenabled"); entity.adjfactorhidden = row.Field <bool>("adjfactorhidden"); entity.memomixhidden = row.Field <bool>("memomixhidden"); 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 UpdateRowFromPoitcheader(ref DataRow row, Poitcheader entity) { row.SetField("orderno", entity.orderno); row.SetField("ordersuf", entity.ordersuf); row.SetField("lineno", entity.lineno); row.SetField("ordertype", entity.ordertype); row.SetField("inquirefl", entity.inquirefl); row.SetField("functionname", entity.functionname); row.SetField("prod", entity.prod); row.SetField("units", entity.units); row.SetField("whse", entity.whse); row.SetField("custno", entity.custno); row.SetField("shipto", entity.shipto); row.SetField("price", entity.price); row.SetField("bundleid", entity.bundleid); row.SetField("adjfactor", entity.adjfactor); row.SetField("bundlefl", entity.bundlefl); row.SetField("memomixfl", entity.memomixfl); row.SetField("qtyact", entity.qtyact); row.SetField("qtybf", entity.qtybf); row.SetField("qtyreq", entity.qtyreq); row.SetField("proddesc", entity.proddesc); row.SetField("randommixfl", entity.randommixfl); row.SetField("recalcfl", entity.recalcfl); row.SetField("unit", entity.unit); row.SetField("unitconvfl", entity.unitconvfl); row.SetField("unitstock", entity.unitstock); row.SetField("onhandlf", entity.onhandlf); row.SetField("availlf", entity.availlf); row.SetField("onorderlf", entity.onorderlf); row.SetField("onhandbf", entity.onhandbf); row.SetField("availbf", entity.availbf); row.SetField("onorderbf", entity.onorderbf); row.SetField("qtyreqenabled", entity.qtyreqenabled); row.SetField("adjfactorhidden", entity.adjfactorhidden); row.SetField("memomixhidden", entity.memomixhidden); row.SetField("userfield", entity.userfield); }