Ejemplo n.º 1
0
        /// <summary>
        /// Sets the template configuration.
        /// </summary>
        /// <param name="selectedtemplateID">The selectedtemplate ID.</param>
        /// <returns>ArrayList</returns>
        private ArrayList SetTemplateConfiguration(int selectedtemplateID)
        {
            ArrayList arlTemplateConfiguaration = new ArrayList();

            /// Update the DWB Template Pages Mapping List with new set of pages
            ListItemCollection newMasterPages = duallistTemplatePages.RightItems;
            if (newMasterPages != null && newMasterPages.Count > 0)
            {
                TemplateConfiguration objTemplateConfiguration = null;
                for (int intIndex = 0; intIndex < newMasterPages.Count; intIndex++)
                {
                    objTemplateConfiguration = new TemplateConfiguration();

                    /// RowId and LinkedMasterPageId are assigned to Value field of List Box.
                    /// Incase of existing Master Page in Template, it is the ID of the Template Pages Mapping entry
                    /// Incase of new master page, it is the MasterPage ID from Master Page List and from where it has to copied

                    objTemplateConfiguration.LinkedMasterPageId = newMasterPages[intIndex].Value;
                    objTemplateConfiguration.MasterPageTitle = newMasterPages[intIndex].Text;
                    objTemplateConfiguration.TemplateID = selectedtemplateID.ToString();

                    arlTemplateConfiguaration.Add(objTemplateConfiguration);
                }
            }
            return arlTemplateConfiguaration;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// To set the properties of the master page from the Selected template
        /// </summary>
        /// <param name="selectedtemplateID">ID of the template selected</param>
        /// <returns>Array list of master pages in the selected template</returns>
        private ArrayList SetTemplateConfiguration(int selectedtemplateID)
        {
            int[] masterPageID = null;

            ArrayList arlTemplateConfiguaration = null;
            DataTable dtListDetails = null;
            /// Title column is renamed to Template_Name - internal name remains as Title
            /// This query fetch ID of the new Tempalte created
            string strCAMLQuery = @"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + txtTemplateTitle.Text.Trim() + "</Value></Eq></Where>";

            string strfieldsToView = "<FieldRef Name='ID' />";
            string strNewTemplateID = string.Empty;
            dtListDetails = GetListItems(TEMPLATELIST, strCAMLQuery, strfieldsToView);

            try
            {
                if (dtListDetails != null && dtListDetails.Rows.Count > 0)
                {
                    strNewTemplateID = dtListDetails.Rows[0][DWBIDCOLUMN].ToString();
                }
                if (!string.IsNullOrEmpty(strNewTemplateID))
                {
                    objListEntry.TemplateDetails.RowId = Int32.Parse(strNewTemplateID);
                }
                masterPageID = GetMasterPageIDForTemplate(selectedtemplateID, TEMPLATEPAGESMAPPINGLIST);
                if (masterPageID != null && masterPageID.Length > 0)
                {
                    arlTemplateConfiguaration = new ArrayList();
                    for (int index = 0; index < masterPageID.Length; index++)
                    {
                        strCAMLQuery = string.Empty;
                        strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + masterPageID[index].ToString() + "</Value></Eq></Where>";
                        strfieldsToView = string.Empty;
                        /// Title column is renamed to MasterPageName - internal name remains as Title
                        strfieldsToView = "<FieldRef Name='Title' /><FieldRef Name='Title_Template' /><FieldRef Name='Page_Owner' /><FieldRef Name='Sign_Off_Discipline' /><FieldRef Name='Connection_Type' /><FieldRef Name='ID' /><FieldRef Name='Page_Sequence' /><FieldRef Name='Asset_Type' /><FieldRef Name='Page_URL' /><FieldRef Name='Standard_Operating_Procedure' /><FieldRef Name='Page_Sequence' /><FieldRef Name='Page_Sequence' />";
                        DataTable dtresult = GetListItems(MASTERPAGELIST, strCAMLQuery, strfieldsToView);
                        if (dtresult != null && dtresult.Rows.Count > 0)
                        {
                            TemplateConfiguration objTemplateConfiguration = null;

                            foreach (DataRow objdataRow in dtresult.Rows)
                            {
                                 objTemplateConfiguration = new TemplateConfiguration();

                                objTemplateConfiguration.MasterPageTitle = objdataRow[DWBTITLECOLUMN].ToString();
                                objTemplateConfiguration.TemplateTitle = objdataRow["Title_Template"].ToString();
                                objTemplateConfiguration.PageOwner = objdataRow["Page_Owner"].ToString();
                                objTemplateConfiguration.Discipline = objdataRow["Sign_Off_Discipline"].ToString();
                                objTemplateConfiguration.ConnectionType = objdataRow["Connection_Type"].ToString();
                                objTemplateConfiguration.LinkedMasterPageId = objdataRow[DWBIDCOLUMN].ToString();
                                objTemplateConfiguration.PageSequence = Int32.Parse(objdataRow["Page_Sequence"].ToString());
                                objTemplateConfiguration.AssetType = objdataRow["Asset_Type"].ToString();
                                objTemplateConfiguration.PageURL = objdataRow["Page_URL"].ToString();
                                objTemplateConfiguration.StandardOperatingProcedure = objdataRow["Standard_Operating_Procedure"].ToString();
                                objTemplateConfiguration.TemplateID = strNewTemplateID;
                                arlTemplateConfiguaration.Add(objTemplateConfiguration);
                            }
                            dtresult.Dispose();
                        }
                    }
                }
            }
            finally
            {
                if (dtListDetails != null)
                {
                    dtListDetails.Dispose();
                }
            }
            return arlTemplateConfiguaration;
        }