public static Ccsetup BuildCcsetupFromRow(DataRow row) { Ccsetup entity = new Ccsetup(); entity.coNum = row.IsNull("co_num") ? string.Empty : row.Field <string>("co_num"); entity.whNum = row.IsNull("wh_num") ? string.Empty : row.Field <string>("wh_num"); entity.aCountInterval = row.IsNull("a_count_interval") ? 0 : row.Field <int>("a_count_interval"); entity.aCountLoc = row.IsNull("a_count_loc") ? 0 : row.Field <int>("a_count_loc"); entity.bCountInterval = row.IsNull("b_count_interval") ? 0 : row.Field <int>("b_count_interval"); entity.bCountLoc = row.IsNull("b_count_loc") ? 0 : row.Field <int>("b_count_loc"); entity.countType = row.IsNull("count_type") ? string.Empty : row.Field <string>("count_type"); entity.cCountInterval = row.IsNull("c_count_interval") ? 0 : row.Field <int>("c_count_interval"); entity.cCountLoc = row.IsNull("c_count_loc") ? 0 : row.Field <int>("c_count_loc"); entity.dCountInterval = row.IsNull("d_count_interval") ? 0 : row.Field <int>("d_count_interval"); entity.dCountLoc = row.IsNull("d_count_loc") ? 0 : row.Field <int>("d_count_loc"); entity.excludeProdCat = row.IsNull("exclude_prod_cat") ? string.Empty : row.Field <string>("exclude_prod_cat"); entity.cycleAdj = row.Field <bool>("cycle_adj"); entity.displayCycleQty = row.Field <bool>("display_cycle_qty"); entity.displayPhysQty = row.Field <bool>("display_phys_qty"); entity.cycleAdjCodeOut = row.IsNull("cycle_adj_code_out") ? string.Empty : row.Field <string>("cycle_adj_code_out"); entity.cycleAdjCodeIn = row.IsNull("cycle_adj_code_in") ? string.Empty : row.Field <string>("cycle_adj_code_in"); entity.abcRowID = row.Field <byte[]>("abcRowID").ToStringEncoded(); entity.parametersRowID = row.Field <byte[]>("parametersRowID").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 UpdateRowFromCcsetup(ref DataRow row, Ccsetup entity) { row.SetField("co_num", entity.coNum); row.SetField("wh_num", entity.whNum); row.SetField("a_count_interval", entity.aCountInterval); row.SetField("a_count_loc", entity.aCountLoc); row.SetField("b_count_interval", entity.bCountInterval); row.SetField("b_count_loc", entity.bCountLoc); row.SetField("count_type", entity.countType); row.SetField("c_count_interval", entity.cCountInterval); row.SetField("c_count_loc", entity.cCountLoc); row.SetField("d_count_interval", entity.dCountInterval); row.SetField("d_count_loc", entity.dCountLoc); row.SetField("exclude_prod_cat", entity.excludeProdCat); row.SetField("cycle_adj", entity.cycleAdj); row.SetField("display_cycle_qty", entity.displayCycleQty); row.SetField("display_phys_qty", entity.displayPhysQty); row.SetField("cycle_adj_code_out", entity.cycleAdjCodeOut); row.SetField("cycle_adj_code_in", entity.cycleAdjCodeIn); row.SetField("abcRowID", entity.abcRowID.ToByteArray()); row.SetField("parametersRowID", entity.parametersRowID.ToByteArray()); row.SetField("userfield", entity.userfield); }