public bool AddAccountForAdminPage(Account account) { var item = RedisBase.HashGetAll <KeyValuePair <string, Account> >(this._key); if (item != null) { var accounts = item.Where(t => t.Value.AccountName == account.AccountName); if (accounts.Any()) { var count = item.Where(t => t.Value.AccountName.Contains(account.AccountName)).Count(); account.AccountName = account.AccountName + "(" + count + ")"; } } account.Id = Guid.NewGuid().ToString(); if (account.Password == "-1") { account.Password = account.ConfirmPassword = "******"; } KeyValuePair <string, Account> model = new KeyValuePair <string, Account>(account.Id, account); return(RedisBase.HashSet <KeyValuePair <string, Account> >(this._key, model.Key, model)); }
public object AddAccount(Account account) { var item = RedisBase.HashGetAll <KeyValuePair <string, Account> >(this._key); if (item != null) { bool isExist = item.Any(t => t.Value.AccountName == account.AccountName); if (isExist) { return(new { result = false, message = "昵称已经被占用" }); } } account.Id = Guid.NewGuid().ToString(); KeyValuePair <string, Account> model = new KeyValuePair <string, Account>(account.Id, account); RedisBase.HashSet <KeyValuePair <string, Account> >(this._key, model.Key, model); return(new { result = true, message = "success" }); }
public List <KeyValuePair <string, Project> > GetProject() { var projects = RedisBase.HashGetAll <KeyValuePair <string, Project> >(this._key).ForIn(t => { if (!string.IsNullOrEmpty(t.Value.StartTime)) { t.Value.RunTime = (DateTime.Now - Convert.ToDateTime(t.Value.StartTime)).Days; } t.Value.Progress = CalcProgress(t.Value.Task); t.Value.TotalTime = CalcTotalTime(t.Value.Task); }); if (projects != null) { return(projects.ToList()); } return(null); }
public object Login(Account account, string ipAddress) { var model = RedisBase.HashGetAll <KeyValuePair <string, Account> >(this._key) .Where(t => t.Value.AccountName == account.AccountName); //Tuple if (!model.Any()) { return(new { result = false, message = "用户不存在" }); } var item = model.FirstOrDefault(); if (item.Value.Password != account.Password) { return(new { result = false, message = "密码错误" }); } new BllSession().AddSession(new SessionCache() { IpAddress = ipAddress, Token = item.Value.Id, Name = item.Value.UserName }); Chat.SendClientMessage(new Message() { Timestamp = DateTime.UtcNow, Body = "login out", MessageType = MessageType.LoginOut }); return(new { result = item }); }
public List <KeyValuePair <string, TaskTarget> > GetWorkTask() { return(RedisBase.HashGetAll <KeyValuePair <string, TaskTarget> >(TASK_TARGET)); }
public List <KeyValuePair <string, Account> > GetAccountById(string uuid) { return(RedisBase.HashGetAll <KeyValuePair <string, Account> >(this._key).Where(t => t.Key == uuid).ToList()); }
public List <KeyValuePair <string, Account> > GetAccount() { return(RedisBase.HashGetAll <KeyValuePair <string, Account> >(this._key)); }
public List <KeyValuePair <string, WorkTask> > GetWorkTask() { return(RedisBase.HashGetAll <KeyValuePair <string, WorkTask> >(this._key)); }
public List <KeyValuePair <string, TaskTarget> > GetTaskTarget() { return(RedisBase.HashGetAll <KeyValuePair <string, TaskTarget> >(this._key)); }