Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            paramsContainer   = new ParamsContainer(HttpContext.Current);
            initialJson.Value = PublicMethods.toJSON(RouteList.get_data_server_side(paramsContainer, RouteName.node));

            try
            {
                Guid?nodeId = PublicMethods.parse_guid(Request.Params["ID"], alternatvieValue:
                                                       PublicMethods.parse_guid(Request.Params["NodeID"]));

                if (Request.Url.ToString().ToLower().Contains("_escaped_fragment_=") && nodeId.HasValue)
                {
                    ParamsContainer paramsContainer = new ParamsContainer(HttpContext.Current);

                    Modules.CoreNetwork.Node _nd = CNController.get_node(paramsContainer.Tenant.Id, nodeId.Value, true);

                    string htmlContent = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" +
                                         "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>" + _nd.Name + " - " + RaaiVanSettings.SystemTitle(paramsContainer.Tenant.Id) + "</title></head><body>" +
                                         "<div>" + _nd.Name + "</div>" +
                                         "<div>" + ProviderUtil.list_to_string <string>(_nd.Tags, ' ') + "</div>" +
                                         "<div>" + PublicMethods.shuffle_text(PublicMethods.markup2plaintext(paramsContainer.Tenant.Id,
                                                                                                             _nd.Description, true)) + "</div>" +
                                         "<div>" + PublicMethods.markup2plaintext(paramsContainer.Tenant.Id,
                                                                                  Modules.Wiki.WikiController.get_wiki_content(paramsContainer.Tenant.Id, nodeId.Value), true) + "</div>" +
                                         "</body></html>";

                    paramsContainer.return_response(htmlContent);

                    return;
                }
            }
            catch { }
        }
Пример #2
0
        public static void GetMessageReceivers(Guid applicationId,
                                               ref List <Message> refMsg, List <Guid> MessagesIds, int?count, int?lastId)
        {
            string spName = GetFullyQualifiedName("GetMessageReceivers");

            try
            {
                if (lastId <= 0)
                {
                    lastId = null;
                }
                if (count <= 0)
                {
                    count = null;
                }

                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref MessagesIds), ',', count, lastId);
                _parse_message_receivers(ref reader, ref refMsg);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.MSG);
            }
        }
Пример #3
0
        protected void get_thread_users(Guid?threadId, int?count, int?lastId, ref string responseText)
        {
            //Privacy Check: OK
            if (!paramsContainer.GBEdit)
            {
                return;
            }

            if (!lastId.HasValue)
            {
                lastId = -1;
            }

            if (!threadId.HasValue || !MSGController.has_message(paramsContainer.Tenant.Id,
                                                                 null, paramsContainer.CurrentUserID.Value, threadId, null))
            {
                responseText = "{\"ErrorText\":\"" + Messages.AccessDenied + "\"}";
                return;
            }

            List <User> users = MSGController.get_thread_users(paramsContainer.Tenant.Id,
                                                               threadId.Value, paramsContainer.CurrentUserID.Value, count, lastId);

            responseText = "{\"Users\":[" +
                           ProviderUtil.list_to_string <string>(users.Select(
                                                                    u => "{\"UserID\":\"" + u.UserID.ToString() + "\"" +
                                                                    ",\"UserName\":\"" + Base64.encode(u.UserName) + "\"" +
                                                                    ",\"FirstName\":\"" + Base64.encode(u.FirstName) + "\"" +
                                                                    ",\"LastName\":\"" + Base64.encode(u.LastName) + "\"" +
                                                                    ",\"ProfileImageURL\":\"" + DocumentUtilities.get_personal_image_address(paramsContainer.Tenant.Id,
                                                                                                                                             u.UserID.Value) + "\"}").ToList()) +
                           "]}";
        }
