/// <summary> /// Add Books as favorites /// </summary> /// <param name="siteUrl">Site URL.</param> /// <param name="favBookIds">Books IDs separated by ;</param> /// <param name="listName">List Name.</param> /// <param name="username">User ID</param> /// <param name="addToFavourite">True if Add to Favourites. False if Remove from Favorites.</param> public void AddToFavorites(string siteURL, string favBookIds, string listName, string username, bool addToFavourite) { objWellBookDAL = new WellBookDAL(); Dictionary<string, string> listItemCollection = null; if (favBookIds.Length != 0) { listItemCollection = new Dictionary<string, string>(); string strCAMLQuery = "<Where><Eq><FieldRef Name='Windows_User_ID' /><Value Type='Text'>" + username + "</Value></Eq></Where>"; if (addToFavourite) { listItemCollection.Add("FavoriteBooks", favBookIds); WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection); } else { /// Read the FavoriteBooks value from DWB User list /// Remove the Book Ids in favBookIds /// Update the FavoriteBooks in DWB User list with the new value objCommonDAL = new CommonDAL(); DataTable dtUser = objCommonDAL.ReadList(siteURL, listName, strCAMLQuery); if (dtUser != null && dtUser.Rows.Count > 0) { string strExistingFavouriteBooks = Convert.ToString(dtUser.Rows[0]["FavoriteBooks"]); if (!string.IsNullOrEmpty(strExistingFavouriteBooks)) { string[] strBookIds = favBookIds.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int intIndex = 0; intIndex < strBookIds.Length; intIndex++) { if (strExistingFavouriteBooks.Contains(";" + strBookIds[intIndex] + ";")) { strExistingFavouriteBooks = strExistingFavouriteBooks.Remove(strExistingFavouriteBooks.IndexOf(";" + strBookIds[intIndex] + ";"), strBookIds[intIndex].Length + 1); if (strExistingFavouriteBooks.Length == 1 && (string.Compare(strExistingFavouriteBooks, ";")) == 0) { strExistingFavouriteBooks = string.Empty; } } } listItemCollection.Add("FavoriteBooks", strExistingFavouriteBooks); WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection); } } } } }
/// <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> /// Added By Gopinath /// Date : 22-11-2010 /// To save the bacth import log in sharepoint list. /// </summary> /// <param name="siteURL">string</param> /// <param name="listName">string</param> /// <param name="batchImportLog">DataTable</param> public void SaveBatchImportLog(string siteURL, string listName, DataTable batchImportLog) { objWellBookDAL = new WellBookDAL(); objWellBookDAL.SaveBatchImportLog(siteURL, listName, batchImportLog); }
/// <summary> /// Added By Gopinath /// Date : 22-11-2010 /// Clear the Batch Import sharepoint list at start of batch import long running process. /// </summary> /// <param name="siteURL"></param> /// <param name="listName"></param> public void ClearBatchImportLog(string siteURL, string listName) { objWellBookDAL = new WellBookDAL(); objWellBookDAL.ClearBatchImportLog(siteURL, listName); }
/// <summary> /// Gets the Well Book Details /// </summary> /// <param name="siteURL"></param> /// <param name="listName"></param> /// <param name="queryString"></param> /// <returns>ListEntry</returns> public ListEntry GetWellBookDetail(string siteURL, string listName, string CAMLQuery) { objWellBookDAL = new WellBookDAL(); return (objWellBookDAL.GetWellBookDetail(siteURL, listName, CAMLQuery)); }
/// <summary> /// Changes the Sign of status and the Chapter Page mapping list. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="signOffStatus">The sign off status.</param> /// <param name="listName">Name of the list.</param> /// <param name="username">The username.</param> /// <param name="bookId">The book id.</param> /// <param name="actionPerformed">The action performed.</param> public void ChangeSignOffStatus(string siteURL, string signOffStatus, string listName, string username, string bookId, string actionPerformed) { objWellBookDAL = new WellBookDAL(); objCommonDAL = new CommonDAL(); objCommonBLL = new CommonBLL(); StringBuilder strChapterPageId = new StringBuilder(); Dictionary<string, string> listItemCollection = new Dictionary<string, string>(); listItemCollection.Add("Sign_Off_Status", signOffStatus); string strCAMLQuery = "<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + bookId + "</Value></Eq></Where>"; WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection); int intBookId = 0; if (!string.IsNullOrEmpty(bookId)) { intBookId = int.Parse(bookId); } objCommonDAL.UpdateListAuditHistory(siteURL, DWBWELLBOOKAUDITLIST, intBookId, username, actionPerformed); #region Code Commented as per confirmation of UAT Feedback /// Update Signoff Status for all pages in Book //dtResult = GetPagesForBook(siteURL, bookId, "No"); //if (dtResult != null && dtResult.Rows.Count > 0) //{ // for (int intRowIndex = 0; intRowIndex < dtResult.Rows.Count; intRowIndex++) // { // strChapterPageId.Append(Convert.ToString(dtResult.Rows[intRowIndex][IDCOLUMN])); // strChapterPageId.Append(";"); // } // strCAMLQuery = objCommonBLL.CreateCamlQueryWithoutWhere(strChapterPageId.ToString(), IDCOLUMN, IDCOLUMNTYPE); // listItemCollection.Clear(); // listItemCollection.Add("Sign_Off_Status", signOffStatus); // WellBookDAL.UpdateListItemCollectionValues(siteURL, chapterpageList, strCAMLQuery, listItemCollection); //} //if (dtResult != null) //{ // dtResult.Dispose(); //} #endregion Code Commented as per UAT Feedback }
/// <summary> /// Updates the Sign of Status /// </summary> /// <param name="siteUrl">Site URL.</param> /// <param name="listName">List Name.</param> /// <param name="signOffStatus">Yes/No.</param> /// <param name="pageId">Page ID.</param> /// <param name="actionperformed">ID of Audit Action.</param> public void UpdateWellBookPageSignOffStatus(string siteURL, string listName, string signOffStatus, int pageId, string actionPerformed) { objWellBookDAL = new WellBookDAL(); Dictionary<string, string> listItemCollection = new Dictionary<string, string>(); listItemCollection.Add("Sign_Off_Status", signOffStatus); string strCAMLQuery = "<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + pageId + "</Value></Eq></Where>"; WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection); objCommonDAL = new CommonDAL(); Shell.SharePoint.DREAM.Utilities.CommonUtility objCommonUtility = new Shell.SharePoint.DREAM.Utilities.CommonUtility(); string strUserName = objCommonUtility.GetUserName(); objCommonDAL.UpdateListAuditHistory(siteURL, CHAPTERPAGESMAPPINGAUDITLIST, pageId, strUserName, actionPerformed); }
/// <summary> /// Updates the page owners /// </summary> /// <param name="siteURL">Site URL.</param> /// <param name="listEntry">ListEntry object.</param> /// <param name="auditListName">Name of the audit list.</param> /// <param name="listName">Name of the list.</param> /// <param name="userName">Name of the user.</param> /// <param name="actionPerformed">The action performed.</param> public void UpdatePageOwner(string siteURL, ListEntry listEntry, string auditListName, string listName, string userName, string actionPerformed) { StringBuilder strPageId = new StringBuilder(); objWellBookDAL = new WellBookDAL(); objCommonBLL = new CommonBLL(); objCommonDAL = new CommonDAL(); string strCAMLQuery = string.Empty; #region DREAM 4.0 - eWB2.0 - Change discipline when page owner is changed strCAMLQuery = string.Format(@"<Where><Eq><FieldRef Name='Windows_User_ID' /><Value Type='Text'>{0}</Value></Eq></Where>", userName); string strViewFields = @"<FieldRef Name='Windows_User_ID' /><FieldRef Name='ID' /><FieldRef Name='Discipline' /><FieldRef Name='Privileges' /><FieldRef Name='DWBUserName' />"; DataTable dtUserDetails = null; string strDiscipline = string.Empty; dtUserDetails = objCommonDAL.ReadList(siteURL, DWBUSER, strCAMLQuery, strViewFields); if (dtUserDetails != null && dtUserDetails.Rows.Count > 0) { strDiscipline = Convert.ToString(dtUserDetails.Rows[0][DISCIPLINECOLUMN]); } #endregion objWellBookDAL.UpdatePageOwner(siteURL, listEntry, listName, auditListName, userName, actionPerformed,strDiscipline); for (int intRowIndex = 0; intRowIndex < listEntry.ChapterPagesMapping.Count; intRowIndex++) { strPageId.Append(listEntry.ChapterPagesMapping[intRowIndex].RowId); strPageId.Append(";"); } strCAMLQuery = objCommonBLL.CreateCAMLQuery(strPageId.ToString(), "Page_ID", "Number"); objWellBookDAL.UpdatePageOwner(siteURL, strCAMLQuery, DWBSTORYBOARD, userName); #region DREAM 4.0 - eWB2.0 - Change discipline when page owner is changed /// Update the "Disciplie" column for selected Page_IDs in DWB Story Board list strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Discipline' /><FieldRef Name='Page_ID' />"; objCommonDAL.UpdateListItem(siteURL, DWBSTORYBOARD,DISCIPLINECOLUMN, Microsoft.SharePoint.SPFieldType.Text, strDiscipline, strCAMLQuery, strViewFields); /// Update the "Disciplie" column for selected Page_IDs in DWB Comments list objCommonDAL.UpdateListItem(siteURL, DWBCOMMENT, DISCIPLINECOLUMN, Microsoft.SharePoint.SPFieldType.Text, strDiscipline, strCAMLQuery, strViewFields); #endregion }
/// <summary> /// Updates the list entry. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="listEntry">The list entry.</param> /// <param name="listName">Name of the list.</param> /// <param name="type">The type.</param> public void UpdateListEntry(string siteURL, ListEntry listEntry, string auditListName, string listName, string userName, string actionPerformed) { objWellBookDAL = new WellBookDAL(); objWellBookDAL.UpdateListEntry(siteURL, listEntry, listName, auditListName, userName, actionPerformed); }
/// <summary> /// Update Sign Off Status /// Added By: Praveena /// Date:11/09/2010 /// Reason: For module Simplify Sign Off /// </summary> /// <param name="siteURL"></param> /// <param name="listName"></param> /// <param name="signOffStatus"></param> /// <param name="pageIDs"></param> /// <param name="actionPerformed"></param> public void UpdateBulkSignOffStatus(string siteURL, string listName, string signOffStatus, string pageIDs, string actionPerformed) { objWellBookDAL = new WellBookDAL(); objCommonBLL = new CommonBLL(); string strCAMLQuery = objCommonBLL.CreateCAMLQuery(pageIDs, "ID", "Number"); WellBookDAL.UpdateBulkSignOffSatus(siteURL, listName, strCAMLQuery, signOffStatus); objCommonDAL = new CommonDAL(); Shell.SharePoint.DREAM.Utilities.CommonUtility objCommonUtility = new Shell.SharePoint.DREAM.Utilities.CommonUtility(); string strUserName = objCommonUtility.GetUserName(); objCommonDAL.UpdateBulkListAuditHistory(siteURL, CHAPTERPAGESMAPPINGAUDITLIST, pageIDs, strUserName, actionPerformed); }