public TradeController() { tradeService = new TradeService(); orderService = new OrderService(); configService = new PublicConfigService(); userService = new UserService(); }
public PayController() { orderService = new OrderService(); publicConfigService = new PublicConfigService(); }
public PublicConfigManager() { configService = new PublicConfigService(); }
public TradeService() { tradeDao = new TradeDao(); publicConfigService = new PublicConfigService(); }
public void SendDemandByEmail(int demandId) { Task.Factory.StartNew(() => { try { var demand = demandService.GetDemandById(demandId); if (demand == null) { return; } // Get all subscribed details. var subscriptions = subscriptionService.GetSubscriptionsOnlySubscribed(); // Get all subscribed wechat users. var subscribedWeChatUsers = userService.GetWeChatUserOnlySubscribed(); // Get email subscription format. PublicConfigService configService = new PublicConfigService(); // {0}:取消订阅链接, {1}:需求标题,{2}:需求类型,{3}:需求类别,{4}:需求预算,{5}:需求开始时间和结束时间,{6}:区域位置,{7}:需求详情,{8}:查看需求链接 var emailSubscriptionContentFormat = configService.GetConfigValue("EmailSubscriptionContentFormat").ConfigValue; if (subscriptions.HasItem() && subscribedWeChatUsers.HasItem()) { foreach (var subscription in subscriptions) { if (subscription.IsEnableEmailSubscription.HasValue && subscription.IsEnableEmailSubscription.Value) { var isDemandMatchWithSubscription = IsDemandMatchWithSubscription(subscription, demand); if (isDemandMatchWithSubscription) { // Only subscried user can recieve articles. var wechatUser = subscribedWeChatUsers.FirstOrDefault(x => x.Id == subscription.WeChatUserId); if (wechatUser.IsNotNull()) { var mailAddress = subscription.EmailAddress; var displayName = "活动在线网"; var mailSubject = "【活动在线网】【需求订阅】" + demand.Title; var mailBody = GetEmailSubscriptionContent(emailSubscriptionContentFormat, demand); var mailEntity = StaticUtility.EmailManager.CreateMailMessage(mailAddress, displayName, mailSubject, mailBody); var response = StaticUtility.EmailManager.Send(mailEntity); if (response.IsSuccess) { LogService.LogWexin("邮箱推送需求成功", "微信用户ID: " + wechatUser.Id + ", 用户名: " + wechatUser.NickName + ", 用户邮箱:" + subscription.EmailAddress); } else { LogService.LogWexin("邮箱推送需求失败", "微信用户ID: " + wechatUser.Id + ", 用户名: " + wechatUser.NickName + ", 用户邮箱:" + subscription.EmailAddress + "\r\n" + response.InnerException.ToString()); } } } } } } } catch (Exception ex) { LogService.LogWexin("SendDemandByEmail", ex.ToString()); } }); }
public PayController() { publicConfigService = new PublicConfigService(); }