public void SetUserStatus(UserStatus status) { logger.debug("set status {0} to user {1}", status, FullName); switch(user.Constructor) { case Constructor.userEmpty: break; case Constructor.userSelf: ((UserSelfConstructor) user).status = status; break; case Constructor.userContact: ((UserContactConstructor) user).status = status; break; case Constructor.userRequest: ((UserRequestConstructor) user).status = status; break; case Constructor.userForeign: ((UserForeignConstructor) user).status = status; break; case Constructor.userDeleted: break; default: throw new InvalidDataException("invalid constructor"); } OnPropertyChanged("Status"); }
public ChatListSubItem(string nicname, string displayname, string personalmsg, UserStatus status) { this.nicName = nicname; this.displayName = displayname; this.personalMsg = personalmsg; this.status = status; }
public async Task<int> UpdateUserRoleAndStatus(CompetentAuthorityUser user, Role role, UserStatus status) { user.UpdateUserStatus(status.ToDomainEnumeration<Domain.User.UserStatus>()); user.UpdateRole(role); return await context.SaveChangesAsync(); }
/// <summary> /// Set new status message. /// </summary> /// <param name="userID">User identificator.</param> /// <param name="message">Message content.</param> /// <param name="status">Type of status.</param> public static void SetStatusMessage(Guid userID, String message, UserStatus status) { using (SocialNetworkDBEntities record = new SocialNetworkDBEntities()) { record.spInsStatus(userID, message, (Int32)status); } }
public CompetentAuthorityUser(string userId, Guid competentAuthorityId, UserStatus userStatus, Role role) { UserId = userId; CompetentAuthorityId = competentAuthorityId; UserStatus = userStatus; Role = role; }
public ChatListSubItem() { this.status = UserStatus.Online; this.displayName = "displayName"; this.nicName = "nicName"; this.personalMsg = "Personal Message ..."; }
/// <summary> /// Initializes a new instance of the <see cref="User" /> class. /// Default constructor. /// </summary> public User() { this.personData = new Person(); this.priceUAH = 0; this.priceUSD = 0; this.status = UserStatus.NotLogged; }
/// <summary> /// Convert UserStatus to string status name. /// </summary> /// <param name="status">Enum UserStatus.</param> /// <returns>Status name.</returns> public static String ToString(UserStatus status) { String statusName = String.Empty; switch (status) { case UserStatus.Offline: { statusName = "offline"; } break; case UserStatus.Online: { statusName = "online"; } break; case UserStatus.AtHome: { statusName = "at home"; } break; case UserStatus.AtWork: { statusName = "at work"; } break; case UserStatus.Busy: { statusName = "busy"; } break; } return statusName; }
/// <summary> /// Initializes a new instance of the <see cref="User" /> class. /// Constructor with arguments. /// </summary> /// <param name="inPersonData">User's person data.</param> /// <param name="inPriceUAH">Price in UAH.</param> /// <param name="inPriceUSD">Price in USD.</param> /// <param name="inStatus">User's status.</param> public User(Person inPersonData, int inPriceUAH, int inPriceUSD, UserStatus inStatus) { this.personData = inPersonData; this.priceUAH = inPriceUAH; this.priceUSD = inPriceUSD; this.status = inStatus; }
public User(int uid, String username, String email, UserStatus status) { Username = username; Email = email; UID = uid; Status = status; }
public static List<User> GetUserDetails(UserStatus status) { List<User> Users = new List<User>(); using (sqlDBConnection = new SqlConnection(ConfigurationManager.ConnectionStrings[Connection.ConnectionName].ConnectionString)) { StringBuilder sqlstmt = new StringBuilder("select id,username,password,firstname,lastname,address,contactnumber,dateofbirth,emailid,securityquestion,answer,addressproof,photoidentity,status,rewardpoints from [dbo].[User] where status = @status"); //sqlstmt.Append(Convert.ToString(userid)); SqlCommand myCommand = new SqlCommand(sqlstmt.ToString(), sqlDBConnection); myCommand.CommandType = CommandType.Text; myCommand.Parameters.AddWithValue("@status", (int)status); sqlDBConnection.Open(); using (SqlDataReader myReader = myCommand.ExecuteReader()) { User user; while (myReader.Read()) { user = FillDataRecord(myReader); Users.Add(user); } myReader.Close(); } sqlDBConnection.Close(); } return Users; }
public User(string username, string password, UserAuthorization authorization, UserStatus status) { this._mongoServer = MyMongoDB.GetServer(); this._username = username; this._password = password; this._authorization = authorization; this._status = status; }
public SearchNodeStaff(Staff staff) { this.InitializeComponent(); this.staff = staff; this.status = staff.Status; this.SetSizeHandler(); this.UpdateInfo(); }
public void LockUser() { Assert.DoesNotThrow(() => QueryContext.SetUserStatus("tester", UserStatus.Locked)); UserStatus status = new UserStatus(); Assert.DoesNotThrow(() => status = QueryContext.GetUserStatus("tester")); Assert.AreEqual(UserStatus.Locked, status); }
public TreeNodeStaff(Staff staff) { this.InitializeComponent(); this.staff = staff; this.status = staff.Status; this.UpdateInfo(); this.AddEventListenerHandler(); }
public User() { this.CreatedAt = DateTime.Now; this.ID = Guid.NewGuid(); this.status = UserStatus.Pending; this.Logs = new List<UserActivityLog>(); this.MailerLogs = new List<UserMailerLog>(); }
public SetUserStatusStatement(string userName, UserStatus status) { if (String.IsNullOrEmpty(userName)) throw new ArgumentNullException("userName"); UserName = userName; Status = status; }
public SelfDepartmentStaffNode(Staff staff) { this.InitializeComponent(); this.staff = staff; this.status = staff.Status; this.UpdateInfo(); this.AddEventListenerHandler(); }
/// <summary> /// 更新用户状态 /// </summary> /// <param name="sysNo">用户编号</param> /// <param name="status">用户状态</param> /// <returns></returns> public static bool UpdateStatus(int sysNo, UserStatus status) { DataCommand cmd = DataCommandManager.GetDataCommand("Users_UpdateStatus"); cmd.SetParameterValue("@Status", (int)status); cmd.SetParameterValue("@SysNo", sysNo); cmd.ExecuteNonQuery(); return true; }
public ChatListSubItem(int id, string nicname, string displayname, string personalmsg, UserStatus status, Bitmap head) { this.id = id; this.nicName = nicname; this.displayName = displayname; this.personalMsg = personalmsg; this.status = status; this.headImage = head; }
public MyUser(int _userId, String _username, String _name, String _contactno, UserType _usertype, UserStatus _status) { this.userId=_userId; this.username = _username; this.status = _status; this.name = _name; this.contactNo = _contactno; this.usertype = _usertype; }
private void CreateUser(UserGender gender, UserStatus status) { ((App)App.Current).Client.CreateUserAsync((user, callbackParams) => { Utilities.HandleAsyncResults(user, callbackParams, () => { this.UserCreated(user); }, "Create user failed. Please try again."); }, this.Name.Text, this.Password.Password, gender: gender, age: this.GetAge(), email: this.Email.Text, status: status); }
public MsgCenterTreeNode(Staff staff, bool isMark) { this.viewModel.AddEventListenerHandler(); this.InitializeComponent(); this.staff = staff; this.status = UserStatus.Online; this.StaffIsMark = isMark; base.MouseLeftButtonUp += new MouseButtonEventHandler(this.StaffMsgCenterTreeNode_MouseLeftButtonUp); this.UpdateInfoStaff(); }
public User(int userId, string name, string @namespace) { if(string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException("name"); _userId = userId; this.Name = _fullName = name.Trim(); this.Namespace = @namespace; _status = UserStatus.Unapproved; _createdTime = DateTime.Now; }
public TreeNodeCustomStaff(Staff staff) { this.InitializeComponent(); this.staff = staff; this.status = staff.Status; this.UpdateInfo(); this.AddEventListenerHandler(); base.PreviewMouseRightButtonDown += delegate(object s, MouseButtonEventArgs e) { TreeNodeCustomStaff.mouse_event(this.MOUSEEVENTF_LEFTDOWN, (int)e.GetPosition(this).X, (int)e.GetPosition(this).Y, 0, 0); }; }
public OrganisationUser(Guid userId, Guid organisationId, UserStatus userStatus) { UserId = userId.ToString(); OrganisationId = organisationId; UserStatus = userStatus; if (userStatus == UserStatus.Pending) { // Raise a domain event indicating that a user's request to join an organisation is pending. RaiseEvent(new OrganisationUserRequestEvent(this.OrganisationId, userId)); } }
public string CreateUser(string email, string passwordHash, string salt, UserStatus status = UserStatus.Signup) { var user = new User { Email = email, PasswordHash = passwordHash, Salt = salt, Status = (int) status }; return CreateUser(user); }
/// <summary> /// ���캯�� /// </summary> private User() { name = String.Empty; email = String.Empty; password = String.Empty; telephone = String.Empty; cellphone = String.Empty; joinDate = DateTime.Now; status = UserStatus.Normal; payModeCollection = null; activePayMode = null; }
/// <summary> /// Obtiene todos los usuarios registrados en el sistema, ya sea por medio de la caché o de webservices /// </summary> /// <param name="userStatus">Opcional, estado para filtrar usuarios, si no se especifica se obtienen todos /// los usuarios registrados en la aplicación</param> public static IObservable<IList<User>> GetAllUsers(UserStatus? userStatus = null) { var parameters = new Dictionary<string, string>(); parameters["sort"] = "-status,username"; if (userStatus != null) parameters["status"] = ((int)userStatus).ToString(); return RestEndpointFactory .Create<IUsersEndpoint>(SessionManager.Instance.CurrentLoggedUser) .GetAllUsers(parameters).ToObservable() .SubscribeOn(TaskPoolScheduler.Default) .InterpretingErrors(); }
public bool UpdateInfo() { bool update = false; this.txtName.Text = this.staff.Name + " (" + this.staff.UserName + ")"; this.imgFace.Source = this.staff.HeaderImage; this.imgFaceForeground.Source = this.staff.StatusIcon; if (this.status != this.staff.Status) { this.status = this.staff.Status; update = true; } return update; }
public Icon GetStatusIcon(UserStatus status) { return(GlobalResourceManager.GetStatusIcon(status)); }
public User(string id) { Id = id; UserStatus = new UserStatus(); }
public async Task AddUserAsyncAsync_Throws_UserStatusException_On_Throw(string username, bool exists, UserStatus status, int averageSpeed, int downloadCount, int fileCount, int directoryCount, string countryCode) { var result = new AddUserResponse(username, exists, status, averageSpeed, downloadCount, fileCount, directoryCount, countryCode); var waiter = new Mock <IWaiter>(); waiter.Setup(m => m.Wait <AddUserResponse>(It.IsAny <WaitKey>(), null, It.IsAny <CancellationToken>())) .Returns(Task.FromResult(result)); var serverConn = new Mock <IMessageConnection>(); serverConn.Setup(m => m.WriteAsync(It.IsAny <byte[]>(), It.IsAny <CancellationToken>())) .Throws(new ConnectionException("foo")); using (var s = new SoulseekClient("127.0.0.1", 1, waiter: waiter.Object, serverConnection: serverConn.Object)) { s.SetProperty("State", SoulseekClientStates.Connected | SoulseekClientStates.LoggedIn); AddUserResponse r = null; var ex = await Record.ExceptionAsync(async() => r = await s.AddUserAsync(username)); Assert.NotNull(ex); Assert.IsType <AddUserException>(ex); Assert.IsType <ConnectionException>(ex.InnerException); } }
/// <summary> /// Handles new messages by the server /// </summary> /// <param name="networkData"></param> /// <param name="connection"></param> private void DataReceived(NetworkData networkData, IConnection connection) { Byte[] buffer = networkData.Buffer; buffer = encryption.Decrypt(buffer); log.DebugFormat("Message received. Length: {0}", buffer.Length); String message = Encoding.UTF8.GetString(buffer); if (message != Communication.SERVER_SEND_WAIT_SIGNAL) { messageBacklog.Add(message); } // Do we have a message cached if (buffer.Length == 32 && messageBacklog.Count == 1) { // Handle messages who dont have additional parameters if (!SessionCreated && sessionDataPending && message != Communication.SERVER_SEND_SESSION_CREATED) { // Invalid connection log.Fatal("Server is talking an invalid connection protocol!"); connection.Send(Communication.CLIENT_SEND_DISCONNECT, networkData.RemoteHost, encryption); Connection.Client.Close(); Environment.Exit(1); } else if (message == Communication.SERVER_SEND_HEARTBEAT_CHALLENGE) { log.Debug("Heartbeat received"); connection.Send(new [] { Communication.CLIENT_SEND_HEARTBEAT, Environment.UserName }, networkData.RemoteHost, encryption); messageBacklog.Clear(); } else if (message == Communication.SERVER_SEND_DISCONNECT) { // Server has gone offline, go and die too log.Fatal("Server went offline."); connection.Send(Communication.CLIENT_SEND_DISCONNECT, networkData.RemoteHost, encryption); Connection.Client.Close(); Environment.Exit(1); } else if (message == Communication.SERVER_SEND_LOGIN_INVALID) { // No login :( Application.Instance.AsyncInvoke(noLogInAction); messageBacklog.Clear(); Status = new UserStatus(); } else if (message == Communication.SERVER_SEND_NO_LOGIN_SERVERS) { Application.Instance.AsyncInvoke(noLogInServerAction); messageBacklog.Clear(); Status = new UserStatus(); } } else if (messageBacklog.Count > 1) { if (messageBacklog[0] == Communication.SERVER_SEND_SESSION_KEY) { // Load the Encoder Type try { Type encoderType = PluginManager.GetType <IEncryptionProvider>(SecuritySettings.Instance.encryption); encryption = (IEncryptionProvider)Activator.CreateInstance(encoderType); } catch (Exception e) { log.Error("Invalid Encryption Provider! Falling back to no encryption", e); // Fallback to None encryption = new NoneEncryptionProvider(); } // Log log.InfoFormat("Received session key. Used encryption: {0}", encryption.GetType().Name); // Apply session key encryption.ChangeKey(buffer); // Send session Data log.Info("Sending session data"); connection.Send(new [] { Communication.CLIENT_SEND_USERDATA, Environment.MachineName, Environment.UserName, Communication.CLIENT_ID }, networkData.RemoteHost, encryption); log.Info("Sucessfully send session data"); sessionDataPending = true; messageBacklog.Clear(); } else if (!SessionCreated && sessionDataPending && messageBacklog[0] == Communication.SERVER_SEND_SESSION_CREATED) { if (message == Communication.SERVER_ID) { sessionDataPending = false; SessionCreated = true; log.Info("Session created"); Application.Instance.AsyncInvoke(logInAction); } else { // Invalid connection log.Info("Invalid connection"); connection.Send(Communication.CLIENT_SEND_DISCONNECT, networkData.RemoteHost, encryption); Connection.Client.Close(); Environment.Exit(1); } // Clear messageBacklog.Clear(); } else if (messageBacklog[0] == Communication.SERVER_SEND_LOGIN_SUCCESS) { UserType type = (UserType)Int32.Parse(message); log.InfoFormat("Login was successfull. Usertype: {0}", type); Status = new UserStatus { Username = Status.Username, Type = type }; Application.Instance.AsyncInvoke(loggedInAction); messageBacklog.Clear(); } else if (messageBacklog[0] == Communication.SERVER_SEND_ROOMS && message == Communication.SERVER_SEND_ROOMS_FINISHED) { String[] rooms = new String[messageBacklog.Count - 2]; for (Int32 i = 1; i < messageBacklog.Count - 1; i++) { rooms[i] = messageBacklog[i]; } // We've got rooms Application.Instance.AsyncInvoke(() => { roomNameReceivedAction(rooms); }); messageBacklog.Clear(); } else if (messageBacklog[0] == Communication.SERVER_SEND_STARTED_CLIENTS && message == Communication.SERVER_SEND_STARTED_CLIENTS_FINISHED) { List <String> computers = new List <String>(); for (Int32 i = 1; i < messageBacklog.Count - 1; i++) { computers.AddRange(messageBacklog[i].Split(new [] { ";" }, StringSplitOptions.RemoveEmptyEntries)); } // We've got rooms Application.Instance.AsyncInvoke(() => { roomComputersReceivedAction(computers.ToArray(), false); }); messageBacklog.Clear(); } else if (messageBacklog[0] == Communication.SERVER_SEND_LOCKED_CLIENTS && message == Communication.SERVER_SEND_LOCKED_CLIENTS_FINISHED) { List <String> computers = new List <String>(); for (Int32 i = 1; i < messageBacklog.Count - 1; i++) { computers.AddRange(messageBacklog[i].Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries)); } // We've got rooms Application.Instance.AsyncInvoke(() => { roomComputersReceivedAction(computers.ToArray(), true); }); messageBacklog.Clear(); } } else { messageBacklog.Clear(); } }
public User(long id, string name, UserStatus status) { Id = id; UserName = name; Status = status; }
/// <summary> /// GetOrGenerateItemByWeixinUnionIdAsync /// </summary> /// <param name="generateGroupId"></param> /// <param name="generateStatus"></param> /// <param name="unionId"></param> /// <returns></returns> public async Task <UserInfo> GetOrGenerateItemByWeixinUnionIdAsync(Guid generateGroupId, UserStatus generateStatus, string unionId) { var userInfo = await _manager.GetOrGenerateItemByWeixinUnionIdAsync(generateGroupId, generateStatus, unionId); if (userInfo != null && userInfo.Status == UserStatus.Normal) { await CacheUser(userInfo); } return(userInfo); }
public BaseUser(JToken node) : base(node) { if (node["id"] != null) { this._Id = node["id"].Value <string>(); } if (node["partnerId"] != null) { this._PartnerId = ParseInt(node["partnerId"].Value <string>()); } if (node["screenName"] != null) { this._ScreenName = node["screenName"].Value <string>(); } if (node["fullName"] != null) { this._FullName = node["fullName"].Value <string>(); } if (node["email"] != null) { this._Email = node["email"].Value <string>(); } if (node["country"] != null) { this._Country = node["country"].Value <string>(); } if (node["state"] != null) { this._State = node["state"].Value <string>(); } if (node["city"] != null) { this._City = node["city"].Value <string>(); } if (node["zip"] != null) { this._Zip = node["zip"].Value <string>(); } if (node["thumbnailUrl"] != null) { this._ThumbnailUrl = node["thumbnailUrl"].Value <string>(); } if (node["description"] != null) { this._Description = node["description"].Value <string>(); } if (node["tags"] != null) { this._Tags = node["tags"].Value <string>(); } if (node["adminTags"] != null) { this._AdminTags = node["adminTags"].Value <string>(); } if (node["status"] != null) { this._Status = (UserStatus)ParseEnum(typeof(UserStatus), node["status"].Value <string>()); } if (node["createdAt"] != null) { this._CreatedAt = ParseInt(node["createdAt"].Value <string>()); } if (node["updatedAt"] != null) { this._UpdatedAt = ParseInt(node["updatedAt"].Value <string>()); } if (node["partnerData"] != null) { this._PartnerData = node["partnerData"].Value <string>(); } if (node["indexedPartnerDataInt"] != null) { this._IndexedPartnerDataInt = ParseInt(node["indexedPartnerDataInt"].Value <string>()); } if (node["indexedPartnerDataString"] != null) { this._IndexedPartnerDataString = node["indexedPartnerDataString"].Value <string>(); } if (node["storageSize"] != null) { this._StorageSize = ParseInt(node["storageSize"].Value <string>()); } if (node["language"] != null) { this._Language = (LanguageCode)StringEnum.Parse(typeof(LanguageCode), node["language"].Value <string>()); } if (node["lastLoginTime"] != null) { this._LastLoginTime = ParseInt(node["lastLoginTime"].Value <string>()); } if (node["statusUpdatedAt"] != null) { this._StatusUpdatedAt = ParseInt(node["statusUpdatedAt"].Value <string>()); } if (node["deletedAt"] != null) { this._DeletedAt = ParseInt(node["deletedAt"].Value <string>()); } if (node["allowedPartnerIds"] != null) { this._AllowedPartnerIds = node["allowedPartnerIds"].Value <string>(); } if (node["allowedPartnerPackages"] != null) { this._AllowedPartnerPackages = node["allowedPartnerPackages"].Value <string>(); } if (node["userMode"] != null) { this._UserMode = (UserMode)ParseEnum(typeof(UserMode), node["userMode"].Value <string>()); } }
public async Task AddUserAsync_Returns_Expected_Info(string username, bool exists, UserStatus status, int averageSpeed, int downloadCount, int fileCount, int directoryCount, string countryCode) { var result = new AddUserResponse(username, exists, status, averageSpeed, downloadCount, fileCount, directoryCount, countryCode); var waiter = new Mock <IWaiter>(); waiter.Setup(m => m.Wait <AddUserResponse>(It.IsAny <WaitKey>(), null, It.IsAny <CancellationToken>())) .Returns(Task.FromResult(result)); var serverConn = new Mock <IMessageConnection>(); serverConn.Setup(m => m.WriteAsync(It.IsAny <byte[]>(), It.IsAny <CancellationToken>())) .Returns(Task.CompletedTask); using (var s = new SoulseekClient("127.0.0.1", 1, waiter: waiter.Object, serverConnection: serverConn.Object)) { s.SetProperty("State", SoulseekClientStates.Connected | SoulseekClientStates.LoggedIn); var add = await s.AddUserAsync(username); Assert.Equal(result.Username, add.Username); Assert.Equal(result.Exists, add.Exists); Assert.Equal(result.Status, add.Status); Assert.Equal(result.AverageSpeed, add.AverageSpeed); Assert.Equal(result.DownloadCount, add.DownloadCount); Assert.Equal(result.FileCount, add.FileCount); Assert.Equal(result.DirectoryCount, add.DirectoryCount); Assert.Equal(result.CountryCode, add.CountryCode); } }
// 处理登录失败 private void HandleTokenErr() { // 重登录 UserStatus.SetStatus(UserStatus.StatusType.Logout); this.Socket.Emit("autoAuth", null); }
/// <summary> /// 初始化流程: /// (1)Initialize时,从服务器加载自己的全部信息,从本地缓存文件加载好友列表。 /// (2)MainForm_Load,填充ChatListBox /// (3)MainForm_Shown,调用globalUserCache在后台刷新:若是第一次登录,则分批从服务器加载好友资料。否则,从服务器获取好友最新状态和版本,并刷新本地缓存。 /// (4)globalUserCache.FriendRTDataRefreshCompleted 事件,请求离线消息、离线文件、正式通知好友自己上线 /// </summary> public void Initialize(IRapidPassiveEngine engine, ChatListSubItem.UserStatus userStatus, Image stateImage)//, Image headImage, string nickName, ChatListSubItem.UserStatus userStatus, Image stateImage) { GlobalResourceManager.PostInitialize(engine.CurrentUserID); this.Cursor = Cursors.WaitCursor; this.toolTip1.SetToolTip(this.skinButton_headImage, "帐号:" + engine.CurrentUserID); this.rapidPassiveEngine = engine; this.globalUserCache = new GlobalUserCache(this.rapidPassiveEngine); this.globalUserCache.FriendInfoChanged += new CbGeneric <GGUser>(globalUserCache_FriendInfoChanged); this.globalUserCache.FriendStatusChanged += new CbGeneric <GGUser>(globalUserCache_FriendStatusChanged); this.globalUserCache.GroupChanged += new CbGeneric <GGGroup, GroupChangedType, string>(globalUserCache_GroupInfoChanged); this.globalUserCache.FriendRTDataRefreshCompleted += new CbGeneric(globalUserCache_FriendRTDataRefreshCompleted); this.globalUserCache.FriendRemoved += new CbGeneric <string>(globalUserCache_FriendRemoved); this.globalUserCache.FriendAdded += new CbGeneric <GGUser>(globalUserCache_FriendAdded); this.globalUserCache.CurrentUser.UserStatus = (UserStatus)((int)userStatus); this.myStatus = this.globalUserCache.CurrentUser.UserStatus; this.labelSignature.Text = this.globalUserCache.CurrentUser.Signature; this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser); this.labelName.Text = this.globalUserCache.CurrentUser.Name; skinButton_State.Image = stateImage; skinButton_State.Tag = userStatus; this.skinLabel_softName.Text = GlobalResourceManager.SoftwareName; this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:{3}", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID, GlobalResourceManager.GetUserStatusName(this.globalUserCache.CurrentUser.UserStatus))); this.MaximumSize = new Size(543, Screen.GetWorkingArea(this).Height); this.Size = SystemSettings.Singleton.MainFormSize; this.Location = SystemSettings.Singleton.MainFormLocation;//new Point(Screen.PrimaryScreen.Bounds.Width - this.Width - 20, 40); this.friendListBox1.Initialize(this.globalUserCache.CurrentUser, this, new UserInformationForm(new Point(this.Location.X - 284, this.friendListBox1.Location.Y))); this.groupListBox.Initialize(this.globalUserCache.CurrentUser, GlobalConsts.CompanyGroupID); this.recentListBox1.Initialize(this); if (!SystemSettings.Singleton.ShowLargeIcon) { this.friendListBox1.IconSizeMode = ChatListItemIcon.Small; this.大头像ToolStripMenuItem.Checked = false; this.小头像ToolStripMenuItem.Checked = true; } //文件传送 this.rapidPassiveEngine.FileOutter.FileRequestReceived += new CbFileRequestReceived(fileOutter_FileRequestReceived); this.rapidPassiveEngine.FileOutter.FileResponseReceived += new CbGeneric <TransferingProject, bool>(fileOutter_FileResponseReceived); this.rapidPassiveEngine.ConnectionInterrupted += new CbGeneric(rapidPassiveEngine_ConnectionInterrupted); //预订断线事件 this.rapidPassiveEngine.BasicOutter.BeingPushedOut += new CbGeneric(BasicOutter_BeingPushedOut); this.rapidPassiveEngine.RelogonCompleted += new CbGeneric <LogonResponse>(rapidPassiveEngine_RelogonCompleted); //预订重连成功事件 this.rapidPassiveEngine.MessageReceived += new CbGeneric <string, int, byte[], string>(rapidPassiveEngine_MessageReceived); //群、组 this.rapidPassiveEngine.ContactsOutter.BroadcastReceived += new CbGeneric <string, string, int, byte[], string>(ContactsOutter_BroadcastReceived); this.rapidPassiveEngine.ContactsOutter.ContactsOffline += new CbGeneric <string>(ContactsOutter_ContactsOffline); //所有联系人的下线事件 //网盘访问器 V2.0 this.nDiskOutter = new NDiskOutter(this.rapidPassiveEngine.FileOutter, this.rapidPassiveEngine.CustomizeOutter); this.notifyIcon.UnhandleMessageOccured += new CbGeneric <UnhandleMessageType, string>(notifyIcon_UnhandleMessageOccured); this.notifyIcon.UnhandleMessageGone += new CbGeneric <UnhandleMessageType, string>(notifyIcon_UnhandleMessageGone); this.notifyIcon.Initialize(this, this); }
internal static ImagemapMessage MakeMenu(Event item) { // 先做初始化 UserStatus userStatus = new UserStatus(item.source.userId); userStatus.InitializeUserStatusByUserID(); ShopTemp shopTemp = new ShopTemp(item.source.userId); shopTemp.InitializeShopTempByUserID(); shopTemp.DeleteShopItemTempByUserID(); OrderTemp orderTemp = new OrderTemp(item.source.userId); orderTemp.UpdateInitialOrderTemp(); PeriodOrderTmp periodOrderTmp = new PeriodOrderTmp(item.source.userId); periodOrderTmp.UpdateInitialPeriodOrderTmp(); ShopListTemp shopListTemp = new ShopListTemp(item.source.userId); shopListTemp.DeleteByUserID(); BuyerTemp buyerTemp = new BuyerTemp(item.source.userId); buyerTemp.DeleteByBuyerID(); // 先做初始化 ImagemapMessage imagemapMessage = new ImagemapMessage(); Uri uri = new Uri("https://i220.photobucket.com/albums/dd130/jung_04/Menu2.png#"); imagemapMessage.baseUrl = uri; imagemapMessage.altText = "這是imagemap"; Size size = new Size(1040, 1040); imagemapMessage.baseSize = size; #region LeftUp isRock.LineBot.ImagemapArea imagemapAreaLeftUp = new isRock.LineBot.ImagemapArea() { x = 0, y = 0, width = 520, height = 520 }; isRock.LineBot.ImagemapMessageAction imagemapMessageActionLeftUp = new ImagemapMessageAction(); imagemapMessageActionLeftUp.area = imagemapAreaLeftUp; imagemapMessageActionLeftUp.text = "我要進入訂單模式!!!"; imagemapMessage.actions.Add(imagemapMessageActionLeftUp); #endregion #region RightUp isRock.LineBot.ImagemapArea imagemapAreaRightUp = new isRock.LineBot.ImagemapArea() { x = 520, y = 0, width = 520, height = 520 }; isRock.LineBot.ImagemapMessageAction imagemapMessageActionRightUp = new ImagemapMessageAction(); imagemapMessageActionRightUp.area = imagemapAreaRightUp; imagemapMessageActionRightUp.text = "我要進入個人模式!!!"; imagemapMessage.actions.Add(imagemapMessageActionRightUp); #endregion #region LeftDown isRock.LineBot.ImagemapArea imagemapAreaLeftDown = new isRock.LineBot.ImagemapArea() { x = 0, y = 520, width = 520, height = 520 }; isRock.LineBot.ImagemapMessageAction imagemapMessageActionLeftDown = new ImagemapMessageAction(); imagemapMessageActionLeftDown.area = imagemapAreaLeftDown; imagemapMessageActionLeftDown.text = "我要進入社團模式!!!"; imagemapMessage.actions.Add(imagemapMessageActionLeftDown); #endregion #region RightDown var actions1 = new List <isRock.LineBot.ImagemapActionBase>(); isRock.LineBot.ImagemapArea imagemapAreaRightDown = new isRock.LineBot.ImagemapArea() { x = 520, y = 520, width = 520, height = 520 }; isRock.LineBot.ImagemapMessageAction imagemapMessageActionRightDown = new ImagemapMessageAction(); imagemapMessageActionRightDown.area = imagemapAreaRightDown; imagemapMessageActionRightDown.text = "我要進入商店模式!!!"; imagemapMessage.actions.Add(imagemapMessageActionRightDown); #endregion return(imagemapMessage); }
internal UserUpdatedEvent(Guid userId, long userVersion, string emailAddress, UserStatus userStatus) : base(userId, userVersion) { EmailAddress = emailAddress; UserStatus = userStatus; }
/// <summary> /// Initializes a new instance of the <see cref="GetStatusResponse"/> class. /// </summary> /// <param name="username">The username of the peer.</param> /// <param name="status">The status of the peer.</param> /// <param name="privileged">A value indicating whether the peer is privileged.</param> internal GetStatusResponse(string username, UserStatus status, bool privileged) { Username = username; Status = status; Privileged = privileged; }
internal static async Task LoginAsync(string token, AsyncEventHandler <ReadyEventArgs> onReady, Func <Exception, Task> onError, bool background, UserStatus status = UserStatus.Online) { Exception taskEx = null; await _connectSemaphore.WaitAsync(); try { var loader = ResourceLoader.GetForViewIndependentUse(); if (Discord == null) { if (background || await WindowsHelloManager.VerifyAsync(VERIFY_LOGIN, loader.GetString("VerifyLoginDisplayReason"))) { try { async Task ReadyHandler(ReadyEventArgs e) { e.Client.Ready -= ReadyHandler; e.Client.SocketErrored -= SocketErrored; e.Client.ClientErrored -= ClientErrored; _readySource.TrySetResult(e); if (onReady != null) { await onReady(e); } } Task SocketErrored(SocketErrorEventArgs e) { e.Client.Ready -= ReadyHandler; e.Client.SocketErrored -= SocketErrored; e.Client.ClientErrored -= ClientErrored; _readySource.SetException(e.Exception); return(Task.CompletedTask); } Task ClientErrored(ClientErrorEventArgs e) { e.Client.Ready -= ReadyHandler; e.Client.SocketErrored -= SocketErrored; e.Client.ClientErrored -= ClientErrored; _readySource.SetException(e.Exception); return(Task.CompletedTask); } Discord = await Task.Run(() => new DiscordClient(new DiscordConfiguration() { Token = token, TokenType = TokenType.User, LogLevel = DSharpPlus.LogLevel.Debug, GatewayCompressionLevel = GatewayCompressionLevel.None, ReconnectIndefinitely = true })); Discord.DebugLogger.LogMessageReceived += (o, ee) => Logger.Log(ee.Message, ee.Application); Discord.Ready += ReadyHandler; Discord.SocketErrored += SocketErrored; Discord.ClientErrored += ClientErrored; await Discord.ConnectAsync(status : status, idlesince : AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Desktop"?(DateTimeOffset?)null : DateTimeOffset.Now); } catch (Exception ex) { Tools.ResetPasswordVault(); _readySource.TrySetException(ex); await onError(ex); } } else { await onError(null); } } else { try { var res = await _readySource.Task; await onReady(res); } catch { await onError(taskEx); } } } finally { _connectSemaphore.Release(); } }
//Gets Called When The Server Send Status.UserStatus void GetUserStatus(UserStatus status) { OnUpdateUserList?.Invoke(status.User, status.Join); GetMessage(status.Message); }
/// <summary> /// The xmpp on presence. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="pres"> /// The pres. /// </param> private void XmppOnPresence(object sender, Presence pres) { // Most of this if block handles the status if logged in somewhere else as well. if (pres.From.User == this.xmpp.MyJID.User) { if (pres.Type == PresenceType.subscribe) { this.xmpp.PresenceManager.ApproveSubscriptionRequest(pres.From); } else { this.myPresence = pres; this.myPresence.Type = PresenceType.available; if (pres.Show != ShowType.NONE) { this.myPresence.Show = pres.Show; } this.xmpp.Status = this.myPresence.Status ?? this.xmpp.Status; if (this.OnDataReceived != null) { this.OnDataReceived.Invoke(this, DataRecType.MyInfo, pres); } } return; } switch (pres.Type) { case PresenceType.subscribe: if (!this.Friends.Contains(new User(pres.From.Bare))) { var request = new FriendRequestNotification(pres.From.Bare, this, this.noteId); this.Notifications.Add(request); this.noteId++; if (this.OnFriendRequest != null) { this.OnFriendRequest.Invoke(this, pres.From.Bare); } request.Accept(); } else { this.AcceptFriendship(pres.From.Bare); } break; case PresenceType.subscribed: break; case PresenceType.unsubscribe: break; case PresenceType.unsubscribed: break; case PresenceType.error: break; case PresenceType.probe: break; } var presFromUser = pres.From.User; var friendToSet = this.Friends.FirstOrDefault(x => x.UserName == presFromUser); if (friendToSet != null) { friendToSet.CustomStatus = pres.Status ?? string.Empty; friendToSet.SetStatus(pres); this.Friends.Remove(friendToSet); this.Friends.Add(friendToSet); } this.XmppOnOnRosterEnd(this); }
/// <summary> /// Initializes a new instance of the <see cref="SetOnlineStatus"/> class. /// </summary> /// <param name="status">The current status.</param> public SetOnlineStatus(UserStatus status) { Status = status; }
/// <summary> /// The set custom status. /// </summary> /// <param name="status"> /// The status. /// </param> public void SetCustomStatus(string status) { this.xmpp.Status = status; this.xmpp.SendMyPresence(); }
public ViewResult Index(UserStatus userStatus = UserStatus.NormalUser) { ViewBag.userStatus = userStatus; return(View()); }
public IActionResult token([FromBody] User user) { User existUser = user; string Password = EncrPassword(user.Password); Login objlogin = new Login(); JObject JLoginObj = new JObject(); JLoginObj.Add("userName", user.Username); JLoginObj.Add("Password", Password); JLoginObj.Add("authType", "DB"); JLoginObj.Add("AuthSuccess", "N"); LoginRepository repository = new LoginRepository(_iconfiguration); DataSet UserData = repository.SelectLoginDetails(JLoginObj.ToString()); UserStatus userLoginstatus = new UserStatus(); if (UserData.Tables["UserLogin"] != null) { userLoginstatus = getLoginUserStatus(UserData, Password); } else { return(Json(new RequestResult { Results = new { Status = RequestState.Failed, Msg = "Username or password is invalid" }, })); } if (userLoginstatus.IsLogin) { var requestAt = DateTime.Now; var expiresIn = requestAt + TokenAuthOption.ExpiresSpan; var token = GenerateToken(existUser, expiresIn); // var strGroups = UserData.Tables["UserLogin"].Rows[0]["DeptGroupCode"].ToString(); // var userGroups = strGroups.Split(','); var userFullName = UserData.Tables["UserLogin"].Rows[0]["UserName"]; return(Json(new RequestResult { Results = new { Status = RequestState.Success, Msg = "ok" }, Data = new { requertAt = requestAt, expiresIn = TokenAuthOption.ExpiresSpan.TotalSeconds, tokeyType = TokenAuthOption.TokenType, accessToken = token, Userinfo = new { UserID = existUser.Username, username = userFullName } } })); } else { return(Json(new RequestResult { Results = new { Status = RequestState.Failed, Msg = userLoginstatus.Msg }, })); } }
private bool DoRoundTrip(EnumHelper <UserStatus> enumHelper, UserStatus status) { return(enumHelper.Names.Contains(Enum.GetName(typeof(UserStatus), status))); }
public PhantomThief(ulong _id, string _name, DateTime _lastOnline, DateTime _nextBedtime, UserStatus _status) { this.UserId = _id; this.UserName = _name; this.LastOnlineTime = _lastOnline; this.NextBedtime = _nextBedtime; this.LastStatus = _status; }
public void Start() { // Clear Game Console ConsoleManager.Cleaner.ClearConsole(); // Show Game Logo ConsoleManager.Writer.PrintLogo(); try { // Ask Questions var questionAnswers = ConsoleManager.QuestionAction.GetUserAnswers(); // Player Init/Creation Player = GameFactory.PlayerFactory.CreatePlayer(questionAnswers[0].Answer.Split(": ")[0], questionAnswers[1].Answer.Split(": ")[0], (GenderType)Enum.Parse(typeof(GenderType), questionAnswers[2].Answer.Split(": ")[0]), (Birthplaces)Enum.Parse(typeof(Birthplaces), questionAnswers[3].Answer.Split("]")[0].Replace(" ", "")), Generator); } catch (NullReferenceException) { SupressException(Exceptions.Models.Exceptions.AnswerRequirementsFailed); } catch (ArgumentException) { SupressException(Exceptions.Models.Exceptions.InvalidInput); } catch (CustomException e) { SupressException(e.Message); } // Update GameTime GameTime = DateTime.Now; // Update Player's Progress to NewBorn PlayerProgress = PlayerProgress.NewBorn; ConsoleManager.UserInteraction.AddAction( $"You are born as {Player.FirstName} {Player.LastName} in {Player.GetBirthplace()}."); ConsoleManager.UserInteraction.AddAction( $"Your Father is {Player.Father.FirstName} {Player.Father.LastName}"); ConsoleManager.UserInteraction.AddAction( $"Your Mother is {Player.Mother.FirstName} {Player.Mother.LastName}"); // Clears Console ConsoleManager.Cleaner.ClearConsole(); while (true) { // Print Logo ConsoleManager.Writer.PrintLogo(); // Show User's HUD UserStatus.WriteStatus(Player); // Show what the user has done, last X (ActionLogNumber) actions UserStatus.WriteActionLog(ConsoleManager.UserInteraction.ActionLog, ActionLogNumber); // Show User's available options MenuManager.MenuLauncher.PrintMenu(PlayerProgress, MenuManager.OptionsContainer); if (EndTheGame) { break; } try { var commandAsString = ConsoleManager.Reader.ReadLine(); if (string.Equals(commandAsString, TerminationCommand, StringComparison.CurrentCultureIgnoreCase)) { break; } CommandParser.ProcessCommand(commandAsString); } catch (Exception ex) { // Just for now to debug, will be changed later on. //ConsoleManager.UserInteraction.AddAction("An unexpected error has occured and has been logged."); ConsoleManager.UserInteraction.AddAction(ex.Message); Logger.GetLogger.Error(ex.Message); } // Clear Console ConsoleManager.Cleaner.ClearConsole(); } // End Game Screen ConsoleManager.Cleaner.ClearConsole(); ConsoleManager.Writer.PrintLogo(); ConsoleManager.Writer.WriteLine(Player.ToString()); ConsoleManager.Writer.WriteLine( $"Thank you for playing LifeSim Alpha {Assembly.GetExecutingAssembly().GetName().Version}"); }
public void Init() { instance = new UserStatus(); }
public UserRTData(UserStatus status, int ver) { this.UserStatus = status; this.Version = ver; }
public int ChangeUserStatus(int userId, UserStatus status) { return(UserController.ChangeUserStatus(userId, status)); }
public void SetUserStatus(UserStatus userStatus) { UserStatus = userStatus; }
/// <summary> /// let Admin Call user repository method to suspend User /// </summary> /// <param name="UserName"></param> /// <param name="userStatus"></param> /// <returns></returns> public async Task <String> SuspendUser(String UserName, UserStatus userStatus) { //business logic goes here throw new NotImplementedException(); }
public async Task <int> UpdateUserRoleAndStatus(CompetentAuthorityUser user, Role role, UserStatus status) { user.UpdateUserStatus(status.ToDomainEnumeration <Domain.User.UserStatus>()); user.UpdateRole(role); return(await context.SaveChangesAsync()); }
public static IList <MemberUser> ConvertStatus(BizPortalSessionContext context, Member member, UserStatus userStatus) { IList <MemberUser> mus = new List <MemberUser>(); foreach (MemberUser item in member.GetUsersWithStatus(context, userStatus)) { switch (item.Status) { case UserStatus.Active: item.Tag = UserStatus.Active.ToString("G"); break; case UserStatus.Expired: case UserStatus.Expired | UserStatus.Inactive: case UserStatus.Expired | UserStatus.TooManyFailedLogin: item.Tag = UserStatus.Expired.ToString("G"); break; case UserStatus.Disable: case UserStatus.Disable | UserStatus.Inactive: case UserStatus.Disable | UserStatus.TooManyFailedLogin: item.Tag = UserStatus.Disable.ToString("G"); break; case UserStatus.TooManyFailedLogin: case UserStatus.TooManyFailedLogin | UserStatus.Inactive: item.Tag = UserStatus.TooManyFailedLogin.ToString("G"); break; case UserStatus.Inactive: item.Tag = UserStatus.Inactive.ToString("G"); break; default: break; } mus.Add(item); } return(mus); }