/// <summary> /// Handles the Click event of the btnSearch 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 btnSearch_Click(object sender, EventArgs e) { DREAMDataObjects.RequestInfo objRequestInfo = null; try { if (string.Equals(btnSearch.Text, SEARCHBUTTONRESETTEXT)) { cboDWBCountry.Enabled = true; cboColumnName.Enabled = true; cboAssetType.Enabled = true; txtCriteria.Enabled = true; btnSearch.Text = SEARCHBUTTONDEFAULTTEXT; lstAssetValues.Items.Clear(); } else { string strXpath = string.Empty; string strSelectedAsset = cboAssetType.SelectedItem.Text; objChapter = new ChapterBLL(); //objRequestInfo = SetQuickDataObjects(cboDWBCountry.SelectedItem.Text, cboColumnName.SelectedItem.Value, txtCriteria.Text); objRequestInfo = SetQuickDataObjects(cboDWBCountry.SelectedItem.Value, cboColumnName.SelectedItem.Value, txtCriteria.Text); XmlDocument assetNodeList = objChapter.GetAssetValueForAssetType(objRequestInfo, strSelectedAsset); lblAssetValue.Text = strSelectedAsset; AssignValuesToDropDown(assetNodeList, lstAssetValues); cboDWBCountry.Enabled = false; cboColumnName.Enabled = false; cboAssetType.Enabled = false; txtCriteria.Enabled = false; btnSearch.Text = SEARCHBUTTONRESETTEXT; } } catch (XmlException xmlEx) { CommonUtility.HandleException(strParentSiteURL, xmlEx); } catch (SoapException soapEx) { lblException.Text = soapEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Adds the remove chapter nodes to the preference xml saved in document library. /// </summary> /// <param name="wellBookDetails">The well book details.</param> /// <param name="chapterPreference">The chapter preference.</param> /// <returns>XmlDocument</returns> private XmlDocument AddRemoveChapterNodes(XmlDocument wellBookDetails, XmlDocument chapterPreference) { if (wellBookDetails != null && wellBookDetails.ChildNodes.Count > 0 && chapterPreference != null && chapterPreference.ChildNodes.Count > 0) { /// add/remove chapters present in wellbookdetails but not in chapterpreference. XmlNodeList chapterNodesInTree = wellBookDetails.SelectNodes("/BookInfo/Chapter"); XmlNode chapterNodeInPreference = null; int intIndex = 1; foreach (XmlNode chapterNodeInTree in chapterNodesInTree) { chapterNodeInPreference = chapterPreference.SelectSingleNode("/BookInfo/Chapter[@ChapterID = '" + chapterNodeInTree.Attributes["ChapterID"].Value + "']"); if (chapterNodeInPreference == null) { /// Insert at the beginning XmlNode refChapterNode = chapterPreference.SelectSingleNode("/BookInfo/Chapter"); XmlElement newChapterElement = chapterPreference.CreateElement("Chapter"); XmlAttribute chapterIDAttribute = chapterPreference.CreateAttribute("ChapterID"); chapterIDAttribute.Value = chapterNodeInTree.Attributes["ChapterID"].Value; XmlAttribute chapterTitle = chapterPreference.CreateAttribute("ChapterTitle"); chapterTitle.Value = chapterNodeInTree.Attributes["ChapterTitle"].Value; XmlAttribute display = chapterPreference.CreateAttribute("Display"); display.Value = "True"; XmlAttribute chapterOrder = chapterPreference.CreateAttribute("ChapterOrder"); chapterOrder.Value = intIndex.ToString(); intIndex++; newChapterElement.Attributes.Append(chapterIDAttribute); newChapterElement.Attributes.Append(chapterTitle); newChapterElement.Attributes.Append(display); newChapterElement.Attributes.Append(chapterOrder); chapterPreference.SelectSingleNode("/BookInfo").InsertBefore(newChapterElement, refChapterNode); } } /// remove chapters in chapterpreference but not in wellbookdetails. XmlNodeList chapterNodesInPreference = chapterPreference.SelectNodes("/BookInfo/Chapter"); XmlNode newChapterNodeInTree = null; foreach (XmlNode chapterNode in chapterNodesInPreference) { newChapterNodeInTree = wellBookDetails.SelectSingleNode("/BookInfo/Chapter[@ChapterID = '" + chapterNode.Attributes["ChapterID"].Value + "']"); if (newChapterNodeInTree == null) { /// Remove the node from preferencexml. chapterPreference.SelectSingleNode("/BookInfo").RemoveChild(chapterNode); } } } ChapterBLL objChapterBLL = new ChapterBLL(); objChapterBLL.SaveReorderXml(chapterPreference.OuterXml, HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]); return chapterPreference; }
/// <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> /// 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> /// Binds the data to controls. /// </summary> /// <param name="cboList">The cbo list.</param> /// <param name="listname">The listname.</param> /// <param name="pageType">Type of the page.</param> /// <param name="strCAMLQuery">The STR CAML query.</param> protected void BindDataToControls(DropDownList cboList, string listname, string pageType, string strCAMLQuery) { switch (pageType) { case WELLBOOK: objWellBookBLL = new WellBookBLL(); cboList.Items.Clear(); cboList.DataSource = objWellBookBLL.GetListItems(strParentSiteURL, listname, strCAMLQuery); cboList.DataTextField = "value"; cboList.DataValueField = "key"; cboList.DataBind(); break; case CHAPTER: objChapterBLL = new ChapterBLL(); cboList.Items.Clear(); cboList.DataSource = objChapterBLL.GetListItems(strParentSiteURL, listname, strCAMLQuery); cboList.DataTextField = "value"; cboList.DataValueField = "key"; cboList.DataBind(); break; case CHANGEPAGEOWNER: objWellBookBLL = new WellBookBLL(); cboList.Items.Clear(); cboList.DataSource = objWellBookBLL.GetPageOwnerList(strParentSiteURL, listname, strCAMLQuery); cboList.DataTextField = "value"; cboList.DataValueField = "key"; cboList.DataBind(); break; default: break; } }
/// <summary> /// Updates the Story Board /// </summary> /// <param name="listName"></param> /// <param name="pageStoryBoard"></param> /// <param name="actionPerformed"></param> protected void UpdateStoryBoard(string listName, string auditListName, string pageId, DWBDataObjects.StoryBoard pageStoryBoard, string actionPerformed) { string strCamlQuery = string.Empty; try { objChapterBLL = new ChapterBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>" + pageId + "</Value></Eq></Where>"; strUserName = GetUserName(); objChapterBLL.UpdateStoryBoard(strParentSiteURL, listName, auditListName, strCamlQuery, pageId, pageStoryBoard, strUserName, actionPerformed); } catch { throw; } }
/// <summary> /// Updates the narrative. /// </summary> /// <param name="listName">Name of the list.</param> /// <param name="auditListName">Name of the audit list.</param> /// <param name="pageID">The page ID.</param> /// <param name="narrative">The narrative.</param> protected void UpdateNarrative(string listName, string auditListName, string pageID, string narrative) { string strCamlQuery = string.Empty; try { strCamlQuery = @"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>" + pageID + "</Value></Eq></Where>"; objChapterBLL = new ChapterBLL(); strUserName = GetUserName(); objChapterBLL.UpdateNarrative(strParentSiteURL, listName, auditListName, strCamlQuery, pageID, narrative, strUserName); } 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> /// Saves the reorder XML to document library. /// </summary> /// <param name="chapterPreference">The chapter preference.</param> /// <param name="bookId">The book id.</param> /// <returns></returns> protected XmlDocument SaveReorderXml(string chapterPreference, string bookId) { XmlDocument userReorderXml = null; ChapterBLL objChapterBLL = new ChapterBLL(); userReorderXml = objChapterBLL.SaveReorderXml(chapterPreference, bookId); return userReorderXml; }
/// <summary> /// Saves the page to the chapter /// </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) { try { SetChapterPageDetails(); objChapterBLL = new ChapterBLL(); if (objListEntry != null) objChapterBLL.AddPageToChapters(strParentSiteURL, objListEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, GetUserName(), AUDITACTIONCREATION); Page.Response.Redirect(MAINTAINCHAPTERPAGEURL + "?" + CHAPTERIDQUERYSTRING + "=" + strChapterID, false); } catch (WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Sets the chapter details based on the selected master page. /// </summary> private void SetChapterPageDetails() { try { objChapterBLL = new ChapterBLL(); ChapterDetails objChapterdetails = null; int intChapterId = 0; string strConnectionType = string.Empty; ChapterPagesMapping objChapterPageMapping = null; List<ChapterPagesMapping> lstChapterPageMapping = new List<ChapterPagesMapping>(); string strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + cboMasterPages.SelectedValue + "</Value></Eq></Where>"; DataTable dtresultTable = GetListItems(MASTERPAGELIST, strCamlQuery, string.Empty); if (dtresultTable != null && dtresultTable.Rows.Count > 0) { objListEntry = new ListEntry(); objChapterdetails = new ChapterDetails(); int.TryParse(strChapterID, out intChapterId); objChapterdetails.RowID = intChapterId; for (int intRowIndex = 0; intRowIndex < dtresultTable.Rows.Count; intRowIndex++) { objChapterPageMapping = new ChapterPagesMapping(); objChapterPageMapping.Discipline = Convert.ToString(dtresultTable.Rows[intRowIndex]["Sign_Off_Discipline"]); objChapterPageMapping.PageName = Convert.ToString(dtresultTable.Rows[intRowIndex][DWBTITLECOLUMN]); objChapterPageMapping.PageActualName = Convert.ToString(dtresultTable.Rows[intRowIndex]["Title_Template"]); objChapterPageMapping.PageSequence = Convert.ToInt32(dtresultTable.Rows[intRowIndex]["Page_Sequence"]); objChapterPageMapping.AssetType = Convert.ToString(dtresultTable.Rows[intRowIndex]["Asset_Type"]); objChapterPageMapping.StandardOperatingProc = Convert.ToString(dtresultTable.Rows[intRowIndex]["Standard_Operating_Procedure"]); strConnectionType = Convert.ToString(dtresultTable.Rows[intRowIndex][CONNECTIONTYPECOLUMN]); objChapterPageMapping.ConnectionType = strConnectionType; objChapterPageMapping.PageURL = Convert.ToString(dtresultTable.Rows[intRowIndex]["Page_URL"]); if (!strConnectionType.Contains(CONNECTIONTYPEI)) { objChapterPageMapping.Empty = "Yes"; } if (cboPageOwner.SelectedIndex == 0) { objChapterPageMapping.PageOwner = Convert.ToString(dtresultTable.Rows[intRowIndex]["Page_Owner"]); } else { DataTable dtUser = new DataTable(); strCamlQuery = string.Empty; string strViewFields = string.Empty; strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + cboPageOwner.SelectedValue + "</Value></Eq></Where>"; ; strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Windows_User_ID' /><FieldRef Name='DWBUserName' />"; CommonBLL objCommonBLL = new CommonBLL(); dtUser = objCommonBLL.ReadList(strParentSiteURL, USERLIST, strCamlQuery, strViewFields); if (dtUser != null && dtUser.Rows.Count > 0) { objChapterPageMapping.PageOwner = Convert.ToString(dtUser.Rows[0][DWBUSERIDCOLUMN]); dtUser.Dispose(); } } objChapterPageMapping.MasterPageID = Convert.ToInt32(dtresultTable.Rows[intRowIndex][DWBIDCOLUMN]); objChapterPageMapping.Created_Date = Convert.ToString(dtresultTable.Rows[intRowIndex]["Created"]); objChapterPageMapping.Created_By = Convert.ToString(dtresultTable.Rows[intRowIndex]["Page_Owner"]); lstChapterPageMapping.Add(objChapterPageMapping); } objListEntry.ChapterPagesMapping = lstChapterPageMapping; objListEntry.ChapterDetails = objChapterdetails; } if (dtresultTable != null) dtresultTable.Dispose(); } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Loads the controls on page load. /// </summary> private void LoadControlsOnPageLoad() { try { objChapterBLL = new ChapterBLL(); ListItem objListItem = null; bool blnPageOwnerSet = false; DataTable dtresulttable = objChapterBLL.GetMasterPagesForChapter(strParentSiteURL, strChapterID, MASTERPAGELIST, CHAPTERPAGESMAPPINGLIST, DWBCHAPTERLIST); if (dtresulttable != null) { cboMasterPages.Items.Clear(); cboMasterPages.DataSource = dtresulttable; cboMasterPages.DataTextField = DWBTITLECOLUMN; cboMasterPages.DataValueField = DWBIDCOLUMN; cboMasterPages.DataBind(); cboMasterPages.Items.Insert(0, DROPDOWNDEFAULTTEXT); } dtresulttable = objChapterBLL.GetOwnersForChapterPage(strParentSiteURL, strChapterID, DWBCHAPTERLIST, DWBBOOKLIST, TEAMSTAFFLIST); if (dtresulttable != null) { cboPageOwner.Items.Clear(); for (int intRowIndex = 0; intRowIndex < dtresulttable.Rows.Count; intRowIndex++) { objListItem = new ListItem(); objListItem.Value = Convert.ToString(dtresulttable.Rows[intRowIndex][USERIDCOLUMN]); objListItem.Text = Convert.ToString(dtresulttable.Rows[intRowIndex][DISCIPLINECOLUMN]) + "-" + Convert.ToString(dtresulttable.Rows[intRowIndex][DWBTITLECOLUMN]); if (!blnPageOwnerSet) { objListItem.Selected = true; blnPageOwnerSet = true; } cboPageOwner.Items.Add(objListItem); } } cboPageOwner.Items.Insert(0, DROPDOWNDEFAULTTEXTNONE); cboPageOwner.ClearSelection(); cboPageOwner.SelectedIndex = 0; if (dtresulttable != null) dtresulttable.Dispose(); } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Loads the asset value. /// </summary> private void LoadAssetValue() { Shell.SharePoint.DREAM.Business.Entities.RequestInfo objRequestInfo = null; try { string strXpath = string.Empty; string strSelectedAsset = objListEntry.ChapterDetails.AssetType; objChapter = new ChapterBLL(); //objRequestInfo = SetQuickDataObjects(cboDWBCountry.SelectedItem.Text, cboColumnName.SelectedItem.Value, txtCriteria.Text); objRequestInfo = SetQuickDataObjects(cboDWBCountry.SelectedItem.Value, cboColumnName.SelectedItem.Value, txtCriteria.Text); XmlDocument assetNodeList = objChapter.GetAssetValueForAssetType(objRequestInfo, strSelectedAsset); lblAssetValue.Text = strSelectedAsset; AssignValuesToDropDown(assetNodeList, lstAssetValues); BindListBoxValue(lstAssetValues, objListEntry.ChapterDetails.AssetValue); } catch (XmlException xmlEx) { CommonUtility.HandleException(strParentSiteURL, xmlEx); } catch (SoapException soapEx) { lblException.Text = soapEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } }