/// <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> /// 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> /// 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> /// Sets the Chapter details data object from the UI. /// </summary> /// <returns>ChapterDetails object.</returns> private ChapterDetails SetChapterDetails() { ChapterDetails objChapterDetails = new ChapterDetails(); CommonUtility objCommonUtilities = new CommonUtility(); int intTemplateID = 0; objChapterDetails.ChapterTitle = txtChapterTitle.Text.Trim(); objChapterDetails.ChapterDescription = txtDescription.Text.Trim(); int intBookID = 0; int.TryParse(strBookID, out intBookID); objChapterDetails.BookID = intBookID; if (cboDWBCountry.SelectedItem != null) { //objChapterDetails.Country = cboDWBCountry.SelectedItem.Text; objChapterDetails.Country = cboDWBCountry.SelectedItem.Value; } if (cboColumnName.SelectedItem != null) { objChapterDetails.ColumnName = cboColumnName.SelectedItem.Text; } if (txtCriteria.Text.Length > 0) { objChapterDetails.Criteria = txtCriteria.Text.Trim(); } if (cboAssetType.SelectedItem != null && !cboAssetType.SelectedItem.Value.Contains(DROPDONWDEFAULT)) { objChapterDetails.AssetType = cboAssetType.SelectedValue; } if (lstAssetValues.SelectedItem != null) { objChapterDetails.AssetValue = lstAssetValues.SelectedItem.Text; objChapterDetails.ActualAssetValue = lstAssetValues.SelectedItem.Value; } if (cboTemplate.SelectedItem != null && !cboTemplate.SelectedItem.Value.Contains(DROPDONWDEFAULT)) { int.TryParse(cboTemplate.SelectedValue, out intTemplateID); objChapterDetails.TemplateID = intTemplateID; } int intRowId = 0; if (string.Compare(strMode,EDIT, true) == 0) { if (int.TryParse(strSelectedID, out intRowId)) { objChapterDetails.RowID = intRowId; objChapterDetails.BookID = int.Parse(hdnListitemStatus.Value); } } else { objChapterDetails.Terminated = STATUSACTIVE; } return objChapterDetails; }