public static int Count(int siteId)
        {
            int count = OnlyCount(siteId);

            count += DBModule.CountForMyPage(siteId);
            return(count);
        }
Example #2
0
 private void GetModule(int moduleId, int pageId)
 {
     using (IDataReader reader = DBModule.GetModule(moduleId, pageId))
     {
         PopulateFromReader(reader);
     }
 }
Example #3
0
 private void GetModule(Guid moduleGuid)
 {
     using (IDataReader reader = DBModule.GetModule(moduleGuid))
     {
         PopulateFromReader(reader);
     }
 }
        public List<dynamic> search(DBModule.TypeOfDepth depth, String value,TreeView treeView1)
        {
            //IDataBase dataBase = new DataBase();
            ResultList = DataBase.ReceiveResults(depth, value);
            addDataToTree(treeView1, new List<dynamic>(), ResultList, depth, value, 0);

            return ResultList;
        }
Example #5
0
        public static List <PageModule> GetPageModulesByModule(int moduleId)
        {
            List <PageModule> pageModules = new List <PageModule>();

            using (IDataReader reader = DBModule.PageModuleGetReaderByModule(moduleId))
            {
                pageModules = LoadListFromReader(reader);
            }

            return(pageModules);
        }
Example #6
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            //Внедрение зависимостей

            NinjectModule DBModule       = new DBModule("MyConnection");
            NinjectModule servicesModule = new ServicesModule();
            var           kernel         = new StandardKernel(DBModule, servicesModule);

            System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver = new  Ninject.WebApi.DependencyResolver.NinjectDependencyResolver(kernel);
        }
Example #7
0
 public static DataTable SelectGlobalPage(
     int siteId,
     int moduleDefId,
     int pageId,
     int pageNumber,
     int pageSize,
     out int totalPages)
 {
     return(DBModule.SelectGlobalPage(
                siteId,
                moduleDefId,
                pageId,
                pageNumber,
                pageSize,
                out totalPages));
 }
Example #8
0
        private bool Create()
        {
            bool created = false;
            int  newID   = -1;

            if (this.guid == Guid.Empty)// tni 2013-06-26 forced moduleGuid implementation
            {
                this.guid = Guid.NewGuid();
            }

            newID = DBModule.AddModule(
                this.pageID,
                this.siteID,
                this.siteGuid,
                this.moduleDefID,
                this.moduleOrder,
                this.paneName,
                this.moduleTitle,
                this.viewRoles,
                this.authorizedEditRoles,
                this.draftEditRoles,
                this.draftApprovalRoles,
                this.cacheTime,
                this.showTitle,
                this.availableForMyPage,
                this.allowMultipleInstancesOnMyPage,
                this.icon,
                this.createdByUserID,
                DateTime.UtcNow,
                this.guid,
                this.featureGuid,
                this.hideFromAuthenticated,
                this.hideFromUnauthenticated,
                this.headElement,
                this.publishMode);

            this.moduleID = newID;
            created       = (newID > -1);
            if (created)
            {
                ModuleSettings.CreateDefaultModuleSettings(this.moduleID);
            }

            return(created);
        }
Example #9
0
        private bool Create()
        {
            bool created = false;
            int  newID   = -1;

            if (this.ModuleGuid == Guid.Empty)// tni 2013-06-26 forced moduleGuid implementation
            {
                this.ModuleGuid = Guid.NewGuid();
            }

            newID = DBModule.AddModule(
                this.PageId,
                this.SiteId,
                this.SiteGuid,
                this.ModuleDefId,
                this.ModuleOrder,
                this.PaneName,
                this.ModuleTitle,
                this.ViewRoles,
                this.AuthorizedEditRoles,
                this.DraftEditRoles,
                this.DraftApprovalRoles,
                this.CacheTime,
                this.ShowTitle,
                this.AvailableForMyPage,
                this.AllowMultipleInstancesOnMyPage,
                this.Icon,
                this.CreatedByUserId,
                DateTime.UtcNow,
                this.ModuleGuid,
                this.FeatureGuid,
                this.HideFromAuthenticated,
                this.HideFromUnauthenticated,
                this.HeadElement,
                this.PublishMode);

            this.ModuleId = newID;
            created       = (newID > -1);
            if (created)
            {
                ModuleSettings.CreateDefaultModuleSettings(this.ModuleId);
            }

            return(created);
        }
