Last active
February 6, 2018 10:56
-
-
Save cpereira7/bf12ea7fa27020bc43e38717269c08c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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