Пример #4
0
        public static void GetOwnerFiles(Guid applicationId,
                                         ref List <DocFileInfo> retFiles, ref List <Guid> ownerIds, FileOwnerTypes ownerType)
        {
            string spName = GetFullyQualifiedName("GetOwnerFiles");

            try
            {
                if (ownerIds.Count == 0)
                {
                    return;
                }
                string strOwnerType = null;
                if (ownerType != FileOwnerTypes.None)
                {
                    strOwnerType = ownerType.ToString();
                }

                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref ownerIds), ',', strOwnerType);
                _parse_files(applicationId, ref reader, ref retFiles);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
            }
        }
Пример #5
0
        protected void get_confidentiality_level_users(Guid?confidentialityId,
                                                       string searchText, int?count, long?lowerBoundary, ref string responseText)
        {
            //Privacy Check: OK
            if (!paramsContainer.GBEdit)
            {
                return;
            }

            if (!AuthorizationManager.has_right(AccessRoleName.ManageConfidentialityLevels, paramsContainer.CurrentUserID))
            {
                responseText = "{\"ErrorText\":\"" + Messages.AccessDenied + "\"}";
                return;
            }

            long totalCount = 0;

            List <User> users = !confidentialityId.HasValue ? new List <User>() :
                                UsersController.get_users(paramsContainer.Tenant.Id,
                                                          PrivacyController.get_confidentiality_level_user_ids(paramsContainer.Tenant.Id,
                                                                                                               confidentialityId.Value, searchText, count, lowerBoundary, ref totalCount));

            responseText = "{\"TotalCount\":" + totalCount.ToString() +
                           ",\"Users\":[" + ProviderUtil.list_to_string <string>(users.Select(
                                                                                     u => "{\"UserID\":\"" + u.UserID.ToString() + "\"" +
                                                                                     ",\"UserName\":\"" + Base64.encode(u.UserName) + "\"" +
                                                                                     ",\"FirstName\":\"" + Base64.encode(u.FirstName) + "\"" +
                                                                                     ",\"LastName\":\"" + Base64.encode(u.LastName) + "\"" +
                                                                                     ",\"ProfileImageURL\":\"" + DocumentUtilities.get_personal_image_address(
                                                                                         paramsContainer.Tenant.Id, u.UserID.Value) + "\"" +
                                                                                     "}"
                                                                                     ).ToList()) + "]" +
                           "}";
        }
Пример #6
0
        public static bool ArithmeticDeleteNotifications(Guid applicationId, Notification info, List <string> actions)
        {
            string spName = GetFullyQualifiedName("ArithmeticDeleteNotifications");

            try
            {
                if (!string.IsNullOrEmpty(info.Action.ToString()))
                {
                    actions.Add(info.Action.ToString());
                }
                actions = actions.Distinct().ToList();

                if (info.SubjectID.HasValue)
                {
                    info.SubjectIDs.Add(info.SubjectID.Value);
                }
                if (info.RefItemID.HasValue)
                {
                    info.RefItemIDs.Add(info.RefItemID.Value);
                }

                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        ProviderUtil.list_to_string <Guid>(info.SubjectIDs), ProviderUtil.list_to_string <Guid>(info.RefItemIDs),
                                                                        info.Sender.UserID, ProviderUtil.list_to_string <string>(ref actions), ',')));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
                return(false);
            }
        }
Пример #7
0
        public static void SearchUsers(Guid applicationId, ref List <User> retUsers, string searchText,
                                       ref List <Guid> departmentIds, ref List <Guid> expertiseKDIds, ref List <Guid> projectIds,
                                       ref List <Guid> processIds, ref List <Guid> communityIds, ref List <Guid> knowledgeKds,
                                       int?count, Guid?minId)
        {
            string spName = GetFullyQualifiedName("SearchUsers");

            try
            {
                List <Guid> _userIds = new List <Guid>();

                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId, count, minId,
                                                                 ProviderUtil.get_search_text(searchText), ProviderUtil.list_to_string <Guid>(ref departmentIds),
                                                                 ProviderUtil.list_to_string <Guid>(ref expertiseKDIds), ProviderUtil.list_to_string <Guid>(ref projectIds),
                                                                 ProviderUtil.list_to_string <Guid>(ref processIds), ProviderUtil.list_to_string <Guid>(ref communityIds),
                                                                 ProviderUtil.list_to_string <Guid>(ref knowledgeKds), ',');

                ProviderUtil.parse_guids(ref reader, ref _userIds);
                retUsers = UsersController.get_users(applicationId, _userIds);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SRCH);
            }
        }
