public static Lotcutentry BuildLotcutentryFromRow(DataRow row) { Lotcutentry entity = new Lotcutentry(); entity.whse = row.IsNull("whse") ? string.Empty : row.Field <string>("whse"); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.lotno = row.IsNull("lotno") ? string.Empty : row.Field <string>("lotno"); entity.type = row.IsNull("type") ? string.Empty : row.Field <string>("type"); 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.seqno = row.IsNull("seqno") ? 0 : row.Field <int>("seqno"); entity.returnfl = row.Field <bool>("returnfl"); entity.ordqty = row.IsNull("ordqty") ? decimal.Zero : row.Field <decimal>("ordqty"); entity.qtyunavail = row.IsNull("qtyunavail") ? decimal.Zero : row.Field <decimal>("qtyunavail"); entity.totqty = row.IsNull("totqty") ? decimal.Zero : row.Field <decimal>("totqty"); entity.conditioncd = row.IsNull("conditioncd") ? string.Empty : row.Field <string>("conditioncd"); entity.width1p1 = row.IsNull("width1p1") ? decimal.Zero : row.Field <decimal>("width1p1"); entity.width1p1format = row.IsNull("width1p1format") ? string.Empty : row.Field <string>("width1p1format"); entity.width1p2 = row.IsNull("width1p2") ? decimal.Zero : row.Field <decimal>("width1p2"); entity.width1p2format = row.IsNull("width1p2format") ? string.Empty : row.Field <string>("width1p2format"); entity.length1p1 = row.IsNull("length1p1") ? decimal.Zero : row.Field <decimal>("length1p1"); entity.length1p1format = row.IsNull("length1p1format") ? string.Empty : row.Field <string>("length1p1format"); entity.length1p2 = row.IsNull("length1p2") ? decimal.Zero : row.Field <decimal>("length1p2"); entity.length1p2format = row.IsNull("length1p2format") ? string.Empty : row.Field <string>("length1p2format"); entity.width2p1 = row.IsNull("width2p1") ? decimal.Zero : row.Field <decimal>("width2p1"); entity.width2p1format = row.IsNull("width2p1format") ? string.Empty : row.Field <string>("width2p1format"); entity.width2p2 = row.IsNull("width2p2") ? decimal.Zero : row.Field <decimal>("width2p2"); entity.width2p2format = row.IsNull("width2p2format") ? string.Empty : row.Field <string>("width2p2format"); entity.length2p1 = row.IsNull("length2p1") ? decimal.Zero : row.Field <decimal>("length2p1"); entity.length2p1format = row.IsNull("length2p1format") ? string.Empty : row.Field <string>("length2p1format"); entity.length2p2 = row.IsNull("length2p2") ? decimal.Zero : row.Field <decimal>("length2p2"); entity.length2p2format = row.IsNull("length2p2format") ? string.Empty : row.Field <string>("length2p2format"); entity.width3p1 = row.IsNull("width3p1") ? decimal.Zero : row.Field <decimal>("width3p1"); entity.width3p1format = row.IsNull("width3p1format") ? string.Empty : row.Field <string>("width3p1format"); entity.width3p2 = row.IsNull("width3p2") ? decimal.Zero : row.Field <decimal>("width3p2"); entity.width3p2format = row.IsNull("width3p2format") ? string.Empty : row.Field <string>("width3p2format"); entity.length3p1 = row.IsNull("length3p1") ? decimal.Zero : row.Field <decimal>("length3p1"); entity.length3p1format = row.IsNull("length3p1format") ? string.Empty : row.Field <string>("length3p1format"); entity.length3p2 = row.IsNull("length3p2") ? decimal.Zero : row.Field <decimal>("length3p2"); entity.length3p2format = row.IsNull("length3p2format") ? string.Empty : row.Field <string>("length3p2format"); entity.lengthp1unit = row.IsNull("lengthp1unit") ? string.Empty : row.Field <string>("lengthp1unit"); entity.lengthp2unit = row.IsNull("lengthp2unit") ? string.Empty : row.Field <string>("lengthp2unit"); entity.widthp1unit = row.IsNull("widthp1unit") ? string.Empty : row.Field <string>("widthp1unit"); entity.widthp2unit = row.IsNull("widthp2unit") ? string.Empty : row.Field <string>("widthp2unit"); entity.lengthp2hidden = row.Field <bool>("lengthp2hidden"); entity.widthp2hidden = row.Field <bool>("widthp2hidden"); 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 UpdateRowFromLotcutentry(ref DataRow row, Lotcutentry entity) { row.SetField("whse", entity.whse); row.SetField("prod", entity.prod); row.SetField("lotno", entity.lotno); row.SetField("type", entity.type); row.SetField("orderno", entity.orderno); row.SetField("ordersuf", entity.ordersuf); row.SetField("lineno", entity.lineno); row.SetField("seqno", entity.seqno); row.SetField("returnfl", entity.returnfl); row.SetField("ordqty", entity.ordqty); row.SetField("qtyunavail", entity.qtyunavail); row.SetField("totqty", entity.totqty); row.SetField("conditioncd", entity.conditioncd); row.SetField("width1p1", entity.width1p1); row.SetField("width1p1format", entity.width1p1format); row.SetField("width1p2", entity.width1p2); row.SetField("width1p2format", entity.width1p2format); row.SetField("length1p1", entity.length1p1); row.SetField("length1p1format", entity.length1p1format); row.SetField("length1p2", entity.length1p2); row.SetField("length1p2format", entity.length1p2format); row.SetField("width2p1", entity.width2p1); row.SetField("width2p1format", entity.width2p1format); row.SetField("width2p2", entity.width2p2); row.SetField("width2p2format", entity.width2p2format); row.SetField("length2p1", entity.length2p1); row.SetField("length2p1format", entity.length2p1format); row.SetField("length2p2", entity.length2p2); row.SetField("length2p2format", entity.length2p2format); row.SetField("width3p1", entity.width3p1); row.SetField("width3p1format", entity.width3p1format); row.SetField("width3p2", entity.width3p2); row.SetField("width3p2format", entity.width3p2format); row.SetField("length3p1", entity.length3p1); row.SetField("length3p1format", entity.length3p1format); row.SetField("length3p2", entity.length3p2); row.SetField("length3p2format", entity.length3p2format); row.SetField("lengthp1unit", entity.lengthp1unit); row.SetField("lengthp2unit", entity.lengthp2unit); row.SetField("widthp1unit", entity.widthp1unit); row.SetField("widthp2unit", entity.widthp2unit); row.SetField("lengthp2hidden", entity.lengthp2hidden); row.SetField("widthp2hidden", entity.widthp2hidden); row.SetField("userfield", entity.userfield); }