public static Abcclass BuildAbcclassFromRow(DataRow row) { Abcclass entity = new Abcclass(); 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.aCountPercent = row.IsNull("a_count_percent") ? decimal.Zero : row.Field <decimal>("a_count_percent"); 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.bCountPercent = row.IsNull("b_count_percent") ? decimal.Zero : row.Field <decimal>("b_count_percent"); entity.countType = row.IsNull("count_type") ? string.Empty : row.Field <string>("count_type"); entity.customData1 = row.IsNull("custom_data1") ? string.Empty : row.Field <string>("custom_data1"); entity.customData2 = row.IsNull("custom_data2") ? string.Empty : row.Field <string>("custom_data2"); entity.customData3 = row.IsNull("custom_data3") ? string.Empty : row.Field <string>("custom_data3"); entity.customData4 = row.IsNull("custom_data4") ? string.Empty : row.Field <string>("custom_data4"); entity.customData5 = row.IsNull("custom_data5") ? string.Empty : row.Field <string>("custom_data5"); 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.cCountPercent = row.IsNull("c_count_percent") ? decimal.Zero : row.Field <decimal>("c_count_percent"); 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.dCountPercent = row.IsNull("d_count_percent") ? decimal.Zero : row.Field <decimal>("d_count_percent"); entity.excludeProdCat = row.IsNull("exclude_prod_cat") ? string.Empty : row.Field <string>("exclude_prod_cat"); entity.historyInterval = row.IsNull("history_interval") ? 0 : row.Field <int>("history_interval"); entity.historyTimeframe = row.IsNull("history_timeframe") ? string.Empty : row.Field <string>("history_timeframe"); entity.procCreated = row.IsNull("proc_created") ? string.Empty : row.Field <string>("proc_created"); entity.recalcInterval = row.IsNull("recalc_interval") ? 0 : row.Field <int>("recalc_interval"); entity.recalcLast = row.Field <DateTime?>("recalc_last"); entity.recalcPending = row.Field <bool>("recalc_pending"); entity.recalcPendDate = row.Field <DateTime?>("recalc_pend_date"); entity.recalcTimeframe = row.IsNull("recalc_timeframe") ? string.Empty : row.Field <string>("recalc_timeframe"); entity.recalcType = row.IsNull("recalc_type") ? string.Empty : row.Field <string>("recalc_type"); entity.nextRecalcDate = row.Field <DateTime?>("next_recalc_date"); entity.transDate = row.IsNull("trans_date") ? string.Empty : row.Field <string>("trans_date"); entity.transProc = row.IsNull("trans_proc") ? string.Empty : row.Field <string>("trans_proc"); entity.transSecTime = row.IsNull("trans_sec_time") ? 0 : row.Field <int>("trans_sec_time"); entity.transUser = row.IsNull("trans_user") ? string.Empty : row.Field <string>("trans_user"); entity.toggleReport = row.Field <bool>("toggle_report"); entity.toggleUpdate = row.Field <bool>("toggle_update"); entity.toggleInclude = row.Field <bool>("toggle_include"); entity.iMinAbcQty = row.IsNull("iMinAbcQty") ? 0 : row.Field <int>("iMinAbcQty"); entity.abcRowID = row.Field <byte[]>("abcRowID").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 UpdateRowFromAbcclass(ref DataRow row, Abcclass 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("a_count_percent", entity.aCountPercent); row.SetField("b_count_interval", entity.bCountInterval); row.SetField("b_count_loc", entity.bCountLoc); row.SetField("b_count_percent", entity.bCountPercent); row.SetField("count_type", entity.countType); row.SetField("custom_data1", entity.customData1); row.SetField("custom_data2", entity.customData2); row.SetField("custom_data3", entity.customData3); row.SetField("custom_data4", entity.customData4); row.SetField("custom_data5", entity.customData5); row.SetField("c_count_interval", entity.cCountInterval); row.SetField("c_count_loc", entity.cCountLoc); row.SetField("c_count_percent", entity.cCountPercent); row.SetField("d_count_interval", entity.dCountInterval); row.SetField("d_count_loc", entity.dCountLoc); row.SetField("d_count_percent", entity.dCountPercent); row.SetField("exclude_prod_cat", entity.excludeProdCat); row.SetField("history_interval", entity.historyInterval); row.SetField("history_timeframe", entity.historyTimeframe); row.SetField("proc_created", entity.procCreated); row.SetField("recalc_interval", entity.recalcInterval); row.SetField("recalc_last", entity.recalcLast); row.SetField("recalc_pending", entity.recalcPending); row.SetField("recalc_pend_date", entity.recalcPendDate); row.SetField("recalc_timeframe", entity.recalcTimeframe); row.SetField("recalc_type", entity.recalcType); row.SetField("next_recalc_date", entity.nextRecalcDate); row.SetField("trans_date", entity.transDate); row.SetField("trans_proc", entity.transProc); row.SetField("trans_sec_time", entity.transSecTime); row.SetField("trans_user", entity.transUser); row.SetField("toggle_report", entity.toggleReport); row.SetField("toggle_update", entity.toggleUpdate); row.SetField("toggle_include", entity.toggleInclude); row.SetField("iMinAbcQty", entity.iMinAbcQty); row.SetField("abcRowID", entity.abcRowID.ToByteArray()); row.SetField("userfield", entity.userfield); }