Skip to content

Instantly share code, notes, and snippets.

@cpereira7
Last active February 6, 2018 10:56
Show Gist options
  • Select an option

  • Save cpereira7/bf12ea7fa27020bc43e38717269c08c6 to your computer and use it in GitHub Desktop.

Select an option

Save cpereira7/bf12ea7fa27020bc43e38717269c08c6 to your computer and use it in GitHub Desktop.
/*
* Created by SharpDevelop.
* User: cpereira7
* C#, DataTable, Interfaces
*/
using System;
using System.Data;
namespace ReportGenerator
{
/// <summary>
/// Interface defined by a DataTable and related properties.
/// </summary>
public interface IData
{
DataTable Table {get;}
string TableName {get; set;}
TypeOfTable TableType {get;set;}
bool HasData();
}
public enum TypeOfTable {ClientData, FinancialReport };
public class CustomTable : IData
{
public CustomTable(){ }
public CustomTable(string name, DataTable table, TypeOfTable tabletype)
{
TableName = name;
Table = table;
TableType = tabletype;
}
private DataTable table;
public DataTable Table {
get {
if (table == null)
table = new System.Data.DataTable();
return table;
}
set
{
this.table = value;
}
}
public TypeOfTable TableType{ get; set;}
public string TableName { get; set; }
public bool HasData()
{
if (this.Table.Rows.Count > 0)
return true;
else
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment