using LHDN.CRM.BC.Services;
using LHDN.CRM.Models.ViewModels;
using LHDN.CRM.Web.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using LHDN.CRM.Web.Resources;
using LHDN.CRM.BC.Common;

namespace LHDN.CRM.Web.Controllers
{
    public class HomeController : BaseController
    {
        //[OutputCache(CacheProfile = "Cache5mins")]
        // GET: Home
        public ActionResult Index()
        {
            AddAntiforgeryToken();
            return View();
        }


        public ActionResult Simulator()
        {
            return View();
        }

        public ActionResult DownloadManual()
        {
            return View();
        }

        public void DownloadManualByType(string id)
        {
            string fileName = "";

            if (id.ToIntSafe() == (int)Constant.ManualFileType.AgentUserManual) { fileName = Constant.ManualFileName.AgentUserManual; }
            else if (id.ToIntSafe() == (int)Constant.ManualFileType.CounterUserManual) { fileName = Constant.ManualFileName.CounterUserManual; }
            else if (id.ToIntSafe() == (int)Constant.ManualFileType.GeneralManual) { fileName = Constant.ManualFileName.GeneralManual; }
            else if (id.ToIntSafe() == (int)Constant.ManualFileType.OutboundMgmtManual) { fileName = Constant.ManualFileName.OutboundMgmtManual; }
            else if (id.ToIntSafe() == (int)Constant.ManualFileType.PEKELILINGOPERASI) { fileName = Constant.ManualFileName.PEKELILINGOPERASI; }
            else if (id.ToIntSafe() == (int)Constant.ManualFileType.SMARTKAUNTER) { fileName = Constant.ManualFileName.SMARTKAUNTER; }
            else if (id.ToIntSafe() == (int)Constant.ManualFileType.SMARTBACKOFFICE) { fileName = Constant.ManualFileName.SMARTBACKOFFICE; }

            string path = AppDomain.CurrentDomain.BaseDirectory + "Content\\Manuals\\" + fileName;
            System.IO.FileInfo file = new System.IO.FileInfo(path);
            string Outgoingfile = fileName;
            if (file.Exists)
            {
                Response.Clear();
                Response.AddHeader("Content-Disposition", "attachment; filename=" + Outgoingfile);
                Response.AddHeader("Content-Length", file.Length.ToString());
                Response.ContentType = "application/octet-stream";
                Response.WriteFile(file.FullName);
                Response.End();
            }
            else
            {
                Response.Write("This file does not exist.");
            }
        }

        public ActionResult Dashboard(string id)
        {
            ViewBag.DashboardId = id;
            GeneralService svc = new GeneralService();
            DashboardViewModel obj = new DashboardViewModel();
            obj = svc.GetDashboardbyLoginUnit(id.ToIntSafe());
            if (obj != null && obj.IsAllowAccess)
            {
                ViewBag.DashboardVM = obj;

            }
            return View();

        }

        public ActionResult Notification()
        {
            return View();
        }

        public ActionResult OutboundManualAssigned()
        {
            return View();
        }

        public ActionResult IWSConnector()
        {
            return View();
        }
        public ActionResult Menu()
        {
            return PartialView("_MenuBar", GenerateMenu());
        }
        public ActionResult ResetCache()
        {
            AddAntiforgeryToken();
            AdminService.ReInitAllRefData();
            return View("Index");
        }