Example #10
0
 private bool Update()
 {
     return(DBModule.UpdateModule(
                this._moduleId,
                this._moduleDefId,
                this._moduleTitle,
                this._viewRoles,
                this._authorizedEditRoles,
                this._draftEditRoles,
                this._cacheTime,
                this._showTitle,
                this._editUserId,
                this._availableForMyPage,
                this._allowMultipleInstancesOnMyPage,
                this._icon,
                this._hideFromAuthenticated,
                this._hideFromUnauthenticated));
 }
Example #11
0
 public static bool Publish(
     Guid pageGuid,
     Guid moduleGuid,
     int moduleId,
     int pageId,
     String paneName,
     int moduleOrder,
     DateTime publishBeginDate,
     DateTime publishEndDate)
 {
     return(DBModule.Publish(
                pageGuid,
                moduleGuid,
                moduleId,
                pageId,
                paneName,
                moduleOrder,
                publishBeginDate,
                publishEndDate));
 }
Example #12
0
 public static DataTable SelectPage(
     int siteId,
     int moduleDefId,
     string title,
     int pageNumber,
     int pageSize,
     bool sortByModuleType,
     bool sortByAuthor,
     out int totalPages)
 {
     return(DBModule.SelectPage(
                siteId,
                moduleDefId,
                title,
                pageNumber,
                pageSize,
                sortByModuleType,
                sortByAuthor,
                out totalPages));
 }
Example #13
0
        public static void DeletePageModules(int pageId)
        {
            DBModule.PageModuleDeleteByPage(pageId);
            //IDataReader result = GetPageModules(pageId);
            //ArrayList modules = new ArrayList();

            //while (result.Read())
            //{
            //    Module m = new Module();
            //    m.ModuleId = Convert.ToInt32(result["ModuleID"]);
            //    m.ModuleDefId = Convert.ToInt32(result["ModuleDefID"]);
            //    m.PageId = Convert.ToInt32(result["PageID"]);
            //    m.PaneName = result["PaneName"].ToString();
            //    m.ModuleTitle = result["ModuleTitle"].ToString();
            //    m.AuthorizedEditRoles = result["AuthorizedEditRoles"].ToString();
            //    m.CacheTime = Convert.ToInt32(result["CacheTime"]);
            //    m.ModuleOrder = Convert.ToInt32(result["ModuleOrder"]);
            //    if (result["EditUserID"] != DBNull.Value)
            //    {
            //        m.EditUserId = Convert.ToInt32(result["EditUserID"]);
            //    }


            //    string showTitle = result["ShowTitle"].ToString();
            //    m.ShowTitle = (showTitle == "True" || showTitle == "1");
            //    m.ControlSource = result["ControlSrc"].ToString();


            //    modules.Add(m);


            //}
            //result.Close();

            //foreach (Module m in modules)
            //{
            //    DeleteModuleInstance(m.ModuleId, pageId);

            //}
        }
Example #14
0
        private bool Create()
        {
            bool created = false;
            int  newID   = -1;

            this._guid = Guid.NewGuid();

            newID = DBModule.AddModule(
                this._pageId,
                this._siteId,
                this._siteGuid,
                this._moduleDefId,
                this._moduleOrder,
                this._paneName,
                this._moduleTitle,
                this._viewRoles,
                this._authorizedEditRoles,
                this._draftEditRoles,
                this._cacheTime,
                this._showTitle,
                this._availableForMyPage,
                this._allowMultipleInstancesOnMyPage,
                this._icon,
                this._createdByUserId,
                DateTime.UtcNow,
                this._guid,
                this._featureGuid,
                this._hideFromAuthenticated,
                this._hideFromUnauthenticated);

            this._moduleId = newID;
            created        = (newID > -1);
            if (created)
            {
                ModuleSettings.CreateDefaultModuleSettings(this._moduleId);
            }

            return(created);
        }
