Ejemplo n.º 1
0
        public static bool SetMessageTemplate(Guid applicationId, MessageTemplate info)
        {
            string spName = GetFullyQualifiedName("SetMessageTemplate");

            try
            {
                if (info.AudienceType == AudienceType.NotSet)
                {
                    return(false);
                }
                if (info.AudienceRefOwnerID == Guid.Empty)
                {
                    info.AudienceRefOwnerID = null;
                }
                if (info.AudienceNodeID == Guid.Empty)
                {
                    info.AudienceNodeID = null;
                }
                if (!info.CreationDate.HasValue)
                {
                    info.CreationDate = DateTime.Now;
                }

                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        info.TemplateID, info.OwnerID, info.BodyText, info.AudienceType.ToString(), info.AudienceRefOwnerID,
                                                                        info.AudienceNodeID, info.AudienceNodeAdmin, info.CreatorUserID, info.CreationDate)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
                return(false);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        public static bool RemoveMessages(Guid applicationId, Guid?userId, Guid?threadId, long?id)
        {
            string spName = GetFullyQualifiedName("RemoveMessages");

            try
            {
                if (userId == Guid.Empty)
                {
                    userId = null;
                }
                if (threadId == Guid.Empty)
                {
                    threadId = null;
                }
                if (id <= 0)
                {
                    id = null;
                }

                if (!id.HasValue && (!userId.HasValue || !threadId.HasValue))
                {
                    return(false);
                }

                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId, userId, threadId, id)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.MSG);
                return(false);
            }
        }
Ejemplo n.º 4
0
        public static bool AddFiles(Guid applicationId,
                                    Guid ownerId, FileOwnerTypes ownerType, ref List <DocFileInfo> attachments, Guid currentUserId)
        {
            SqlConnection con = new SqlConnection(ProviderUtil.ConnectionString);
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection = con;

            //Add Attachments
            DataTable attachmentsTable = new DataTable();

            attachmentsTable.Columns.Add("FileID", typeof(Guid));
            attachmentsTable.Columns.Add("FileName", typeof(string));
            attachmentsTable.Columns.Add("Extension", typeof(string));
            attachmentsTable.Columns.Add("MIME", typeof(string));
            attachmentsTable.Columns.Add("Size", typeof(long));
            attachmentsTable.Columns.Add("OwnerID", typeof(Guid));
            attachmentsTable.Columns.Add("OwnerType", typeof(string));

            foreach (DocFileInfo _att in attachments)
            {
                attachmentsTable.Rows.Add(_att.FileID, _att.FileName,
                                          _att.Extension, _att.MIME(), _att.Size, _att.OwnerID, _att.OwnerType);
            }

            SqlParameter attachmentsParam = new SqlParameter("@Attachments", SqlDbType.Structured);

            attachmentsParam.TypeName = "[dbo].[DocFileInfoTableType]";
            attachmentsParam.Value    = attachmentsTable;
            //end of Add Attachments

            cmd.Parameters.AddWithValue("@ApplicationID", applicationId);
            cmd.Parameters.AddWithValue("@OwnerID", ownerId);
            cmd.Parameters.AddWithValue("@OwnerType", ownerType.ToString());
            cmd.Parameters.Add(attachmentsParam);
            cmd.Parameters.AddWithValue("@CurrentUserID", currentUserId);
            cmd.Parameters.AddWithValue("@Now", DateTime.Now);

            string spName = GetFullyQualifiedName("AddFiles");

            string sep       = ", ";
            string arguments = "@ApplicationID" + sep + "@OwnerID" + sep + "@OwnerType" + sep +
                               "@Attachments" + sep + "@CurrentUserID" + sep + "@Now";

            cmd.CommandText = ("EXEC" + " " + spName + " " + arguments);

            con.Open();
            try { return(ProviderUtil.succeed((IDataReader)cmd.ExecuteReader())); }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
                return(false);
            }
            finally { con.Close(); }
        }
        protected static bool save_phrase_local(string phrase, string dictionary, string version, string data)
        {
            string spName = "[dbo]." + "[EP_AddPhrase]";

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName,
                                                                        phrase, dictionary, version, data)));
            }
            catch (Exception ex) { return(false); }
        }
Ejemplo n.º 6
0
        public static bool ArithmeticDeleteComment(Guid applicationId, Guid?CommentID)
        {
            string spName = GetFullyQualifiedName("ArithmeticDeleteComment");

            try { return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId, CommentID))); }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SH);
                return(false);
            }
        }