        private List<MenuViewModel> GenerateMenu()
        {
            List<MenuViewModel> lstMenu;
            List<SubMenusectionViewModel> lstSubSection;
            List<SubMenuViewModel> lstSubmenu;

            string strMenuFormat = "{{Title : '{0}', Icon : '{1}', Description : '{2}', IsAuthorized : false, SubSections : []  }}";
            string strSubSectionFormat = "{{Title: '{0}', IsAuthorized : false, ContainSubMenus : false, Submenus : [] }}";
            string strSubmenuFormat = "{{Title: '{0}', ActionLink : '{1}', IsFunction : false, AngularFunction : '{2}'}}";

            string strMenu =
                    // 0
                    String.Format(strMenuFormat, Resources.MegaMenu.GeneralTitle, Resources.MegaMenu.GeneralIcon, Resources.MegaMenu.GeneralDesc)
                    // 1
                    + "," + String.Format(strMenuFormat, Resources.MegaMenu.ActivityCaseTitle, Resources.MegaMenu.ActivityCaseIcon, Resources.MegaMenu.ActivityCaseDesc)
                    // 2
                    + "," + String.Format(strMenuFormat, Resources.MegaMenu.TaxPayerTitle, Resources.MegaMenu.TaxPayerIcon, Resources.MegaMenu.TaxPayerDesc)
                    // 3
                    + "," + String.Format(strMenuFormat, Resources.MegaMenu.OutboundTitle, Resources.MegaMenu.OutboundIcon, Resources.MegaMenu.OutboundDesc)
                    // 4
                    + "," + String.Format(strMenuFormat, Resources.MegaMenu.BizTitle, Resources.MegaMenu.BizIcon, Resources.MegaMenu.BizDesc)
                    // 5
                    + "," + String.Format(strMenuFormat, Resources.MegaMenu.SysTitle, Resources.MegaMenu.SysIcon, Resources.MegaMenu.SysDesc);

            lstMenu = JsonConvert.DeserializeObject<List<MenuViewModel>>(
                    "[" + strMenu + "]"
                );

            string strSubSection = "";
            strSubSection += String.Format(strSubSectionFormat, Resources.MegaMenu.Section_DashboardTitle) + ","; // 0 General- Dashboard
            strSubSection += String.Format(strSubSectionFormat, Resources.MegaMenu.Section_GeneralTitle) + ","; // 1 General- General
            strSubSection += String.Format(strSubSectionFormat, Resources.MegaMenu.Section_ActivityTitle) + ","; // 2 Activity
            strSubSection += String.Format(strSubSectionFormat, Resources.MegaMenu.Section_TaxPayerTitle) + ","; // 3 Taxpayer
            strSubSection += String.Format(strSubSectionFormat, Resources.MegaMenu.Section_HRCCTitle) + ","; // 4 Outbound- HRCC
            strSubSection += String.Format(strSubSectionFormat, Resources.MegaMenu.Section_HCLTitle) + ","; // 5 Outbound- HCL
            strSubSection += String.Format(strSubSectionFormat, Resources.MegaMenu.Section_BizAdminTitle) + ","; // 6 BusinessAdmin
            strSubSection += String.Format(strSubSectionFormat, Resources.MegaMenu.Section_SysAdminTitle) + ",";  // 7 SysAdmin
            strSubSection += String.Format(strSubSectionFormat, Resources.MegaMenu.Section_BizAdminTitle); // 8 BusinessAdmin 2

            lstSubSection = JsonConvert.DeserializeObject<List<SubMenusectionViewModel>>(
                    "[" + strSubSection + "]"
                );

            #region "Submenu item"
            string strSubmenu = "";
            // 0
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_TaskCreate, "#", @"menu.onNewTask($event);") + ",";
            // 1
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_TaskSearch, Url.Action("Search", "Task"), "") + ",";
            // 2
            //strSubmenu += String.Format(strSubmenuFormat, "Simulator (Temporary)", Url.Action("Simulator", "Home"), "") + ",";
            strSubmenu += String.Format(strSubmenuFormat, "", "", "") + ",";
            // 3
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_ActivityNew, "#", @"menu.onNewActivity($event);") + ",";
            // 4
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_ActivitySearch, Url.Action("Search", "Activity"), "") + ",";
            // 5
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_CaseSearch, Url.Action("Search", "Case"), "") + ",";
            // 6
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_TaxPayerSearch, Url.Action("Search", "TaxPayer"), "") + ",";
            // 7
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_OutboundSearch, Url.Action("Listing", "Outbound"), "") + ",";
            // 8
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_OutboundCreateSegmentize, "#", @"menu.onNewSegmentise($event);") + ",";
            // 9
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_OutboundSegmentiseList, Url.Action("Listing/SegmentiseList", "Outbound"), "") + ",";
            // 10
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_OutboundREMSBatch, Url.Action("Listing/RemsBatch", "Outbound"), "") + ",";
            // 11
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_HCLSearchEmailBlast, Url.Action("HCLEmailBlastListing", "Outbound"), "") + ",";
            // 12
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_HCLCreateEmailBlastSeg, "#", @"menu.onNewEmailBlastSegmentise($event);") + ",";
            // 13
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_HCLEmailBlastList, Url.Action("HCLEmailBlastListing/SegmentiseList", "Outbound"), "") + ",";
            // 14
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_HCLEmailBlastBatch, Url.Action("HCLEmailBlastListing/EmailBlastBatch", "Outbound"), "") + ",";
            // 15
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizParam, Url.Action("Setting/Biz", "Admin"), "") + ",";
            // 16
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizSysparam, "#", "") + ",";
            // 17
            //strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizBackOfficeWFConfig, Url.Action("Setting/ConfigureBackOfficeWorkflow","Admin"), "") + ",";
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizBackOfficeWFConfig, Url.Action("WorkflowConfig", "Admin"), "") + ",";
            // 18
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizResultTableView, Url.Action("SearchView", "Admin"), "") + ",";
            // 19
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizDashboardView, Url.Action("Dashboard", "Admin"), "") + ",";
            // 20
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizCommTemplate, Url.Action("CommTemplate", "Admin"), "") + ",";
            // 21
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizAdditionalField, "#", "") + ",";
            // 22
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizTraineeApproval, "#", "") + ",";
            // 23
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizReassignment, Url.Action("CaseReassignment", "Admin"), "") + ",";
            // 24
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizIncidentReport, "#", "") + ",";
            // 25
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizCFFRouting, "#", "") + ",";
            // 26
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizAudit, "#", "") + ",";
            // 27
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizCreateUsers, Url.Action("Search", "User"), "") + ",";
            // 28
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizUserRoleList, Url.Action("Roles/Listing", "User"), "") + ",";
            // 29
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizUserRoleMatrix, Url.Action("Roles/FunctionalTask", "User"), "") + ",";
            // 30
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_HCLDownloadExcel, Url.Action("HCLEmailBlastListing/HCLDownloadExcelFormat", "Outbound"), "") + ",";
            // 31
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_CaseAssign, Url.Action("Assignment", "Case"), "") + ",";
            // 32
            strSubmenu += String.Format(strSubmenuFormat, Resources.MegaMenu.Menu_BizCreateUsersRequest, Url.Action("Search", "UserRequest"), "") + ",";
            lstSubmenu = JsonConvert.DeserializeObject<List<SubMenuViewModel>>(
                   "[" + strSubmenu + "]"
               );
            #endregion

            #region "General"
            //Dashboard
            List<SubMenuViewModel> lstSubmenuDashboard = new List<SubMenuViewModel>();
            List<DashboardViewModel> lstDashboard = new List<DashboardViewModel>();

            GeneralService svc = new GeneralService();

            lstDashboard = svc.GetDashboardList();
            foreach(DashboardViewModel item in lstDashboard)
            {
                SubMenuViewModel submenu = new SubMenuViewModel();
                submenu = new SubMenuViewModel { Title = item.DashboardName, IsFunction = false, ActionLink = Url.Action("Dashboard/" + item.DashboardID.ToStringSafe(), "Home")};

                lstSubSection[0].Submenus.Add(submenu);
            }

            //lstSubmenuDashboard.Add(new SubMenuViewModel { Title = "Test Dashboard 1", IsFunction = false, ActionLink = "Home/Dashboard/1" });
            //lstSubmenuDashboard.Add(new SubMenuViewModel { Title = "Test Dashboard 2", IsFunction = false, ActionLink = "Home/Dashboard/2" });

            //lstSubSection[0].Submenus.Add(lstSubmenuDashboard[0]);
            //lstSubSection[0].Submenus.Add(lstSubmenuDashboard[1]);
            lstSubSection[0].IsAuthorized = true;
            lstMenu[0].SubSections.Add(lstSubSection[0]);
            //General
            if (User.IsInRole(Constant.Authentication.Task.CreateUpdateTask))
            {
                lstSubmenu[0].IsFunction = true;
                lstSubSection[1].Submenus.Add(lstSubmenu[0]);
            }
            if (User.IsInRole(Constant.Authentication.Task.SearchTask))
            {
                lstSubSection[1].Submenus.Add(lstSubmenu[1]);
            }
            //// Temporary show for UAT
            lstSubSection[1].Submenus.Add(lstSubmenu[2]);
            lstSubSection[1].IsAuthorized = lstSubSection[1].Submenus.Count() > 0;
            // Show and add submenu
            if (lstSubSection[1].IsAuthorized)
            {
                lstMenu[0].SubSections.Add(lstSubSection[1]);
            }
            // Show menu box only when there is content
            lstMenu[0].SectionCount = lstMenu[0].SubSections.Count;
            lstMenu[0].IsAuthorized = lstMenu[0].SectionCount > 0;
            lstMenu[0].ContainSections = true;
            #endregion

            #region "Activity and Case"
            if (User.IsInRole(Constant.Authentication.Activity.CreateUpdateProfile))
            {
                lstSubmenu[3].IsFunction = true;
                lstSubSection[2].Submenus.Add(lstSubmenu[3]);
            }
            if (User.IsInRole(Constant.Authentication.Activity.SearchActivityProfile))
            {
                lstSubSection[2].Submenus.Add(lstSubmenu[4]);
            }
            if (User.IsInRole(Constant.Authentication.Cases.SearchCaseProfile))
            {
                lstSubSection[2].Submenus.Add(lstSubmenu[5]);
            }
            if (User.IsInRole(Constant.Authentication.Cases.ReassignCase))
            {
                lstSubSection[2].Submenus.Add(lstSubmenu[31]);
            }
            lstSubSection[2].IsAuthorized = lstSubSection[2].Submenus.Count() > 0;
            // Add only when section contains submenu
            if (lstSubSection[2].IsAuthorized) lstMenu[1].SubSections.Add(lstSubSection[2]);
            // Show menu box only when there is content
            lstMenu[1].SectionCount = lstMenu[1].SubSections.Count;
            lstMenu[1].IsAuthorized = lstMenu[1].SectionCount > 0;
            lstMenu[1].ContainSections = false;
            #endregion

            #region "TaxPayer"
            if (User.IsInRole(Constant.Authentication.TaxPayer.SearchTPProfile))
            {
                lstSubSection[3].Submenus.Add(lstSubmenu[6]);
            }
            lstSubSection[3].IsAuthorized = lstSubSection[3].Submenus.Count() > 0;
            // Add only when section contains submenu
            if (lstSubSection[3].IsAuthorized) lstMenu[2].SubSections.Add(lstSubSection[3]);
            // Show menu box only when there is content
            lstMenu[2].SectionCount = lstMenu[2].SubSections.Count;
            lstMenu[2].IsAuthorized = lstMenu[2].SectionCount > 0;
            lstMenu[2].ContainSections = false;
            #endregion

            #region "Outbound"
            //HRCC TODO: UPDATE Functional Task in DB and below
            if (User.IsInRole(Constant.Authentication.Outbound.SearchOutboundList))
            {
                lstSubSection[4].Submenus.Add(lstSubmenu[7]);
            }
            if (User.IsInRole(Constant.Authentication.Outbound.ManageSegmentization))
            {
                lstSubmenu[8].IsFunction = true;
                lstSubSection[4].Submenus.Add(lstSubmenu[8]);
            }
            if (User.IsInRole(Constant.Authentication.Outbound.ManageSegmentization))
            {
                lstSubSection[4].Submenus.Add(lstSubmenu[9]);
            }
            if (User.IsInRole(Constant.Authentication.Outbound.ManageCampaign))
            {
                lstSubSection[4].Submenus.Add(lstSubmenu[10]);
            }
            lstSubSection[4].IsAuthorized = lstSubSection[4].Submenus.Count() > 0;
            // Show and add submenu
            if (lstSubSection[4].IsAuthorized)
            {
                lstMenu[3].SubSections.Add(lstSubSection[4]);
            }

            //HCL TODO: UPDATE Functional Task in DB and below
            if (User.IsInRole(Constant.Authentication.HCL.CreateHCLEmailCampaign))
            {
                lstSubSection[5].Submenus.Add(lstSubmenu[11]);
            }
            if (User.IsInRole(Constant.Authentication.HCL.CreateHCLEmailCampaign))
            {
                lstSubmenu[12].IsFunction = true;
                lstSubSection[5].Submenus.Add(lstSubmenu[12]);
            }
            if (User.IsInRole(Constant.Authentication.HCL.CreateHCLEmailCampaign))
            {
                lstSubSection[5].Submenus.Add(lstSubmenu[13]);
            }
            if (User.IsInRole(Constant.Authentication.HCL.CreateHCLEmailCampaign))
            {
                lstSubSection[5].Submenus.Add(lstSubmenu[14]);
            }
            if (User.IsInRole(Constant.Authentication.HCL.UploadHCLEmail))// TODO View Role Matrix?
            {
                lstSubSection[5].Submenus.Add(lstSubmenu[30]);
            }
            lstSubSection[5].IsAuthorized = lstSubSection[5].Submenus.Count() > 0;
            // Show and add submenu
            if (lstSubSection[5].IsAuthorized)
            {
                lstMenu[3].SubSections.Add(lstSubSection[5]);
            }
            // Show menu box only when there is content
            lstMenu[3].SectionCount = lstMenu[3].SubSections.Count;
            lstMenu[3].IsAuthorized = lstMenu[3].SectionCount > 0;
            lstMenu[3].ContainSections = lstMenu[3].SectionCount > 1;
            #endregion

            #region "Business Admin"
            if (User.IsInRole(Constant.Authentication.Administration.ManageBusinessParameter))
            {
                lstSubSection[6].Submenus.Add(lstSubmenu[15]);
            }
            //if (User.IsInRole(Constant.Authentication.Administration.ManageBusinessParameter)) // TODO Business and System same?
            //{
            //    lstSubSection[6].Submenus.Add(lstSubmenu[16]);
            //}
            if (User.IsInRole(Constant.Authentication.Administration.ManageBackOfficeWorkflow))
            {
                lstSubSection[6].Submenus.Add(lstSubmenu[17]);
            }
            if (User.IsInRole(Constant.Authentication.Administration.ManageCaseSearchView) ||
                User.IsInRole(Constant.Authentication.Administration.ManageActivitySearchView) ||
                User.IsInRole(Constant.Authentication.Administration.ManageTaxPayerSearchView)) // TODO Add Result table view?
            {
                lstSubSection[6].Submenus.Add(lstSubmenu[18]);
            }
            if (User.IsInRole(Constant.Authentication.Administration.ManageDashboardView))
            {
                lstSubSection[6].Submenus.Add(lstSubmenu[19]);
            }
            if (User.IsInRole(Constant.Authentication.Administration.ManageCommunicationTemplate))
            {
                lstSubSection[6].Submenus.Add(lstSubmenu[20]);
            }
            //Hide Temporary
            //if (User.IsInRole(Constant.Authentication.Administration.ManageAdditionalFields))
            //{
            //    lstSubSection[8].Submenus.Add(lstSubmenu[21]);
            //}
            //if (User.IsInRole(Constant.Authentication.Administration.ManageTraineeAPproval))
            //{
            //    lstSubSection[8].Submenus.Add(lstSubmenu[22]);
            //}

            //temp hide
            if (User.IsInRole(Constant.Authentication.Administration.ManageCaseReassignment))
            {
                lstSubSection[8].Submenus.Add(lstSubmenu[23]);
            }
            //if (User.IsInRole(Constant.Authentication.Administration.ManageIncidentReport))
            //{
            //    lstSubSection[8].Submenus.Add(lstSubmenu[24]);
            //}
            //if (User.IsInRole(Constant.Authentication.Administration.ManageCFFRouting))
            //{
            //    lstSubSection[8].Submenus.Add(lstSubmenu[25]);
            //}
            //if (User.IsInRole(Constant.Authentication.Administration.ViewAudit)) //TODO still available
            //{
            //    lstSubSection[8].Submenus.Add(lstSubmenu[26]);
            //}
            lstSubSection[6].IsAuthorized = lstSubSection[6].Submenus.Count() > 0;
            lstSubSection[8].IsAuthorized = lstSubSection[8].Submenus.Count() > 0;
            // Add only when section contains submenu
            if (lstSubSection[6].IsAuthorized) lstMenu[4].SubSections.Add(lstSubSection[6]);
            if (lstSubSection[8].IsAuthorized) lstMenu[4].SubSections.Add(lstSubSection[8]);
            // Show menu box only when there is content
            lstMenu[4].SectionCount = lstMenu[4].SubSections.Count;
            lstMenu[4].IsAuthorized = lstMenu[4].SectionCount > 0;
            lstMenu[4].ContainSections = lstMenu[4].SectionCount > 1;
            #endregion

            #region "System Admin"
            if (User.IsInRole(Constant.Authentication.Administration.ReviewUserProfileCreationUpdate) ||
           User.IsInRole(Constant.Authentication.Administration.ApproveUserProfileCreationUpdate) ||
           User.IsInRole(Constant.Authentication.Administration.RequestUserCreation) ||
           User.IsInRole(Constant.Authentication.Administration.RequestUpdateUserProfile))
            {
                lstSubSection[7].Submenus.Add(lstSubmenu[32]);
            }
            if (User.IsInRole(Constant.Authentication.Administration.EditUserProfile))
            {
                lstSubSection[7].Submenus.Add(lstSubmenu[27]);
            }
            if (User.IsInRole(Constant.Authentication.Administration.ManageUserRole))
            {
                lstSubSection[7].Submenus.Add(lstSubmenu[28]);
            }
            if (User.IsInRole(Constant.Authentication.Administration.ManageUserRole))// TODO View Role Matrix?
            {
                lstSubSection[7].Submenus.Add(lstSubmenu[29]);
            }
       
            lstSubSection[7].IsAuthorized = lstSubSection[7].Submenus.Count() > 0;
            // Add only when section contains submenu
            if (lstSubSection[7].IsAuthorized) lstMenu[5].SubSections.Add(lstSubSection[7]);
            // Show menu box only when there is content
            lstMenu[5].SectionCount = lstMenu[5].SubSections.Count;
            lstMenu[5].IsAuthorized = lstMenu[5].SectionCount > 0;
            lstMenu[5].ContainSections = lstMenu[5].SectionCount > 1;
            #endregion

            return lstMenu;
        }
    }
}