/// <summary> /// Publishe the Well book and updates the list item. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="listName">Name of the list.</param> /// <param name="rowId">The row id.</param> public void PublishWellBook(string siteURL, string listName, int rowId) { objWellBookDAL = new WellBookDAL(); objCommonDAL = new CommonDAL(); objCommonBLL = new CommonBLL(); DataTable dtResultTable = null; int intListItemRowId = 0; StringBuilder strID = new StringBuilder(); string strCAMlQueryforPageId = string.Empty; Dictionary<string, string> listItemCollection = null; string strCamlQuery = string.Empty; listItemCollection = new Dictionary<string, string>(); listItemCollection.Add("Sign_Off_Status", "No"); /// Updating Sign_Off_Status column value to "No" in DWB Books list. objWellBookDAL.UpdateListItemValue(siteURL, listName, rowId, listItemCollection); strCamlQuery = "<Where><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" + rowId.ToString() + "</Value></Eq></Where>"; dtResultTable = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { for (int i = 0; i < dtResultTable.Rows.Count; i++) { strID.Append(Convert.ToString(dtResultTable.Rows[i][IDCOLUMN])); strID.Append(";"); } } else { //the book does not have any chapters return; } /// Updating Sign_Off_Status column value to "No" in DWB Chapter Pages Mapping list. ///Build CAML Query to get all pages in the selected Book strCamlQuery = objCommonBLL.CreateCAMLQuery(strID.ToString(), "Chapter_ID", "Number"); dtResultTable = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCamlQuery); strID.Remove(0, strID.Length); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { listItemCollection.Clear(); listItemCollection.Add("Sign_Off_Status", "No"); for (int intRowIndex = 0; intRowIndex < dtResultTable.Rows.Count; intRowIndex++) { int.TryParse(Convert.ToString(dtResultTable.Rows[intRowIndex][IDCOLUMN]), out intListItemRowId); /// Updating Sign_Off_Status column value to "No" in DWB Chapter Pages Mapping list. objWellBookDAL.UpdateListItemValue(siteURL, CHAPTERPAGESMAPPINGLIST, intListItemRowId, listItemCollection); strID.Append(intListItemRowId.ToString()); strID.Append(";"); } } /// Delete Comments for All Books Pages strCAMlQueryforPageId = objCommonBLL.CreateCAMLQuery(strID.ToString(), "Page_ID", "Number"); objCommonDAL.DeleteAuditTrail(siteURL, DWBCOMMENT, strCAMlQueryforPageId); /// Delete audit trail of the Book. strCamlQuery = @"<Where><Eq><FieldRef Name='Master_ID' /><Value Type='Number'>" + rowId.ToString() + "</Value></Eq></Where>"; objCommonDAL.DeleteAuditTrail(siteURL, DWBWELLBOOKAUDITLIST, strCamlQuery); if (dtResultTable != null) { dtResultTable.Dispose(); } }
/// <summary> /// Deletes the list item by id. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="listName">Name of the list.</param> /// <param name="itemID">The item ID.</param> public void DeleteListItemById(string siteURL, int itemID, string listName, string auditListName) { objCommonDAL = new CommonDAL(); objCommonDAL.DeleteListItemById(siteURL, listName, itemID); if(!string.IsNullOrEmpty(auditListName)) { /// Get the CAML Query to delete the Audit History records for the selected records. string strCamlQuery = string.Format(AUDITHISTORYCAMLQUERY, itemID.ToString()); objCommonDAL.DeleteAuditTrail(siteURL, auditListName, strCamlQuery); } }
/// <summary> /// Deletes the template. /// Deletes the Pages added to the template and removes the entry /// in Template_ID column of Master Pages list. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="templateID">The template ID.</param> /// <param name="listName">Name of the list.</param> /// <param name="auditListName">Name of the audit list.</param> public void DeleteTemplate(string siteURL, int templateID, string listName, string auditListName) { DataTable dtResultsTable; StringBuilder strTemplateID = new StringBuilder(); ; objCommonDAL = new CommonDAL(); string strCamlQuery = string.Empty; /// Retrieve ID values for of Template Pages Mapping list. dtResultsTable = objCommonDAL.ReadList(siteURL, DWBTEMPLATEPAGESLIST, string.Format(@"<Where><Eq><FieldRef Name='Template_ID' /><Value Type='Number'>{0}</Value></Eq></Where>", templateID.ToString()), "<FieldRef Name='Template_ID' /><FieldRef Name='ID' />"); if (dtResultsTable != null && dtResultsTable.Rows.Count > 0) { for (int intRowIndex = 0; intRowIndex < dtResultsTable.Rows.Count;intRowIndex++ ) { strTemplateID.Append(Convert.ToString(dtResultsTable.Rows[intRowIndex]["ID"])); strTemplateID.Append(";"); } } /// Delete the Template Pages objCommonDAL.DeleteListItem(siteURL, DWBTEMPLATEPAGESLIST, string.Format(@"<Where><Eq><FieldRef Name='Template_ID' /><Value Type='Number'>{0}</Value></Eq></Where>", templateID.ToString())); if (strTemplateID.Length > 0) { strCamlQuery = CreateCAMLQuery(strTemplateID.ToString(), "Master_ID", "Number"); } /// Delete the Template Pages Audit objCommonDAL.DeleteAuditTrail(siteURL, DWBTEMPLATECONFIGURATIONAUDIT, strCamlQuery); /// Delete Template objCommonDAL.DeleteListItemById(siteURL, listName, templateID); /// Delete Template Audit objCommonDAL.DeleteAuditTrail(siteURL, auditListName, string.Format(AUDITHISTORYCAMLQUERY, templateID.ToString())); }
/// <summary> /// Deletes the chapter pages. /// Deletes Audit Trail, Story Board, Comments, Narrative and document /// for the selected page. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="chapterPageID">The chapter page ID.</param> /// <param name="connectionType">Type of the connection.</param> /// <param name="listName">Name of the list.</param> /// <param name="auditListName">Name of the audit list.</param> public void DeleteChapterPages(string siteURL, int chapterPageID, string connectionType, string listName, string auditListName) { string strCamlQuery = string.Empty; string strPageType = string.Empty; DataTable dtResultTable; objCommonDAL = new CommonDAL(); /// Get the Page type from "DWB Chapter Pages Mapping" list /// Based on the connection type delete the document. strCamlQuery = string.Format(@" <Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>{0}</Value></Eq></Where>", chapterPageID.ToString()); dtResultTable = objCommonDAL.ReadList(siteURL, listName, strCamlQuery, "<FieldRef Name='ID' /><FieldRef Name='Connection_Type' />"); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strPageType = Convert.ToString(dtResultTable.Rows[0]["Connection_Type"]); dtResultTable.Dispose(); } /// Delete documents for the selected page if (!string.IsNullOrEmpty(strPageType)) { switch (strPageType) { case DWBTYPE2PAGE: { objCommonDAL.DeleteDocument(siteURL,PUBLISHEDDOCUMENTLIST,string.Format(CHAPTERPAGEDOCUMNETCAMEQUERY,chapterPageID.ToString())); break; } case DWBTYPE3PAGE: { objCommonDAL.DeleteDocument(siteURL, USERDEFINEDDOCUMENTLIST, string.Format(CHAPTERPAGEDOCUMNETCAMEQUERY, chapterPageID.ToString())); break; } default: break; } } strCamlQuery = string.Empty; /// CAML query for DWB Comments. strCamlQuery = string.Format(@"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>{0}</Value></Eq></Where> ", chapterPageID.ToString()); /// Delete Comments objCommonDAL.DeleteListItem(siteURL, DWBCOMMENT, strCamlQuery); /// Delete Narrative objCommonDAL.DeleteListItem(siteURL, DWBNARRATIVES, strCamlQuery); /// Delete StoryBoard objCommonDAL.DeleteListItem(siteURL, DWBSTORYBOARD, strCamlQuery); /// Delete Audit Trail objCommonDAL.DeleteAuditTrail(siteURL, auditListName, string.Format(AUDITHISTORYCAMLQUERY, chapterPageID.ToString())); /// Delete Chapter Page objCommonDAL.DeleteListItemById(siteURL, listName, chapterPageID); }