Ejemplo n.º 1
0
        /// <summary>
        /// Sets the book detail data object.
        /// </summary>
        private void LoadMetaData()
        {
            string strCamlQuery = string.Empty;
            string strPageOwner = string.Empty;
            string strPageDiscipline = string.Empty;
            string strBookOwner = string.Empty;
            string strBookTeamID = string.Empty;
            string strViewFields = string.Empty;
            DataTable dtBookPage = null;
            DataTable dtPublishedDocDetails = null;
            btnSignOff.Visible = false;
            btnUpdate.Visible = false;
            linkEPCatalogFilter.Visible = false;
            bool blnShowUpdate = false;
            lblModifiedDate.Visible = false;

            if (HttpContext.Current.Request.QueryString[MODEQUERYSTRING] != null)
                strMode = HttpContext.Current.Request.QueryString[MODEQUERYSTRING];
            hidPageId.Value = PageID;
            try
            {
                objCommon = new CommonBLL();

                strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Number'>" +
                    PageID + "</Value></Eq></Where>";
                dtBookPage = objCommon.ReadList(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, strCamlQuery);
                if (dtBookPage.Rows.Count > 0)
                {
                    lblOwner.Text = dtBookPage.Rows[0]["Owner"].ToString();
                    lblSignedOff.Text = dtBookPage.Rows[0]["Sign_Off_Status"].ToString();
                    lblTitleTemplate.Text = dtBookPage.Rows[0]["Page_Actual_Name"].ToString();
                    strPageDiscipline = dtBookPage.Rows[0]["Discipline"].ToString();
                    strPageOwner = dtBookPage.Rows[0]["Owner"].ToString();
                    string strAssetValue = objCommon.GetAssetValue(ChapterID);
                    /// If $ is present in Page Title replace with Asset Value
                    /// Else prefix with Asset Value.
                    if (lblTitleTemplate.Text.IndexOf("$") == 0)
                    {
                        lblTitleTemplate.Text = lblTitleTemplate.Text.Replace("$", strAssetValue);
                    }
                    else
                    {
                        lblTitleTemplate.Text = string.Concat(strAssetValue, "-", lblTitleTemplate.Text);
                    }
                }

                if (string.Compare(lblSignedOff.Text.ToLowerInvariant(), STATUSSIGNEDOFF) == 0)
                {
                    blnShowUpdate = false;
                    btnSignOff.Text = CANCELSIGNOFF;
                }
                else
                {
                    blnShowUpdate = true;
                    btnSignOff.Text = SIGNOFF;
                }

                strCamlQuery = @"<Where><Eq><FieldRef Name='PageID' /><Value Type='Number'>" +
                  PageID + "</Value></Eq></Where>";

                string strObjectInnerHtml = objCommon.GetUploadedDocumentUrl(strParentSiteURL, PUBLISHEDDOCUMENTLIST, strCamlQuery);
                ///loads the embedded image/document/application
                docviewerdiv.InnerHtml = strObjectInnerHtml;

                //Added by Praveena for module "Add Last Updated date"
                strViewFields = @"<FieldRef Name='PageID' /><FieldRef Name='Modified' />";
                dtPublishedDocDetails = objCommon.ReadList(strParentSiteURL, PUBLISHEDDOCUMENTLIST, strCamlQuery, strViewFields);
                if (dtPublishedDocDetails != null && dtPublishedDocDetails.Rows.Count > 0)
                {
                    string dtModifiedDate = GetDateTime(dtPublishedDocDetails.Rows[0]["Modified"].ToString());
                    lblModifiedDate.Visible = true;
                    lblModifiedDate.Text = "Last Updated Date:" + dtModifiedDate;
                }

                /// EPCatalog Issue Fix
                BookInfo objBookInfo = null;
                if (HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT] != null)
                {
                    string strAssetType = string.Empty;
                    objBookInfo = ((BookInfo)HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT]);
                    if (objBookInfo != null)
                    {
                        strBookOwner = objBookInfo.BookOwner;
                        strBookTeamID = objBookInfo.BookTeamID;
                        foreach (ChapterInfo objChapterInfo in objBookInfo.Chapters)
                        {
                            if (string.Equals(objChapterInfo.ChapterID, ChapterID))
                            {
                                hidSelectedRows.Value = objChapterInfo.ActualAssetValue;
                                /// To send as query string to EPCatalog screen
                                hidAssetType.Value = objChapterInfo.AssetType;
                                if (string.Equals(objChapterInfo.AssetType, ASSETTYPEWELL))
                                    hidSelectedCriteriaName.Value =UWI;
                                else if (string.Equals(objChapterInfo.AssetType, ASSETTYPEFIELD))
                                    hidSelectedCriteriaName.Value = FIELDNAME;
                                else
                                    hidSelectedCriteriaName.Value = UWBI;
                            }
                        }
                    }
                }
                if (ShowButton(WELLBOOKVIEWERCONTROLPAGE, strBookOwner, strBookTeamID, strPageOwner, strPageDiscipline))
                {
                    btnSignOff.Visible = true;
                }
                if (ShowButton(WELLBOOKVIEWERCONTROLPAGEUPDATE, strBookOwner, strBookTeamID, strPageOwner, strPageDiscipline))
                {
                    if (blnShowUpdate)
                    {
                        btnUpdate.Visible = true;
                        linkEPCatalogFilter.Visible = true;
                    }
                }

                if (!string.IsNullOrEmpty(strMode) && strMode.Equals(VIEW))
                {
                    btnUpdate.Visible = false;
                    btnSignOff.Visible = false;
                    linkEPCatalogFilter.Visible = false;
                }

            }
            catch
            {
                throw;
            }
            finally
            {
                if (dtBookPage != null)
                    dtBookPage.Dispose();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the book detail data object.
        /// </summary>
        private void LoadMetaData()
        {
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            string strBookOwner = string.Empty;
            string strBookTeamID = string.Empty;
            string strPageOwner = string.Empty;
            string strPageDiscipline = string.Empty;
            DataTable dtBookPage = null;
            DataTable dtUserDefinedDocDetails=null;
            btnSignOff.Visible = false;
            btnUpdate.Visible = false;
            bool blnShowUpdate = false;
            lblModifiedDate.Visible = false;
            if (HttpContext.Current.Request.QueryString[MODEQUERYSTRING] != null)
                strMode = HttpContext.Current.Request.QueryString[MODEQUERYSTRING];
            hidPageId.Value = PageID;

            if (HttpContext.Current.Session[SESSIONTYPE3UPLOADED] != null)
                hidtype3uploaded.Value = HttpContext.Current.Session[SESSIONTYPE3UPLOADED].ToString().ToLowerInvariant();

            objCommon = new CommonBLL();
            strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Number'>" +
                PageID + "</Value></Eq></Where>";
            dtBookPage = objCommon.ReadList(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, strCamlQuery);
            if (dtBookPage.Rows.Count > 0)
            {
                lblOwner.Text = dtBookPage.Rows[0]["Owner"].ToString();
                lblSignedOff.Text = dtBookPage.Rows[0]["Sign_Off_Status"].ToString();
                lblTitleTemplate.Text = dtBookPage.Rows[0]["Page_Actual_Name"].ToString();

                /// CHAPTERIDQUERYSTRING is not applicable. Get ChapterID from session object.
                string strAssetValue = objCommon.GetAssetValue(ChapterID);
                /// If $ is present in Page Title replace with Asset Value
                /// Else prefix with Asset Value.
                if (lblTitleTemplate.Text.IndexOf("$") == 0)
                {
                    lblTitleTemplate.Text = lblTitleTemplate.Text.Replace("$", strAssetValue);
                }
                else
                {
                    lblTitleTemplate.Text = string.Concat(strAssetValue, "-", lblTitleTemplate.Text);
                }
                strPageDiscipline = dtBookPage.Rows[0]["Discipline"].ToString();
                strPageOwner = dtBookPage.Rows[0]["Owner"].ToString();
            }
            if (string.Compare(lblSignedOff.Text.ToLowerInvariant(),STATUSSIGNEDOFF) == 0)
            {
                blnShowUpdate = false;
                btnSignOff.Value = CANCELSIGNOFF;
            }
            else
            {
                blnShowUpdate = true;
                btnSignOff.Value = SIGNOFF;
            }
            strCamlQuery = @"<Where><Eq><FieldRef Name='PageID' /><Value Type='Number'>" +
              PageID + "</Value></Eq></Where>";
            string strObjectInnerHtml = objCommon.GetUploadedDocumentUrl(strParentSiteURL, USERDEFINEDDOCUMENTLIST, strCamlQuery);
            /// Loads the embedded image/document/application
            docviewerdiv.InnerHtml = strObjectInnerHtml;

            //Added by Praveena for module "Add Last Updated date"
            strViewFields = @"<FieldRef Name='PageID' /><FieldRef Name='Modified' />";
            dtUserDefinedDocDetails = objCommon.ReadList(strParentSiteURL, USERDEFINEDDOCUMENTLIST, strCamlQuery,strViewFields);
            if (dtUserDefinedDocDetails != null && dtUserDefinedDocDetails.Rows.Count > 0)
            {
                string dtModifiedDate = GetDateTime(dtUserDefinedDocDetails.Rows[0]["Modified"].ToString());
                lblModifiedDate.Visible = true;
                lblModifiedDate.Text = "Last Updated Date:" + dtModifiedDate;
            }

            if (HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT] != null)
            {
                BookInfo objBookInfo = ((BookInfo)HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT]);
                if (objBookInfo != null)
                {
                    strBookOwner = objBookInfo.BookOwner;
                    strBookTeamID = objBookInfo.BookTeamID;
                }
            }
            if (ShowButton(WELLBOOKVIEWERCONTROLPAGE, strBookOwner, strBookTeamID, strPageOwner, strPageDiscipline))
            {
                btnSignOff.Visible = true;
            }
            if (ShowButton(WELLBOOKVIEWERCONTROLPAGEUPDATE, strBookOwner, strBookTeamID, strPageOwner, strPageDiscipline))
            {
                if (blnShowUpdate)
                {
                    btnUpdate.Visible = true;
                }
            }

            if (!string.IsNullOrEmpty(strMode) && strMode.Equals(VIEW))
            {
                btnUpdate.Visible = false;
                btnSignOff.Visible = false;
            }
            if (dtBookPage != null)
            {
                dtBookPage.Dispose();
            }
        }