Example #15
0
 private bool Update()
 {
     return(DBModule.UpdateModule(
                this.moduleID,
                this.moduleDefID,
                this.moduleTitle,
                this.viewRoles,
                this.authorizedEditRoles,
                this.draftEditRoles,
                this.draftApprovalRoles,
                this.cacheTime,
                this.showTitle,
                this.editUserID,
                this.availableForMyPage,
                this.allowMultipleInstancesOnMyPage,
                this.icon,
                this.hideFromAuthenticated,
                this.hideFromUnauthenticated,
                this.includeInSearch,
                this.isGlobal,
                this.headElement,
                this.publishMode));
 }
Example #16
0
 private bool Update()
 {
     return(DBModule.UpdateModule(
                this.ModuleId,
                this.ModuleDefId,
                this.ModuleTitle,
                this.ViewRoles,
                this.AuthorizedEditRoles,
                this.DraftEditRoles,
                this.DraftApprovalRoles,
                this.CacheTime,
                this.ShowTitle,
                this.EditUserId,
                this.AvailableForMyPage,
                this.AllowMultipleInstancesOnMyPage,
                this.Icon,
                this.HideFromAuthenticated,
                this.HideFromUnauthenticated,
                this.IncludeInSearch,
                this.IsGlobal,
                this.HeadElement,
                this.PublishMode));
 }
Example #17
0
        public static List <GlobalContent> GetGlobalContent(int siteId)
        {
            List <GlobalContent> globalContents = new List <GlobalContent>();

            using (IDataReader reader = DBModule.GetGlobalContent(siteId))
            {
                while (reader.Read())
                {
                    globalContents.Add(new GlobalContent {
                        ModuleGuid   = Guid.Parse(reader["ModuleGuid"].ToString()),
                        ModuleID     = Convert.ToInt32(reader["ModuleId"]),
                        ModuleTitle  = reader["ModuleTitle"].ToString(),
                        FeatureName  = reader["FeatureName"].ToString(),
                        ResourceFile = reader["ResourceFile"].ToString(),
                        CreatedBy    = reader["CreatedBy"].ToString(),
                        CreatedById  = Convert.ToInt32(reader["CreatedById"]),
                        ControlSrc   = reader["ContrlSrc"].ToString(),
                        UseCount     = Convert.ToInt32(reader["UseCount"])
                    });
                }
            }
            return(globalContents);
        }
        /*public List<dynamic> searchFromAnotherNodes(TypeOfDepth depth, String value, TreeView treeView1)
        {
            //ICommunication communication = new Communication();
        //    List<dynamic> tmpList = Communication.SendMessage(depth, value);
            addDataToTree(treeView1,ResultList, tmpList, depth, value, ResultList.Count);

            ResultList.AddRange(tmpList);
            
            return ResultList;
        }
        */
        private bool isAdded(List<dynamic> list, dynamic value, DBModule.TypeOfDepth depth)
        {
            switch (depth)
            {
                case DBModule.TypeOfDepth.Section:
                    {
                        DBModule.Section temp = value;
                        foreach (DBModule.Section section in list)
                        {
                            if (section.SectionName.Equals(temp.SectionName))
                                return true;
                        }
                        return false;
                    }
                case DBModule.TypeOfDepth.ForumThread:
                    {
                        ForumThread temp = value;
                        foreach (ForumThread thread in list)
                        {
                            if ((thread.SectionName.Equals(temp.SectionName)) && (thread.ThreadName.Equals(temp.ThreadName)))
                                return true;
                        }
                        return false;
                    }
                case DBModule.TypeOfDepth.Post:
                    {
                        DBModule.Post temp = value;
                        foreach (Post post in list)
                        {
                            if ((post.SectionTitle.Equals(temp.SectionTitle)) && (post.TopicTitle.Equals(temp.TopicTitle)) && (post.Author.Equals(temp.Author)) && (post.Content.Equals(temp.Content)) && (post.Date.Equals(temp.Date)))
                                return true;
                        }
                        return false;
                    }
            }
            return false;
        }
        public override bool InvokeCommand(SubModuleFunctions command, IContext contextHandler)
        {
            Console.WriteLine("InvokeCommand execution for EpidemyAlert subModule");

            EpidemyContext subModuleContextHandler = contextHandler as EpidemyContext;

            DBModule     instance    = Utils.Singleton <DBModule> .Instance;
            UserHandler  userHandler = instance.GetUserHandler();
            List <Point> points;

            switch (command)
            {
            case SubModuleFunctions.EpidemyCheckForAreas:

                points = userHandler.GetPoints();
                subModuleContextHandler.json = CreateConvexHauls(points);
                return(true);

            case SubModuleFunctions.EpidemyCheckForSpecificAlert:

                points = userHandler.GetPointsForDisease(subModuleContextHandler.specificSearch);
                subModuleContextHandler.json = CreateConvexHauls(points);
                return(true);

            case SubModuleFunctions.EpidemyCheckForAlert:

                points = userHandler.GetPointsForDisease(subModuleContextHandler.specificSearch);
                Point user = new Point();
                subModuleContextHandler.json = CheckIfPointsCauseAlert(points, user);
                return(true);

            default:

                return(false);
            }
        }