Пример #8
0
 public static void GetLogs(Guid?applicationId, ref List <Log> retLogs, List <Guid> userIds, List <Action> actions,
                            DateTime?beginDate, DateTime?finishDate, long?lastId, int?count)
 {
     try
     {
         IDataReader reader = ProviderUtil.execute_reader(GetFullyQualifiedName("GetLogs"), applicationId,
                                                          ProviderUtil.list_to_string <Guid>(ref userIds), ProviderUtil.list_to_string <Action>(ref actions),
                                                          ',', beginDate, finishDate, lastId, count);
         _parse_logs(ref reader, ref retLogs);
     }
     catch (Exception ex) { string strEx = ex.ToString(); }
 }
Пример #9
0
        protected void nodes_rss(Guid?nodeTypeId, string title, string description, int?count, long?lowerBoundary,
                                 string searchText, bool?isDocument, bool?isKnowledge, bool?sitemap)
        {
            if (!count.HasValue || count.Value <= 0)
            {
                count = 20;
            }
            if (count.HasValue && count > 5000)
            {
                count = 5000;
            }

            List <Node> nodes = nodeTypeId.HasValue ?
                                CNController.get_nodes(paramsContainer.Tenant.Id, nodeTypeId.Value, null, searchText,
                                                       isDocument, isKnowledge, null, null, count.Value, lowerBoundary, false) :
                                CNController.get_nodes(paramsContainer.Tenant.Id,
                                                       searchText, isDocument, isKnowledge, null, null, count.Value, lowerBoundary, false);

            if (sitemap.HasValue && sitemap.Value)
            {
                paramsContainer.xml_response(
                    "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">" +
                    ProviderUtil.list_to_string <string>(nodes.Select(
                                                             u => "<url>" +
                                                             "<loc>" +
                                                             PublicConsts.get_complete_url(paramsContainer.Tenant.Id, PublicConsts.NodePage) +
                                                             "/" + u.NodeID.Value.ToString() +
                                                             "</loc>" +
                                                             "<changefreq>weekly</changefreq>" +
                                                             "<lastmod>" + String.Format("{0:yyyy-MM-dd}", DateTime.Now) + "</lastmod>" +
                                                             //"<priority>0.8</priority>" +
                                                             "</url>").ToList(), null) +
                    "</urlset>"
                    );

                return;
            }

            List <RSSItem> rssItems = new List <RSSItem>();

            foreach (Modules.CoreNetwork.Node _nd in nodes)
            {
                rssItems.Add(new RSSItem()
                {
                    Title = _nd.Name,
                    Link  = PublicConsts.get_complete_url(paramsContainer.Tenant.Id, PublicConsts.NodePage) +
                            "/" + _nd.NodeID.Value.ToString()
                });
            }

            RSSUtilities.send_feed(HttpContext.Current, rssItems, title, description);
        }
Пример #10
0
        public static bool ArithmeticDeleteFiles(Guid applicationId, Guid?ownerId, ref List <Guid> fileIds)
        {
            string spName = GetFullyQualifiedName("ArithmeticDeleteFiles");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        ownerId, ProviderUtil.list_to_string <Guid>(ref fileIds), ',')));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
                return(false);
            }
        }
Пример #11
0
        public static void GetFileOwnerNodes(Guid applicationId, ref List <DocFileInfo> retFiles, ref List <Guid> fileIds)
        {
            string spName = GetFullyQualifiedName("GetFileOwnerNodes");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref fileIds), ',');
                _parse_file_owner_nodes(ref reader, ref retFiles);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
            }
        }
