private bool Create() { this.guid = Guid.NewGuid(); int rowsAffected = DBContentWorkflow.Create( this.guid, this.siteGuid, this.moduleGuid, this.userGuid, this.createdDateUtc, this.contentText, this.customData, this.customReferenceNumber, this.customReferenceGuid, this.status.ToString()); //make entry in approval process table DBContentWorkflow.DeactivateAudit(moduleGuid); DBContentWorkflow.CreateAuditHistory( Guid.NewGuid(), this.guid, this.moduleGuid, this.lastModUserGuid, this.lastModUtc, this.status.ToString(), this.notes, true); return(rowsAffected > 0); }
public static ContentWorkflow GetWorkInProgress(Guid moduleGuid, string status) { using (IDataReader reader = DBContentWorkflow.GetWorkInProgress(moduleGuid, status)) { ContentWorkflow wip = new ContentWorkflow(); if (wip.PopulateFromReader(reader)) { return(wip); } else { return(null); } } }
/// <summary> /// Updates an existing instance of ContentHistory. Returns true on success. /// </summary> /// <returns></returns> private bool Update() { int rowsAffected = DBContentWorkflow.Update( this.guid, this.lastModUserGuid, this.lastModUtc, this.contentText, this.customData, this.customReferenceNumber, this.customReferenceGuid, this.status.ToString()); if (status == ContentWorkflowStatus.Approved) { //make entry in approval process table DBContentWorkflow.CreateAuditHistory( Guid.NewGuid(), this.guid, this.moduleGuid, this.lastModUserGuid, this.lastModUtc, this.status.ToString(), this.notes, false); DBContentWorkflow.DeactivateAudit(moduleGuid); } else if (status != originalStatus) { DBContentWorkflow.DeactivateAudit(moduleGuid); DBContentWorkflow.CreateAuditHistory( Guid.NewGuid(), this.guid, this.moduleGuid, this.lastModUserGuid, this.lastModUtc, this.status.ToString(), this.notes, true); } return(rowsAffected > 0); }
/// <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); }
public static int GetWorkInProgressCountByPage(Guid pageGuid) { return(DBContentWorkflow.GetWorkInProgressCountByPage(pageGuid)); }
public static bool DeleteBySite(Guid siteGuid) { return(DBContentWorkflow.DeleteBySite(siteGuid)); }
public static bool DeleteByModule(Guid moduleGuid) { return(DBContentWorkflow.DeleteByModule(moduleGuid)); }
public static Guid GetDraftSubmitter(Guid workflowGuid) { return(DBContentWorkflow.GetDraftSubmitter(workflowGuid)); }