//线程实例 //用户管理类DB public void createUser(object obj) { try { object[] objs = null; UserGroup user = null; UserLogin login = null; User info = null; UserRegister reg = null; while (true) { user = regQueue.ReceiveUserGroup(); // objs = regQueue.GetAllUserMessage(); if (user != null) { Console.WriteLine("消息UserGroup" + user.ID); login = regQueue.ReceiveUserLogin(); if (login != null) { Console.WriteLine("消息UserLogin" + login.LoginID); info = regQueue.ReceiveUser(); if (info != null) { Console.WriteLine("消息User" + info.PhoneNumber); reg = regQueue.ReceiveUserRegister(); if (reg != null) { Console.WriteLine("消息UserRegister" + reg.UserId); db.Create(user); db.CreateOrUpdate(login); db.CreateOrUpdate(info); db.Create(reg); Console.WriteLine("消息DB .." + reg.UserId); } } } } Thread.Sleep(100); } } catch (Exception ex) { Console.WriteLine("消息DB异常" + ex.ToString()); } }
//Return User public bool Register(UserDTO userDTO) { if (UserOperations.IsPresent(userDTO.Email)) { throw new UsernameAlreadyExists("User Name is Already taken"); } else { UserOperations.Create(userDTO); return(true); } }