Esempio n. 1
0
        public void GetTemplateByIdTest()
        {
            var templateObject = _clientObject.GetTemplateById(_configData.TemplateId);

            Assert.IsNotNull(templateObject);
            Assert.AreEqual(templateObject.Id, _configData.TemplateId);
        }
Esempio n. 2
0
        public void GetTemplateById_InvalidCredential()
        {
            var invalidCredential = new GcConnectClient("abc",
                                                        _configData.Email);
            var templateObject = invalidCredential.GetTemplateById(_configData.TemplateId);

            Assert.IsNull(templateObject);
        }
Esempio n. 3
0
        private void PopulateForm()
        {
            // Set the project and template Ids from query string.
            Session["TemplateId"] = Server.UrlDecode(Request.QueryString["TemplateId"]);
            Session["ProjectId"]  = Server.UrlDecode(Request.QueryString["ProjectId"]);

            // If the DDS for credentials is null or empty, turn off the page visibility and alert the user to set up the config.
            if (_credentialsStore.IsNullOrEmpty())
            {
                Response.Write("<script>alert('Please setup your GatherContent config first!');" +
                               "window.location='/modules/GcEpiPlugin/GatherContentConfigSetup.aspx'</script>");
                Visible = false;
                return;
            }

            // This is to validate the user to not access this page directly.
            if (Session["TemplateId"] == null || Session["ProjectId"] == null)
            {
                Response.Write("<script>alert('This page is not directly accessible! Review your GatherContent items from Template Mappings page!');" +
                               "window.location='/modules/GcEpiPlugin/GcEpiTemplateMappings.aspx'</script>");
                Visible = false;
                return;
            }

            // Local variables initialization and setting the values for some of the form components.
            Client = new GcConnectClient(_credentialsStore.First().ApiKey, _credentialsStore.First().Email);

            // This is to make sure we only fetch mappings associated with this GcAccount.
            _mappingsStore = GcDynamicUtilities.RetrieveStore <GcDynamicTemplateMappings>().
                             FindAll(i => i.AccountId == _credentialsStore.First().AccountId);

            // Fetch the mapping for current template.
            var currentMapping = _mappingsStore.First(i => i.TemplateId == Session["TemplateId"].ToString());

            // Make a usable templateId and projectId
            var templateId = Convert.ToInt32(Session["TemplateId"]);
            var projectId  = Convert.ToInt32(Session["ProjectId"]);

            // Fetch Template details from GatherContentConnect.
            var gcTemplate = Client.GetTemplateById(templateId);

            // Set the labels with the gathered values.
            templateName.Text        = gcTemplate.Name;
            projectName.Text         = Client.GetProjectById(projectId).Name;
            templateDescription.Text = gcTemplate.Description;

            // Fetch the items (if there are any) from trash.
            var recycleBin = _contentRepository.GetDescendents(ContentReference.WasteBasket).ToList();

            // This is to make sure that the drop down doesn't persist previous values upon page refresh.
            ddlDefaultParent.Items.Clear();

            // Create an empty list to store all the content descendants.
            List <IContent> sortedDescendants = new EditableList <IContent>();

            // Populating the default parent selection drop down based on the type of the post type.
            switch (currentMapping.PostType)
            {
            case "PageType":
                // Add the root parent before everything else.
                ddlDefaultParent.Items.Add(new ListItem("Root", "1"));

                SortContent <PageData>(_contentRepository.Get <PageData>(ContentReference.RootPage), sortedDescendants);
                foreach (var pageData in sortedDescendants)
                {
                    // If the page is in recycle bin or if the page itself is recycle bin,
                    // Then do not add it to the drop down.
                    if (recycleBin.Contains(pageData.ContentLink) || pageData.ContentLink.ID == 2)
                    {
                        continue;
                    }

                    // Fetch the page data of its immediate parent.
                    var parentPage = _contentRepository.Get <PageData>(pageData.ParentLink);

                    // Add the parent's name along with the page name to avoid the confusion between the same page names.
                    ddlDefaultParent.Items.Add(new ListItem(parentPage.Name + " => " + pageData.Name, pageData.ContentLink.ID.ToString()));
                }
                break;

            case "BlockType":
                // Add the root parent before everything else.
                ddlDefaultParent.Items.Add(new ListItem("SysGlobalAssets", "3"));

                SortContent <ContentFolder>(_contentRepository.Get <ContentFolder>(ContentReference.GlobalBlockFolder), sortedDescendants);
                foreach (var contentFolder in sortedDescendants)
                {
                    // If the block is in recycle bin,
                    // Then do not add it to the drop down.
                    if (recycleBin.Contains(contentFolder.ContentLink))
                    {
                        continue;
                    }

                    // Fetch the block data of its immediate parent.
                    var parentFolder = _contentRepository.Get <ContentFolder>(contentFolder.ParentLink);
                    // Add the parent's name along with the block name to avoid the confusion between the same block names.
                    ddlDefaultParent.Items.Add(new ListItem(parentFolder.Name + " => " + contentFolder.Name,
                                                            contentFolder.ContentLink.ID.ToString()));
                }
                break;
            }
            // Add the data source to the repeater and bind it.
            rptGcItems.DataSource = Client.GetItemsByTemplateId(templateId, projectId);
            rptGcItems.DataBind();
        }