Example #20
0
 public static bool UpdateCountOfUseOnMyPage(int moduleId, int increment)
 {
     return(DBModule.UpdateCountOfUseOnMyPage(moduleId, increment));
 }
Example #21
0
 public static IDataReader GetMyPageModules(int siteId)
 {
     return(DBModule.GetMyPageModules(siteId));
 }
Example #22
0
 public static bool UpdatePage(int oldPageId, int newPageId, int moduleId)
 {
     return(DBModule.UpdatePage(oldPageId, newPageId, moduleId));
 }
Example #23
0
 public static bool DeleteModuleInstance(int moduleId, int pageId)
 {
     return(DBModule.DeleteModuleInstance(moduleId, pageId));
 }
Example #24
0
 public static bool UpdateModuleOrder(int pageId, int moduleId, int moduleOrder, string paneName)
 {
     return(DBModule.UpdateModuleOrder(pageId, moduleId, moduleOrder, paneName));
 }
 public List<dynamic> ReceiveMessage(DBModule.TypeOfDepth depth, String value)
 {
     return this.DataBase.ReceiveResults(depth, value);
 }
Example #26
0
 public static DataTable GetPageModulesTable(int moduleId)
 {
     return(DBModule.PageModuleGetByModule(moduleId));
 }
Example #27
0
 public static void DeletePageModules(int pageId)
 {
     DBModule.PageModuleDeleteByPage(pageId);
 }
Example #28
0
 /// <summary>
 /// Returns a DataReader of published pagemodules
 /// </summary>
 /// <param name="pageID"></param>
 /// <returns></returns>
 public static IDataReader GetPageModules(int pageId)
 {
     return(DBModule.GetPageModules(pageId));
 }
Example #29
0
 public static int GetGlobalCount(int siteId, int moduleDefId, int pageId)
 {
     return(DBModule.GetGlobalCount(siteId, moduleDefId, pageId));
 }
Example #30
0
 public static int GetCountByFeature(int moduleDefId)
 {
     return(DBModule.GetCountByFeature(moduleDefId));
 }
Example #31
0
 public static IDataReader GetModulesForSite(int siteId, Guid featureGuid)
 {
     return(DBModule.GetModulesForSite(siteId, featureGuid));
 }
Example #32
0
 public static bool DeleteModule(int moduleId)
 {
     ModuleSettings.DeleteModuleSettings(moduleId);
     return(DBModule.DeleteModule(moduleId));
 }
