public override DSDataRow GetRow(int index) { var connection = connections[index]; DSDataRow ret = null; if (index < Rows.Count) { ret = Rows[index]; } if (ret == null) { ret = new DSDataRow(); ret["Serial Number"] = connection.serialNumber.ToString(); Rows.Add(ret); } foreach (var tp in test.parameters.targetPoints) { var resultTable = test.testResults.resultsTable[connection.serialNumber]; TestResults.Result result; if (resultTable.TryGetValue(tp, out result) && result != null) { ret[tp.ToRowString()] = resultTable[tp].result.ToString(); } else { ret[tp.ToRowString()] = "N/A"; } } return(ret); }
public ExampleDataTable2(String Name) : base(Name) { var ColumnsDefs = new Dictionary <String, float>(); ColumnsDefs.Add("Primary", 100); ColumnsDefs.Add("Code", 150); ColumnsDefs.Add("Name", 300); ColumnsDefs.Add("Phone", 174); ColumnsDefs.Add("Email", 300); foreach (var aKey in ColumnsDefs.Keys) { // Create a column var dc1 = new DSDataColumn(aKey); dc1.Caption = aKey; dc1.ReadOnly = true; dc1.DataType = typeof(String); dc1.AllowSort = true; dc1.Width = ColumnsDefs[aKey]; this.Columns.Add(dc1); } for (int loop = 0; loop < 21; loop++) { var dr = new DSDataRow(); dr["Primary"] = loop; dr["Code"] = @"Customer " + loop.ToString(); dr["Name"] = @"Name of the Customer " + loop.ToString(); dr["Phone"] = "01234 56789"; dr["Email"] = "*****@*****.**"; this.Rows.Add(dr); } }
/// <summary> /// Gets the row at the specified indexs /// </summary> /// <returns>The row.</returns> /// <param name="Index">Index.</param> public override DSDataRow GetRow(int Index) { DSDataRow aRow = null; if (Index < Rows.Count) { aRow = Rows [Index]; } else { aRow = new DSDataRow(); aRow ["Title"] = @"Test"; Rows.Add(aRow); } aRow ["Description"] = @"Some description would go here"; aRow ["Date"] = DateTime.Now.ToShortDateString(); aRow ["Value"] = "10000.00"; //see if even or odd to pick an image from the array var pos = Index % 2; aRow ["Image"] = Icons [pos]; aRow ["Ordered"] = (pos == 0) ? true : false; return(aRow); }
/// <summary> /// Initializes the Table within the Spreadsheet and inputs the information from the Database /// </summary> /// <param name="context">This will be used for calling the functions from the DataDB</param> /// <param name="Name">This is used to name the table and used to call this specific Table from another part of the project</param> public DataTable(Context context, String Name) : base(Name) { DataDB db = new DataDB(context); var dataColumns = new Dictionary <string, float>(); dataColumns.Add(" UserId", 75); dataColumns.Add("DataOne", 100); dataColumns.Add("DataTwo", 100); dataColumns.Add("DataThree", 100); foreach (var key in dataColumns.Keys) { var dc = new DSDataColumn(key); dc.Caption = key; dc.ReadOnly = true; dc.DataType = typeof(string); dc.AllowSort = true; dc.Width = dataColumns[key]; Columns.Add(dc); } for (int Loop = 0; Loop < db.Count(); Loop++) { var dataRows = new DSDataRow(); dataRows[" UserID"] = " " + (db.readPrimary("UserID", Loop)); dataRows["DataOne"] = db.readData("DataOne", Loop); dataRows["DataTwo"] = db.readData("DataTwo", Loop); dataRows["DataThree"] = db.readData("DataThree", Loop); Rows.Add(dataRows); } }
public void ViewDidLoad() { //create the data table object and set a name var aDataSource = new DSDataTable("ADT"); //add a column var dc1 = new DSDataColumn("Title"); dc1.Caption = "Title"; dc1.ReadOnly = true; dc1.DataType = typeof(String); dc1.AllowSort = true; //dc1.Width = ColumnsDefs[aKey]; aDataSource.Columns.Add(dc1); //add a row to the data table var dr = new DSDataRow(); //dr["ID"] = loop; dr["Title"] = @"Test"; dr["Description"] = @"Some description would go here"; dr["Date"] = DateTime.Now.ToShortDateString(); dr["Value"] = "10000.00"; //set the value as an image //dr["Image"] = UIImage.FromFile("first.png") aDataSource.Rows.Add(dr); }
/// <summary> /// Convert a .Net DataRow object to a DSDataRow object /// </summary> /// <returns>The DS data row.</returns> /// <param name="Data">Data.</param> internal static DSDataRow ToDSDataRow(this DataRow Data) { var result = new DSDataRow(); foreach (DataColumn column in Data.Table.Columns) { result [column.ColumnName] = Data [column.ColumnName]; } return(result); }
/// <summary> /// Initialises CustomFieldDataTable /// Pulls Data from the database and generates columns and rows to match the said data /// and inputs that dta afterwards /// </summary> /// <param name="context">Allows it to know which activity it is calling it from</param> /// <param name="Name">Used to Determine which spreadsheet is to be openned</param> public CustomFieldDataTable(Context context, String Name) : base(Name) { CustomFieldTableDB customFieldTable = new CustomFieldTableDB(context); string customFieldID = "CustomFieldID"; string fieldID = "FieldID"; string graphID = "GraphID"; string red = "Red"; string green = "Green"; string blue = "Blue"; var dataColumns = new Dictionary <string, float>(); dataColumns.Add(" " + customFieldID, 150); dataColumns.Add(fieldID, 100); dataColumns.Add(graphID, 100); dataColumns.Add(red, 100); dataColumns.Add(green, 100); dataColumns.Add(blue, 100); foreach (var key in dataColumns.Keys) { var dc = new DSDataColumn(key); dc.Caption = key; dc.ReadOnly = true; dc.DataType = typeof(string); dc.AllowSort = true; dc.Width = dataColumns[key]; Columns.Add(dc); } List <string> CustomFieldIDList = customFieldTable.readString(customFieldID); List <string> FieldIDList = customFieldTable.readString(fieldID); List <string> GraphIDList = customFieldTable.readString(graphID); List <string> RedList = customFieldTable.readString(red); List <string> GreenList = customFieldTable.readString(green); List <string> BlueList = customFieldTable.readString(blue); int row = customFieldTable.Count(); for (int i = 0; i < row; i += 1) { var dataRows = new DSDataRow(); dataRows[" " + customFieldID] = " " + CustomFieldIDList[i]; dataRows[fieldID] = FieldIDList[i]; dataRows[graphID] = GraphIDList[i]; dataRows[red] = RedList[i]; dataRows[green] = GreenList[i]; dataRows[blue] = BlueList[i]; Rows.Add(dataRows); } }
/// <summary> /// Initialises GraphDataTable /// Pulls Data from the database and generates columns and rows to match the said data /// and inputs that dta afterwards /// </summary> /// <param name="context">Allows it to know which activity it is calling it from</param> /// <param name="Name">Used to Determine which spreadsheet is to be openned</param> public GraphDataTable(Context context, String Name) : base(Name) { GraphTableDB graphTabledb = new GraphTableDB(context); string graphID = "GraphID"; string tableID = "TableID"; string userName = "******"; string dateCreated = "DateCreated"; var dataColumns = new Dictionary <string, float>(); dataColumns.Add(" " + graphID, 100); dataColumns.Add(tableID, 100); dataColumns.Add(userName, 150); dataColumns.Add(dateCreated, 300); foreach (var key in dataColumns.Keys) { var dc = new DSDataColumn(key); dc.Caption = key; dc.ReadOnly = true; dc.DataType = typeof(string); dc.AllowSort = true; dc.Width = dataColumns[key]; Columns.Add(dc); } List <string> PrimaryKeyList = graphTabledb.readString(graphID); List <string> TableIDList = graphTabledb.readString(tableID); List <string> UserNameList = graphTabledb.readString(userName); int row = graphTabledb.Count(); for (int i = 0; i < row; i += 1) { var dataRows = new DSDataRow(); dataRows[" " + graphID] = " " + PrimaryKeyList[i]; dataRows[tableID] = TableIDList[i]; dataRows[userName] = UserNameList[i]; dataRows[dateCreated] = graphTabledb.readDateTime(dateCreated, i); Rows.Add(dataRows); } }
/// <summary> /// Initialises FieldDataTable /// Pulls Data from the database and generates columns and rows to match the said data /// and inputs that dta afterwards /// </summary> /// <param name="context">Allows it to know which activity it is calling it from</param> /// <param name="Name">Used to Determine which spreadsheet is to be openned</param> public FieldDataTable(Context context, String Name) : base(Name) { FieldTableDB fieldTable = new FieldTableDB(context); string fieldName = "FieldName"; string tableID = "TableID"; string dataType = "DataType"; var dataColumns = new Dictionary <string, float>(); dataColumns.Add(" " + fieldName, 100); dataColumns.Add(tableID, 100); dataColumns.Add(dataType, 100); foreach (var key in dataColumns.Keys) { var dc = new DSDataColumn(key); dc.Caption = key; dc.ReadOnly = true; dc.DataType = typeof(string); dc.AllowSort = true; dc.Width = dataColumns[key]; Columns.Add(dc); } List <string> FieldNameList = fieldTable.readString(fieldName); List <int> TableIDList = fieldTable.readInt(tableID); List <string> DataTypeList = fieldTable.readString(dataType); int row = fieldTable.Count(); for (int i = 0; i < row; i += 1) { var dataRows = new DSDataRow(); dataRows[" " + fieldName] = " " + FieldNameList[i]; dataRows[tableID] = TableIDList[i]; dataRows[dataType] = DataTypeList[i]; Rows.Add(dataRows); } }
/// <summary> /// Gets the row at the specified indexs /// </summary> /// <returns>The row.</returns> /// <param name="Index">Index.</param> public override DSDataRow GetRow(int Index) { DSDataRow aRow = null; var anApp = Apps [Index]; if (Index < Rows.Count) { aRow = Rows [Index]; } else { aRow = new DSDataRow(); Rows.Add(aRow); } aRow ["Name"] = anApp.Name; aRow ["Artist"] = anApp.Artist; aRow ["ICON"] = anApp.Image; return(aRow); }
public ExampleDataTable2 (String Name) : base(Name) { var ColumnsDefs = new Dictionary<String,float>(); ColumnsDefs.Add("Primary",100); ColumnsDefs.Add("Code",150); ColumnsDefs.Add("Name",300); ColumnsDefs.Add("Phone",174); ColumnsDefs.Add("Email",300); foreach (var aKey in ColumnsDefs.Keys) { // Create a column var dc1 = new DSDataColumn(aKey); dc1.Caption = aKey; dc1.ReadOnly = true; dc1.DataType = typeof(String); dc1.AllowSort = true; dc1.Width = ColumnsDefs[aKey]; this.Columns.Add(dc1); } for (int loop = 0;loop < 21;loop++) { var dr = new DSDataRow(); dr["Primary"] = loop; dr["Code"] = @"Customer " + loop.ToString(); dr["Name"] = @"Name of the Customer " + loop.ToString(); dr["Phone"] = "01234 56789"; dr["Email"] = "*****@*****.**"; this.Rows.Add(dr); } }
/// <summary> /// Initialises UserDataTable /// Pulls Data from the database and generates columns and rows to match the said data /// and inputs that dta afterwards /// </summary> /// <param name="context">Allows it to know which activity it is calling it from</param> /// <param name="Name">Used to Determine which spreadsheet is to be openned</param> public UserDataTable(Context context, String Name) : base(Name) { UserTableDB userTabledb = new UserTableDB(context); string userName = "******"; string passWord = "******"; var dataColumns = new Dictionary <string, float>(); dataColumns.Add(" " + userName, 150); dataColumns.Add(passWord, 150); foreach (var key in dataColumns.Keys) { var dc = new DSDataColumn(key); dc.Caption = key; dc.ReadOnly = true; dc.DataType = typeof(string); dc.AllowSort = true; dc.Width = dataColumns[key]; Columns.Add(dc); } List <string> UserNameList = userTabledb.readString(userName); List <string> PassWordList = userTabledb.readString(passWord); int row = userTabledb.Count(); for (int i = 0; i < row; i += 1) { var dataRows = new DSDataRow(); dataRows[" " + userName] = " " + UserNameList[i]; dataRows[passWord] = PassWordList[i]; Rows.Add(dataRows); } }
/// <summary> /// Initializes a new instance of the <see cref="DSComponentsSample.Data.Grid.ExampleDataTable"/> class. /// </summary> /// <param name="EntryPoint">Entry point.</param> /// <param name="Name">Name.</param> public ExampleDataTable(Context EntryPoint, String Name) : base(Name) { mEntryPoint = EntryPoint; var ColumnsDefs = new Dictionary <String, float> (); ColumnsDefs.Add("Image", 30); ColumnsDefs.Add("Ordered", 100); ColumnsDefs.Add("ID", 100); ColumnsDefs.Add("Date", 124); //ColumnsDefs.Add ("Title", 150); ColumnsDefs.Add("Description", 550); ColumnsDefs.Add("Value", 100); foreach (var aKey in ColumnsDefs.Keys) { // Create a column var dc1 = new DSDataColumn(aKey); dc1.Caption = (aKey == "Ordered") ? "Record\nNumber" : aKey; dc1.ReadOnly = true; if (aKey.Equals("Image")) { dc1.DataType = typeof(Bitmap); dc1.AllowSort = false; dc1.Formatter = new DSImageFormatter(new DSSize(ColumnsDefs [aKey], ColumnsDefs [aKey])); } else if (aKey.Equals("Ordered")) { dc1.DataType = typeof(Boolean); dc1.AllowSort = false; // var boolFormatter = new DSBooleanFormatter (DSoft.UI.Grid.Enums.BooleanFormatterStyle.Text, "Yes", "No"); // boolFormatter.TextAlignment = DSoft.Datatypes.Enums.TextAlignment.Middle; var boolFormatter = new DSBooleanFormatter(BooleanFormatterStyle.Image); boolFormatter.Size = new DSSize(10, 10); dc1.Formatter = boolFormatter; } else if (aKey.Equals("Title")) { //add a custom view to allow us to update the title //DSTextFieldView dc1.DataType = typeof(String); dc1.AllowSort = true; dc1.ReadOnly = false; var custFormatter = new DSViewFormatter(new DSTextFieldView(EntryPoint)); dc1.Formatter = custFormatter; } else if (aKey.Equals("Value")) { dc1.DataType = typeof(String); dc1.AllowSort = true; //added a text formatter dc1.Formatter = new DSTextFormatter(TextAlignment.Left); } else { dc1.DataType = typeof(String); dc1.AllowSort = true; } dc1.Width = ColumnsDefs [aKey]; this.Columns.Add(dc1); } //add row defs to keep row ids for (int loop = 0; loop < 100; loop++) { var aRow = new DSDataRow(); aRow ["Title"] = @"Test"; aRow ["ID"] = loop; Rows.Add(aRow); } }
/// <summary> /// Initializes a new instance of the <see cref="DSComponentsSample.Data.Grid.ExampleDataTable"/> class. /// </summary> /// <param name="EntryPoint">Entry point.</param> /// <param name="Name">Name.</param> public ExampleDataTable (Context EntryPoint, String Name) : base (Name) { mEntryPoint = EntryPoint; var ColumnsDefs = new Dictionary<String,float> (); ColumnsDefs.Add ("Image", 30); ColumnsDefs.Add ("Ordered", 100); ColumnsDefs.Add ("ID", 100); ColumnsDefs.Add ("Date", 124); //ColumnsDefs.Add ("Title", 150); ColumnsDefs.Add ("Description", 550); ColumnsDefs.Add ("Value", 100); foreach (var aKey in ColumnsDefs.Keys) { // Create a column var dc1 = new DSDataColumn (aKey); dc1.Caption = (aKey == "Ordered") ? "Record\nNumber" : aKey; dc1.ReadOnly = true; if (aKey.Equals ("Image")) { dc1.DataType = typeof(Bitmap); dc1.AllowSort = false; dc1.Formatter = new DSImageFormatter (new DSSize (ColumnsDefs [aKey], ColumnsDefs [aKey])); } else if (aKey.Equals ("Ordered")) { dc1.DataType = typeof(Boolean); dc1.AllowSort = false; // var boolFormatter = new DSBooleanFormatter (DSoft.UI.Grid.Enums.BooleanFormatterStyle.Text, "Yes", "No"); // boolFormatter.TextAlignment = DSoft.Datatypes.Enums.TextAlignment.Middle; var boolFormatter = new DSBooleanFormatter (BooleanFormatterStyle.Image); boolFormatter.Size = new DSSize (10, 10); dc1.Formatter = boolFormatter; } else if (aKey.Equals ("Title")) { //add a custom view to allow us to update the title //DSTextFieldView dc1.DataType = typeof(String); dc1.AllowSort = true; dc1.ReadOnly = false; var custFormatter = new DSViewFormatter(new DSTextFieldView(EntryPoint)); dc1.Formatter = custFormatter; } else if (aKey.Equals ("Value")) { dc1.DataType = typeof(String); dc1.AllowSort = true; //added a text formatter dc1.Formatter = new DSTextFormatter (TextAlignment.Left); } else { dc1.DataType = typeof(String); dc1.AllowSort = true; } dc1.Width = ColumnsDefs [aKey]; this.Columns.Add (dc1); } //add row defs to keep row ids for(int loop = 0; loop < 100; loop++) { var aRow = new DSDataRow (); aRow ["Title"] = @"Test"; aRow ["ID"] = loop; Rows.Add (aRow); } }
/// <summary> /// Gets the row at the specified indexs /// </summary> /// <returns>The row.</returns> /// <param name="Index">Index.</param> public override DSDataRow GetRow (int Index) { DSDataRow aRow = null; if (Index < Rows.Count) { aRow = Rows [Index]; } else { aRow = new DSDataRow (); aRow ["Title"] = @"Test"; Rows.Add (aRow); } aRow ["Description"] = @"Some description would go here"; aRow ["Date"] = DateTime.Now.ToShortDateString (); aRow ["Value"] = "10000.00"; //see if even or odd to pick an image from the array var pos = Index % 2; aRow ["Image"] = Icons [pos]; aRow ["Ordered"] = (pos == 0) ? true : false; return aRow; }
/// <summary> /// Gets the row at the specified indexs /// </summary> /// <returns>The row.</returns> /// <param name="Index">Index.</param> public override DSDataRow GetRow(int Index) { DSDataRow aRow = null; var anApp = Apps [Index]; if (Index < Rows.Count) { aRow = Rows [Index]; } else { aRow = new DSDataRow (); Rows.Add (aRow); } aRow ["Name"] = anApp.Name; aRow ["Artist"] = anApp.Artist; aRow ["ICON"] = anApp.Image; return aRow; }