/// <summary> /// Gets the parent title for the selected item. /// </summary> /// <returns>Title of the selected item.</returns> protected string GetParentTitle() { string strTitle = string.Empty; string strCAMLQuery = string.Empty; string strFieldsToView = string.Empty; DataTable dtResultTable = null; switch (strReportName) { case TEMPLATEPAGESREPORT: { TemplateDetailBLL objTemplateDetail = new TemplateDetailBLL(); strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING] + "</Value></Eq></Where>"; ListEntry objTemplateListEntry = objTemplateDetail.GetTemplateDetail(strSiteURL, TEMPLATELIST, strCAMLQuery); if (objTemplateListEntry != null && objTemplateListEntry.TemplateDetails != null) { strTitle = objTemplateListEntry.TemplateDetails.Title; } break; } case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); ListEntry objTeamListEntry = objTeamStaffRegistrationBLL.GetTeamDetails(strSiteURL, HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING], TEAMLIST); if (objTeamListEntry != null && objTeamListEntry.TeamDetails != null) { strTitle = objTeamListEntry.TeamDetails.TeamName; } break; } case "Audit Trail": { if (HttpContext.Current.Request.QueryString["auditFor"] != null) strTitle = HttpContext.Current.Request.QueryString["auditFor"]; else strTitle = string.Empty; break; } case CHAPTERREPORT: case WELLBOOKPAGEVIEW: case CHAPTERPAGEMAPPINGREPORT: { strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + HttpContext.Current.Request.QueryString["BookId"] + "</Value></Eq></Where>"; objCommonBLL = new CommonBLL(); strFieldsToView = "<FieldRef Name='ID'/><FieldRef Name='Title'/>"; dtResultTable = objCommonBLL.ReadList(strSiteURL, WELLBOOKLIST, strCAMLQuery, strFieldsToView); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strTitle = Convert.ToString(dtResultTable.Rows[0]["Title"]); } break; } case CHAPTERPAGEREPORT: { string strBookId = string.Empty; strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + HttpContext.Current.Request.QueryString["ChapterID"] + "</Value></Eq></Where>"; objCommonBLL = new CommonBLL(); strFieldsToView = "<FieldRef Name='Title'/><FieldRef Name='Book_ID'/>"; dtResultTable = objCommonBLL.ReadList(strSiteURL, CHAPTERLIST, strCAMLQuery, strFieldsToView); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strTitle = Convert.ToString(dtResultTable.Rows[0]["Title"]); strBookId = Convert.ToString(dtResultTable.Rows[0]["Book_ID"]); } if (!string.IsNullOrEmpty(strBookId)) { strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strBookId + "</Value></Eq></Where>"; strFieldsToView = "<FieldRef Name='Title'/>"; dtResultTable = objCommonBLL.ReadList(strSiteURL, WELLBOOKLIST, strCAMLQuery, strFieldsToView); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strTitle = strTitle + " ( " + Convert.ToString(dtResultTable.Rows[0]["Title"]) + " )"; } } break; } } if (dtResultTable != null) { dtResultTable.Dispose(); } return strTitle; }
/// <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> /// Updates the master page details. /// </summary> private void UpdateMasterPageDetails() { string strActionPerformed = AUDITACTIONCREATION; if (string.Compare(strMode,EDIT) == 0) { strActionPerformed = AUDITACTIONUPDATION; } objUtility = new CommonUtility(); string strUserName = objUtility.GetUserName(); switch (strListType) { case BOOKPAGES: objWellBook = new WellBookBLL(); objWellBook.UpdateBookPage(strParentSiteURL, objListEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, strUserName, strActionPerformed); break; case CHAPTERPAGES: objWellBook = new WellBookBLL(); objWellBook.UpdateBookPage(strParentSiteURL, objListEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, strUserName, strActionPerformed); break; case TEMPLATEMASTERPAGES: objTemplateBLL = new TemplateDetailBLL(); objTemplateBLL.UpdateMasterPageDetail(strParentSiteURL, TEMPLATEPAGESMAPPINGLIST, TEMPLATECONFIGURATIONAUDIT, objListEntry, strActionPerformed, strUserName); break; default: UpdateListEntry(objListEntry, MASTERPAGELIST, MASTERPAGEAUDITLIST, MASTERPAGE, strActionPerformed); break; } }
/// <summary> /// Gets the details for selected ID. /// </summary> /// <param name="selectedID">The selected ID.</param> /// <param name="listName">Name of the list.</param> /// <param name="pageType">Type of the page.</param> /// <returns></returns> protected DWBDataObjects.ListEntry GetDetailsForSelectedID(string selectedID, string listName, string pageType) { string strQueryString; DWBDataObjects.ListEntry objListEntry = null; try { strQueryString = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + selectedID + "</Value></Eq></Where>"; switch (pageType) { case MASTERPAGE: { objMasterBLL = new MasterPageBLL(); objListEntry = objMasterBLL.SetMasterPageDetail(strParentSiteURL, listName, strQueryString); break; } case TEMPLATE: { objTemplateBLL = new TemplateDetailBLL(); objListEntry = objTemplateBLL.GetTemplateDetail(strParentSiteURL, listName, strQueryString); break; } case WELLBOOK: { objWellBookBLL = new WellBookBLL(); objListEntry = objWellBookBLL.GetWellBookDetail(strParentSiteURL, listName, strQueryString); break; } case CHAPTER: { objChapterBLL = new ChapterBLL(); objListEntry = objChapterBLL.SetChapterDetail(strParentSiteURL, listName, strQueryString); break; } case USERREGISTRATION: { UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); objListEntry = objUserRegistrationBLL.GetUserDetails(strParentSiteURL, selectedID, listName); break; } case TEAMREGISTRATION: case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); objListEntry = objTeamStaffRegistrationBLL.GetTeamDetails(strParentSiteURL, selectedID, listName); break; } } return objListEntry; } catch { throw; } }
/// <summary> /// Gets the list of items based on the CAML query and the fields to view. /// </summary> /// <param name="strListName"></param> /// <param name="strCamlQuery"></param> /// <param name="strFieldsView"></param> /// <returns></returns> protected void UpdateListItemSequence(string strListName, DataView dvUpdatedListItem, string strAuditListName, string strActionPerformed, string pageType) { CommonUtility objCommonUtility; ; try { switch (pageType) { case MASTERPAGE: case CHAPTERPAGEMAPPING: objMasterBLL = new MasterPageBLL(); objMasterBLL.UpdatepageSequence(strParentSiteURL, strListName, strAuditListName, dvUpdatedListItem, strActionPerformed); break; case CHAPTER: objChapterBLL = new ChapterBLL(); objCommonUtility = new CommonUtility(); objChapterBLL.UpdateChapterSequence(strParentSiteURL, strListName, strAuditListName, dvUpdatedListItem, strActionPerformed, objCommonUtility.GetUserName()); break; case TEMPLATEPAGESSEQUENCE: { objTemplateBLL = new TemplateDetailBLL(); objCommonUtility = new CommonUtility(); objTemplateBLL.UpdatePageSequence(strParentSiteURL, strListName, strAuditListName, strActionPerformed, objCommonUtility.GetUserName(), dvUpdatedListItem); break; } } } catch { throw; } }
/// <summary> /// Updates the list entry. /// </summary> /// <param name="listEntry">The list entry.</param> /// <param name="listName">Name of the list.</param> /// <param name="pageType">Type of the page.</param> protected bool UpdateListEntry(DWBDataObjects.ListEntry listEntry, string listName, string auditListName, string pageType, string actionPerformed) { bool blnUpdateSuccess = false; strUserName = GetUserName(); switch (pageType) { case MASTERPAGE: { objMasterBLL = new MasterPageBLL(); listEntry.MasterPage.PageOwner = strUserName; objMasterBLL.UpdateListEntry(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case TEMPLATE: { objTemplateBLL = new TemplateDetailBLL(); objTemplateBLL.UpdateListEntry(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case TEMPLATEPAGEMAPPING: { objTemplateBLL = new TemplateDetailBLL(); objTemplateBLL.UpdateTemplatePageMapping(strParentSiteURL, listEntry, listName, auditListName, strUserName, actionPerformed, listEntry.TemplateDetails.RowId.ToString()); break; } case MASTERPAGETEMPLATEMAPPING: { objTemplateBLL = new TemplateDetailBLL(); objTemplateBLL.UpdateTemplateIDinMasterPageList(strParentSiteURL, listEntry, listName, auditListName, strUserName, actionPerformed); break; } case WELLBOOK: { objWellBookBLL = new WellBookBLL(); objWellBookBLL.UpdateListEntry(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case CHAPTER: { objChapterBLL = new ChapterBLL(); objChapterBLL.UpdateListEntry(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case CHANGEPAGEOWNER: { objWellBookBLL = new WellBookBLL(); objWellBookBLL.UpdatePageOwner(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case PAGECOMMENTS: { objWellBookBLL = new WellBookBLL(); blnUpdateSuccess = objWellBookBLL.UpdatePageComments(strParentSiteURL, listName, auditListName, listEntry, actionPerformed); break; } } return blnUpdateSuccess; }
/// <summary> /// Gets the items already included /// </summary> /// <param name="lbxMasterPageList">DualList object</param> /// <param name="strListName">List name from where the Right box to populated</param> /// <param name="strPageType">Page where the Dual list control is used (Template/User Privileges/Staff Privileges)</param> protected void SetDualListRightBox(DualList dualLstMasterPages, string strListName, string strSelectedID, string strPageType) { DataTable objListData = null; DataRow objListRow; ListItem lstItem; DataView objlistSortedView; string strCAMLQuery = string.Empty; string strViewFields = string.Empty; try { switch (strPageType) { case TEMPLATEMASTERPAGES: { objTemplateBLL = new TemplateDetailBLL(); strCAMLQuery = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><Eq><FieldRef Name='Template_ID' /><Value Type='Number'>" + strSelectedID + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='Page_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Master_Page_Name' /><FieldRef Name='Master_Page_ID' />"; objListData = objTemplateBLL.GetMasterPageList(strParentSiteURL, strListName, strCAMLQuery, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { objlistSortedView = objListData.DefaultView; dualLstMasterPages.RightItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = string.Format("{0:0000}", objListRow["Page_Sequence"]) + "-" + objListRow["Master_Page_Name"].ToString(); lstItem.Value = objListRow[DWBIDCOLUMN].ToString(); dualLstMasterPages.RightItems.Add(lstItem); } } break; } case USERPRIVILEGES: { /// Get the Privileges string from DWB User List - strSelectedID string contains the Privileges from User List / Team Staff List /// Split the String with splitter ";" /// For each Privilege in User Record get Privilege from DWB System Privileges list / DWB Team Privileges List string[] privileges = strSelectedID.Split(SPLITTER, StringSplitOptions.None); /// Privilege_Abbr - Title column is used strViewFields = @"<FieldRef Name='Title'/><FieldRef Name='Privilege_Description'/><FieldRef Name='ID'/>"; if (privileges != null && privileges.Length > 0) { string strTempCAML = string.Empty; strCAMLQuery = string.Empty; if (privileges.Length == 1) { strCAMLQuery = @"<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[0] + "</Value></Eq>"; } else { for (int intIndex = privileges.Length; intIndex > 0; intIndex--) { if (intIndex == privileges.Length) { strTempCAML = string.Empty; strTempCAML = @"<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[intIndex - 1] + "</Value></Eq>"; strCAMLQuery = strTempCAML; } else if (intIndex == privileges.Length - 1) { strTempCAML = string.Empty; strTempCAML = @"<Or>" + strCAMLQuery + "<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[intIndex - 1] + "</Value></Eq>" + "</Or>"; strCAMLQuery = strTempCAML; } else { strTempCAML = string.Empty; strTempCAML = @"<Or>" + strCAMLQuery + "<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[intIndex - 1] + "</Value></Eq>" + "</Or>"; strCAMLQuery = strTempCAML; } } } strCAMLQuery = @"<Where>" + strCAMLQuery + "</Where>"; objCommonBLL = new CommonBLL(); objListData = objCommonBLL.ReadList(strParentSiteURL, strListName, strCAMLQuery, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { /// Loop through the values in Country List and finds the index of country user preference in List. dualLstMasterPages.RightItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = objListRow[PRIVILEGEDESCRIPTIONCOLUMN].ToString(); lstItem.Value = objListRow[DWBTITLECOLUMN].ToString(); dualLstMasterPages.RightItems.Add(lstItem); } } } break; } case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); objListData = objTeamStaffRegistrationBLL.GetStaffs(strParentSiteURL, strSelectedID, strListName); if (objListData != null && objListData.Rows.Count > 0) { /// Title column is renamed as User_Name dualLstMasterPages.RightItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = objListRow[DWBTITLECOLUMN].ToString(); lstItem.Value = objListRow[DWBIDCOLUMN].ToString() + SPLITTER_STRING + objListRow["User_ID"].ToString(); dualLstMasterPages.RightItems.Add(lstItem); } } break; } } } catch { throw; } finally { if (objListData != null) objListData.Dispose(); } }
/// <summary> /// Gets the items which are not included /// </summary> /// <param name="dualLstMasterPages">DualList object</param> /// <param name="strListName">List name from where the Right box to populated</param> /// <param name="strPageType">Page where the Dual list control is used (Template/User Privileges/Staff Privileges)</param> /// <param name="assetType">Asset Type if the Dual list box is used in Templates pages else string.Empty</param> protected void SetDualListLeftBox(DualList dualListBox, string strListName, string strPageType, string assetType) { DataTable objListData = null; DataRow objListRow; string strQuerystring = string.Empty; string strViewFields = string.Empty; ListItem lstItem; try { switch (strPageType) { case TEMPLATEMASTERPAGES: { objTemplateBLL = new TemplateDetailBLL(); strQuerystring = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><And><Eq><FieldRef Name='Asset_Type' /><Value Type='Lookup'>" + assetType + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>"; strViewFields = @"<FieldRef Name='Page_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Terminate_Status' />"; objListData = objTemplateBLL.GetMasterPageList(strParentSiteURL, strListName, strQuerystring, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { //Loop through the values in Country List and finds the index of country user preference in List. dualListBox.LeftItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = string.Format("{0:0000}", objListRow["Page_Sequence"]) + "-" + objListRow[DWBTITLECOLUMN].ToString(); lstItem.Value = string.Format("New{0}", objListRow[DWBIDCOLUMN].ToString()); dualListBox.LeftItems.Add(lstItem); } } break; } case USERPRIVILEGES: { /// Call the Team Privileges / System Privileges List to get the details objCommonBLL = new CommonBLL(); strQuerystring = string.Empty; /// Privilege_Abbr - Title column is used strViewFields = @"<FieldRef Name='Title'/><FieldRef Name='Privilege_Description'/><FieldRef Name='ID'/>"; objListData = objCommonBLL.ReadList(strParentSiteURL, strListName, strQuerystring, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { dualListBox.LeftItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = objListRow[PRIVILEGEDESCRIPTIONCOLUMN].ToString(); lstItem.Value = objListRow[DWBTITLECOLUMN].ToString(); dualListBox.LeftItems.Add(lstItem); } } break; } case STAFFREGISTRATION: { /// Call the DWB User List and populate with Active Users objCommonBLL = new CommonBLL(); strQuerystring = string.Empty; strViewFields = string.Empty; //strQuerystring = @"<Where><Eq><FieldRef Name='Terminate_Status'/><Value Type='Choice'>" + STATUSACTIVE + "</Value></Eq></Where>"; strQuerystring = @"<Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + STATUSACTIVE + "</Value></Eq><Neq><FieldRef Name='Discipline' /><Value Type='Lookup'>Administrator</Value></Neq></And></Where><OrderBy><FieldRef Name='DWBUserName' Ascending='True'/></OrderBy>"; strViewFields = @"<FieldRef Name='Terminate_Status'/><FieldRef Name='ID'/><FieldRef Name='DWBUserName'/>"; objListData = objCommonBLL.ReadList(strParentSiteURL, strListName, strQuerystring, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { dualListBox.LeftItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = Convert.ToString(objListRow["DWBUserName"]); lstItem.Value = Convert.ToString(objListRow[DWBIDCOLUMN]); dualListBox.LeftItems.Add(lstItem); } } break; } } } catch { throw; } finally { if (objListData != null) objListData.Dispose(); } }