public static Camcontactlist BuildCamcontactlistFromRow(DataRow row) { Camcontactlist entity = new Camcontactlist(); entity.contactid = row.IsNull("contactid") ? decimal.Zero : row.Field <decimal>("contactid"); entity.firstnm = row.IsNull("firstnm") ? string.Empty : row.Field <string>("firstnm"); entity.notesfl = row.IsNull("notesfl") ? string.Empty : row.Field <string>("notesfl"); entity.middlenm = row.IsNull("middlenm") ? string.Empty : row.Field <string>("middlenm"); entity.lastnm = row.IsNull("lastnm") ? string.Empty : row.Field <string>("lastnm"); entity.cotitle = row.IsNull("cotitle") ? string.Empty : row.Field <string>("cotitle"); entity.comment = row.IsNull("comment") ? string.Empty : row.Field <string>("comment"); entity.priority = row.IsNull("priority") ? 0 : row.Field <int>("priority"); entity.salutation = row.IsNull("salutation") ? string.Empty : row.Field <string>("salutation"); entity.groupcd = row.IsNull("groupcd") ? string.Empty : row.Field <string>("groupcd"); entity.contacttype = row.IsNull("contacttype") ? string.Empty : row.Field <string>("contacttype"); entity.contacttypedesc = row.IsNull("contacttypedesc") ? string.Empty : row.Field <string>("contacttypedesc"); entity.phoneno = row.IsNull("phoneno") ? string.Empty : row.Field <string>("phoneno"); entity.phonenoformatted = row.IsNull("phonenoformatted") ? string.Empty : row.Field <string>("phonenoformatted"); entity.emailaddr = row.IsNull("emailaddr") ? string.Empty : row.Field <string>("emailaddr"); entity.addr1 = row.IsNull("addr1") ? string.Empty : row.Field <string>("addr1"); entity.addr2 = row.IsNull("addr2") ? string.Empty : row.Field <string>("addr2"); entity.addr3 = row.IsNull("addr3") ? string.Empty : row.Field <string>("addr3"); entity.city = row.IsNull("city") ? string.Empty : row.Field <string>("city"); entity.faxphoneno = row.IsNull("faxphoneno") ? string.Empty : row.Field <string>("faxphoneno"); entity.state = row.IsNull("state") ? string.Empty : row.Field <string>("state"); entity.zipcd = row.IsNull("zipcd") ? string.Empty : row.Field <string>("zipcd"); entity.countrycd = row.IsNull("countrycd") ? string.Empty : row.Field <string>("countrycd"); entity.others = row.IsNull("others") ? string.Empty : row.Field <string>("others"); entity.cName = row.IsNull("cName") ? string.Empty : row.Field <string>("cName"); entity.cAddr = row.IsNull("cAddr") ? string.Empty : row.Field <string>("cAddr"); entity.cCityStateZip = row.IsNull("cCityStateZip") ? string.Empty : row.Field <string>("cCityStateZip"); entity.cCountrycd = row.IsNull("cCountrycd") ? string.Empty : row.Field <string>("cCountrycd"); entity.cSubject = row.IsNull("cSubject") ? string.Empty : row.Field <string>("cSubject"); entity.contactsrecid = row.IsNull("contactsrecid") ? 0 : row.Field <long>("contactsrecid"); entity.removefromsubject = row.Field <bool>("removefromsubject"); entity.deletecontact = row.Field <bool>("deletecontact"); 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 UpdateRowFromCamcontactlist(ref DataRow row, Camcontactlist entity) { row.SetField("contactid", entity.contactid); row.SetField("firstnm", entity.firstnm); row.SetField("notesfl", entity.notesfl); row.SetField("middlenm", entity.middlenm); row.SetField("lastnm", entity.lastnm); row.SetField("cotitle", entity.cotitle); row.SetField("comment", entity.comment); row.SetField("priority", entity.priority); row.SetField("salutation", entity.salutation); row.SetField("groupcd", entity.groupcd); row.SetField("contacttype", entity.contacttype); row.SetField("contacttypedesc", entity.contacttypedesc); row.SetField("phoneno", entity.phoneno); row.SetField("phonenoformatted", entity.phonenoformatted); row.SetField("emailaddr", entity.emailaddr); row.SetField("addr1", entity.addr1); row.SetField("addr2", entity.addr2); row.SetField("addr3", entity.addr3); row.SetField("city", entity.city); row.SetField("faxphoneno", entity.faxphoneno); row.SetField("state", entity.state); row.SetField("zipcd", entity.zipcd); row.SetField("countrycd", entity.countrycd); row.SetField("others", entity.others); row.SetField("cName", entity.cName); row.SetField("cAddr", entity.cAddr); row.SetField("cCityStateZip", entity.cCityStateZip); row.SetField("cCountrycd", entity.cCountrycd); row.SetField("cSubject", entity.cSubject); row.SetField("contactsrecid", entity.contactsrecid); row.SetField("removefromsubject", entity.removefromsubject); row.SetField("deletecontact", entity.deletecontact); row.SetField("userfield", entity.userfield); }