Exemplo n.º 1
0
        /// <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;
        }
Exemplo n.º 2
0
        /// <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();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sets the master page details data object from the UI.
        /// </summary>
        /// <returns></returns>
        private MasterPageDetails SetMasterPageDetails()
        {
            MasterPageDetails objMasterPage = new MasterPageDetails();
            int intRowId = 0;
            objMasterPage.Name = txtPageTitle.Text.Trim();
            objMasterPage.TemplateTitle = txtTitleTemplate.Text.Trim();

            if (cboDiscipline.SelectedIndex > 0)
            {
                if ((string.Compare(strListType, BOOKPAGES, true) == 0) || (string.Compare(strListType,CHAPTERPAGES, true) == 0) ||
                  (string.Compare(strListType, TEMPLATEMASTERPAGES, true) == 0))
                {
                    objMasterPage.SignOffDiscipline = cboDiscipline.SelectedItem.Text;
                    /// This property is used to update DWB Template Pages Mapping list details
                    objMasterPage.SignOffDisciplineText = cboDiscipline.SelectedItem.Text;
                }
                else
                {
                    objMasterPage.SignOffDiscipline = cboDiscipline.SelectedItem.Value;
                    /// This property is used to update DWB Template Pages Mapping list details
                    objMasterPage.SignOffDisciplineText = cboDiscipline.SelectedItem.Text;
                }
            }
            objMasterPage.SOP = txtSOP.Text.Trim();

            if (string.Compare(strListType, TEMPLATEMASTERPAGES) == 0)
            {
                objMasterPage.ConnectionType = cboConnectionType.SelectedItem.Text;
                objMasterPage.AssetType = cboAssetType.SelectedItem.Text;
                /// This property is used to update DWB Template Pages Mapping list details
                objMasterPage.ConnectionTypeText = cboConnectionType.SelectedItem.Text;
                /// This property is used to update DWB Template Pages Mapping list details
                objMasterPage.AssetTypeText = cboAssetType.SelectedItem.Text;
            }
            else
            {
                objMasterPage.ConnectionType = cboConnectionType.SelectedItem.Value;
                objMasterPage.AssetType = cboAssetType.SelectedItem.Value;
                /// This property is used to update DWB Template Pages Mapping list details
                objMasterPage.ConnectionTypeText = cboConnectionType.SelectedItem.Text;
                /// This property is used to update DWB Template Pages Mapping list details
                objMasterPage.AssetTypeText = cboAssetType.SelectedItem.Text;
            }
            if (string.Equals(strMode, ADD))
            {
                objMasterPage.Terminated = "No";
                if (cboConnectionType.SelectedItem.Value.Equals("2"))
                {
                    objMasterPage.PageURL = DWBTYPE2PAGEURL;
                }
                else if (cboConnectionType.SelectedItem.Value.Equals("3"))
                {
                    objMasterPage.PageURL = DWBTYPE3PAGEURL;
                }
                ListItemCollection templateList = lstTemplates.Items;
                foreach (ListItem templateItem in templateList)
                {
                    if (templateItem.Selected)
                    {
                        objMasterPage.Templates = objMasterPage.Templates + templateItem.Value + ";";
                    }
                }

            }
            else
            {
                if (int.TryParse(strSelectedID, out intRowId))
                {
                    objMasterPage.RowId = intRowId;
                }

            }

            return objMasterPage;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the Master Page Details.
        /// </summary>
        /// <param name="parentSiteUrl">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>
        /// <returns>ListEntry object.</returns>
        internal ListEntry GetMasterPageDetail(string parentSiteUrl, string listName, string queryString)
        {
            ListEntry objListEntry = null;
            DataTable objListItems = null;
            DataRow objListRow;
            MasterPageDetails objMasterPage = null;
            try
            {
                objCommonDAL = new CommonDAL();
                objListItems = objCommonDAL.ReadList(parentSiteUrl, 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 = objListRow["Title"].ToString();
                        objMasterPage.TemplateTitle = objListRow["Title_Template"].ToString();
                        if (objListRow["Page_Sequence"] != DBNull.Value)
                        {
                            objMasterPage.PageSequence = Convert.ToInt32(objListRow["Page_Sequence"]);
                        }
                        objMasterPage.AssetType = Convert.ToString(objListRow["Asset_Type"]);
                        objMasterPage.SignOffDiscipline = Convert.ToString(objListRow["Sign_Off_Discipline"]);
                        objMasterPage.SOP = Convert.ToString(objListRow["Standard_Operating_Procedure"]);
                        objMasterPage.ConnectionType = Convert.ToString(objListRow["Connection_Type"]);
                        objMasterPage.Terminated = Convert.ToString(objListRow["Terminate_Status"]);
                        objMasterPage.Templates = Convert.ToString(objListRow["Template_ID"]);
                        objListEntry.MasterPage = objMasterPage;
                    }
                }
                return objListEntry;
            }
            finally
            {
                if (objListItems != null)
                    objListItems.Dispose();
            }
        }