Пример #12
0
        public static bool ArithmeticDeleteDashboards(Guid applicationId, Guid userId, List <long> dashboardIds)
        {
            string spName = GetFullyQualifiedName("ArithmeticDeleteDashboards");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        userId, ProviderUtil.list_to_string <long>(dashboardIds), ',')));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
                return(false);
            }
        }
Пример #13
0
        public static bool SetParagraphsOrder(Guid applicationId, List <Guid> paragraphIds)
        {
            string spName = GetFullyQualifiedName("SetParagraphsOrder");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        ProviderUtil.list_to_string <Guid>(paragraphIds), ',')));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
                return(false);
            }
        }
Пример #14
0
        public static void GetPosts(Guid applicationId, ref List <Post> retPosts, ref List <Guid> postIds, Guid?userId)
        {
            string spName = GetFullyQualifiedName("GetPostsByIDs");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref postIds), ',', userId);
                _parse_posts(ref reader, ref retPosts);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SH);
            }
        }
Пример #15
0
        public static bool SetNotificationsAsSeen(Guid applicationId, Guid userId, ref List <long> notificationIds)
        {
            string spName = GetFullyQualifiedName("SetNotificationsAsSeen");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        userId, ProviderUtil.list_to_string <long>(ref notificationIds), ',', DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
                return(false);
            }
        }
Пример #16
0
        public static void GetTrees(Guid applicationId, ref List <Tree> retTrees, ref List <Guid> treeIds)
        {
            string spName = GetFullyQualifiedName("GetTreesByIDs");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref treeIds), ',');
                _parse_trees(ref reader, ref retTrees);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
            }
        }
Пример #17
0
        public static void GetChangedWikiOwnerIDs(Guid applicationId, ref List <Guid> retIds, ref List <Guid> ownerIds)
        {
            string spName = GetFullyQualifiedName("GetChangedWikiOwnerIDs");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref ownerIds), ',');
                ProviderUtil.parse_guids(ref reader, ref retIds);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
            }
        }
Пример #18
0
        public static void GetOwnerMessageTemplates(Guid applicationId,
                                                    ref List <MessageTemplate> retTemplates, ref List <Guid> ownerIds)
        {
            string spName = GetFullyQualifiedName("GetOwnerMessageTemplates");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref ownerIds), ',');
                _parse_message_templates(ref reader, ref retTemplates);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
            }
        }
Пример #19
0
        public static Dictionary <Guid, List <DefaultPermission> > GetDefaultPermissions(Guid applicationId, List <Guid> objectIds)
        {
            string spName = GetFullyQualifiedName("GetDefaultPermissions");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(objectIds), ',');
                return(_parse_default_permissions(ref reader));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.PRVC);
                return(new Dictionary <Guid, List <DefaultPermission> >());
            }
        }
Пример #20
0
        public static void GetTitleParagraphs(Guid applicationId, ref List <Paragraph> retSubjects,
                                              ref List <Guid> titleIds, bool?isAdmin, Guid?currentUserId, bool removed)
        {
            string spName = GetFullyQualifiedName("GetParagraphs");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref titleIds), ',', isAdmin, currentUserId, removed);
                _parse_paragraphs(ref reader, ref retSubjects);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
            }
        }
Пример #21
0
        public static List <Privacy> GetSettings(Guid applicationId, List <Guid> objectIds)
        {
            string spName = GetFullyQualifiedName("GetSettings");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(objectIds), ',');
                return(_parse_settings(ref reader));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.PRVC);
                return(new List <Privacy>());
            }
        }
Пример #22
0
        public static bool RemoveTreeNodeContents(Guid applicationId,
                                                  Guid treeNodeId, List <Guid> nodeIds, Guid currentUserId)
        {
            string spName = GetFullyQualifiedName("RemoveTreeNodeContents");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        treeNodeId, ProviderUtil.list_to_string <Guid>(nodeIds), ',', currentUserId, DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WF);
                return(false);
            }
        }
