public static Pdsvclookupresults BuildPdsvclookupresultsFromRow(DataRow row) { Pdsvclookupresults entity = new Pdsvclookupresults(); entity.contractno = row.IsNull("contractno") ? string.Empty : row.Field <string>("contractno"); entity.levelcd = row.IsNull("levelcd") ? 0 : row.Field <int>("levelcd"); entity.whse = row.IsNull("whse") ? string.Empty : row.Field <string>("whse"); entity.vendno = row.IsNull("vendno") ? decimal.Zero : row.Field <decimal>("vendno"); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.startdt = row.Field <DateTime?>("startdt"); entity.enddt = row.Field <DateTime?>("enddt"); entity.statustype = row.Field <bool>("statustype"); entity.refer = row.IsNull("refer") ? string.Empty : row.Field <string>("refer"); entity.custno = row.IsNull("custno") ? decimal.Zero : row.Field <decimal>("custno"); entity.unit = row.IsNull("unit") ? string.Empty : row.Field <string>("unit"); entity.actqty = row.IsNull("actqty") ? decimal.Zero : row.Field <decimal>("actqty"); entity.maxqty = row.IsNull("maxqty") ? decimal.Zero : row.Field <decimal>("maxqty"); entity.hardmaxqtyfl = row.Field <bool>("hardmaxqtyfl"); entity.price = row.IsNull("price") ? decimal.Zero : row.Field <decimal>("price"); entity.qtyremain = row.IsNull("qtyremain") ? decimal.Zero : row.Field <decimal>("qtyremain"); entity.sortseqno = row.IsNull("sortseqno") ? 0 : row.Field <int>("sortseqno"); entity.pdsvcRowid = row.Field <byte[]>("pdsvc-rowid").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 UpdateRowFromPdsvclookupresults(ref DataRow row, Pdsvclookupresults entity) { row.SetField("contractno", entity.contractno); row.SetField("levelcd", entity.levelcd); row.SetField("whse", entity.whse); row.SetField("vendno", entity.vendno); row.SetField("prod", entity.prod); row.SetField("startdt", entity.startdt); row.SetField("enddt", entity.enddt); row.SetField("statustype", entity.statustype); row.SetField("refer", entity.refer); row.SetField("custno", entity.custno); row.SetField("unit", entity.unit); row.SetField("actqty", entity.actqty); row.SetField("maxqty", entity.maxqty); row.SetField("hardmaxqtyfl", entity.hardmaxqtyfl); row.SetField("price", entity.price); row.SetField("qtyremain", entity.qtyremain); row.SetField("sortseqno", entity.sortseqno); row.SetField("pdsvc-rowid", entity.pdsvcRowid.ToByteArray()); row.SetField("userfield", entity.userfield); }