Esempio n. 4
0
        private void PopulateForm()
        {
            if (_credentialsStore.IsNullOrEmpty())
            {
                Response.Write("<script>alert('Please setup your GatherContent config first!');" +
                               "window.location='/modules/GcEpiPlugin/GatherContentConfigSetup.aspx'</script>");
                Visible = false;
                return;
            }

            if (Session["ProjectId"] == null || Session["TemplateId"] == null)
            {
                Response.Write("<script>alert('Please select the GatherContent Template!');" +
                               "window.location='/modules/GcEpiPlugin/NewGcMappingStep2.aspx'</script>");
                Visible = false;
                return;
            }
            EnableDdl();

            // Clear all the statically created drop down items to avoid data persistence on post-back.
            ddlAuthors.Items.Clear();
            ddlStatuses.Items.Clear();

            _client = new GcConnectClient(_credentialsStore.ToList().First().ApiKey, _credentialsStore.ToList().First().Email);
            var projectId  = Convert.ToInt32(Session["ProjectId"]);
            var templateId = Convert.ToInt32(Session["TemplateId"]);

            projectName.Text         = _client.GetProjectById(projectId).Name;
            templateName.Text        = _client.GetTemplateById(templateId).Name;
            templateDescription.Text = _client.GetTemplateById(templateId).Description;
            var userProvider = ServiceLocator.Current.GetInstance <UIUserProvider>();
            var epiUsers     = userProvider.GetAllUsers(0, 200, out int _);

            epiUsers.ToList().ForEach(epiUser => ddlAuthors.Items.Add(new ListItem(epiUser.Username, epiUser.Username)));
            var saveActions = Enum.GetValues(typeof(SaveAction)).Cast <SaveAction>().ToList();

            saveActions.RemoveAt(1);
            saveActions.ToList().ForEach(i => ddlStatuses.Items.Add(new ListItem(i.ToString(), i.ToString())));

            if (Session["PostType"] == null || Session["Author"] == null || Session["DefaultStatus"] == null)
            {
                ddlPostTypes.SelectedIndex = 0;
                ddlAuthors.SelectedIndex   = 0;
                ddlStatuses.SelectedIndex  = 0;
                Session["PostType"]        = ddlPostTypes.SelectedValue;
                Session["Author"]          = ddlAuthors.SelectedValue;
                Session["DefaultStatus"]   = ddlStatuses.SelectedValue;
            }
            else
            {
                ddlPostTypes.Items.Remove(ddlPostTypes.Items.FindByValue("-1"));
                ddlPostTypes.SelectedValue = Session["PostType"].ToString();
                ddlAuthors.SelectedValue   = Session["Author"].ToString();
                ddlStatuses.SelectedValue  = Session["DefaultStatus"].ToString();

                // Clear all the statically created drop down items to avoid data persistence on post-back.
                ddlEpiContentTypes.Items.Clear();

                if (Session["PostType"].ToString() is "PageType")
                {
                    var contentTypeList = _contentTypeRepository.List().OfType <PageType>();
                    var pageTypes       = contentTypeList as IList <PageType> ?? contentTypeList.ToList();
                    pageTypes.ToList().ForEach(i =>
                    {
                        if (i.ID != 1 && i.ID != 2)
                        {
                            ddlEpiContentTypes.Items.Add(new ListItem(i.DisplayName, "page-" + i.Name));
                        }
                    });
                    ddlEpiContentTypes.Enabled = true;
                    btnNextStep.Enabled        = true;
                }
                else if (Session["PostType"].ToString() is "BlockType")
                {
                    var contentTypeList = _contentTypeRepository.List().OfType <BlockType>();
                    var blockTypes      = contentTypeList as IList <BlockType> ?? contentTypeList.ToList();
                    blockTypes.ToList().ForEach(i => ddlEpiContentTypes.Items.Add(new ListItem(i.DisplayName, "block-" + i.Name)));
                    ddlEpiContentTypes.Enabled = true;
                    btnNextStep.Enabled        = true;
                }
                else
                {
                    var gcEpiMisc = new GcEpiMiscUtility();
                    gcEpiMisc.GetMediaTypes().ToList().
                    ForEach(i => ddlEpiContentTypes.Items.Add(new ListItem(i.DisplayName, "media-" + i.Name)));
                    ddlEpiContentTypes.Enabled = true;
                    btnNextStep.Enabled        = true;
                }
                if (Session["EpiContentType"] != null)
                {
                    ddlEpiContentTypes.SelectedValue = Session["EpiContentType"].ToString();
                }
            }
            var gcStatuses = _client.GetStatusesByProjectId(projectId);
            var tHeadRow   = new TableRow {
                Height = 42
            };

            tHeadRow.Cells.Add(new TableCell {
                Text = "GatherContent Status"
            });
            tHeadRow.Cells.Add(new TableCell {
                Text = "Mapped EPiServer Status"
            });
            //tHeadRow.Cells.Add(new TableCell { Text = "On Import, Change GatherContent Status" });
            tableGcStatusesMap.Rows.Add(tHeadRow);
            foreach (var status in gcStatuses)
            {
                var tRow = new TableRow();
                tableGcStatusesMap.Rows.Add(tRow);
                for (var cellIndex = 1; cellIndex <= 2; cellIndex++)//Need to make it the highest index, 3 in the next version.
                {
                    var tCell = new TableCell();
                    if (cellIndex is 3)
                    {
                        var ddlOnImportGcStatuses = new DropDownList {
                            Height = 30, Width = 250, CssClass = "chosen-select"
                        };
                        ddlOnImportGcStatuses.Items.Add(new ListItem("Do Not Change", "1"));
                        gcStatuses.ToList().ForEach(i => ddlOnImportGcStatuses.Items.Add(new ListItem(i.Name, i.Id)));
                        ddlOnImportGcStatuses.ID = "onImportGc-" + status.Id;
                        tCell.Controls.Add(ddlOnImportGcStatuses);
                    }
                    else if (cellIndex is 2)
                    {
                        var ddlEpiStatuses = new DropDownList {
                            Height = 30, Width = 250, CssClass = "chosen-select"
                        };
                        ddlEpiStatuses.Items.Add(new ListItem("Use Default Status", "Use Default Status"));
                        saveActions.ToList().ForEach(i => ddlEpiStatuses.Items.Add(new ListItem(i.ToString(), i.ToString())));
                        ddlEpiStatuses.ID = "mappedEPi-" + status.Id;
                        tCell.Controls.Add(ddlEpiStatuses);
                    }
                    else if (cellIndex is 1)
                    {
                        tCell.Text = status.Name;
                    }
                    tRow.Cells.Add(tCell);
                }
            }
        }
        private void PopulateForm()
        {
            if (_credentialsStore.IsNullOrEmpty())
            {
                Response.Write("<script>alert('Please setup your GatherContent config first!');" +
                               "window.location='/modules/GcEpiPlugin/GatherContentConfigSetup.aspx'</script>");
                Visible = false;
                return;
            }

            if (Session["ProjectId"] == null || Session["TemplateId"] == null ||
                Session["PostType"] == null || (string)Session["PostType"] == "-1")
            {
                Response.Write("<script>alert('Please set the MetaDataProducer Defaults!');" +
                               "window.location='/modules/GcEpiPlugin/NewGcMappingStep3.aspx'</script>");
                Visible = false;
                return;
            }
            // Variables initialization.
            _client = new GcConnectClient(_credentialsStore.ToList().First().ApiKey, _credentialsStore.ToList().First().Email);
            var projectId  = Convert.ToInt32(Session["ProjectId"]);
            var templateId = Convert.ToInt32(Session["TemplateId"]);
            var gcFields   = _client.GetTemplateById(templateId).Config.ToList();

            gcFields.ForEach(i => _elements.AddRange(i.Elements));

            // Setting the mark-up labels.
            projectName.Text         = _client.GetProjectById(projectId).Name;
            templateName.Text        = _client.GetTemplateById(templateId).Name;
            templateDescription.Text = _client.GetTemplateById(templateId).Description;

            // Table rows instantiation and updating.
            var tHeadRow = new TableRow {
                Height = 42
            };

            tHeadRow.Cells.Add(new TableCell {
                Text = "GatherContent Field"
            });
            tHeadRow.Cells.Add(new TableCell {
                Text = "Mapped EPiServer Field"
            });
            tableMappings.Rows.Add(tHeadRow);
            foreach (var element in _elements.OrderByDescending(i => i.Type))
            {
                var tRow = new TableRow();
                tableMappings.Rows.Add(tRow);
                for (var cellIndex = 1; cellIndex <= 2; cellIndex++)
                {
                    var tCell = new TableCell {
                        Width = 500
                    };
                    if (cellIndex is 1)
                    {
                        tCell.Text =
                            $"<span style='font-weight: Bold;'>{element.Label + element.Title}</span><br>Type: {element.Type}<br>Limit: " +
                            $"{element.Limit}<br>Description: {element.MicroCopy}<br>";
                    }
                    else
                    {
                        if (Session["EpiContentType"].ToString().StartsWith("block-"))
                        {
                            var blockTypes = _contentTypeRepository.List().OfType <BlockType>();
                            tCell.Controls.Add(MetaDataProducer(blockTypes, element, 6));
                        }

                        else if (Session["EpiContentType"].ToString().StartsWith("page-"))
                        {
                            var pageTypes = _contentTypeRepository.List().OfType <PageType>();
                            tCell.Controls.Add(MetaDataProducer(pageTypes, element, 5));
                        }

                        else
                        {
                            var gcEpiMisc    = new GcEpiMiscUtility();
                            var dropDownList = MetaDataProducer(gcEpiMisc.GetMediaTypes(), element, 6);
                            tCell.Controls.Add(dropDownList);
                        }
                    }
                    tRow.Cells.Add(tCell);
                }
            }
        }
