Ejemplo n.º 1
0
        public JsonResult LoadMessages(Messages msg)
        {
            BMessages bm   = new BMessages();
            var       msgs = bm.LoadMessages(msg.FromUser, msg.ToUser, msg.CreateDate);

            return(Json(JsonConvert.SerializeObject(msgs), JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        //private static Collection<MMessageProfile> AllMessages()
        //{
        //    DataTable mDataTable = new DataTable();
        //    Collection<MMessageProfile> mMessagesCollection = null;
        //    BMessages mBMessages = new BMessages(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
        //    DataSet myDataSet = new DataSet();
        //    try
        //    {
        //        int mySecurityEntity = ClientChoicesUtility.SelectedSecurityEntity();
        //        mMessagesCollection = mBMessages.GetMessages(mySecurityEntity);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    finally
        //    {
        //        if ((myDataSet != null))
        //        {
        //            myDataSet.Dispose();
        //            myDataSet = null;
        //        }
        //        if ((mDataTable != null))
        //        {
        //            mDataTable.Dispose();
        //            mDataTable = null;
        //        }
        //        if ((mBMessages != null))
        //        {
        //            mBMessages = null;
        //        }
        //    }
        //    return mMessagesCollection;
        //}

        /// <summary>
        /// Saves the specified profile.
        /// </summary>
        /// <param name="profile">The profile.</param>
        public static void Save(MMessageProfile profile)
        {
            BMessages mBMessages = new BMessages(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            mBMessages.Save(profile);
            RemoveCachedMessagesCollection();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Searches the specified search criteria.
 /// </summary>
 /// <param name="searchCriteria">The search criteria.</param>
 /// <returns>DataTable.</returns>
 public static DataTable Search(MSearchCriteria searchCriteria)
 {
     try
     {
         BMessages mBMessages = new BMessages(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
         return(mBMessages.Search(searchCriteria));
     }
     catch (IndexOutOfRangeException ex)
     {
         Logger mLog = Logger.Instance();
         mLog.Debug(ex);
         return(null);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the messages.
        /// </summary>
        /// <returns>Collection{MMessageProfile}.</returns>
        public static Collection <MMessageProfile> Messages()
        {
            MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.CurrentProfile();
            string mCacheName = MessagesUnitCachedCollectionName(mSecurityEntityProfile.Id);
            Collection <MMessageProfile> mMessageCollection = null;

            mMessageCollection = (Collection <MMessageProfile>)HttpContext.Current.Cache[mCacheName];
            if (mMessageCollection == null)
            {
                BMessages mBMessages = new BMessages(mSecurityEntityProfile, ConfigSettings.CentralManagement);
                mMessageCollection = mBMessages.GetMessages(mSecurityEntityProfile.Id);
                CacheController.AddToCacheDependency(mCacheName, mMessageCollection);
            }
            return(mMessageCollection);
        }
Ejemplo n.º 5
0
        public void sendMessage(string username, string message, string receiver)
        {
            Clients.All.send(username, message, receiver);

            Messages messages = new Messages
            {
                FromUser    = receiver,
                MessageText = message,
                ToUser      = username,
            };

            BMessages newMessage = new BMessages();

            Task.Run(() => newMessage.SendMessage(messages));
        }