public static Poeilineadd BuildPoeilineaddFromRow(DataRow row) { Poeilineadd entity = new Poeilineadd(); entity.pono = row.IsNull("pono") ? 0 : row.Field <int>("pono"); entity.posuf = row.IsNull("posuf") ? 0 : row.Field <int>("posuf"); entity.lineno = row.IsNull("lineno") ? 0 : row.Field <int>("lineno"); entity.jrnlno = row.IsNull("jrnlno") ? 0 : row.Field <int>("jrnlno"); entity.correctionfl = row.Field <bool>("correctionfl"); entity.whse = row.IsNull("whse") ? string.Empty : row.Field <string>("whse"); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.descrip = row.IsNull("descrip") ? string.Empty : row.Field <string>("descrip"); entity.descrip2 = row.IsNull("descrip2") ? string.Empty : row.Field <string>("descrip2"); entity.prodcat = row.IsNull("prodcat") ? string.Empty : row.Field <string>("prodcat"); entity.qtyord = row.IsNull("qtyord") ? decimal.Zero : row.Field <decimal>("qtyord"); entity.unit = row.IsNull("unit") ? string.Empty : row.Field <string>("unit"); entity.price = row.IsNull("price") ? decimal.Zero : row.Field <decimal>("price"); entity.nonstockty = row.IsNull("nonstockty") ? string.Empty : row.Field <string>("nonstockty"); entity.trackno = row.IsNull("trackno") ? 0 : row.Field <int>("trackno"); entity.vendno = row.IsNull("vendno") ? decimal.Zero : row.Field <decimal>("vendno"); entity.upcid = row.IsNull("upcid") ? string.Empty : row.Field <string>("upcid"); entity.transtype = row.IsNull("transtype") ? string.Empty : row.Field <string>("transtype"); entity.nonstocktyOrig = row.IsNull("nonstockty-orig") ? string.Empty : row.Field <string>("nonstockty-orig"); entity.prodOrig = row.IsNull("prod-orig") ? string.Empty : row.Field <string>("prod-orig"); entity.qtyordOrig = row.IsNull("qtyord-orig") ? decimal.Zero : row.Field <decimal>("qtyord-orig"); entity.unitOrig = row.IsNull("unit-orig") ? string.Empty : row.Field <string>("unit-orig"); entity.oannsfl = row.Field <bool>("oannsfl"); entity.cbNonStockTySensitive = row.Field <bool>("cbNonStockTy-sensitive"); entity.cbNonStockTyScreenValues = row.IsNull("cbNonStockTy-screen-values") ? string.Empty : row.Field <string>("cbNonStockTy-screen-values"); entity.cbNonStockTyDataValues = row.IsNull("cbNonStockTy-data-values") ? string.Empty : row.Field <string>("cbNonStockTy-data-values"); entity.ordertype = row.IsNull("ordertype") ? string.Empty : row.Field <string>("ordertype"); entity.currencyty = row.IsNull("currencyty") ? string.Empty : row.Field <string>("currencyty"); entity.currencydesc = row.IsNull("currencydesc") ? string.Empty : row.Field <string>("currencydesc"); entity.foreigncost = row.IsNull("foreigncost") ? decimal.Zero : row.Field <decimal>("foreigncost"); entity.exchgrate = row.IsNull("exchgrate") ? decimal.Zero : row.Field <decimal>("exchgrate"); entity.shortdesc = row.IsNull("shortdesc") ? string.Empty : row.Field <string>("shortdesc"); entity.sastcfl = row.Field <bool>("sastcfl"); entity.vendname = row.IsNull("vendname") ? string.Empty : row.Field <string>("vendname"); entity.fiForeignCostHidden = row.Field <bool>("fiForeignCost-hidden"); entity.fiExchgRateHidden = row.Field <bool>("fiExchgRate-hidden"); entity.fiCurrencyTyHidden = row.Field <bool>("fiCurrencyTy-hidden"); entity.fiShortDescHidden = row.Field <bool>("fiShortDesc-hidden"); entity.btnCostCalculatorHidden = row.Field <bool>("btn_Cost-Calculator-hidden"); entity.btnCostCalculatorSensitive = row.Field <bool>("btn_Cost-Calculator-sensitive"); 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 UpdateRowFromPoeilineadd(ref DataRow row, Poeilineadd entity) { row.SetField("pono", entity.pono); row.SetField("posuf", entity.posuf); row.SetField("lineno", entity.lineno); row.SetField("jrnlno", entity.jrnlno); row.SetField("correctionfl", entity.correctionfl); row.SetField("whse", entity.whse); row.SetField("prod", entity.prod); row.SetField("descrip", entity.descrip); row.SetField("descrip2", entity.descrip2); row.SetField("prodcat", entity.prodcat); row.SetField("qtyord", entity.qtyord); row.SetField("unit", entity.unit); row.SetField("price", entity.price); row.SetField("nonstockty", entity.nonstockty); row.SetField("trackno", entity.trackno); row.SetField("vendno", entity.vendno); row.SetField("upcid", entity.upcid); row.SetField("transtype", entity.transtype); row.SetField("nonstockty-orig", entity.nonstocktyOrig); row.SetField("prod-orig", entity.prodOrig); row.SetField("qtyord-orig", entity.qtyordOrig); row.SetField("unit-orig", entity.unitOrig); row.SetField("oannsfl", entity.oannsfl); row.SetField("cbNonStockTy-sensitive", entity.cbNonStockTySensitive); row.SetField("cbNonStockTy-screen-values", entity.cbNonStockTyScreenValues); row.SetField("cbNonStockTy-data-values", entity.cbNonStockTyDataValues); row.SetField("ordertype", entity.ordertype); row.SetField("currencyty", entity.currencyty); row.SetField("currencydesc", entity.currencydesc); row.SetField("foreigncost", entity.foreigncost); row.SetField("exchgrate", entity.exchgrate); row.SetField("shortdesc", entity.shortdesc); row.SetField("sastcfl", entity.sastcfl); row.SetField("vendname", entity.vendname); row.SetField("fiForeignCost-hidden", entity.fiForeignCostHidden); row.SetField("fiExchgRate-hidden", entity.fiExchgRateHidden); row.SetField("fiCurrencyTy-hidden", entity.fiCurrencyTyHidden); row.SetField("fiShortDesc-hidden", entity.fiShortDescHidden); row.SetField("btn_Cost-Calculator-hidden", entity.btnCostCalculatorHidden); row.SetField("btn_Cost-Calculator-sensitive", entity.btnCostCalculatorSensitive); row.SetField("userfield", entity.userfield); }