/// <summary> /// Updates the list entry. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="listEntry">The list entry.</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 UpdateListEntry(string siteURL, ListEntry listEntry, string auditListName, string listName, string userName, string actionPerformed) { objMasterDAL = new MasterDAL(); objCommonDAL = new CommonDAL(); string[] strTemplateIds = null; string strTemplatemappingRowId = string.Empty; objMasterDAL.UpdateListEntry(siteURL, listEntry, listName, actionPerformed); if (listEntry.MasterPage.RowId > 0) { objMasterDAL.UpdateListAuditHistory(siteURL, listName, auditListName, listEntry.MasterPage.RowId, listEntry.MasterPage.Name, userName, actionPerformed); } if (!string.IsNullOrEmpty(listEntry.MasterPage.Templates) && actionPerformed.Contains(AUDIT_ACTION_CREATION)) { strTemplatemappingRowId = objMasterDAL.AddTemplateMasterPageMapping(siteURL, listEntry, TEMPLATEPAGESMAPPINGLIST); strTemplateIds = strTemplatemappingRowId.Split(';'); if (strTemplateIds != null) { for (int intIndex = 0; intIndex < strTemplateIds.Length - 1; intIndex++) { int intRowId = 0; int.TryParse(strTemplateIds[intIndex], out intRowId); objCommonDAL.UpdateListTemplateMappingAuditHistory(siteURL, TEMPLATEPAGESMAPPINGAUDITLIST, intRowId, userName, AUDIT_ACTION_CREATION); } } } }
/// <summary> /// Updates the list entry for Add/Edit template. /// </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="auditListName">Audit List Name.</param> /// <param name="userName">User Name.</param> /// <param name="actionPerformed">Audit Action.</param> /// <exception cref="">Handled in calling class.</exception> public void UpdateListEntry(string siteURL, ListEntry listEntry, string auditListName, string listName, string userName, string actionPerformed) { objTemplateDAL = new TemplateDAL(); objTemplateDAL.UpdateListEntry(siteURL, listEntry, listName, auditListName, userName, actionPerformed); }
/// <summary> /// Save click Handler. /// Saves the comment to SharePoint list and close the popup window. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">EventArg</param> protected void btnSave_Click(object sender, EventArgs e) { TreeNodeSelection objTreeNodeSelection = null; UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); UserDetails objUserDetails = null; bool blnUpdateSuccess = false; try { objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; if (objTreeNodeSelection != null) { strPageID = objTreeNodeSelection.PageID; } strUserName = GetUserName(); objUserDetails = objUserRegistrationBLL.GetUserDesicipline(strParentSiteURL, strUserName, USERLIST); if (objUserDetails != null) { strDiscipline = objUserDetails.Discipline; strDisciplineID = objUserDetails.DisciplineID; } /// Save the Comments to the DWB Comment list and refresh the parent window PageCommentsDetails objPageCommentsDetails = new PageCommentsDetails(); objPageCommentsDetails.Comments = txtPageComments.Text.Trim(); objPageCommentsDetails.Discipline = strDiscipline; objPageCommentsDetails.DisciplineID = strDisciplineID; objPageCommentsDetails.PageID = strPageID; objPageCommentsDetails.UserName = strUserName; if (chkShareComments.Checked) { objPageCommentsDetails.ShareComments = STATUSTERMINATED; } else { objPageCommentsDetails.ShareComments = STATUSACTIVE; } ListEntry objListEntry = new ListEntry(); objListEntry.PageComments = objPageCommentsDetails; blnUpdateSuccess = UpdateListEntry(objListEntry, PAGESCOMMENTSLIST, CHAPTERPAGESMAPPINGAUDITLIST, PAGECOMMENTS, AUDITACTIONCOMMENTADDED); if (blnUpdateSuccess) { txtPageComments.Text = string.Empty; } } catch (WebException webEx) { CommonUtility.HandleException(strParentSiteURL, webEx); lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <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> /// <returns>string</returns> internal string AddTemplateMasterPageMapping(string siteURL, ListEntry listEntry, string listName) { SPList list; SPListItem objListItem; string[] strTemplateIds = null; StringBuilder strTemplatePageMappingRowId = new StringBuilder(); SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(siteURL)) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; list = web.Lists[listName]; if (!string.IsNullOrEmpty(listEntry.MasterPage.Templates)) { strTemplateIds = listEntry.MasterPage.Templates.Split(';'); } if (strTemplateIds != null) { for (int i = 0; i < strTemplateIds.Length - 1; i++) { objListItem = list.Items.Add(); objListItem["Master_Page_ID"] = listEntry.MasterPage.RowId; objListItem["Template_ID"] = int.Parse(strTemplateIds[i]); objListItem["Page_Sequence"] = listEntry.MasterPage.PageSequence; objListItem["Master_Page_Name"] = listEntry.MasterPage.Name; objListItem["Page_Title_Template"] = listEntry.MasterPage.TemplateTitle; objListItem["Asset_Type"] = listEntry.MasterPage.AssetTypeText; objListItem["Discipline"] = listEntry.MasterPage.SignOffDisciplineText; objListItem["Standard_Operating_Procedure"] = listEntry.MasterPage.SOP; objListItem["Connection_Type"] = listEntry.MasterPage.ConnectionTypeText; if (!string.IsNullOrEmpty(listEntry.MasterPage.PageURL)) { objListItem["Page_URL"] = listEntry.MasterPage.PageURL; } objListItem["Page_Owner"] = listEntry.MasterPage.PageOwner; objListItem.Update(); /// Update the DWB Template list - Has_MasterPage column TemplateDAL objTemplateDAL = new TemplateDAL(); objTemplateDAL.UpdateHasMasterPageColumn(siteURL, TEMPLATELIST, strTemplateIds[i], 1); strTemplatePageMappingRowId.Append(objListItem["ID"].ToString() + ";"); } } web.AllowUnsafeUpdates = false; } } }); return strTemplatePageMappingRowId.ToString(); }
/// <summary> /// Gets the Master Pages for the selected Template /// </summary> /// <param name="siteUrl">Site URL.</param> /// <param name="listName">List Name (DWB Template).</param> /// <param name="queryString">CAML Query.</param> /// <param name="viewFields">View Fields.</param> /// <returns>List Entry object with TemplateConfiguration values assigned.</returns> /// <exception cref="">Handled in calling method.</exception> internal ListEntry GetMasterPageDetail(string siteUrl, string listName, string queryString, string viewFields) { ListEntry objListEntry = null; SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(siteUrl)) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; SPList list = web.Lists[listName]; SPQuery query = new SPQuery(); query.Query = queryString; query.ViewFields = viewFields; SPListItemCollection listItems = list.GetItems(query); if (listItems != null) { objListEntry = new ListEntry(); MasterPageDetails objMasterPageDetails = new MasterPageDetails(); foreach (SPListItem item in listItems) { objMasterPageDetails.RowId = Convert.ToInt32(item["ID"]);//ID objMasterPageDetails.AssetType = Convert.ToString(item["Asset_Type"]);//Asset_Type objMasterPageDetails.ConnectionType = Convert.ToString(item["Connection_Type"]);// Connection_Type objMasterPageDetails.PageOwner = Convert.ToString(item["Page_Owner"]); //Page_Owner objMasterPageDetails.PageSequence = Convert.ToInt32(item["Page_Sequence"]);//Page_Sequence objMasterPageDetails.PageURL = Convert.ToString(item["Page_URL"]);//Page_URL objMasterPageDetails.SignOffDiscipline = Convert.ToString(item["Discipline"]);//Discipline objMasterPageDetails.SOP = Convert.ToString(item["Standard_Operating_Procedure"]);//Standard_Operating_Procedure objMasterPageDetails.TemplateTitle = Convert.ToString(item["Page_Title_Template"]);//Page_Title_Template objMasterPageDetails.Templates = Convert.ToString(item["Template_ID"]);//Template_ID objMasterPageDetails.Name = Convert.ToString(item["Master_Page_Name"]);//Master_Page_Name objMasterPageDetails.MasterPageID = Convert.ToString(item["Master_Page_ID"]);//Master_Page_ID objListEntry.MasterPage = objMasterPageDetails; } } web.AllowUnsafeUpdates = false; } } }); return objListEntry; }
/// <summary> /// Handles the Click event of the cmdSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void CmdSave_Click(object sender, EventArgs e) { /// Update the DWB Template Master Pages list for current list of Master Pages /// Update the DWB Master Page list for Template_ID column [update for new for addition and removal of a master page from Template try { if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING])) { int intSelectedTemplateID = Int32.Parse(HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING]); ArrayList arlTemplateConfigurations = new ArrayList(); objTemplateData = new ListEntry(); TemplateDetails objTemplateDetails = new TemplateDetails(); objTemplateDetails.RowId = intSelectedTemplateID; objTemplateDetails.Title = lblTemplateTitle.Text.Trim(); objTemplateDetails.AssetType = hdnTemplateType.Value; objTemplateData.TemplateDetails = objTemplateDetails; arlTemplateConfigurations = SetTemplateConfiguration(intSelectedTemplateID); objTemplateData.TemplateConfiguration = arlTemplateConfigurations; UpdateListEntry(objTemplateData, TEMPLATEPAGESMAPPINGLIST, TEMPLATECONFIGURATIONAUDIT, TEMPLATEPAGEMAPPING, AUDITACTIONUPDATION); /// Update the DWB Master Pages list for the MasterPages referenced in the new template UpdateListEntry(objTemplateData, MASTERPAGELIST, MASTERPAGEAUDITLIST, MASTERPAGETEMPLATEMAPPING, AUDITACTIONUPDATION); Response.Redirect(MAINTAINTEMPLATEPAGESURL + "?"+ IDVALUEQUERYSTRING+"=" + HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING],false); } } catch (WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Add page to the chapter /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="objListentry">ListEntry object.</param> /// <param name="listName">Name of the list.</param> /// <param name="auditListName">Name of the audit list.</param> /// <param name="username">Windows User ID.</param> /// <param name="actionPerformed">Audit Action ID</param> public void AddPageToChapters(string siteURL, ListEntry objListentry, string listName, string auditListName, string username, string actionPerformed) { objWellBookChapterDAL = new WellBookChapterDAL(); string strPageID = objWellBookChapterDAL.AddPageToChapter(siteURL, objListentry, listName, auditListName, username, actionPerformed); if (!string.IsNullOrEmpty(strPageID) && objListentry != null && objListentry.ChapterPagesMapping != null) { StoryBoard objStoryBoard = new StoryBoard(); objStoryBoard.PageId = Int32.Parse(strPageID); objStoryBoard.PageOwner = objListentry.ChapterPagesMapping[0].PageOwner; objStoryBoard.PageType = objListentry.ChapterPagesMapping[0].AssetType; objStoryBoard.SOP = objListentry.ChapterPagesMapping[0].StandardOperatingProc; objStoryBoard.PageTitle = objListentry.ChapterPagesMapping[0].PageName; objStoryBoard.Discipline = objListentry.ChapterPagesMapping[0].Discipline; objStoryBoard.ConnectionType = objListentry.ChapterPagesMapping[0].ConnectionType; objStoryBoard.MasterPageName = objListentry.ChapterPagesMapping[0].PageActualName; objStoryBoard.CreatedBy = objListentry.ChapterPagesMapping[0].Created_By; objStoryBoard.CreationDate = objListentry.ChapterPagesMapping[0].Created_Date; string strCAMLQuery = @"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>" + strPageID + "</Value></Eq></Where>"; objWellBookChapterDAL.UpdateStoryBoard(siteURL, DWBSTORYBOARD, CHAPTERPAGESMAPPINGAUDITLIST, strCAMLQuery, strPageID, objStoryBoard, actionPerformed, username); } }
/// <summary> /// Updates comments for Well Book Page. /// </summary> /// <param name="parentSiteURL">The site URL.</param> /// <param name="listName">Name of the list.</param> /// <param name="auditListName">Audit List Name.</param> /// <param name="listEntry">ListEntry object contains the Comments.</param> /// <param name="actionPerformed">Audit action.</param> /// <returns>True/False</returns> /// <exception cref="">Handled in calling method.</exception> internal bool UpdateComments(string siteURL, string listName, string auditListName, ListEntry listEntry, string actionPerformed) { SPList list; SPListItem objListItem; SPFieldLookupValue lookupField; bool blnUpdateSuccess = false; SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(siteURL)) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; list = web.Lists[listName]; if (string.Compare(AUDIT_ACTION_COMMENT_ADDED, actionPerformed, true) == 0) { if (listEntry != null && listEntry.PageComments != null) { objListItem = list.Items.Add(); objListItem["Page_ID"] = Convert.ToInt32(listEntry.PageComments.PageID); objListItem["UserName"] = listEntry.PageComments.UserName; objListItem["Comment"] = listEntry.PageComments.Comments; /// Lookup column if (!string.IsNullOrEmpty(listEntry.PageComments.DisciplineID)) { lookupField = new SPFieldLookupValue(listEntry.PageComments.DisciplineID); objListItem["Discipline"] = lookupField; } objListItem["Shared"] = listEntry.PageComments.ShareComments; objListItem.Update(); objCommonDAL = new CommonDAL(); objCommonDAL.UpdateListAuditHistory(siteURL, auditListName, Int32.Parse(listEntry.PageComments.PageID), listEntry.PageComments.UserName, actionPerformed); blnUpdateSuccess = true; } } web.AllowUnsafeUpdates = false; } } }); return blnUpdateSuccess; }
/// <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="auditListName">Audit List Name.</param> /// <param name="userName">User Name.</param> /// <param name="actionPerformed">Audit Action.</param> /// <returns>ID of the Chapter Created/Updated.</returns> /// <exception cref="">Handled in calling method.</exception> internal string UpdateListEntry(string siteURL, ListEntry listEntry, string listName, string auditListName, string userName, string actionPerformed) { SPList list; SPQuery query; SPListItem objListItem; SPListItemCollection objListItemCollection; SPFieldLookupValue lookupField; int intPageSequence = 10; int intListItemId = 0; string strListGuid = string.Empty; StringBuilder sbMethodBuilder = new StringBuilder(); string strChapterID = string.Empty; string strBatch = string.Empty; string strBatchFormat = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<ows:Batch OnError=\"Return\">{0}</ows:Batch>"; string strMethodFormat = "<Method ID=\"{0}\">" + "<SetList>{1}</SetList>" + "<SetVar Name=\"Cmd\">Save</SetVar>" + "<SetVar Name=\"ID\">{2}</SetVar>" + "<SetVar Name=\"urn:schemas-microsoft-com:office:office#Chapter_Sequence\">{3}</SetVar>" + "</Method>"; SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(siteURL)) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; list = web.Lists[listName]; query = new SPQuery(); strListGuid = list.ID.ToString(); objListItem = list.Items.Add(); if (string.Equals(actionPerformed, AUDIT_ACTION_UPDATION)) { objListItem = list.GetItemById(listEntry.ChapterDetails.RowID); } objListItem["Title"] = listEntry.ChapterDetails.ChapterTitle; objListItem["Asset_Value"] = listEntry.ChapterDetails.AssetValue; objListItem["Actual_Asset_Value"] = listEntry.ChapterDetails.ActualAssetValue; objListItem["Country"] = listEntry.ChapterDetails.Country; objListItem["Criteria"] = listEntry.ChapterDetails.Criteria; objListItem["Column_Name"] = listEntry.ChapterDetails.ColumnName; objListItem["Book_ID"] = listEntry.ChapterDetails.BookID; if (!string.IsNullOrEmpty(listEntry.ChapterDetails.AssetType)) { lookupField = new SPFieldLookupValue(Convert.ToInt32(listEntry.ChapterDetails.AssetType), ""); objListItem["Asset_Type"] = lookupField; } objListItem["Chapter_Description"] = listEntry.ChapterDetails.ChapterDescription; objListItem["Template_ID"] = listEntry.ChapterDetails.TemplateID; if (!string.IsNullOrEmpty(listEntry.ChapterDetails.Terminated)) { objListItem["Terminate_Status"] = listEntry.ChapterDetails.Terminated; } objListItem.Update(); strChapterID = objListItem["ID"].ToString(); listEntry.ChapterDetails.RowID = int.Parse(objListItem["ID"].ToString()); string strNoOfActiveChapters = string.Empty; if (string.Equals(actionPerformed, AUDIT_ACTION_CREATION)) { query.Query = @"<OrderBy><FieldRef Name='Chapter_Sequence' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" + listEntry.ChapterDetails.BookID.ToString() + "</Value></Eq></And></Where>"; objListItemCollection = list.GetItems(query); if (objListItemCollection != null && objListItemCollection.Count > 0) { strNoOfActiveChapters = objListItemCollection.Count.ToString(); for (int intIndex = 0; intIndex < objListItemCollection.Count; intIndex++) { int.TryParse(Convert.ToString(objListItemCollection[intIndex]["ID"]), out intListItemId); if (intListItemId != listEntry.ChapterDetails.RowID) { intPageSequence = intPageSequence + 10; sbMethodBuilder.AppendFormat(strMethodFormat, intListItemId, strListGuid, intListItemId, intPageSequence); } else { sbMethodBuilder.AppendFormat(strMethodFormat, intListItemId, strListGuid, intListItemId, 10); } } strBatch = string.Format(strBatchFormat, sbMethodBuilder.ToString()); web.ProcessBatchData(strBatch); } objCommonDAL = new CommonDAL(); /// Update the DWB Books list with no of active chapters objCommonDAL.UpdateNoOfActiveChapters(siteURL, DWBBOOKLIST, listEntry.ChapterDetails.BookID.ToString(), strNoOfActiveChapters.ToString()); } web.AllowUnsafeUpdates = false; objCommonDAL = new CommonDAL(); objCommonDAL.UpdateListAuditHistory(siteURL, auditListName, listEntry.ChapterDetails.RowID, userName, actionPerformed); } } }); return strChapterID; }
/// <summary> /// Gets the Chapter Details. /// </summary> /// <param name="parentSiteUrl">Site URL.</param> /// <param name="listName">List Name.</param> /// <param name="queryString">CAML Query.</param> /// <returns>ListEntry Object.</returns> /// <exception cref="">Handled in calling method.</exception> internal ListEntry GetChapterDetails(string siteURL, string listName, string queryString) { ListEntry objListEntry = null; DataTable objListItems = null; DataRow objListRow; int intTemplateId = 0; int intBookId = 0; ChapterDetails objChapterDetails = null; try { objCommonDAL = new CommonDAL(); objListItems = objCommonDAL.ReadList(siteURL, listName, queryString); if (objListItems != null) { objListEntry = new ListEntry(); objChapterDetails = new ChapterDetails(); for (int index = 0; index < objListItems.Rows.Count; index++) { objListRow = objListItems.Rows[index]; objChapterDetails.ChapterTitle = objListRow["Title"].ToString(); objChapterDetails.AssetValue = Convert.ToString(objListRow["Asset_Value"]); objChapterDetails.Country = Convert.ToString(objListRow["Country"]); objChapterDetails.Criteria = Convert.ToString(objListRow["Criteria"]); objChapterDetails.ColumnName = Convert.ToString(objListRow["Column_Name"]); if (objListRow["Chapter_Sequence"] != DBNull.Value) { objChapterDetails.ChapterSequence = Convert.ToInt32(objListRow["Chapter_Sequence"]); } int.TryParse(Convert.ToString(objListRow["Book_ID"]), out intBookId); objChapterDetails.BookID = intBookId; objChapterDetails.AssetType = Convert.ToString(objListRow["Asset_Type"]); objChapterDetails.ChapterDescription = Convert.ToString(objListRow["Chapter_Description"]); int.TryParse(Convert.ToString(objListRow["Template_ID"]), out intTemplateId); objChapterDetails.TemplateID = intTemplateId; objChapterDetails.Terminated = Convert.ToString(objListRow["Terminate_Status"]); objListEntry.ChapterDetails = objChapterDetails; } } return objListEntry; } finally { if (objListItems != null) objListItems.Dispose(); } }
/// <summary> /// Gets the Master Page Information from ChapterPage mapping List based on the CAML Query. /// </summary> /// <param name="parentSiteUrl">Site URL.</param> /// <param name="listName">List Name.</param> /// <param name="queryString">CAML Query.</param> /// <returns>ListEntry object.</returns> /// <exception cref="">Handled in calling method.</exception> internal ListEntry SetChapterPage(string siteURL, string listName, string queryString) { ListEntry objListEntry = null; DataTable objListItems = null; DataRow objListRow; int intRowId = 0; MasterPageDetails objMasterpage = null; ChapterDetails objChapterDetails = null; try { objCommonDAL = new CommonDAL(); objListItems = objCommonDAL.ReadList(siteURL, listName, queryString); if (objListItems != null) { objListEntry = new ListEntry(); objMasterpage = new MasterPageDetails(); for (int index = 0; index < objListItems.Rows.Count; index++) { objListRow = objListItems.Rows[index]; objMasterpage.Name = Convert.ToString(objListRow["Page_Name"]); objMasterpage.TemplateTitle = Convert.ToString(objListRow["Page_Actual_Name"]); if (objListRow["Page_Sequence"] != DBNull.Value) { objMasterpage.PageSequence = Convert.ToInt32(objListRow["Page_Sequence"]); } objMasterpage.SOP = Convert.ToString(objListRow["Standard_Operating_Procedure"]); objMasterpage.AssetType = Convert.ToString(objListRow["Asset_Type"]); objMasterpage.ConnectionType = Convert.ToString(objListRow["Connection_Type"]); objMasterpage.SignOffDiscipline = Convert.ToString(objListRow["Discipline"]); objChapterDetails = new ChapterDetails(); int.TryParse(Convert.ToString(objListRow["Chapter_ID"]), out intRowId); objChapterDetails.RowID = intRowId; int.TryParse(Convert.ToString(objListRow["ID"]), out intRowId); objMasterpage.RowId = intRowId; objListEntry.ChapterDetails = objChapterDetails; objListEntry.MasterPage = objMasterpage; } } return objListEntry; } finally { if (objListItems != null) objListItems.Dispose(); } }
/// <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> /// Adds the Pages to the Chapter Directly. /// </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="auditListName">Audit List Name.</param> /// <param name="userName">User Name.</param> /// <param name="actionPerformed">Audit Action.</param> /// <returns>ID of the Chapter Page Created.</returns> /// <exception cref="">Handled in calling method.</exception> internal string AddPageToChapter(string siteURL, ListEntry listEntry, string listName, string auditListtname, string username, string actionPerformed) { string strPageID = string.Empty; SPList list; SPListItem objListItem; int intRowId = 0; int intPageSequence = 0; DataTable dtlistItem = null; int intMappingRowId = 0; DataView dtDataView = null; SPQuery query; string strCamlQuery = string.Empty; try { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(siteURL)) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; list = web.Lists[listName]; objCommonDAL = new CommonDAL(); for (int i = 0; i < listEntry.ChapterPagesMapping.Count; i++) { objListItem = list.Items.Add(); objListItem["Master_Page_ID"] = listEntry.ChapterPagesMapping[i].MasterPageID; objListItem["Page_Actual_Name"] = listEntry.ChapterPagesMapping[i].PageActualName; objListItem["Page_Name"] = listEntry.ChapterPagesMapping[i].PageName; objListItem["Owner"] = listEntry.ChapterPagesMapping[i].PageOwner; objListItem["Discipline"] = listEntry.ChapterPagesMapping[i].Discipline; objListItem["Chapter_ID"] = listEntry.ChapterDetails.RowID; objListItem["Asset_Type"] = listEntry.ChapterPagesMapping[i].AssetType; if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].Empty)) objListItem["Empty"] = listEntry.ChapterPagesMapping[i].Empty; objListItem["Page_Sequence"] = listEntry.ChapterPagesMapping[i].PageSequence; if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].SignOffStatus)) { objListItem["Sign_Off_Status"] = listEntry.ChapterPagesMapping[i].SignOffStatus; } objListItem["Connection_Type"] = listEntry.ChapterPagesMapping[i].ConnectionType; objListItem["Standard_Operating_Procedure"] = listEntry.ChapterPagesMapping[i].StandardOperatingProc; if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].PageURL)) { objListItem["Page_URL"] = listEntry.ChapterPagesMapping[i].PageURL; } objListItem.Update(); /// Assing the Item ID to return strPageID = Convert.ToString(objListItem["ID"]); int.TryParse(Convert.ToString(objListItem["ID"]), out intRowId); listEntry.ChapterPagesMapping[i].RowId = intRowId; strCamlQuery = @"<Where><Eq><FieldRef Name='Chapter_ID' /><Value Type='Number'>" + listEntry.ChapterDetails.RowID + "</Value></Eq></Where>"; query = new SPQuery(); query.Query = strCamlQuery; query.ViewFields = @"<FieldRef Name='Chapter_ID' /><FieldRef Name='ID' /><FieldRef Name='Page_Sequence' />"; dtlistItem = list.GetItems(query).GetDataTable(); if (dtlistItem != null && dtlistItem.Rows.Count > 0) { dtDataView = dtlistItem.DefaultView; dtDataView.Sort = "Page_Sequence asc"; for (int j = 0; j < dtDataView.Count; j++) { intPageSequence = intPageSequence + 10; intMappingRowId = (int)dtDataView[j]["ID"]; if (intMappingRowId != intRowId) { objListItem = list.GetItemById(intMappingRowId); objListItem["Page_Sequence"] = intPageSequence; objListItem.Update(); } } } objCommonDAL.UpdateListAuditHistory(siteURL, auditListtname, intRowId, username, actionPerformed); } web.AllowUnsafeUpdates = false; } } }); } finally { if (dtlistItem != null) dtlistItem.Dispose(); } return strPageID; }
/// <summary> /// Sets the list entry Data object. /// </summary> private void SetListEntry() { objListEntry = new ListEntry(); objListEntry.WellBookDetails = SetWellBookDetails(); }
/// <summary> /// Add/Remove the staffs in a team /// </summary> /// <param name="siteUrl">Site URL.</param> /// <param name="listEntry">List Entry object.</param> /// <param name="listName">List Name.</param> public void UpdateStaffsInTeam(string siteUrl, ListEntry listEntry, string listName) { objTeamStaffRegistrationDAL = new TeamStaffRegistrationDAL(); objTeamStaffRegistrationDAL.UpdateStaffsInTeam(siteUrl, listEntry, listName); }
/// <summary> /// Updates the list entry. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="listEntry">The list entry.</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 UpdateListEntry(string siteURL, ListEntry listEntry, string auditListName, string listName, string userName, string actionPerformed) { objWellBookChapterDAL = new WellBookChapterDAL(); objCommonDAL = new CommonDAL(); string strChapterID = objWellBookChapterDAL.UpdateListEntry(siteURL, listEntry, listName, auditListName, userName, actionPerformed); if (listEntry != null && listEntry.ChapterPagesMapping != null) { if (listEntry.ChapterPagesMapping.Count > 0 && actionPerformed.Contains(AUDIT_ACTION_CREATION)) { objWellBookChapterDAL.AddChapterMasterPageMapping(siteURL, listEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, userName, actionPerformed); string strCAMLQuery = string.Empty; DataTable dtChapterPages = null; DataTable dtMasterPage = null; DataTable dtTemplate = null; string strViewFields = string.Empty; int intMasterPageID; if (!string.IsNullOrEmpty(strChapterID)) { strCAMLQuery = @"<Where><Eq><FieldRef Name='Chapter_ID'/><Value Type='Number'>" + strChapterID + "</Value></Eq></Where>"; dtChapterPages = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCAMLQuery); } if (dtChapterPages != null && dtChapterPages.Rows.Count > 0) { foreach (DataRow dtRow in dtChapterPages.Rows) { StoryBoard objStoryBoard = new StoryBoard(); objStoryBoard.PageId = Int32.Parse(dtRow["ID"].ToString()); objStoryBoard.PageOwner = dtRow["Owner"].ToString(); objStoryBoard.PageType = dtRow["Asset_Type"].ToString(); objStoryBoard.SOP = dtRow["Standard_Operating_Procedure"].ToString(); objStoryBoard.PageTitle = dtRow["Page_Actual_Name"].ToString(); objStoryBoard.Discipline = dtRow["Discipline"].ToString(); objStoryBoard.ConnectionType = dtRow["Connection_Type"].ToString(); intMasterPageID = Int32.Parse(dtRow["Master_Page_ID"].ToString()); strCAMLQuery = string.Empty; strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + intMasterPageID.ToString() + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='ID'/><FieldRef Name='Master_Page_ID'/>"; dtTemplate = objCommonDAL.ReadList(siteURL, DWBTEMPLATEPAGESLIST, strCAMLQuery, strViewFields); if (dtTemplate != null && dtTemplate.Rows.Count > 0) { intMasterPageID = Int32.Parse(dtTemplate.Rows[0]["Master_Page_ID"].ToString()); } strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + intMasterPageID.ToString() + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='ID'/><FieldRef Name='Page_Owner'/><FieldRef Name='Created'/><FieldRef Name='Title'/>"; dtMasterPage = objCommonDAL.ReadList(siteURL, DWBMASTERPAGESLIST, strCAMLQuery, strViewFields); if (dtMasterPage != null && dtMasterPage.Rows.Count > 0) { objStoryBoard.MasterPageName = dtMasterPage.Rows[0]["Title"].ToString(); objStoryBoard.CreatedBy = dtMasterPage.Rows[0]["Page_Owner"].ToString(); objStoryBoard.CreationDate = dtMasterPage.Rows[0]["Created"].ToString(); } strCAMLQuery = string.Empty; strCAMLQuery = @"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>" + objStoryBoard.PageId.ToString() + "</Value></Eq></Where>"; objWellBookChapterDAL.UpdateStoryBoard(siteURL, DWBSTORYBOARD, CHAPTERPAGESMAPPINGAUDITLIST, strCAMLQuery, objStoryBoard.PageId.ToString(), objStoryBoard, actionPerformed, userName); } } if (dtChapterPages != null) { dtChapterPages.Dispose(); } if (dtMasterPage != null) { dtMasterPage.Dispose(); } } } }
/// <summary> /// Add/Update the Team details /// </summary> /// <param name="siteUrl">Site URL.</param> /// <param name="listEntry">List Entry object.</param> /// <param name="listName">List Name.</param> /// <param name="actionPerformed">Audit Action.</param> /// <returns>True/False.</returns> public bool UpdateTeamListEntry(string siteUrl, ListEntry listEntry, string listName, string actionPerformed) { objTeamStaffRegistrationDAL = new TeamStaffRegistrationDAL(); return objTeamStaffRegistrationDAL.UpdateTeamListEntry(siteUrl, listEntry, listName, actionPerformed); }
/// <summary> /// Loads the Well Book Pages data in the UI controls. /// Based on the book id passed in the query string. /// </summary> private void LoadWellBookData() { DataTable dtBookSummary = null; StringBuilder strChapterId = new StringBuilder(); string strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + strWellBookId + "</Value></Eq></Where>"; /// Get the Book Details for the selected Book Id and populate the controls with data objListEntry = GetDetailsForSelectedID(strWellBookId, DWBBOOKLIST, WELLBOOK); txtOwner.Text = objListEntry.WellBookDetails.BookOwner; txtOwner.Enabled = false; txtTeam.Text = objListEntry.WellBookDetails.Team; txtTeam.Enabled = false; txtSignOffStatus.Text = objListEntry.WellBookDetails.SignOffStatus; txtSignOffStatus.Enabled = false; #region DREAM 4.0 - eWB 2.0 - Customise Chapters strWellBookName = objListEntry.WellBookDetails.Title; #endregion if (objListEntry.WellBookDetails.SignOffStatus.ToLowerInvariant().Equals(STATUSSIGNEDOFF)) { hdnSelectedStatus.Value = STATUSTERMINATED; btnSignOff.Text = CANCELSIGNOFF; } else { hdnSelectedStatus.Value = STATUSACTIVE; btnSignOff.Text = SIGNOFF; } btnSignOff.Visible = false; btnBatchImport.Visible = false; blnShowWellSummaryTable = false; btnPrint.Visible = true; /// Show/Hide the SignOff,Pring Button and Book Summary if (ShowButton(WELLBOOKVIEWERCONTROLBOOK, objListEntry.WellBookDetails.BookOwner, objListEntry.WellBookDetails.TeamID, string.Empty, string.Empty)) { blnShowWellSummaryTable = true; //Modefied By: Gopinath //Date : 04-11-2010 //Below line of code commented due to the V.2 requirement as Page Owner also can do the print. //btnPrint.Visible = true; btnSignOff.Visible = true; //Added By Gopinath //Date : 17/11/2010 btnBatchImport.Visible = true; } //Modefied By: Gopinath //Date : 04-11-2010 //Below line of code commented due to the V.2 requirement as Page Owner also can do the print //But not DWB User. If Book owner is normal user or DWB User then it returns true if (IsUserAsDWBUserAndPageOwner(strWellBookId, objListEntry.WellBookDetails.BookOwner)) { btnPrint.Visible = false; } /// Show/Hide the Book Summary if (blnShowWellSummaryTable) { /// Get the well book summary for the selected book and bid to the gridview dtBookSummary = GetWellBookSummary(strWellBookId); grdWellBookSummary.CssClass = WELLBOOKSUMMARYCSS; grdWellBookSummary.EnableViewState = true; grdWellBookSummary.HeaderStyle.CssClass = FIXEDHEADERCSS; grdWellBookSummary.HeaderStyle.Height = new Unit(20, UnitType.Pixel); grdWellBookSummary.RowStyle.CssClass = EVENROWSTYLECSS; grdWellBookSummary.AlternatingRowStyle.CssClass = ODDROWSTYLECSS; grdWellBookSummary.Attributes.Add(BORDERCOLOR, BORDERCOLORVALUE);//modified for eWB2 rebranding grdWellBookSummary.DataSource = dtBookSummary; grdWellBookSummary.DataBind(); } else /// For users who are != BO/AD shows the summary of pages owned by the logged in user. [PageOwner summary CR implementation] { dtBookSummary = GetWellBookSummary(strWellBookId); if (dtBookSummary != null && dtBookSummary.Rows.Count > 0) { DataView dtPageOwnerView = dtBookSummary.DefaultView; /// Filter the summary table for the logged in user. dtPageOwnerView.RowFilter = "Page_Owner ='" + GetUserName() + "'"; /// Convert the Dataview to DataTable if (dtPageOwnerView != null && dtPageOwnerView.Count > 0) { dtBookSummary = null; dtBookSummary = dtPageOwnerView.ToTable(); } /// If the Summary table contains Rows > 0 bind to to datagrid. if (dtBookSummary != null && dtBookSummary.Rows.Count > 0) { grdWellBookSummary.CssClass = WELLBOOKSUMMARYCSS; grdWellBookSummary.EnableViewState = true; grdWellBookSummary.HeaderStyle.CssClass = FIXEDHEADERCSS; grdWellBookSummary.HeaderStyle.Height = new Unit(20, UnitType.Pixel); grdWellBookSummary.RowStyle.CssClass = EVENROWSTYLECSS; grdWellBookSummary.AlternatingRowStyle.CssClass = ODDROWSTYLECSS; grdWellBookSummary.Attributes.Add(BORDERCOLOR, BORDERCOLORVALUE);//modified for eWB2 rebranding grdWellBookSummary.DataSource = dtBookSummary; grdWellBookSummary.DataBind(); } } } if (dtBookSummary != null) dtBookSummary.Dispose(); }
/// <summary> /// page load event triggered by asp.net engine. Used to read query string /// and populate the UI controls. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { #region DREAM 4.0-eWB2.0-Customise Chapters if (radLstChapters != null && chkSelectDeselectAll != null) { btnCustomiseChapters.OnClientClick = "return OpeneWBChpaterReorderPopUp('diveWBCustomiseChapters','"+ radLstChapters.ClientID+"','"+ chkSelectDeselectAll.ClientID +"');"; chkSelectDeselectAll.Attributes.Add("onclick", "return SelectDeselectAll(this,'" + radLstChapters.ClientID + "');"); btnApply.OnClientClick = "return ReOrderItemsInSession(this,'" + radLstChapters.ClientID + "',true);"; btnApplyAndSave.OnClientClick = "return ReOrderItemsInSession(this,'" + radLstChapters.ClientID + "',false);"; } #endregion hdnSelectedStatus = new HiddenField(); hdnSelectedStatus.ID = "hdnSelectedStatus"; this.Controls.Add(hdnSelectedStatus); #region DREAM 4.0 - eWB 2.0 - Customise Chapters /// Populating the RadListBox in OnLoad. if (!Page.IsPostBack) { strWellBookId = HttpContext.Current.Request.QueryString["BookID"]; string strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + strWellBookId + "</Value></Eq></Where>"; /// Get the Book Details for the selected Book Id and populate the controls with data objListEntry = GetDetailsForSelectedID(strWellBookId, DWBBOOKLIST, WELLBOOK); if (objListEntry != null && objListEntry.WellBookDetails != null) { strWellBookName = objListEntry.WellBookDetails.Title; if (ShowButton(CUSTOMISECHAPTERS, objListEntry.WellBookDetails.BookOwner, objListEntry.WellBookDetails.TeamID, string.Empty, string.Empty)) { btnCustomiseChapters.Visible = true; radLstChapters.Items.Clear(); LoadChapterRadListBox(strWellBookId, radLstChapters); } } } /// EventTarget value is set and __doPostBack is called in case of Apply and Apply & Save click of Customise Chapter. /// __doPostBack is used instead of server click event since it should be notified to TreeViewControl.cs as well for repopulating /// the treeview in OnPreRender. if (this.Page.Request.Params[EVENTTARGET] != null) { strWellBookId = HttpContext.Current.Request.QueryString["BookID"]; string strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + strWellBookId + "</Value></Eq></Where>"; /// Get the Book Details for the selected Book Id and populate the controls with data objListEntry = GetDetailsForSelectedID(strWellBookId, DWBBOOKLIST, WELLBOOK); if (objListEntry != null && objListEntry.WellBookDetails != null) { strWellBookName = objListEntry.WellBookDetails.Title; } /// If Apply button is clicked. if (this.Page.Request.Params[EVENTTARGET].ToLowerInvariant().Equals("customisechaptersinsession")) { SaveCustomiseChapterPreferenceToSession(strWellBookId, strWellBookName, radLstChapters); } else if (this.Page.Request.Params[EVENTTARGET].ToLowerInvariant().Equals("customisechaptersforfuture")) { /// If Apply and Save button is clicked the changes are saved to document library as well as to Session SaveCustomiseChapterPreferenceToSession(strWellBookId, strWellBookName, radLstChapters); SaveReorderXml((string)HttpContext.Current.Session[CHAPTERPREFERENCEXML], strWellBookId); } } #endregion }
/// <summary> /// Signs Off book or Cancel Signs off the book. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSignOff_Click(object sender, EventArgs e) { objWellBookBLL = new WellBookBLL(); try { if (HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES] != null && ((TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]).IsBookSelected) { objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; strWellBookId = objTreeNodeSelection.BookID; } string strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + strWellBookId + "</Value></Eq></Where>"; /// Get the Book Details for the selected Book Id and populate the controls with data objListEntry = GetDetailsForSelectedID(strWellBookId, DWBBOOKLIST, WELLBOOK); if (objListEntry != null && objListEntry.WellBookDetails != null) { #region DREAM 4.0 - eWB 2.0 - Customise Chapters strWellBookName = objListEntry.WellBookDetails.Title; #endregion if (objListEntry.WellBookDetails.SignOffStatus.ToLowerInvariant().CompareTo(STATUSSIGNEDOFF) == 0) { objWellBookBLL.ChangeSignOffStatus(strParentSiteURL, STATUSACTIVE, DWBBOOKLIST, GetUserName(), strWellBookId, AUDITACTIONUNSIGNEDOFF); } else { objWellBookBLL.ChangeSignOffStatus(strParentSiteURL, STATUSTERMINATED, DWBBOOKLIST, GetUserName(), strWellBookId, AUDITACTIONSIGNEDOFF); } } } catch (WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } finally { this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE); } }
/// <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="auditListName">Audit List Name.</param> /// <param name="userName">User Name.</param> /// <param name="actionPerformed">Audit Action.</param> /// <returns>ID of the Chapter Page Created.</returns> /// <exception cref="">Handled in calling method.</exception> internal string AddChapterMasterPageMapping(string siteURL, ListEntry listEntry, string listName, string auditListtname, string username, string actionPerformed) { SPList list; SPListItem objListItem; int intRowId = 0; StringBuilder strTemplatePageMappingRowId = new StringBuilder(); SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(siteURL)) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; list = web.Lists[listName]; objCommonDAL = new CommonDAL(); string strCAMLQuery = string.Empty; string strViewFields = string.Empty; string strBookTeamID = string.Empty; string strPageOwner = string.Empty; string strUserID = string.Empty; DataTable dtTeamStaff = null; DataTable dtBook = null; DataTable dtUser = null; if (listEntry != null) { /// Get the Team of the book if (listEntry.ChapterDetails != null) { strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + listEntry.ChapterDetails.BookID.ToString() + "</Value></Eq></Where>"; strViewFields =@"<FieldRef Name='ID' /><FieldRef Name='Team' /><FieldRef Name='Team_ID' />"; dtBook = objCommonDAL.ReadList(siteURL, DWBBOOKLIST, strCAMLQuery, strViewFields); if (dtBook != null && dtBook.Rows.Count > 0) { strBookTeamID = Convert.ToString(dtBook.Rows[0]["Team_ID"]); } } for (int i = 0; i < listEntry.ChapterPagesMapping.Count; i++) { strPageOwner = string.Empty; objListItem = list.Items.Add(); objListItem["Master_Page_ID"] = listEntry.ChapterPagesMapping[i].MasterPageID; objListItem["Page_Actual_Name"] = listEntry.ChapterPagesMapping[i].PageActualName; objListItem["Page_Name"] = listEntry.ChapterPagesMapping[i].PageName; objListItem["Discipline"] = listEntry.ChapterPagesMapping[i].Discipline; objListItem["Chapter_ID"] = listEntry.ChapterDetails.RowID; objListItem["Asset_Type"] = listEntry.ChapterPagesMapping[i].AssetType; if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].Empty)) objListItem["Empty"] = listEntry.ChapterPagesMapping[i].Empty; objListItem["Page_Sequence"] = listEntry.ChapterPagesMapping[i].PageSequence; if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].SignOffStatus)) { objListItem["Sign_Off_Status"] = listEntry.ChapterPagesMapping[i].SignOffStatus; } objListItem["Standard_Operating_Procedure"] = listEntry.ChapterPagesMapping[i].StandardOperatingProc; objListItem["Connection_Type"] = listEntry.ChapterPagesMapping[i].ConnectionType; if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].PageURL)) { objListItem["Page_URL"] = listEntry.ChapterPagesMapping[i].PageURL; } strCAMLQuery = string.Empty; strViewFields = string.Empty; /// Retrieve the User with Rank =1 for the selected Team(Book) and Discipline(MasterPage) , "DWB Team Staff" and assign to "Owner" column if (!string.IsNullOrEmpty(strBookTeamID) && !string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].Discipline)) { strCAMLQuery = @"<OrderBy><FieldRef Name='User_Rank' Ascending='TRUE' /></OrderBy><Where><And><And><Eq><FieldRef Name='Team_ID' /><Value Type='Number'>" + strBookTeamID + "</Value></Eq><Eq><FieldRef Name='Discipline' /><Value Type='Text'>" + listEntry.ChapterPagesMapping[i].Discipline + "</Value></Eq></And><Eq><FieldRef Name='User_Rank' /><Value Type='Number'>" + "1" + "</Value></Eq></And></Where>"; strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Team_ID' /><FieldRef Name='Discipline' /><FieldRef Name='User_Rank' /><FieldRef Name='User_ID' /><FieldRef Name='Title' />"; dtTeamStaff = objCommonDAL.ReadList(siteURL, DWBTEAMSTAFFLIST, strCAMLQuery, strViewFields); } if (dtTeamStaff != null && dtTeamStaff.Rows.Count > 0) { strUserID = Convert.ToString(dtTeamStaff.Rows[0]["User_ID"]); strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strUserID + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Windows_User_ID' />"; dtUser = objCommonDAL.ReadList(siteURL, DWBUSERLIST, strCAMLQuery, strViewFields); if (dtUser != null && dtUser.Rows.Count > 0) { strPageOwner = dtUser.Rows[0]["Windows_User_ID"].ToString(); } } if (!string.IsNullOrEmpty(strPageOwner)) { objListItem["Owner"] = strPageOwner; } else /// If no user with Rank =1 or no user for the selected discipline available, assign the Master Page Owner to "Owner" column { objListItem["Owner"] = listEntry.ChapterPagesMapping[i].PageOwner; } objListItem.Update(); int.TryParse(Convert.ToString(objListItem["ID"]), out intRowId); listEntry.ChapterPagesMapping[i].RowId = intRowId; objCommonDAL.UpdateListAuditHistory(siteURL, auditListtname, intRowId, username, actionPerformed); } } web.AllowUnsafeUpdates = false; if (dtBook != null) { dtBook.Dispose(); } if (dtTeamStaff != null) { dtTeamStaff.Dispose(); } if (dtUser != null) { dtUser.Dispose(); } } } }); return strTemplatePageMappingRowId.ToString(); }
/// <summary> /// Updates the Book Page details. /// </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="auditListName">Name of the audit list.</param> /// <param name="userName">Name of the user.</param> /// <param name="actionPerformed">The action performed.</param> public void UpdateBookPage(string siteURL, ListEntry listEntry, string listName, string auditListName, string userName, string actionPerformed) { objWellBookDAL = new WellBookDAL(); objWellBookDAL.UpdateBookPage(siteURL, listEntry, listName, auditListName, userName, actionPerformed); }
/// <summary> /// Saves the new ranks. /// </summary> /// <returns>bool</returns> private bool SaveNewRanks() { ListEntry objListEntry = new ListEntry(); objListEntry.TeamDetails = new TeamDetails(); objListEntry.TeamDetails.RowId = Int32.Parse(strSelectedID); objListEntry.Staffs = GetNewStaffRanks(); bool blnUpdateSuccess = UpdateListEntry(objListEntry, TEAMSTAFFLIST, STAFFRANK, AUDITACTIONUPDATION); return blnUpdateSuccess; }
/// <summary> /// Binds the UI controls. /// </summary> /// <param name="objMasterData">The obj master data.</param> private void SetUIControls(ListEntry objMasterData) { if (objMasterData != null && objMasterData.MasterPage != null) { txtPageTitle.Text = objMasterData.MasterPage.Name; int intIndexof = 0; if (!string.IsNullOrEmpty(objMasterData.MasterPage.TemplateTitle)) { intIndexof = objMasterData.MasterPage.TemplateTitle.IndexOf("$ -"); } if (intIndexof == -1) { txtTitleTemplate.Text = "$ - " + objMasterData.MasterPage.TemplateTitle; } else { txtTitleTemplate.Text = objMasterData.MasterPage.TemplateTitle; } BindDropDownList(cboAssetType, objMasterData.MasterPage.AssetType); cboAssetType.Enabled = false; BindDropDownList(cboDiscipline, objMasterData.MasterPage.SignOffDiscipline); txtSOP.Text = objMasterData.MasterPage.SOP; BindDropDownList(cboConnectionType, objMasterData.MasterPage.ConnectionType); cboConnectionType.Enabled = false; hdnListItemStatus.Value = objMasterData.MasterPage.Terminated; if (string.Compare(strListType,BOOKPAGES, true) == 0) { lstTemplates.Visible = false; lblTemplates.Visible = false; lblMasterPage.Text = string.Format("Edit Book Page: {0}", objListEntry.MasterPage.Name); if (objListEntry.ChapterDetails != null) ParentId = Convert.ToString(objListEntry.ChapterDetails.BookID); } else if (string.Compare(strListType,CHAPTERPAGES, true) == 0) { lstTemplates.Visible = false; lblTemplates.Visible = false; lblMasterPage.Text = string.Format("Edit Chapter Page: {0}", objListEntry.MasterPage.Name); if (objListEntry.ChapterDetails != null) ParentId = Convert.ToString(objMasterData.ChapterDetails.RowID); } else if (string.Compare(strListType,TEMPLATEMASTERPAGES, true) == 0) { lstTemplates.Visible = false; lblTemplates.Visible = false; if (objListEntry.MasterPage != null) { ParentId = objListEntry.MasterPage.Templates; } } else { string strCamlQuery = @"<Where><Eq><FieldRef Name='Asset_Type' /> <Value Type='Lookup'>" + objMasterData.MasterPage.AssetType + "</Value></Eq></Where>"; SetListValues(lstTemplates, TEMPLATELIST, strCamlQuery, objMasterData); lstTemplates.Enabled = false; } } }
/// <summary> /// Add/Update the Rank of the Staff based in Discipline in a Team /// </summary> /// <param name="siteUrl">Site URL.</param> /// <param name="listEntry">List Entry object.</param> /// <param name="listName">List Name.</param> /// <returns>True/False.</returns> public bool UpdateStaffsRank(string siteUrl, ListEntry listEntry, string listName) { objTeamStaffRegistrationDAL = new TeamStaffRegistrationDAL(); return objTeamStaffRegistrationDAL.UpdateStaffRank(siteUrl, listEntry, listName); }
/// <summary> /// Updates the Comments for the Selected Page /// </summary> /// <param name="siteUrl">Site URL.</param> /// <param name="listName">List Name.</param> /// <param name="auditListName">Name of Audit List.</param> /// <param name="listEntry">ListEntry object.</param> /// <param name="actionPerformed">ID of the Audit Action</param> /// <returns>bool</returns> public bool UpdatePageComments(string siteURL, string listName, string auditListName, ListEntry listEntry, string actionPerformed) { objWellBookChapterDAL = new WellBookChapterDAL(); return objWellBookChapterDAL.UpdateComments(siteURL, listName, auditListName, listEntry, actionPerformed); }
/// <summary> /// Binds the UI controls. /// </summary> /// <param name="objMasterData">The WellBookData object.</param> private void BindUIControls(ListEntry objWellBookData) { txtWellBookTitle.Text = objWellBookData.WellBookDetails.Title; cboTeam.ClearSelection(); BindDropDownList(cboTeam, objWellBookData.WellBookDetails.TeamID); cboTeam.Enabled = false; if (string.Equals(strMode, EDIT)) { if (!cboTeam.SelectedItem.Value.Contains(DROPDOWNDEFAULTTEXTNONE)) { string strCAMLQuery = @"<Where><Eq><FieldRef Name='Team_ID' /> <Value Type='Number'>" + cboTeam.SelectedItem.Value + "</Value></Eq></Where><OrderBy><FieldRef Name='Title' Ascending='True'/></OrderBy>"; BindDataToControls(cboOwner, TEAMSTAFFLIST, WELLBOOK, strCAMLQuery); cboOwner.Items.Insert(0,DROPDOWNDEFAULTTEXTNONE); BindDropDownList(cboOwner, objWellBookData.WellBookDetails.BookOwnerID); } lblWellBookHeading.Text = lblWellBookHeading.Text + objWellBookData.WellBookDetails.Title; } hdnListitemStatus.Value = objWellBookData.WellBookDetails.Terminated; }
/// <summary> /// Sets the master page details. /// </summary> private void GetMasterPageDetails() { switch (strListType) { case CHAPTERPAGES: objChapterBll = new ChapterBLL(); objListEntry = objChapterBll.GetChapterPages(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strSelectedID + "</Value></Eq></Where>"); break; case BOOKPAGES: objWellBook = new WellBookBLL(); objListEntry = objWellBook.GetBookPages(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strSelectedID + "</Value></Eq></Where>"); break; case TEMPLATEMASTERPAGES: { objTemplateBLL = new TemplateDetailBLL(); string strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strSelectedID + "</Value></Eq></Where>"; string strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Asset_Type' /><FieldRef Name='Connection_Type' /><FieldRef Name='Page_Owner' /><FieldRef Name='Page_Sequence' /><FieldRef Name='Page_URL' /><FieldRef Name='Discipline' /><FieldRef Name='Standard_Operating_Procedure' /><FieldRef Name='Page_Title_Template' /><FieldRef Name='Template_ID' /><FieldRef Name='Master_Page_Name' /><FieldRef Name='Master_Page_ID' />"; objListEntry = objTemplateBLL.GetMasterPageDetails(strParentSiteURL, TEMPLATEPAGESMAPPINGLIST, strCAMLQuery, strViewFields); break; } default: objListEntry = GetDetailsForSelectedID(strSelectedID, MASTERPAGELIST, MASTERPAGE); break; } }
/// <summary> /// Add/Update the User Privilieges in DWB User list /// </summary> /// <param name="siteUrl">Site URL</param> /// <param name="listEntry">ListEntry object</param> /// <param name="listName">List Name</param> /// <param name="actionPerformed">Audit Action</param> /// <returns>True/False</returns> public bool UpdatePrivileges(string siteUrl, ListEntry listEntry, string listName, string actionPerformed) { objUserDetailDAL = new UserRegistrationDAL(); return objUserDetailDAL.UpdatePrivileges(siteUrl, listEntry, listName, actionPerformed); }
/// <summary> /// Sets the list entry Data object. /// </summary> private void SetListEntry() { objListEntry = new ListEntry(); objListEntry.MasterPage = SetMasterPageDetails(); }