private LostKind ToModel(DataRow row) { LostKind model = new LostKind(); model.Id = (System.Guid)SqlHelper.FromDBValue(row["Id"]); model.LostKindName = (System.String)SqlHelper.FromDBValue(row["LostKindName"]); model.Sort = (System.Int32?)SqlHelper.FromDBValue(row["Sort"]); return model; }
public LostKind[] ListAll() { DataTable table = SqlHelper.ExecuteDataTable(@"select [Id],[LostKindName],[Sort] from Tb_LostKind ORDER BY Sort "); LostKind[] dt = new LostKind[table.Rows.Count]; for (int i = 0; i < table.Rows.Count; i++) { dt[i] = ToModel(table.Rows[i]); } return dt; }