Ejemplo n.º 7
0
        public static bool UpdatePermissions(Guid applicationId, Guid currentUserId, List <ExchangePermission> permissions)
        {
            SqlConnection con = new SqlConnection(ProviderUtil.ConnectionString);
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection = con;

            //Add Permissions
            DataTable permissionsTable = new DataTable();

            permissionsTable.Columns.Add("NodeTypeAdditionalID", typeof(string));
            permissionsTable.Columns.Add("NodeAdditionalID", typeof(string));
            permissionsTable.Columns.Add("GroupTypeAdditionalID", typeof(string));
            permissionsTable.Columns.Add("GroupAdditionalID", typeof(string));
            permissionsTable.Columns.Add("UserName", typeof(string));
            permissionsTable.Columns.Add("PermissionType", typeof(string));
            permissionsTable.Columns.Add("Allow", typeof(bool));
            permissionsTable.Columns.Add("DropAll", typeof(bool));

            foreach (ExchangePermission a in permissions)
            {
                permissionsTable.Rows.Add(a.NodeTypeAdditionalID, a.NodeAdditionalID,
                                          a.GroupTypeAdditionalID, a.GroupAdditionalID, a.UserName, a.PermissionType.ToString(), a.Allow, a.DropAll);
            }

            SqlParameter permissionsParam = new SqlParameter("@Items", SqlDbType.Structured);

            permissionsParam.TypeName = "[dbo].[ExchangePermissionTableType]";
            permissionsParam.Value    = permissionsTable;
            //end of Add Permissions

            cmd.Parameters.AddWithValue("@ApplicationID", applicationId);
            cmd.Parameters.AddWithValue("@CurrentUserID", currentUserId);
            cmd.Parameters.Add(permissionsParam);
            cmd.Parameters.AddWithValue("@Now", DateTime.Now);

            string spName = GetFullyQualifiedName("UpdatePermissions");

            string sep       = ", ";
            string arguments = "@ApplicationID" + sep + "@CurrentUserID" + sep + "@Items" + sep + "@Now";

            cmd.CommandText = ("EXEC" + " " + spName + " " + arguments);

            con.Open();
            try { return(ProviderUtil.succeed((IDataReader)cmd.ExecuteReader())); }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DE);
                return(false);
            }
            finally { con.Close(); }
        }
Ejemplo n.º 8
0
        public static bool UpdateRelations(Guid applicationId, Guid currentUserId, List <ExchangeRelation> relations)
        {
            SqlConnection con = new SqlConnection(ProviderUtil.ConnectionString);
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection = con;

            //Add Users
            DataTable relationsTable = new DataTable();

            relationsTable.Columns.Add("SourceTypeAdditionalID", typeof(string));
            relationsTable.Columns.Add("SourceAdditionalID", typeof(string));
            relationsTable.Columns.Add("SourceID", typeof(Guid));
            relationsTable.Columns.Add("DestinationTypeAdditionalID", typeof(string));
            relationsTable.Columns.Add("DestinationAdditionalID", typeof(string));
            relationsTable.Columns.Add("DestinationID", typeof(Guid));
            relationsTable.Columns.Add("Bidirectional", typeof(bool));

            foreach (ExchangeRelation r in relations)
            {
                relationsTable.Rows.Add(r.SourceTypeAdditionalID, r.SourceAdditionalID, r.SourceID,
                                        r.DestinationTypeAdditionalID, r.DestinationAdditionalID, r.DestinationID, r.Bidirectional);
            }

            SqlParameter relationsParam = new SqlParameter("@Relations", SqlDbType.Structured);

            relationsParam.TypeName = "[dbo].[ExchangeRelationTableType]";
            relationsParam.Value    = relationsTable;
            //end of Add Users

            cmd.Parameters.AddWithValue("@ApplicationID", applicationId);
            cmd.Parameters.AddWithValue("@CurrentUserID", currentUserId);
            cmd.Parameters.Add(relationsParam);
            cmd.Parameters.AddWithValue("@Now", DateTime.Now);

            string spName = GetFullyQualifiedName("UpdateRelations");

            string sep       = ", ";
            string arguments = "@ApplicationID" + sep + "@CurrentUserID" + sep + "@Relations" + sep + "@Now";

            cmd.CommandText = ("EXEC" + " " + spName + " " + arguments);

            con.Open();
            try { return(ProviderUtil.succeed((IDataReader)cmd.ExecuteReader())); }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DE);
                return(false);
            }
            finally { con.Close(); }
        }
Ejemplo n.º 9
0
        public static bool ChangeUserStatus(Guid applicationId, Guid eventId, Guid userId, string status)
        {
            string spName = GetFullyQualifiedName("ChangeUserStatus");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId, eventId, userId, status)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.EVT);
                return(false);
            }
        }
Ejemplo n.º 10
0
        public static bool RenameFile(Guid applicationId, Guid fileId, string name)
        {
            string spName = GetFullyQualifiedName("RenameFile");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId, fileId, name)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
                return(false);
            }
        }
Ejemplo n.º 11
0
        public static bool IsPrivateTree(Guid applicationId, Guid treeIdOrTreeNodeId)
        {
            string spName = GetFullyQualifiedName("IsPrivateTree");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId, treeIdOrTreeNodeId)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WF);
                return(false);
            }
        }
Ejemplo n.º 12
0
        public static bool ArithmeticDeleteNotification(Guid applicationId, long notificationId, Guid userId)
        {
            string spName = GetFullyQualifiedName("ArithmeticDeleteNotification");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId, notificationId, userId)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
                return(false);
            }
        }
Ejemplo n.º 13
0
        public static bool SetUserNotificationsAsSeen(Guid applicationId, Guid userId)
        {
            string spName = GetFullyQualifiedName("SetUserNotificationsAsSeen");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId, userId, DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
                return(false);
            }
        }
