Exemple #1
0
 public void DeleteConnectionRecord(ConnectionRecord t)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository <ConnectionRecord>();
         rep.Delete(t);
     }
 }
 public void CreateConnectionRecord(ConnectionRecord t)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository<ConnectionRecord>();
         rep.Insert(t);
     }
 }
Exemple #3
0
 public ConnectionRecord(ConnectionRecord cr)
 {
     ConnectionRecordId = cr.ConnectionRecordId;
     ConnectionId       = cr.ConnectionId;
     UserName           = cr.UserName;
     UserId             = cr.UserId;
     ModuleId           = cr.ModuleId;
     ConnectedDate      = cr.ConnectedDate;
     DisConnectedDate   = cr.DisConnectedDate;
     IpAddress          = cr.IpAddress;
 }
 public ConnectionRecord(ConnectionRecord cr)
 {
     ConnectionRecordId = cr.ConnectionRecordId;
     ConnectionId = cr.ConnectionId;
     UserName = cr.UserName;
     UserId = cr.UserId;
     ModuleId = cr.ModuleId;
     ConnectedDate = cr.ConnectedDate;
     DisConnectedDate = cr.DisConnectedDate;
     IpAddress = cr.IpAddress;
 }
Exemple #5
0
        private ConnectionRecord SetupConnectionRecord()
        {
            string username = Clients.Caller.username;


            //if (string.IsNullOrEmpty(username))
            //{
            //    Clients.Caller.newMessageNoParse(new Message { AuthorName = Localization.GetString("SystemName.Text", "~/desktopmodules/DnnChat/app_localresources/" + Localization.LocalSharedResourceFile), ConnectionId = "0", MessageDate = DateTime.UtcNow, MessageId = -1, MessageText = string.Format(Localization.GetString("BadConnection.Text", "~/desktopmodules/DnnChat/app_localresources/" + Localization.LocalSharedResourceFile), "phantom") });
            //    return new ConnectionRecord();
            //}

            if (username.Trim() == "phantom" || username.Trim() == string.Empty)
            {
                username = string.Format(Localization.GetString("AnonymousUser.Text", "~/desktopmodules/DnnChat/app_localresources/" + Localization.LocalSharedResourceFile), (Users.Count + 1));
            }

            Clients.Caller.username = username;
            var userId = -1;


            if (Convert.ToInt32(Clients.Caller.userid) > 0)
            {
                userId = Convert.ToInt32(Clients.Caller.userid);
            }

            //check if the connectionrecord is already in the DB

            var crc = new ConnectionRecordController();
            var c   = crc.GetConnectionRecordByConnectionId(Context.ConnectionId);

            if (c != null)
            {
                c.UserName = username;
                crc.UpdateConnectionRecord(c);
            }
            else
            {
                c = new ConnectionRecord
                {
                    ConnectionId  = Context.ConnectionId,
                    ConnectedDate = DateTime.UtcNow,
                    ModuleId      = Convert.ToInt32(Clients.Caller.moduleid),
                    UserName      = username,
                    UserId        = userId,
                    IpAddress     = GetIpAddress()
                };

                //Users.Add(c);
                crc.CreateConnectionRecord(c);
            }
            //store the record for the connection
            return(c);
        }
Exemple #6
0
 public bool UserInRoom(Guid roomId, ConnectionRecord cr)
 {
     //TODO: check if the user is in that Room
     // should ensure that they are still IN the room
     return(true);
 }
Exemple #7
0
 public bool UserInRoom(Guid roomId, ConnectionRecord cr)
 {
     //TODO: check if the user is in that Room
     // should ensure that they are still IN the room
     return true;
 }
 public UserListRecords(ConnectionRecord cr, ConnectionRecordRoom cRr) : base(cr)
 {
     crr = cRr;
 }
 public UserListRecords(ConnectionRecord cr, ConnectionRecordRoom cRr)
     : base(cr)
 {
     crr = cRr;
 }