/// <summary> /// Shows how to Select all records. It also shows how to sort, bind, and loop through records. /// </summary> private void SelectAll() { // select all records List <WorkflowMaster> objWorkflowMasterCol = WorkflowMaster.SelectAll(); // Example 1: you can optionally sort the collection in ascending order by your chosen field objWorkflowMasterCol.Sort(WorkflowMaster.ByWorkflowName); // Example 2: to sort in descending order, add this line to the Sort code in Example 1 objWorkflowMasterCol.Reverse(); // Example 3: directly bind to a GridView - for ASP.NET Web Forms // GridView grid = new GridView(); // grid.DataSource = objWorkflowMasterCol; // grid.DataBind(); // Example 4: loop through all the WorkflowMaster(s) foreach (WorkflowMaster objWorkflowMaster in objWorkflowMasterCol) { int workflowId = objWorkflowMaster.WorkflowId; string workflowName = objWorkflowMaster.WorkflowName; int? levelOfApprovals = objWorkflowMaster.LevelOfApprovals; string createdBy = objWorkflowMaster.CreatedBy; DateTime createdOn = objWorkflowMaster.CreatedOn; string updatedby = objWorkflowMaster.Updatedby; DateTime updatedon = objWorkflowMaster.Updatedon; } }
/// <summary> /// Shows how to Select all records sorted by column name in either ascending or descending order. /// </summary> private void SelectAllWithSortExpression() { // select all records sorted by WorkflowId in ascending order string sortBy = "WorkflowId"; // ascending order //string sortBy = "WorkflowId desc"; // descending order List <WorkflowMaster> objWorkflowMasterCol = WorkflowMaster.SelectAll(sortBy); }