Esempio n. 6
0
        private void PopulateForm()
        {
            var credentialsStore = GcDynamicCredentials.RetrieveStore();

            Session["TemplateId"] = Server.UrlDecode(Request.QueryString["TemplateId"]);
            Session["ProjectId"]  = Server.UrlDecode(Request.QueryString["ProjectId"]);
            if (credentialsStore.IsNullOrEmpty())
            {
                Response.Write("<script>alert('Please setup your GatherContent config first!');window.location='/modules/GatherContentImport/GatherContent.aspx'</script>");
                Visible = false;
                return;
            }

            if (Session["TemplateId"] == null || Session["ProjectId"] == null)
            {
                Response.Write("<script>alert('This page is not directly accessible! Review your GatherContent items from Template Mappings page!');window.location='/modules/GatherContentImport/GcEpiTemplateMappings.aspx'</script>");
                Visible = false;
                return;
            }
            var currentMapping = GcDynamicTemplateMappings
                                 .RetrieveStore().First(i => i.TemplateId == Session["TemplateId"].ToString());

            Client = new GcConnectClient(credentialsStore.ToList().First().ApiKey, credentialsStore.ToList().First().Email);
            var templateId = Convert.ToInt32(Session["TemplateId"]);
            var gcTemplate = Client.GetTemplateById(templateId);

            templateName.Text = gcTemplate.Name;
            var projectId = Convert.ToInt32(Session["ProjectId"]);

            projectName.Text         = Client.GetProjectById(projectId).Name;
            templateDescription.Text = gcTemplate.Description;
            var contentRepository = ServiceLocator.Current.GetInstance <IContentRepository>();
            var recycleBin        = contentRepository.GetDescendents(ContentReference.Parse("2")).ToList();

            switch (currentMapping.PostType)
            {
            case "PageType":
                ddlDefaultParent.Items.Add(new ListItem("Root Page", "1"));
                foreach (var cr in contentRepository.GetDescendents(ContentReference.RootPage))
                {
                    try
                    {
                        var pageData = contentRepository.Get <PageData>(cr);
                        if (recycleBin.Contains(pageData.ContentLink) || pageData.ContentLink.ID == 2)
                        {
                            continue;
                        }
                        ddlDefaultParent.Items.Add(new ListItem(pageData.PageName, pageData.ContentLink.ID.ToString()));
                    }
                    catch (TypeMismatchException ex)
                    {
                        Console.WriteLine(ex);
                    }
                }
                break;

            case "BlockType":

                // Add the root parent before everything else.
                ddlDefaultParent.Items.Add(new ListItem("SysGlobalAssets", "3"));
                foreach (var cr in contentRepository.GetDescendents(ContentReference.Parse("3")))
                {
                    try
                    {
                        var blockData = contentRepository.Get <ContentFolder>(cr);
                        // ReSharper disable once SuspiciousTypeConversion.Global
                        var content = blockData as IContent;

                        // If the block is in recycle bin,
                        // Then do not add it to the drop down.
                        if (recycleBin.Contains(content.ContentLink))
                        {
                            continue;
                        }


                        // ReSharper disable once PossibleNullReferenceException
                        if (recycleBin.Contains(content.ContentLink) || content.ContentLink.ID == 2)
                        {
                            continue;
                        }
                        ddlDefaultParent.Items.Add(new ListItem(content.Name, content.ContentLink.ID.ToString()));
                    }
                    catch (TypeMismatchException ex)
                    {
                        Console.WriteLine(ex);
                    }
                }
                break;
            }
            rptGcItems.DataSource = Client.GetItemsByTemplateId(templateId, projectId);
            rptGcItems.DataBind();
        }
