public ActionResult Index() { _user = _userService.GetFrontUserByUserID(_user.UserID); ViewBag.ID = _user.UserID; ViewBag.Avatar = string.IsNullOrEmpty(_user.Picture) ? "/Content/Images/32/20131030111304984.png" : _user.Picture + "?" + new Random(Convert.ToInt32(DateTime.Now.Millisecond)).NextDouble(); ViewBag.UserName = _user.Name ?? ""; ViewBag.RegistDate = _user.RegistDate.ToString("yyyy-MM-dd HH:mm"); ViewBag.LastDate = _user.LastDate == null ? "" : _user.LastDate.Value.ToString("yyyy-MM-dd HH:mm"); ViewBag.Mobile = _user.Mobile ?? ""; return(View(ViewBag)); }
public PersonalInfoManagmentController() { try { var userId = GetSession().User.UserID; _user = _userService.GetFrontUserByUserID(userId); } catch (Exception e) { } finally { } }
private static void ProcessMessageChanges(List <ML.BC.Infrastructure.MsmqHelper.MessageItem> messageItems) { try { if (null == messageItems || messageItems.Count == 0) { return; } foreach (var msg in messageItems) { var usernoteItem = new UserMessageQueueItem(); if (OperationEnum.Added == msg.Operation) { FrontUserDto sendUserDto = new FrontUserDto(); var data = msg.Data.Find(o => o.Key == "SendUserID"); if (null != data) { sendUserDto = Service.GetFrontUserDtoByID(msg.Data.Find(o => o.Key == "SendUserID").Value); } var userIDs = ""; if (msg.Data.Any(o => o.Key == "Recipients")) { userIDs = msg.Data.Find(o => o.Key == "Recipients").Value; } var syncInfos = Service.GetExistSyncStateDtoByUserIDs(userIDs); GeneralSetUserMessageQueueItem(usernoteItem, AppSyncActionEnum.SyncMessage, AppSyncDataTypeEnum.Text, sendUserDto, msg); UserMsgItem2Mongo(Service, syncInfos, usernoteItem); } else { var logger = log4net.LogManager.GetLogger(typeof(MsmqSync)); logger.Info("发送消息失败!" + msg.Type + (msg.Data.Exists(o => o.Key == "Recipients") ? msg.Data.Find(o => o.Key == "Recipients").Value : "获取相关信息失败")); } } } catch (Exception ex) { var logger = log4net.LogManager.GetLogger(typeof(MsmqSync)); logger.Error(ex.Message); } }
private static void GeneralSetUserMessageQueueItem(UserMessageQueueItem item, AppSyncActionEnum action, AppSyncDataTypeEnum dataType, FrontUserDto sendUserInfo, MessageItem msg) { item.Action = action; item.SyncDataType = dataType; item.Time = msg.ChangeTime; var chatMsg = new ChatMessage(); chatMsg.SendUserID = sendUserInfo.UserID; chatMsg.SendUserName = sendUserInfo.Name; chatMsg.SendUserPicture = sendUserInfo.Picture; chatMsg.EnterpriseID = sendUserInfo.EnterpiseID; chatMsg.IsRead = ReadStatus.NoRead; chatMsg.Recipients = msg.Data.Exists(o => o.Key == "Recipients") ? msg.Data.Find(o => o.Key == "Recipients").Value : "noRecipients"; chatMsg.Message = msg.Data.Exists(o => o.Key == "Text") ? msg.Data.Find(o => o.Key == "Text").Value : ""; chatMsg.SendTime = DateTime.SpecifyKind(Convert.ToDateTime(msg.Data.Exists(o => o.Key == "SendTime") ? msg.Data.Find(o => o.Key == "SendTime").Value : DateTime.MaxValue.ToString()), DateTimeKind.Local); chatMsg.MessageID = new Guid(msg.Data.Exists(o => o.Key == "MessageID") ? msg.Data.Find(o => o.Key == "MessageID").Value : Guid.Empty.ToString()); item.Data = chatMsg; }