Пример #23
0
        public static void GetEvents(Guid applicationId,
                                     ref List <Event> retEvents, ref List <Guid> eventIds, bool?full)
        {
            string spName = GetFullyQualifiedName("GetEventsByIDs");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref eventIds), ',', full);
                _parse_events(ref reader, ref retEvents, full);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.EVT);
            }
        }
Пример #24
0
        protected void get_recent_threads(int?count, int?lastId, ref string responseText)
        {
            //Privacy Check: OK
            if (!paramsContainer.GBEdit)
            {
                return;
            }

            List <ThreadInfo> threads = MSGController.get_threads(paramsContainer.Tenant.Id,
                                                                  paramsContainer.CurrentUserID.Value, count, lastId);

            List <ThreadInfo> threadUsers = MSGController.get_thread_users(paramsContainer.Tenant.Id,
                                                                           threads.Where(u => u.IsGroup == true).Select(
                                                                               v => v.ThreadID.Value).ToList(), paramsContainer.CurrentUserID.Value);

            foreach (ThreadInfo tu in threadUsers)
            {
                ThreadInfo th = threads.Where(u => u.ThreadID == tu.ThreadID).FirstOrDefault();

                th.UsersCount  = tu.UsersCount;
                th.ThreadUsers = tu.ThreadUsers;
            }

            responseText = "{\"LastID\":" + (threads.Count > 0 ? threads.Max(u => u.ID) : 0).ToString() + ",\"Threads\":[";
            bool isFirst = true;

            foreach (ThreadInfo th in threads)
            {
                responseText += (isFirst ? string.Empty : ",") + "{\"ThreadID\":\"" + th.ThreadID.Value.ToString() + "\"" +
                                ",\"IsGroup\":" + (th.IsGroup.HasValue && th.IsGroup.Value).ToString().ToLower() +
                                ",\"UsersCount\":" + (th.UsersCount.HasValue ? th.UsersCount.Value : 0).ToString() +
                                ",\"MessagesCount\":" + (th.MessagesCount.HasValue ? th.MessagesCount.Value : 0).ToString() +
                                ",\"SentCount\":" + (th.SentCount.HasValue ? th.SentCount.Value : 0).ToString() +
                                ",\"NotSeenCount\":" + (th.NotSeenCount.HasValue ? th.NotSeenCount.Value : 0).ToString() +
                                ",\"Users\":[" + ProviderUtil.list_to_string <string>(th.ThreadUsers.Select(
                                                                                          u => "{\"UserID\":\"" + u.UserID.ToString() + "\"" +
                                                                                          ",\"UserName\":\"" + Base64.encode(u.UserName) + "\"" +
                                                                                          ",\"FirstName\":\"" + Base64.encode(u.FirstName) + "\"" +
                                                                                          ",\"LastName\":\"" + Base64.encode(u.LastName) + "\"" +
                                                                                          ",\"ProfileImageURL\":\"" +
                                                                                          DocumentUtilities.get_personal_image_address(paramsContainer.Tenant.Id,
                                                                                                                                       u.UserID.Value) + "\"}").ToList()) + "]}";
                isFirst = false;
            }

            responseText += "]}";
        }
Пример #25
0
        public static Dictionary <Guid, int> GetChangesCount(Guid applicationId,
                                                             List <Guid> paragraphIds, bool?applied)
        {
            string spName = GetFullyQualifiedName("GetChangesCount");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(paragraphIds), ',', applied);
                return(ProviderUtil.parse_items_count(ref reader));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
                return(new Dictionary <Guid, int>());
            }
        }
