/// <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 StepId in ascending order string sortBy = "StepId"; // ascending order //string sortBy = "StepId desc"; // descending order List <WorkflowStepsMaster> objWorkflowStepsMasterCol = WorkflowStepsMaster.SelectAll(sortBy); }
/// <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 <WorkflowStepsMaster> objWorkflowStepsMasterCol = WorkflowStepsMaster.SelectAll(); // Example 1: you can optionally sort the collection in ascending order by your chosen field objWorkflowStepsMasterCol.Sort(WorkflowStepsMaster.ByWorKflowId); // Example 2: to sort in descending order, add this line to the Sort code in Example 1 objWorkflowStepsMasterCol.Reverse(); // Example 3: directly bind to a GridView - for ASP.NET Web Forms // GridView grid = new GridView(); // grid.DataSource = objWorkflowStepsMasterCol; // grid.DataBind(); // Example 4: loop through all the WorkflowStepsMaster(s) foreach (WorkflowStepsMaster objWorkflowStepsMaster in objWorkflowStepsMasterCol) { int stepId = objWorkflowStepsMaster.StepId; int? worKflowId = objWorkflowStepsMaster.WorKflowId; string approvalLevel = objWorkflowStepsMaster.ApprovalLevel; string description = objWorkflowStepsMaster.Description; string autoApprove = objWorkflowStepsMaster.AutoApprove; int? waitTime = objWorkflowStepsMaster.WaitTime; string createdBy = objWorkflowStepsMaster.CreatedBy; DateTime createdOn = objWorkflowStepsMaster.CreatedOn; string updatedBy = objWorkflowStepsMaster.UpdatedBy; DateTime updatedOn = objWorkflowStepsMaster.UpdatedOn; // get the WorkflowMaster related to WorKflowId. if (objWorkflowStepsMaster.WorKflowId != null) { WorkflowMaster objWorkflowMasterRelatedToWorKflowId = objWorkflowStepsMaster.WorKflowIdNavigation; } } }