/// <summary> /// Update a database row from a class /// </summary> public static void UpdateRowFromItemhistdtl(ref DataRow row, Itemhistdtl entity) { row.SetField("date_time", entity.dateTime); row.SetField("stock_status", entity.stockStatus); row.SetField("start_balance", entity.startBalance); row.SetField("receipts", entity.receipts); row.SetField("returns", entity.returns); row.SetField("adjustments", entity.adjustments); row.SetField("shipments", entity.shipments); row.SetField("end_balance", entity.endBalance); row.SetField("d_first", entity.dFirst); row.SetField("d_last", entity.dLast); row.SetField("i_week", entity.iWeek); row.SetField("i_year", entity.iYear); row.SetField("itemhistdtluserfield", entity.itemhistdtluserfield); row.SetField("userfield", entity.userfield); }
public static Itemhistdtl BuildItemhistdtlFromRow(DataRow row) { Itemhistdtl entity = new Itemhistdtl(); entity.dateTime = row.Field <DateTime?>("date_time"); entity.stockStatus = row.IsNull("stock_status") ? string.Empty : row.Field <string>("stock_status"); entity.startBalance = row.IsNull("start_balance") ? decimal.Zero : row.Field <decimal>("start_balance"); entity.receipts = row.IsNull("receipts") ? decimal.Zero : row.Field <decimal>("receipts"); entity.returns = row.IsNull("returns") ? decimal.Zero : row.Field <decimal>("returns"); entity.adjustments = row.IsNull("adjustments") ? decimal.Zero : row.Field <decimal>("adjustments"); entity.shipments = row.IsNull("shipments") ? decimal.Zero : row.Field <decimal>("shipments"); entity.endBalance = row.IsNull("end_balance") ? decimal.Zero : row.Field <decimal>("end_balance"); entity.dFirst = row.Field <DateTime?>("d_first"); entity.dLast = row.Field <DateTime?>("d_last"); entity.iWeek = row.IsNull("i_week") ? 0 : row.Field <int>("i_week"); entity.iYear = row.IsNull("i_year") ? 0 : row.Field <int>("i_year"); entity.itemhistdtluserfield = row.IsNull("itemhistdtluserfield") ? string.Empty : row.Field <string>("itemhistdtluserfield"); entity.userfield = row.IsNull("userfield") ? string.Empty : row.Field <string>("userfield"); return(entity); }