Пример #26
0
        public static bool MoveTreesOrTreeNodes(Guid applicationId, Guid treeIdOrTreeNodeId,
                                                List <Guid> movedIds, Guid currentUserId, ref List <Guid> rootIds, ref string errorMessage)
        {
            string spName = GetFullyQualifiedName("MoveTreesOrTreeNodes");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId, treeIdOrTreeNodeId,
                                                                 ProviderUtil.list_to_string <Guid>(ref movedIds), ',', currentUserId, DateTime.Now);
                ProviderUtil.parse_guids(ref reader, ref rootIds, ref errorMessage);
                return(rootIds.Count > 0);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
                return(false);
            }
        }
Пример #27
0
        public static bool SaveLog(Guid?applicationId, Log info)
        {
            try
            {
                if (!info.UserID.HasValue)
                {
                    info.UserID = Guid.Empty;
                }
                if (!info.Action.HasValue || info.Action == Action.None)
                {
                    return(false);
                }
                if (!info.Date.HasValue)
                {
                    info.Date = DateTime.Now;
                }
                if (string.IsNullOrEmpty(info.Info))
                {
                    info.Info = null;
                }

                LogLevel level    = LevelOfTheLog.get(info.Action.Value);
                string   strLevel = level == LogLevel.None ? null : level.ToString();

                if (info.SubjectID.HasValue)
                {
                    info.SubjectIDs.Add(info.SubjectID.Value);
                }
                else if (!info.SubjectID.HasValue && info.SubjectIDs.Count == 0)
                {
                    info.SubjectIDs.Add(Guid.Empty);
                }

                info.NotAuthorized = info.Action.ToString().IndexOf('_') > 0 ||
                                     info.Action == Action.NotAuthorizedAnonymousRequest ||
                                     info.Action == Action.PotentialCSRFAttack || info.Action == Action.PotentialReplayAttack;

                return(ProviderUtil.succeed(ProviderUtil.execute_reader(GetFullyQualifiedName("SaveLog"), applicationId,
                                                                        info.UserID, info.HostAddress, info.HostName, info.Action.ToString(), strLevel, info.NotAuthorized,
                                                                        ProviderUtil.list_to_string <Guid>(info.SubjectIDs), ',', info.SecondSubjectID, info.ThirdSubjectID, info.FourthSubjectID,
                                                                        info.Date, info.Info, (info.ModuleIdentifier.HasValue ? info.ModuleIdentifier.ToString() : string.Empty))));
            }
            catch { return(false); }
        }
Пример #28
0
        public static bool ArithmeticDeleteTree(Guid applicationId,
                                                List <Guid> treeIds, Guid?ownerId, Guid currentUserId)
        {
            string spName = GetFullyQualifiedName("ArithmeticDeleteTree");

            try
            {
                if (ownerId == Guid.Empty)
                {
                    ownerId = null;
                }

                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        ProviderUtil.list_to_string <Guid>(treeIds), ',', ownerId, currentUserId, DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
                return(false);
            }
        }
Пример #29
0
        public static void CloneTrees(Guid applicationId, ref List <Tree> lstTrees,
                                      List <Guid> treeIds, Guid?ownerId, bool?allowMultiple, Guid currentUserId)
        {
            string spName = GetFullyQualifiedName("CloneTrees");

            try
            {
                if (ownerId == Guid.Empty)
                {
                    ownerId = null;
                }

                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(treeIds), ',', ownerId, allowMultiple, currentUserId, DateTime.Now);
                _parse_trees(ref reader, ref lstTrees);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WF);
            }
        }
Пример #30
0
        public static void GetThreadUsers(Guid applicationId,
                                          ref List <ThreadInfo> threads, List <Guid> threadIds, Guid userId, int?count, int?lastId)
        {
            string spName = GetFullyQualifiedName("GetThreadUsers");

            try
            {
                if (lastId <= 0)
                {
                    lastId = null;
                }

                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 userId, ProviderUtil.list_to_string <Guid>(ref threadIds), ',', count, lastId);
                _parse_thread_users(ref reader, ref threads);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.MSG);
            }
        }