Esempio n. 7
0
        private void PopulateForm()
        {
            var credentialsStore = GcDynamicCredentials.RetrieveStore();

            if (credentialsStore.IsNullOrEmpty())
            {
                Response.Write("<script>alert('Please setup your GatherContent config first!');window.location='/modules/GatherContentImport/GatherContent.aspx'</script>");
                Visible = false;
                return;
            }

            if (Session["ProjectId"] == null || Session["TemplateId"] == null ||
                Session["PostType"] == null || (string)Session["PostType"] == "-1")
            {
                Response.Write("<script>alert('Please set the Mapping Defaults!');window.location='/modules/GatherContentImport/NewGcMappingStep3.aspx'</script>");
                Visible = false;
                return;
            }
            _client = new GcConnectClient(credentialsStore.ToList().First().ApiKey,
                                          credentialsStore.ToList().First().Email);
            var projectId  = Convert.ToInt32(Session["ProjectId"]);
            var templateId = Convert.ToInt32(Session["TemplateId"]);

            projectName.Text         = _client.GetProjectById(projectId).Name;
            templateName.Text        = _client.GetTemplateById(templateId).Name;
            templateDescription.Text = _client.GetTemplateById(templateId).Description;
            var tHeadRow = new TableRow {
                Height = 42
            };

            tHeadRow.Cells.Add(new TableCell {
                Text = "GatherContent Field"
            });
            tHeadRow.Cells.Add(new TableCell {
                Text = "Mapped EPiServer Field"
            });
            tableMappings.Rows.Add(tHeadRow);
            var gcFields = _client.GetTemplateById(templateId).Config.ToList();

            foreach (var field in gcFields)
            {
                foreach (var element in field.Elements)
                {
                    var tRow = new TableRow();
                    tableMappings.Rows.Add(tRow);
                    for (var cellIndex = 1; cellIndex <= 2; cellIndex++)
                    {
                        var tCell = new TableCell {
                            Width = 500
                        };
                        if (cellIndex is 1)
                        {
                            tCell.Text =
                                $"<span style='font-weight: Bold;'>{element.Label}</span><br>Type: {element.Type}<br>Limit: " +
                                $"{element.Limit}<br>Description: {element.MicroCopy}<br>";
                        }
                        else
                        {
                            var contentTypeRepository = ServiceLocator.Current.GetInstance <IContentTypeRepository>();
                            //if (Session["EpiContentType"].ToString() is "MediaType")
                            //{
                            //    var ddlMetaData = new DropDownList {Height = 28, Width = 194};
                            //    ddlMetaData.Items.Add(new ListItem("Media Content", "MediaContent"));
                            //    tCell.Controls.Add(ddlMetaData);
                            //}
                            //else
                            //{
                            if (Session["EpiContentType"].ToString().StartsWith("block-"))
                            {
                                var contentTypeList = contentTypeRepository.List().OfType <BlockType>();
                                var myProperty      = new BlockType();
                                var blockTypes      = contentTypeList as IList <BlockType> ?? contentTypeList.ToList();
                                foreach (var i in blockTypes)
                                {
                                    if (Session["EpiContentType"].ToString().Substring(6) != i.Name)
                                    {
                                        continue;
                                    }
                                    myProperty = i;
                                    break;
                                }
                                var ddlMetaData = new DropDownList {
                                    Height = 28, Width = 194
                                };
                                ddlMetaData.Items.Add(new ListItem("Do Not Import", "-1"));
                                myProperty.PropertyDefinitions.ToList().ForEach(i =>
                                                                                ddlMetaData.Items.Add(new ListItem(i.Name, i.Name)));
                                ddlMetaData.ID = "meta-" + element.Name;
                                tCell.Controls.Add(ddlMetaData);
                            }
                            else if (Session["EpiContentType"].ToString().StartsWith("page-"))
                            {
                                var contentTypeList = contentTypeRepository.List().OfType <PageType>();
                                var myProperty      = new PageType();
                                var pageTypes       = contentTypeList as IList <PageType> ?? contentTypeList.ToList();
                                foreach (var i in pageTypes)
                                {
                                    if (Session["EpiContentType"].ToString().Substring(5) != i.Name)
                                    {
                                        continue;
                                    }
                                    myProperty = i;
                                    break;
                                }
                                var ddlMetaData = new DropDownList {
                                    Height = 28, Width = 194
                                };
                                ddlMetaData.Items.Add(new ListItem("Do Not Import", "-1"));
                                myProperty.PropertyDefinitions.ToList().ForEach(i =>
                                                                                ddlMetaData.Items.Add(new ListItem(i.Name, i.Name)));
                                ddlMetaData.ID = "meta-" + element.Name;
                                tCell.Controls.Add(ddlMetaData);
                            }
                            //}
                        }
                        tRow.Cells.Add(tCell);
                    }
                }
            }
        }
