/// <summary>
 /// add new project
 /// </summary>
 /// <param name="project_name"></param>
 public void newProject(string project_name)
 {
     try
     {
         DashDataContext ctx = new DashDataContext();
         ctx.project_status.Add(new projectStatus
         {
             project = project_name,
             status = true
         });
         ctx.SaveChanges();
     }
     catch(Exception ex)
     {
     }            
 }
        /// <summary>
        /// delete page from project
        /// </summary>
        /// <param name="project_name"></param>
        /// <param name="page"></param>
        public void deletePage(string project_name, string page)
        {
            try
            {
                DashDataContext ctx = new DashDataContext();
                var data = ctx.projtbl.FirstOrDefault(m => m.proj == project_name && m.url == page);

                if (data != null)
                    ctx.projtbl.Remove(data);

                ctx.SaveChanges();
            }
            catch(Exception ex)
            {

            }
        }
        /// <summary>
        /// delete projects
        /// </summary>
        /// <param name="project_name"></param>
        public void deleteProject(string Project)
        {
            try
            {
                DashDataContext ctx = new DashDataContext();
                var data = ctx.project_status.FirstOrDefault(m => m.project == Project);

                if (data != null)
                    ctx.project_status.Remove(data);

                var data2 = ctx.projtbl.Where(m => m.proj == Project);

                if (data2 != null)
                    foreach (project_tbl m in data2)
                        ctx.projtbl.Remove(m);

                ctx.SaveChanges();

            }
            catch(Exception ex)
            {

            }
        }
        /// <summary>
        /// update page page name
        /// </summary>
        /// <param name="project"></param>
        /// <param name="currentPageName"></param>
        /// <param name="previousPageName"></param>
        public void updatePage_name(string project, string currentPageName, string previousPageName)
        {
            try
            {
                DashDataContext ctx = new DashDataContext();
                var data = ctx.projtbl.FirstOrDefault(m => m.proj == project && m.url == previousPageName);

                data.url = currentPageName;
                ctx.SaveChanges();
            }
            catch(Exception ex)
            {

            }
        }
        /// <summary>
        /// update page status
        /// </summary>
        /// <param name="project"></param>
        /// <param name="page"></param>
        /// <param name="status"></param>
        public void updatePage_status(string project, string page,bool status)
        {
            try
            {
                DashDataContext ctx = new DashDataContext();
                var Page = ctx.projtbl.FirstOrDefault(m => m.proj == project && m.url == page);

                if (Page == null)
                    ctx.projtbl.Add(new project_tbl { 
                        PageActive = status,
                        proj = project,
                        url = page
                    });
                else
                    Page.PageActive = status;

                ctx.SaveChanges();
            }
            catch(Exception ex)
            {

            }
        }
        /// <summary>
        /// update project status
        /// </summary>
        /// <param name="project"></param>
        /// <param name="status"></param>
        public void updateProject_status(string project,bool status)
        {
            try
            {
                DashDataContext ctx = new DashDataContext();
                var prj = ctx.project_status.FirstOrDefault(m => m.project == project);
                prj.status = status;
                ctx.SaveChanges();
            }
            catch(Exception ex)
            {

            }
        }