private void UpdateStatus(User source, User entity, USER_STATUS status) { entity.Status = status; this.Update(null, entity); var log = new DbLog(DateTime.Now, ACTION_TARGET.USER, ACTION.CHANGE_STATUS, CHANGE_FIELD.TITLE, source.Id, entity.Id, entity.Name, EnumConverter.Convert(status), null); _context.DbLogs.Add(log); _context.SaveChanges(); }
public User(string name, string phoneNumber, string address, ROLE role, USER_STATUS status, string username, string password) { Name = name; PhoneNumber = phoneNumber; Address = address; Role = role; Status = status; Username = username; Password = password; }
/****************************************************************************************************/ // METHODS - PERSISTENCE /****************************************************************************************************/ // Concatenates all data under the user class and returns it as one long string // Each data entry is separated by a delimiter, % public void Clear() { _ticketExpiry = 0; _smsLog.Clear(); _journeyLog.Clear(); _userStatus = USER_STATUS.inactive; _location = null; _journeyPlan = new Journey(null, null, null, -1, -1); _account = 0; }
public static string Convert(USER_STATUS status) { switch (status) { case USER_STATUS.ACTIVE: return("Mở"); case USER_STATUS.DISABLED: return("Khóa"); default: return(""); } }
public void updateUserStatus(string username, USER_STATUS new_status) { using (var db = new ConnectFourContext()) { User playerInDB = db.Users.SingleOrDefault(user => user.userName == username); if (playerInDB == null) { return; } playerInDB.status = new_status; db.Entry(playerInDB).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
//Response.Write(new byte[] { 0x30, 0x00, 0x15, 0x01 }); //Response.Write(GetUID); //uid player //Response.Write(1); //sempre aparece 4 //Response.WriteByte(1); //Response.Write(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }); //Response.Write(ServerInfo.GameServerID); // porta que player se conectou //Response.Write(ServerInfo.LobbyId); //id do canal //Response.WriteStr(ServerInfo.LobbyName, 64); public static byte[] ShowConnectionServer(uint UID, USER_STATUS typeConnection, ServerProcess server) { using (var Response = new PangyaBinaryWriter()) { Response.Write(new byte[] { 0x30, 0x00, 0x15, 0x01 }); Response.Write(UID); Response.Write((uint)typeConnection); Response.WriteByte(1); Response.Write(server.GameID); Response.Write(server.Unknown); Response.Write(server.GameServerID); Response.Write(server.LobbyId); Response.WriteStr(server.LobbyName, 64); return(Response.GetBytes()); } }
private List<Journey> _journeyLog; // stores the bus stops hopped on from and hopped off to and the corresponding bus name taken (past) /****************************************************************************************************/ // CONSTRUCTOR /****************************************************************************************************/ public User(string name, string mobileNum, float account, string creditCardNum, PAYMENT_MODE paymentMode1, PAYMENT_MODE paymentMode2, string password) { _name = name; _mobileNum = mobileNum; _account = account; _creditCardNum = creditCardNum; _paymentMode1 = paymentMode1; _paymentMode2 = paymentMode2; _ticketExpiry = 0; _journeyPlan = new Journey(null, null, null, -1, -1); _userStatus = USER_STATUS.inactive; _location = null; _password = password; _smsLog = new List<string>(); _journeyLog = new List<Journey>(); }
// updates the user status public void UpdateUserStatus(USER_STATUS newUserStatus) { _userStatus = newUserStatus; }
//search public IList <User> Search(IList <User> users, string searchString, ROLE?role, USER_STATUS status = USER_STATUS.ALL, SEARCH_SORT_TYPE type = SEARCH_SORT_TYPE.NAME) { var arr = users.Select(m => new User(m, m.Id)).ToList(); if (!status.Equals(USER_STATUS.ALL)) { arr = arr.Where(m => m.Status.Equals(status)).ToList(); } switch (type) { case SEARCH_SORT_TYPE.ROLE: if (role == null) { break; } users = users.Where(m => m.Role.Equals(role)).ToList(); break; default: users = users.Where(m => m.Name.Contains(searchString.Trim(), StringComparison.OrdinalIgnoreCase)).ToList(); break; } return(arr); }