예제 #1
0
        public User NewUserConnection(HubCallerContext context)
        {
            long companyId = 0;
            long userId    = 0;

            Int64.TryParse(context.User?.FindFirst(ClaimTypes.Name)?.Value, out userId);
            Int64.TryParse(context.User?.FindFirst(ClaimTypes.GroupSid)?.Value, out companyId);

            var user = new User();

            user.CompanyId    = companyId;
            user.ConnectionId = context.ConnectionId;
            user.Connected_at = DateTime.Now;
            user.UserId       = userId;
            db.RepositoryUser.Add(user);
            db.Commit();

            return(user);
        }
예제 #2
0
        public bool NewMessage(HubCallerContext context, long to, string message)
        {
            long companyId = 0;
            long userId    = 0;

            Int64.TryParse(context.User?.FindFirst(ClaimTypes.Name)?.Value, out userId);
            Int64.TryParse(context.User?.FindFirst(ClaimTypes.GroupSid)?.Value, out companyId);

            var msg = new Message();

            msg.CompanyId   = companyId;
            msg.From        = userId;
            msg.To          = to;
            msg.Create_at   = DateTime.Now;
            msg.MessageText = new Encrypt().EncryptData(message, userId, to, companyId);
            msg.Status      = 2; // 1 LIDO 2 NÃO LIDO
            db.RepositoryMessage.Add(msg);

            return(db.Commit());
        }
예제 #3
0
        public static void LogException(IExceptionHandlerFeature error)
        {
            UnityOfWork _u = new UnityOfWork();

            Log log = new Log();

            log.Create_at        = DateTime.Now;
            log.ExceptionMessage = error.Error.ToString();
            log.Type             = "Exception";

            _u.RepositoryLog.Add(log);

            _u.Commit();
        }
예제 #4
0
 public void Commit()
 {
     utw.Commit();
 }
 private void Commit()
 {
     _uow.Commit();
 }