public long SaveMessage(Message objMessaging)
        {
            object messageId = provider.ExecuteScalar("Messaging_Save_Message", objMessaging.PortalID, objMessaging.FromUserID, objMessaging.ToUserID, objMessaging.ToRoleID, (int)objMessaging.Status, objMessaging.Subject, objMessaging.Body, objMessaging.MessageDate, objMessaging.Conversation,
            objMessaging.ReplyTo, objMessaging.AllowReply, objMessaging.SkipInbox);

            return Convert.ToInt64(messageId);
        }
 public static bool DeleteUser(ref UserInfo objUser, bool notify, bool deleteAdmin)
 {
     bool CanDelete = true;
     IDataReader dr = null;
     try
     {
         dr = DataProvider.Instance().GetPortal(objUser.PortalID, PortalController.GetActivePortalLanguage(objUser.PortalID));
         if (dr.Read())
         {
             if (objUser.UserID == Convert.ToInt32(dr["AdministratorId"]))
             {
                 CanDelete = deleteAdmin;
             }
         }
         if (CanDelete)
         {
             FolderPermissionController.DeleteFolderPermissionsByUser(objUser);
             ModulePermissionController.DeleteModulePermissionsByUser(objUser);
             TabPermissionController.DeleteTabPermissionsByUser(objUser);
             CanDelete = memberProvider.DeleteUser(objUser);
         }
         if (CanDelete)
         {
             PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();
             Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
             objEventLog.AddLog("Username", objUser.Username, _portalSettings, objUser.UserID, Services.Log.EventLog.EventLogController.EventLogType.USER_DELETED);
             if (notify && !objUser.IsSuperUser)
             {
                 Message _message = new Message();
                 _message.FromUserID = _portalSettings.AdministratorId;
                 _message.ToUserID = _portalSettings.AdministratorId;
                 _message.Subject = Localization.GetSystemMessage(objUser.Profile.PreferredLocale, _portalSettings, "EMAIL_USER_UNREGISTER_SUBJECT", objUser, Localization.GlobalResourceFile, null, "", _portalSettings.AdministratorId);
                 _message.Body = Localization.GetSystemMessage(objUser.Profile.PreferredLocale, _portalSettings, "EMAIL_USER_UNREGISTER_BODY", objUser, Localization.GlobalResourceFile, null, "", _portalSettings.AdministratorId);
                 _message.Status = MessageStatusType.Unread;
                 //_messagingController.SaveMessage(_message);
                 Services.Mail.Mail.SendEmail(_portalSettings.Email, _portalSettings.Email, _message.Subject, _message.Body);
             }
             DataCache.ClearPortalCache(objUser.PortalID, false);
             DataCache.ClearUserCache(objUser.PortalID, objUser.Username);
         }
     }
     catch (Exception Exc)
     {
         Exceptions.LogException(Exc);
         CanDelete = false;
     }
     finally
     {
         CBO.CloseDataReader(dr, true);
     }
     return CanDelete;
 }
        private void SendMessage(Message objMessage)
        {
            string senderAddress = UserController.GetUserById(objMessage.PortalID, objMessage.FromUserID).Email;
            string fromAddress = _pController.GetPortal(objMessage.PortalID).Email;
            string toAddress = _uController.GetUser(objMessage.PortalID, objMessage.ToUserID).Email;


            Mail.Mail.SendEmail(fromAddress, senderAddress, toAddress, objMessage.Subject, objMessage.Body);

            _mController.MarkMessageAsDispatched(objMessage.MessageID);

        }
 public void UpdateMessage(Message message)
 {
     _DataService.UpdateMessage(message);
 }
        public void SaveMessage(Message message)
        {
            if ((PortalSettings.Current != null))
            {
                message.PortalID = PortalSettings.Current.PortalId;
            }

            if ((message.Conversation == null | message.Conversation == Guid.Empty))
            {
                message.Conversation = Guid.NewGuid();
            }

            _DataService.SaveMessage(message);
        }
 public void UpdateMessage(Message message)
 {
     provider.ExecuteNonQuery("Messaging_UpdateMessage", message.MessageID, message.ToUserID, message.ToRoleID, (int)message.Status, message.Subject, message.Body, message.MessageDate, message.ReplyTo, message.AllowReply,
     message.SkipInbox);
 }
Esempio n. 7
0
        public Message GetReplyMessage()
        {
            Message message = new Message();
            message.AllowReply = this.AllowReply;
            message.Body = string.Format("<br><br><br>On {0} {1} wrote ", this.MessageDate, this.FromUserName) + this.Body;
            message.Conversation = this.Conversation;
            message.FromUserID = this.ToUserID;
            message.ToUserID = this.FromUserID;
            message.ToUserName = this.FromUserName;
            message.PortalID = this.PortalID;
            message.ReplyTo = this.MessageID;
            message.SkipInbox = this.SkipInbox;
            message.Subject = "RE:" + this.Subject;

            return message;
        }