public static Icsvcontrol BuildIcsvcontrolFromRow(DataRow row) { Icsvcontrol entity = new Icsvcontrol(); entity.upcdelim = row.IsNull("upcdelim") ? string.Empty : row.Field <string>("upcdelim"); entity.upcprompt = row.IsNull("upcprompt") ? string.Empty : row.Field <string>("upcprompt"); entity.upclabel1 = row.IsNull("upclabel1") ? string.Empty : row.Field <string>("upclabel1"); entity.upclabel2 = row.IsNull("upclabel2") ? string.Empty : row.Field <string>("upclabel2"); entity.upclabel3 = row.IsNull("upclabel3") ? string.Empty : row.Field <string>("upclabel3"); entity.upclabel4 = row.IsNull("upclabel4") ? string.Empty : row.Field <string>("upclabel4"); entity.upclabel5 = row.IsNull("upclabel5") ? string.Empty : row.Field <string>("upclabel5"); entity.upclabel6 = row.IsNull("upclabel6") ? string.Empty : row.Field <string>("upclabel6"); entity.upclength1 = row.IsNull("upclength1") ? 0 : row.Field <int>("upclength1"); entity.upclength2 = row.IsNull("upclength2") ? 0 : row.Field <int>("upclength2"); entity.upclength3 = row.IsNull("upclength3") ? 0 : row.Field <int>("upclength3"); entity.upclength4 = row.IsNull("upclength4") ? 0 : row.Field <int>("upclength4"); entity.upclength5 = row.IsNull("upclength5") ? 0 : row.Field <int>("upclength5"); entity.upclength6 = row.IsNull("upclength6") ? 0 : row.Field <int>("upclength6"); entity.upclabel1hidden = row.Field <bool>("upclabel1hidden"); entity.upclabel2hidden = row.Field <bool>("upclabel2hidden"); entity.upclabel3hidden = row.Field <bool>("upclabel3hidden"); entity.upclabel4hidden = row.Field <bool>("upclabel4hidden"); entity.upclabel5hidden = row.Field <bool>("upclabel5hidden"); entity.upclabel6hidden = row.Field <bool>("upclabel6hidden"); 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 UpdateRowFromIcsvcontrol(ref DataRow row, Icsvcontrol entity) { row.SetField("upcdelim", entity.upcdelim); row.SetField("upcprompt", entity.upcprompt); row.SetField("upclabel1", entity.upclabel1); row.SetField("upclabel2", entity.upclabel2); row.SetField("upclabel3", entity.upclabel3); row.SetField("upclabel4", entity.upclabel4); row.SetField("upclabel5", entity.upclabel5); row.SetField("upclabel6", entity.upclabel6); row.SetField("upclength1", entity.upclength1); row.SetField("upclength2", entity.upclength2); row.SetField("upclength3", entity.upclength3); row.SetField("upclength4", entity.upclength4); row.SetField("upclength5", entity.upclength5); row.SetField("upclength6", entity.upclength6); row.SetField("upclabel1hidden", entity.upclabel1hidden); row.SetField("upclabel2hidden", entity.upclabel2hidden); row.SetField("upclabel3hidden", entity.upclabel3hidden); row.SetField("upclabel4hidden", entity.upclabel4hidden); row.SetField("upclabel5hidden", entity.upclabel5hidden); row.SetField("upclabel6hidden", entity.upclabel6hidden); row.SetField("userfield", entity.userfield); }