public Result Delete(Model.DB.User model) { UserRA.Delete(model.id.ToString()); MessageBiz.Send(model.id.ToString(), MessageTypeEnum.User_Forbidden); model.created_by = user_id; return(Result(UserDA.Delete(model))); }
public MessageService(IPushNotificationProvider pushNotificationProvider) { PushNotification = pushNotificationProvider; UnitOfWork = new CoreUnitOfWork(); MessageBiz = new MessageBiz(UnitOfWork); NotificationBiz = new NotificationBiz(UnitOfWork); }
/// <summary> /// 自动的执行任务 /// </summary> /// <remarks> /// Interval 单位为毫秒 /// Begin 从 2019-1-1 0:0:0 开始计时执行 /// </remarks> public override void Run() { if (!enableXmpp) { return; } var stopwatch = new Stopwatch(); stopwatch.Start(); Logger.Info("开始保存聊天消息数据"); MessageBiz biz = new MessageBiz(); int count = biz.Save2DB(); stopwatch.Stop(); if (count >= 0) { Logger.Info($"聊天消息数据保存完成,共处理条 {count} 数据。耗时:{ToTime(stopwatch.ElapsedMilliseconds)}"); } else { Logger.Error("聊天消息数据保存失败"); } }
public DataSourceResult ReadSentMessages(DataSourceRequest request, UserIdentity user) { return(MessageBiz .Read(message => message.SenderId == user.UserId, noTracking: true) .OrderByDescending(message => message.CreateDate) .Include(message => message.Receiver) .MapTo <MessagePM>() .ToDataSourceResult(request)); }
public void CreateMessage(int senderId, int receiverId, string text) { var message = MessageBiz.Add(senderId, receiverId, text); var notification = NotificationBiz.Add(NotificationType.WriteMessage, senderId, null, receiverId); UnitOfWork.SaveChanges(); // Send notification PushNotification.Send(receiverId, PushNotificationType.NewNotification, NotificationBiz.ProcessNotification(notification).GetNotificationPM()); }
public void DeleteMessages(IEnumerable <int> ids, UserIdentity user) { //TODO: put here a security check var messages = ids.Select(id => new Message() { Id = id }); messages.ForEach(message => MessageBiz.Remove(message)); UnitOfWork.SaveChanges(); }
public AppStatisticsService() { UnitOfWork = new CoreUnitOfWork(); ArticleBiz = new ArticleBiz(UnitOfWork); BlogBiz = new BlogBiz(UnitOfWork); VisitBiz = new VisitBiz(UnitOfWork); UserBiz = new UserBiz(UnitOfWork); CommentBiz = new CommentBiz(UnitOfWork); MessageBiz = new MessageBiz(UnitOfWork); FeaturedContentBiz = new FeaturedContentBiz(UnitOfWork); }
public Result UpdateStatusOrder(StatusOrder model) { string status_order = ((int)model.status).ToString(); if (UserRA.Exists(model.id.ToString())) { UserRA.Set(model.id.ToString(), "status_order", status_order); } MessageBiz.Send(model.id.ToString(), MessageTypeEnum.User_Order_Status, status_order); return(Result(UserDA.UpdateStatusOrder(model))); }
public DashboardModelContainer GetUserDashboardData(int userId) { var today = DateTime.Now.Date; return(new DashboardModelContainer() { PendingComments = CommentBiz.ReadNotConfirmedComments(userId).Take(4).MapTo <CommentInfoPM>().ToList(), ArticlesCount = ArticleBiz.ReadUserPublishedContents(userId, ContentType.Article).Count(), BlogPostsCount = BlogBiz.ReadUserTotalPublishedPostsCount(userId), TodayTotallVisits = VisitBiz.ReadUserTodayTotalVisits(userId), LatestMessages = MessageBiz.ReadUserMessages(userId, 4).MapTo <MessagePM>().ToList() }); }
public async Task <IActionResult> GetHistoryMessageListStartByTopMsgAsync([FromQuery] GetHistoryMessageListStartByTopMsgRequestDto requestDto) { var biz = new MessageBiz(); var model = await biz.GetAsync(requestDto.TopMsgId); if (model != null) { requestDto.TopMsgDate = model?.CreationDate; } var result = await biz.GetHistoryMessageListStartByTopMsgAsync(requestDto); return(Success(result)); }
private void createMessageFor(string fromPersonId, string toPersonId, string subject, string body) { fromPersonId.IsNullOrWhiteSpaceThrowArgumentException(); toPersonId.IsNullOrWhiteSpaceThrowArgumentException(); subject.IsNullOrWhiteSpaceThrowArgumentException(); body.IsNullOrWhiteSpaceThrowArgumentException(); Person fromPerson = PersonBiz.Find(fromPersonId); fromPerson.IsNullThrowException(); Message message = new Message(fromPersonId, fromPerson, toPersonId, subject, body, MessageENUM.Free, null); MessageBiz.Create(message); }
public BuySellDocBiz(IRepositry <BuySellDoc> entityDal, BuySellItemBiz buySellItemBiz, BizParameters bizParameters, OwnerBiz ownerBiz, CustomerBiz customerBiz, ShopBiz shopBiz, DeliverymanBiz deliverymanBiz, FreightOfferTrxBiz freightOfferTrxBiz, VehicalTypeBiz vehicalTypeBiz, MessageBiz messageBiz, PeopleMessageBiz peopleMessageBiz, SalesmanBiz salesmanBiz, BuySellDocHistoryBiz buySellDocHistoryBiz) : base(entityDal, bizParameters) { _ownerBiz = ownerBiz; _customerBiz = customerBiz; _shopBiz = shopBiz; _buySellBiz = entityDal as BuySellDocBiz; _buySellItemBiz = buySellItemBiz; _freightOfferTrxBiz = freightOfferTrxBiz; _deliverymanBiz = deliverymanBiz; _vehicalTypeBiz = vehicalTypeBiz; _messageBiz = messageBiz; _peopleMessageBiz = peopleMessageBiz; _salesmanBiz = salesmanBiz; _buySellDocHistoryBiz = buySellDocHistoryBiz; }
public Result UpdateStatus(StatusUser model) { if (model.status != StatusUserEnum.Allowed) { UserRA.Delete(model.id.ToString()); } if (model.status != StatusUserEnum.Forbidden) { MessageBiz.Send(model.id.ToString(), MessageTypeEnum.User_Forbidden); } else if (model.status == StatusUserEnum.ForcedOffline) { MessageBiz.Send(model.id.ToString(), MessageTypeEnum.User_ForcedOffline); } return(Result(UserDA.UpdateStatus(model))); }
public IActionResult AddMessageInfo([FromBody] List <AddMessageInfoRequestDto> requestDtoList) { var messageBiz = new MessageBiz(); var messageList = new List <MessageModel>(); foreach (var dto in requestDtoList) { DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); long lTime = long.Parse(dto.CreationDate + "0000"); TimeSpan toNow = new TimeSpan(lTime); var msgDate = dtStart.Add(toNow); var model = new MessageModel { MsgGuid = Guid.NewGuid().ToString("N"), TopicGuid = dto.TopicGuid, FromGuid = dto.FromGuid, ToGuid = dto.ToGuid, Context = dto.Context, IsHtml = dto.IsHtml, CreatedBy = UserID, CreationDate = msgDate, LastUpdatedBy = UserID, LastUpdatedDate = DateTime.Now, OrgGuid = "OrgGuid", Enable = true }; if (!string.IsNullOrWhiteSpace(dto.MessageGuid)) { model.MsgGuid = dto.MessageGuid; } messageList.Add(model); } if (messageList.Count > 0) { var isAddSuccess = messageBiz.Push2Redis(messageList); if (!isAddSuccess) { return(Failed(ErrorCode.DataBaseError, "批量添加失败!")); } DoctorOfflineMessageNotification(messageList.FirstOrDefault()); } return(Success()); }
public static void Start(string monthkey, string user) { MessageBiz messageBiz = new MessageBiz(); SendMPNewsRequest sendNewsRequest = new SendMPNewsRequest(); string strConn = @"Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" + filePath + "Report Mapping.xlsx;Extended Properties='Excel 12.0;HDR=Yes;IMEX=1'"; DataTable ExcelTable = GetDTFromExcel(strConn); if (!string.IsNullOrEmpty(user)) { sendNewsRequest = GetSendMPNewsRequest(monthkey, user, ExcelTable); messageBiz.Send <SendMPNewsRequest>(sendNewsRequest); } else { DataView dataView = ExcelTable.DefaultView; DataTable dataTableDistinct = dataView.ToTable(true, "Name"); for (int i = 0; i < dataTableDistinct.Rows.Count; i++) { string account = Convert.ToString(dataTableDistinct.Rows[i][0]); sendNewsRequest = GetSendMPNewsRequest(monthkey, account, ExcelTable); messageBiz.Send <SendMPNewsRequest>(sendNewsRequest); } } }
public Result ResetPassword(UserPassword model) { MessageBiz.Send(model.id.ToString(), MessageTypeEnum.Password_Changed); return(Result(UserDA.ResetPassword(model))); }
private void createMessageFor(RejectCancelDeleteInbetweenClass rcdbc, BuySellDoc buySellDoc) { string fromPersonId = ""; string toPersonId = ""; Person fromPerson = null; List <string> listOfToPeople = new List <string>(); string buySellDocId = buySellDoc.Id; Person ownerPerson = OwnerBiz.GetPersonForPlayer(buySellDoc.OwnerId); Person customerPerson = CustomerBiz.GetPersonForPlayer(buySellDoc.CustomerId); ownerPerson.IsNullThrowException(); customerPerson.IsNullThrowException(); switch (buySellDoc.BuySellDocumentTypeEnum) { case BuySellDocumentTypeENUM.Sale: fromPersonId = ownerPerson.Id; fromPerson = ownerPerson; toPersonId = customerPerson.Id; listOfToPeople.Add(toPersonId); break; case BuySellDocumentTypeENUM.Purchase: toPersonId = ownerPerson.Id; fromPersonId = customerPerson.Id; fromPerson = customerPerson; listOfToPeople.Add(toPersonId); break; case BuySellDocumentTypeENUM.Delivery: Person deliveryPerson = DeliverymanBiz.GetPersonForPlayer(buySellDoc.DeliverymanId); deliveryPerson.IsNullThrowException(); fromPersonId = deliveryPerson.Id; fromPerson = deliveryPerson; listOfToPeople.Add(ownerPerson.Id); listOfToPeople.Add(customerPerson.Id); break; case BuySellDocumentTypeENUM.Unknown: default: throw new Exception("Unknown document type"); } Message message = new Message( fromPersonId, fromPerson, listOfToPeople, rcdbc.Subject, rcdbc.Comment, MessageENUM.Free, null); if (buySellDoc.Messages.IsNull()) { buySellDoc.Messages = new List <Message>(); } buySellDoc.Messages.Add(message); message.BuySellDocId = buySellDoc.Id; message.ListOfToPeopleId.IsNullOrEmptyThrowException(); foreach (var pplId in message.ListOfToPeopleId) { Person person = PersonBiz.Find(pplId); person.IsNullThrowException(); PeopleMessage pplMsg = new PeopleMessage(); pplMsg.IsNullThrowException(); pplMsg.PersonId = pplId; pplMsg.Person = person; pplMsg.MessageId = message.Id; PeopleMessageBiz.Create(pplMsg); } MessageBiz.Create(message); }
public Result Authority(Model.DB.User model) { MessageBiz.Send(model.id.ToString(), MessageTypeEnum.Authorization_Changed); return(Result(UserDA.Authority(model))); }