Ejemplo n.º 14
0
        public static bool RefineAccessRoles(Guid applicationId)
        {
            string spName = GetFullyQualifiedName("RefineAccessRoles");

            try
            {
                return(ProviderUtil.succeed((IDataReader)ProviderUtil.execute_reader(spName, applicationId)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.PRVC);
                return(false);
            }
        }
Ejemplo n.º 15
0
        public static bool AcceptChange(Guid applicationId, Guid changeId, Guid evaluatorUserId)
        {
            string spName = GetFullyQualifiedName("AcceptChange");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        changeId, evaluatorUserId, DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
                return(false);
            }
        }
Ejemplo n.º 16
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);
            }
        }
Ejemplo n.º 17
0
        public static bool RecycleParagraph(Guid applicationId, Guid paragraphId, Guid modifierUserId)
        {
            string spName = GetFullyQualifiedName("RecycleParagraph");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        paragraphId, modifierUserId, DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
                return(false);
            }
        }
Ejemplo n.º 18
0
        public static bool ModifyTitle(Guid applicationId, WikiTitle Info, bool?accept)
        {
            string spName = GetFullyQualifiedName("ModifyTitle");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        Info.TitleID, Info.Title, Info.LastModifierUserID, Info.LastModificationDate, accept)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
                return(false);
            }
        }
Ejemplo n.º 19
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);
            }
        }
Ejemplo n.º 20
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);
            }
        }
Ejemplo n.º 21
0
        public static bool UnsetConfidentialityLevel(Guid applicationId, Guid itemId, Guid currentUserId)
        {
            string spName = GetFullyQualifiedName("UnsetConfidentialityLevel");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        itemId, currentUserId, DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.PRVC);
                return(false);
            }
        }
Ejemplo n.º 22
0
        public static bool UpdateUserConfidentialities(Guid applicationId, Guid currentUserId, List <KeyValuePair <string, int> > items)
        {
            string spName = GetFullyQualifiedName("UpdateUserConfidentialities");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId, currentUserId,
                                                                        string.Join(",", items.Select(i => i.Value.ToString() + "|" + i.Key)), '|', ',', DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.CN);
                return(false);
            }
        }
Ejemplo n.º 23
0
        public static bool ArithmeticDeleteTitle(Guid applicationId, Guid titleId, Guid lastModifierUserId)
        {
            string spName = GetFullyQualifiedName("ArithmeticDeleteTitle");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        titleId, lastModifierUserId, DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
                return(false);
            }
        }
Ejemplo n.º 24
0
        public static bool ChangeTreeNode(Guid applicationId, TreeNode Info)
        {
            string spName = GetFullyQualifiedName("ChangeTreeNode");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        Info.TreeNodeID, Info.Name, Info.Description, Info.LastModifierUserID, Info.LastModificationDate)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
                return(false);
            }
        }
Ejemplo n.º 25
0
        public static bool AddOwnerTree(Guid applicationId, Guid ownerId, Guid treeId, Guid currentUserId)
        {
            string spName = GetFullyQualifiedName("AddOwnerTree");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        ownerId, treeId, currentUserId, DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WF);
                return(false);
            }
        }
Ejemplo n.º 26
0
        public static bool SetIndexLastUpdateDate(Guid applicationId, SearchDocType itemType, List <Guid> IDs)
        {
            string spName = GetFullyQualifiedName("SetIndexLastUpdateDate");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        itemType.ToString(), ProviderUtil.list_to_string <Guid>(ref IDs), ',', DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SRCH);
                return(false);
            }
        }
Ejemplo n.º 27
0
        public static bool UnlikeComment(Guid applicationId, LikeDislike Info)
        {
            string spName = GetFullyQualifiedName("UnlikeComment");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        Info.ObjectID, Info.UserID)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SH);
                return(false);
            }
        }
Ejemplo n.º 28
0
        public static bool UpdateComment(Guid applicationId, Comment Info)
        {
            string spName = GetFullyQualifiedName("UpdateComment");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        Info.CommentID, Info.Description, Info.LastModifierUserID, Info.LastModificationDate)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SH);
                return(false);
            }
        }
Ejemplo n.º 29
0
        public static bool SetUserMessagingActivation(Guid applicationId, Guid optionId, Guid userId, Guid currentUserId,
                                                      SubjectType subjectType, UserStatus userStatus, ActionType action, Media media, string lang, bool enable)
        {
            string spName = GetFullyQualifiedName("SetUserMessagingActivation");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        optionId, userId, currentUserId, DateTime.Now, subjectType, userStatus, action, media, lang, enable)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
                return(false);
            }
        }
Ejemplo n.º 30
0
        public static bool Share(Guid applicationId, Post Info)
        {
            string spName = GetFullyQualifiedName("Share");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId, Info.PostID,
                                                                        Info.RefPostID, Info.OwnerID, Info.Description, Info.Sender.UserID, Info.SendDate,
                                                                        Info.OwnerType, Info.Privacy)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SH);
                return(false);
            }
        }