Example #33
0
 public ModuleDTO(DBModule module)
 {
     Id       = module.Id;
     Timespan = new TimespanDTO(module.Timespan);
 }
 private void addDataToTree(TreeView treeView1, List<dynamic> actualList, List<dynamic> resultList, DBModule.TypeOfDepth depth, String value, int count)
 {
     // if (sendQuery != null)
     // {
     switch (depth)
     {
         case DBModule.TypeOfDepth.Section:
             {
                 int i = count;
                 foreach (DBModule.Section sectionName in resultList)
                 {
                     if (!isAdded(actualList, sectionName, depth))
                     {
                         TreeViewItem mainItem = new TreeViewItem() { Header = "Section: " + sectionName.SectionName, Name = "item" + i };
                         treeView1.Items.Add(mainItem);
                         mainItem.RegisterName("regName" + i, mainItem);
                         i++;
                     }
                 }
                 break;
             }
         case DBModule.TypeOfDepth.ForumThread:
             {
                 int i = count;
                 
                 foreach (ForumThread forumThread in resultList)
                 {
                     if (!isAdded(actualList, forumThread, depth))
                     {
                         if (!dict.ContainsKey(forumThread.SectionName))
                         {
                             TreeViewItem mainItem = new TreeViewItem() { Header = "Section: " + forumThread.SectionName, Name = "item" + i };
                             treeView1.Items.Add(mainItem);
                             dict.Add(forumThread.SectionName, "regName" + i);
                             mainItem.RegisterName("regName" + i, mainItem);
                             TreeViewItem subItem = new TreeViewItem() { Header = "Thread: " + forumThread.ThreadName, Name = "subItem" + i };
                             mainItem.Items.Add(subItem);
                             subItem.RegisterName("regSubName" + i, subItem);
                         }
                         else
                         {
                             TreeViewItem searchItem = treeView1.FindName(dict[forumThread.SectionName]) as TreeViewItem;
                             TreeViewItem subItem = new TreeViewItem() { Header = "Thread: " + forumThread.ThreadName, Name = "subItem" + i };
                             searchItem.Items.Add(subItem);
                             subItem.RegisterName("regSubName" + i, subItem);
                         }
                         i++;
                     }
                 }
                 break;
             }
         case DBModule.TypeOfDepth.Post:
             {
                 int i = count;
                 
                 foreach (Post post in resultList)
                 {
                     if (!isAdded(actualList, post, depth))
                     {
                         if (!dictSections.ContainsKey(post.SectionTitle))
                         {
                             TreeViewItem mainItem = new TreeViewItem() { Header = "Section: " + post.SectionTitle, Name = "item" + i };
                             treeView1.Items.Add(mainItem);
                             dictSections.Add(post.SectionTitle, "regName" + i);
                             mainItem.RegisterName("regName" + i, mainItem);
                             if (!dictThreads.ContainsKey(post.TopicTitle))
                             {
                                 TreeViewItem subItem = new TreeViewItem() { Header = "Thread: " + post.TopicTitle, Name = "subItem" + i };
                                 mainItem.Items.Add(subItem);
                                 dictThreads.Add(post.TopicTitle, "regSubName" + i);
                                 subItem.RegisterName("regSubName" + i, subItem);
                                 TreeViewItem postItem = new TreeViewItem() { Header = "Post: " + ChangeName(post.Content), Name = "postItem" + i };
                                 subItem.Items.Add(postItem);
                                 postItem.RegisterName("regPostName" + i, postItem);
                             }
                             else
                             {
                                 TreeViewItem searchThreadItem = treeView1.FindName(dictThreads[post.TopicTitle]) as TreeViewItem;
                                 TreeViewItem postItem = new TreeViewItem() { Header = "Post: " + ChangeName(post.Content), Name = "postItem" + i };
                                 searchThreadItem.Items.Add(postItem);
                                 postItem.RegisterName("regPostName" + i, postItem);
                             }
                         }
                         else
                         {
                             TreeViewItem searchItem = treeView1.FindName(dictSections[post.SectionTitle]) as TreeViewItem;
                             if (!dictThreads.ContainsKey(post.TopicTitle))
                             {
                                 TreeViewItem subItem = new TreeViewItem() { Header = "Thread: " + post.TopicTitle, Name = "subItem" + i };
                                 searchItem.Items.Add(subItem);
                                 subItem.RegisterName("regSubName" + i, subItem);
                                 TreeViewItem postItem = new TreeViewItem() { Header = "Post: " + ChangeName(post.Content), Name = "postItem" + i };
                                 subItem.Items.Add(postItem);
                                 postItem.RegisterName("regPostName" + i, postItem);
                             }
                             else
                             {
                                 TreeViewItem searchThreadItem = treeView1.FindName(dictThreads[post.TopicTitle]) as TreeViewItem;
                                 TreeViewItem postItem = new TreeViewItem() { Header = "Post: " + ChangeName(post.Content), Name = "postItem" + i };
                                 searchThreadItem.Items.Add(postItem);
                                 postItem.RegisterName("regPostName" + i, postItem);
                             }
                         }
                         i++;
                     }
                 }
                 break;
             }
     }
 }