Esempio n. 8
0
        protected void RptTableMappings_OnItemCreated(object sender, RepeaterItemEventArgs e)
        {
            if (!(e.Item.DataItem is GcDynamicTemplateMappings map))
            {
                return;
            }
            Client = new GcConnectClient(_credentialsStore.ToList().First().ApiKey, _credentialsStore.ToList().First().Email);
            var slug = Client.GetAccountById(Convert.ToInt32(map.AccountId)).Slug;

            if (e.Item.FindControl("btnEditTemplateMap") is Button buttonEditTemplateMap)
            {
                var serializedStatusMaps   = JsonConvert.SerializeObject(map.StatusMaps);
                var serializedEpiFieldMaps = JsonConvert.SerializeObject(map.EpiFieldMaps);
                buttonEditTemplateMap.PostBackUrl =
                    $"~/modules/GcEpiPlugin/NewGcMappingStep4.aspx?AccountId={map.AccountId}" +
                    $"&ProjectId={map.ProjectId}&TemplateId={map.TemplateId}&PostType={map.PostType}&Author={map.Author}" +
                    $"&DefaultStatus={map.DefaultStatus}&EpiContentType={map.EpiContentType}&StatusMaps={serializedStatusMaps}" +
                    $"&EpiFieldMaps={serializedEpiFieldMaps}&PublishedDateTime={map.PublishedDateTime}";
            }
            if (e.Item.FindControl("lnkAccountSlug") is HyperLink linkAccountSlug)
            {
                linkAccountSlug.NavigateUrl = $"https://{slug}.gathercontent.com/";
            }
            if (e.Item.FindControl("lnkProject") is HyperLink linkProject)
            {
                if (Client.GetProjectById(Convert.ToInt32(map.ProjectId)).Name != null)
                {
                    linkProject.Text        = Client.GetProjectById(Convert.ToInt32(map.ProjectId)).Name;
                    linkProject.NavigateUrl = $"https://{slug}.gathercontent.com/templates/{map.ProjectId}";
                }
                else
                {
                    linkProject.Text = "Project is deleted";
                }
            }
            if (e.Item.FindControl("lnkTemplate") is HyperLink linkTemplate)
            {
                if (Client.GetTemplateById(Convert.ToInt32(map.TemplateId)).Name != null)
                {
                    linkTemplate.Text        = Client.GetTemplateById(Convert.ToInt32(map.TemplateId)).Name;
                    linkTemplate.NavigateUrl = $"https://{slug}.gathercontent.com/templates/{map.TemplateId}";
                }
                else
                {
                    linkTemplate.Text = "Template is deleted";
                }
            }
            if (e.Item.FindControl("chkTemplate") is CheckBox checkBoxTemplate)
            {
                checkBoxTemplate.ID = $"{map.TemplateId}";
            }
            if (e.Item.FindControl("btnItemsReview") is Button buttonItemsReview)
            {
                buttonItemsReview.PostBackUrl = "~/modules/GcEpiPlugin/ReviewItemsForImport.aspx?" +
                                                $"TemplateId={map.TemplateId}&ProjectId={map.ProjectId}";
            }
            if (e.Item.FindControl("publishedOn") is Label publishedOnLabel)
            {
                publishedOnLabel.Text = map.PublishedDateTime;
            }
        }