/// <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 user. /// Deletes the user from the team if added to any team. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="ID">The ID.</param> /// <param name="listName">Name of the list.</param> public void DeleteUser(string siteURL, int ID, string listName) { objCommonDAL = new CommonDAL(); /// Delete User from the team string strCamlQuery = string.Format(@"<Where><Eq><FieldRef Name='User_ID' /><Value Type='Number'>{0}</Value></Eq></Where>", ID.ToString()); objCommonDAL.DeleteListItem(siteURL, TEAMSTAFFLIST, strCamlQuery); /// Delete User objCommonDAL.DeleteListItemById(siteURL, listName, ID); }
/// <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); }