public static Kpcomponentprocess BuildKpcomponentprocessFromRow(DataRow row) { Kpcomponentprocess entity = new Kpcomponentprocess(); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.seqno = row.IsNull("seqno") ? 0 : row.Field <int>("seqno"); entity.comptype = row.IsNull("comptype") ? string.Empty : row.Field <string>("comptype"); entity.comprod = row.IsNull("comprod") ? string.Empty : row.Field <string>("comprod"); entity.pricefl = row.Field <bool>("pricefl"); entity.printfl = row.Field <bool>("printfl"); entity.qtyneeded = row.IsNull("qtyneeded") ? decimal.Zero : row.Field <decimal>("qtyneeded"); entity.unit = row.IsNull("unit") ? string.Empty : row.Field <string>("unit"); entity.refer = row.IsNull("refer") ? string.Empty : row.Field <string>("refer"); entity.reqfl = row.Field <bool>("reqfl"); entity.subfl = row.Field <bool>("subfl"); entity.variablefl = row.Field <bool>("variablefl"); entity.bofl = row.Field <bool>("bofl"); entity.keyword1 = row.IsNull("keyword1") ? string.Empty : row.Field <string>("keyword1"); entity.keyword2 = row.IsNull("keyword2") ? string.Empty : row.Field <string>("keyword2"); entity.keyword3 = row.IsNull("keyword3") ? string.Empty : row.Field <string>("keyword3"); entity.keyword4 = row.IsNull("keyword4") ? string.Empty : row.Field <string>("keyword4"); entity.keyword5 = row.IsNull("keyword5") ? string.Empty : row.Field <string>("keyword5"); entity.npfl = row.Field <bool>("npfl"); entity.user1 = row.IsNull("user1") ? string.Empty : row.Field <string>("user1"); entity.user2 = row.IsNull("user2") ? string.Empty : row.Field <string>("user2"); entity.user3 = row.IsNull("user3") ? string.Empty : row.Field <string>("user3"); entity.user4 = row.IsNull("user4") ? string.Empty : row.Field <string>("user4"); entity.user5 = row.IsNull("user5") ? string.Empty : row.Field <string>("user5"); entity.user6 = row.Field <decimal?>("user6"); entity.user7 = row.Field <decimal?>("user7"); entity.user8 = row.Field <DateTime?>("user8"); entity.user9 = row.Field <DateTime?>("user9"); entity.verno = row.IsNull("verno") ? 0 : row.Field <int>("verno"); entity.verrefer = row.IsNull("verrefer") ? string.Empty : row.Field <string>("verrefer"); entity.vercrtdt = row.Field <DateTime?>("vercrtdt"); entity.rowID = row.Field <byte[]>("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 UpdateRowFromKpcomponentprocess(ref DataRow row, Kpcomponentprocess entity) { row.SetField("prod", entity.prod); row.SetField("seqno", entity.seqno); row.SetField("comptype", entity.comptype); row.SetField("comprod", entity.comprod); row.SetField("pricefl", entity.pricefl); row.SetField("printfl", entity.printfl); row.SetField("qtyneeded", entity.qtyneeded); row.SetField("unit", entity.unit); row.SetField("refer", entity.refer); row.SetField("reqfl", entity.reqfl); row.SetField("subfl", entity.subfl); row.SetField("variablefl", entity.variablefl); row.SetField("bofl", entity.bofl); row.SetField("keyword1", entity.keyword1); row.SetField("keyword2", entity.keyword2); row.SetField("keyword3", entity.keyword3); row.SetField("keyword4", entity.keyword4); row.SetField("keyword5", entity.keyword5); row.SetField("npfl", entity.npfl); row.SetField("user1", entity.user1); row.SetField("user2", entity.user2); row.SetField("user3", entity.user3); row.SetField("user4", entity.user4); row.SetField("user5", entity.user5); row.SetField("user6", entity.user6); row.SetField("user7", entity.user7); row.SetField("user8", entity.user8); row.SetField("user9", entity.user9); row.SetField("verno", entity.verno); row.SetField("verrefer", entity.verrefer); row.SetField("vercrtdt", entity.vercrtdt); row.SetField("rowID", entity.rowID.ToByteArray()); row.SetField("userfield", entity.userfield); }