/// <summary> /// Returns a DataSet with a page ContentWorkflow items and their related pagesettings info /// </summary> /// <param name="siteGuid"></param> /// <param name="status"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="totalPages"></param> /// <returns></returns> public static DataSet GetPageOfWorkflowsWithPageInfo(Guid siteGuid, ContentWorkflowStatus status, int pageNumber, int pageSize, out int totalPages) { DataSet dataSet = new DataSet(); DataTable workFlowsTable = GetEmptyTable(); using (IDataReader reader = DBContentWorkflow.GetPage( siteGuid, status.ToString(), pageNumber, pageSize, out totalPages)) { while (reader.Read()) { DataRow row = workFlowsTable.NewRow(); row["Guid"] = new Guid(reader["Guid"].ToString()); row["SiteGuid"] = new Guid(reader["SiteGuid"].ToString()); row["UserGuid"] = new Guid(reader["UserGuid"].ToString()); row["LastModUserGuid"] = new Guid(reader["LastModUserGuid"].ToString()); row["ModuleGuid"] = new Guid(reader["ModuleGuid"].ToString()); row["CustomReferenceGuid"] = new Guid(reader["CustomReferenceGuid"].ToString()); row["ModuleID"] = Convert.ToInt32(reader["ModuleID"]); row["ModuleTitle"] = reader["ModuleTitle"]; row["ContentText"] = reader["ContentText"]; row["CustomData"] = reader["CustomData"]; row["CustomReferenceNumber"] = Convert.ToInt32(reader["CustomReferenceNumber"]); row["CreatedDateUtc"] = Convert.ToDateTime(reader["CreatedDateUtc"]); row["LastModUtc"] = Convert.ToDateTime(reader["LastModUtc"]); row["CreatedByUserLogin"] = reader["CreatedByUserLogin"]; row["CreatedByUserName"] = reader["CreatedByUserName"]; row["RecentActionByUserLogin"] = reader["RecentActionByUserLogin"]; row["RecentActionByUserName"] = reader["RecentActionByUserName"]; row["RecentActionByUserEmail"] = reader["RecentActionByUserEmail"]; row["Status"] = reader["Status"]; row["Notes"] = reader["Notes"]; if (reader["RecentActionOn"] != DBNull.Value) { row["RecentActionOn"] = Convert.ToDateTime(reader["RecentActionOn"]); } else { row["RecentActionOn"] = DateTime.UtcNow; } workFlowsTable.Rows.Add(row); } } DataTable pageInfoTable = GetEmptyPageInfoTable(); using (IDataReader reader = DBContentWorkflow.GetPageInfoForPage( siteGuid, status.ToString(), pageNumber, pageSize)) { while (reader.Read()) { DataRow row = pageInfoTable.NewRow(); int pageId = Convert.ToInt32(reader["PageID"]); row["PageID"] = pageId; row["PageGuid"] = new Guid(reader["PageGuid"].ToString()); row["WorkflowGuid"] = new Guid(reader["WorkflowGuid"].ToString()); row["PageName"] = reader["PageName"]; bool useUrl = Convert.ToBoolean(reader["UseUrl"]); if (useUrl) { row["PageUrl"] = reader["PageUrl"]; } else { row["PageUrl"] = "~/Default.aspx?pageid=" + pageId.ToString(CultureInfo.InvariantCulture); } pageInfoTable.Rows.Add(row); } } workFlowsTable.TableName = "WorkFlows"; dataSet.Tables.Add(workFlowsTable); pageInfoTable.TableName = "PageInfo"; dataSet.Tables.Add(pageInfoTable); // create a relationship dataSet.Relations.Add("workflowPages", dataSet.Tables["WorkFlows"].Columns["Guid"], dataSet.Tables["PageInfo"].Columns["WorkflowGuid"]); return dataSet; }
/// <summary> /// Returns a DataSet with a page ContentWorkflow items and their related pagesettings info /// </summary> /// <param name="siteGuid"></param> /// <param name="status"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="totalPages"></param> /// <returns></returns> public static DataSet GetPageOfWorkflowsWithPageInfo(Guid siteGuid, ContentWorkflowStatus status, int pageNumber, int pageSize, out int totalPages) { DataSet dataSet = new DataSet(); DataTable workFlowsTable = GetEmptyTable(); using (IDataReader reader = DBContentWorkflow.GetPage( siteGuid, status.ToString(), pageNumber, pageSize, out totalPages)) { while (reader.Read()) { DataRow row = workFlowsTable.NewRow(); row["Guid"] = new Guid(reader["Guid"].ToString()); row["SiteGuid"] = new Guid(reader["SiteGuid"].ToString()); row["UserGuid"] = new Guid(reader["UserGuid"].ToString()); row["LastModUserGuid"] = new Guid(reader["LastModUserGuid"].ToString()); row["ModuleGuid"] = new Guid(reader["ModuleGuid"].ToString()); row["CustomReferenceGuid"] = new Guid(reader["CustomReferenceGuid"].ToString()); row["ModuleID"] = Convert.ToInt32(reader["ModuleID"]); row["ModuleTitle"] = reader["ModuleTitle"]; row["ContentText"] = reader["ContentText"]; row["CustomData"] = reader["CustomData"]; row["CustomReferenceNumber"] = Convert.ToInt32(reader["CustomReferenceNumber"]); row["CreatedDateUtc"] = Convert.ToDateTime(reader["CreatedDateUtc"]); row["LastModUtc"] = Convert.ToDateTime(reader["LastModUtc"]); row["CreatedByUserLogin"] = reader["CreatedByUserLogin"]; row["CreatedByUserName"] = reader["CreatedByUserName"]; row["RecentActionByUserLogin"] = reader["RecentActionByUserLogin"]; row["RecentActionByUserName"] = reader["RecentActionByUserName"]; row["RecentActionByUserEmail"] = reader["RecentActionByUserEmail"]; row["Status"] = reader["Status"]; row["Notes"] = reader["Notes"]; if (reader["RecentActionOn"] != DBNull.Value) { row["RecentActionOn"] = Convert.ToDateTime(reader["RecentActionOn"]); } else { row["RecentActionOn"] = DateTime.UtcNow; } workFlowsTable.Rows.Add(row); } } DataTable pageInfoTable = GetEmptyPageInfoTable(); using (IDataReader reader = DBContentWorkflow.GetPageInfoForPage( siteGuid, status.ToString(), pageNumber, pageSize)) { while (reader.Read()) { DataRow row = pageInfoTable.NewRow(); int pageId = Convert.ToInt32(reader["PageID"]); row["PageID"] = pageId; row["PageGuid"] = new Guid(reader["PageGuid"].ToString()); row["WorkflowGuid"] = new Guid(reader["WorkflowGuid"].ToString()); row["PageName"] = reader["PageName"]; bool useUrl = Convert.ToBoolean(reader["UseUrl"]); if (useUrl) { row["PageUrl"] = reader["PageUrl"]; } else { row["PageUrl"] = "~/Default.aspx?pageid=" + pageId.ToString(CultureInfo.InvariantCulture); } pageInfoTable.Rows.Add(row); } } workFlowsTable.TableName = "WorkFlows"; dataSet.Tables.Add(workFlowsTable); pageInfoTable.TableName = "PageInfo"; dataSet.Tables.Add(pageInfoTable); // create a relationship dataSet.Relations.Add("workflowPages", dataSet.Tables["WorkFlows"].Columns["Guid"], dataSet.Tables["PageInfo"].Columns["WorkflowGuid"]); return(dataSet); }