public static Pdspnpinitresults BuildPdspnpinitresultsFromRow(DataRow row) { Pdspnpinitresults entity = new Pdspnpinitresults(); entity.pdsnrecno = row.IsNull("pdsnrecno") ? 0 : row.Field <int>("pdsnrecno"); entity.clevelcd = row.IsNull("clevelcd") ? string.Empty : row.Field <string>("clevelcd"); entity.vendno = row.IsNull("vendno") ? decimal.Zero : row.Field <decimal>("vendno"); entity.custno = row.IsNull("custno") ? decimal.Zero : row.Field <decimal>("custno"); entity.shipto = row.IsNull("shipto") ? string.Empty : row.Field <string>("shipto"); entity.custgroup = row.IsNull("custgroup") ? string.Empty : row.Field <string>("custgroup"); entity.custpricety = row.IsNull("custpricety") ? string.Empty : row.Field <string>("custpricety"); entity.prod = row.IsNull("prod") ? string.Empty : row.Field <string>("prod"); entity.modelcode = row.IsNull("modelcode") ? string.Empty : row.Field <string>("modelcode"); entity.brandcode = row.IsNull("brandcode") ? string.Empty : row.Field <string>("brandcode"); entity.prodcat = row.IsNull("prodcat") ? string.Empty : row.Field <string>("prodcat"); entity.prodline = row.IsNull("prodline") ? string.Empty : row.Field <string>("prodline"); entity.prodpricety = row.IsNull("prodpricety") ? string.Empty : row.Field <string>("prodpricety"); entity.rebtype = row.IsNull("rebtype") ? string.Empty : row.Field <string>("rebtype"); entity.rebsubty = row.IsNull("rebsubty") ? string.Empty : row.Field <string>("rebsubty"); entity.startdt = row.Field <DateTime?>("startdt"); entity.enddt = row.Field <DateTime?>("enddt"); entity.statustype = row.Field <bool>("statustype"); entity.npcd = row.IsNull("npcd") ? string.Empty : row.Field <string>("npcd"); entity.descrip = row.IsNull("descrip") ? string.Empty : row.Field <string>("descrip"); entity.allowretfl = row.Field <bool>("allowretfl"); entity.programonlyfl = row.Field <bool>("programonlyfl"); entity.npcomcalctype = row.IsNull("npcomcalctype") ? string.Empty : row.Field <string>("npcomcalctype"); entity.npcomcalctypeli = row.IsNull("npcomcalctypeli") ? string.Empty : row.Field <string>("npcomcalctypeli"); entity.npcomcalctypecd = row.IsNull("npcomcalctypecd") ? string.Empty : row.Field <string>("npcomcalctypecd"); entity.npcombasedon = row.IsNull("npcombasedon") ? string.Empty : row.Field <string>("npcombasedon"); entity.npcombasedonli = row.IsNull("npcombasedonli") ? string.Empty : row.Field <string>("npcombasedonli"); entity.npcombasedoncd = row.IsNull("npcombasedoncd") ? string.Empty : row.Field <string>("npcombasedoncd"); entity.npcombasedonvb = row.Field <bool>("npcombasedonvb"); entity.npcomamt = row.IsNull("npcomamt") ? decimal.Zero : row.Field <decimal>("npcomamt"); entity.npcomamtlbl = row.IsNull("npcomamtlbl") ? string.Empty : row.Field <string>("npcomamtlbl"); entity.npcomprod = row.IsNull("npcomprod") ? string.Empty : row.Field <string>("npcomprod"); entity.npcommtype = row.IsNull("npcommtype") ? string.Empty : row.Field <string>("npcommtype"); 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.userfield = row.IsNull("userfield") ? string.Empty : row.Field <string>("userfield"); return(entity); }
/// <summary> /// Update a database row from a class /// </summary> public static void UpdateRowFromPdspnpinitresults(ref DataRow row, Pdspnpinitresults entity) { row.SetField("pdsnrecno", entity.pdsnrecno); row.SetField("clevelcd", entity.clevelcd); row.SetField("vendno", entity.vendno); row.SetField("custno", entity.custno); row.SetField("shipto", entity.shipto); row.SetField("custgroup", entity.custgroup); row.SetField("custpricety", entity.custpricety); row.SetField("prod", entity.prod); row.SetField("modelcode", entity.modelcode); row.SetField("brandcode", entity.brandcode); row.SetField("prodcat", entity.prodcat); row.SetField("prodline", entity.prodline); row.SetField("prodpricety", entity.prodpricety); row.SetField("rebtype", entity.rebtype); row.SetField("rebsubty", entity.rebsubty); row.SetField("startdt", entity.startdt); row.SetField("enddt", entity.enddt); row.SetField("statustype", entity.statustype); row.SetField("npcd", entity.npcd); row.SetField("descrip", entity.descrip); row.SetField("allowretfl", entity.allowretfl); row.SetField("programonlyfl", entity.programonlyfl); row.SetField("npcomcalctype", entity.npcomcalctype); row.SetField("npcomcalctypeli", entity.npcomcalctypeli); row.SetField("npcomcalctypecd", entity.npcomcalctypecd); row.SetField("npcombasedon", entity.npcombasedon); row.SetField("npcombasedonli", entity.npcombasedonli); row.SetField("npcombasedoncd", entity.npcombasedoncd); row.SetField("npcombasedonvb", entity.npcombasedonvb); row.SetField("npcomamt", entity.npcomamt); row.SetField("npcomamtlbl", entity.npcomamtlbl); row.SetField("npcomprod", entity.npcomprod); row.SetField("npcommtype", entity.npcommtype); 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("userfield", entity.userfield); }