public void AddNotice(RequestNotice requestNotice) { var currentuser = AuthManager.GetCurrentUser(); var model = AutoMapper.Mapper.Map <RequestNotice, Notice>(requestNotice); model.CreateName = currentuser.OperatorName; model.CreateTime = DateTime.Now; model.Code = ""; model.State = true; model.EffectiveEndTime = model.EffectiveEndTime.AddHours(23).AddMinutes(59).AddSeconds(59); this.unitOfWorkRepository.PersistCreationOf(model); this.unitOfWork.Commit(); try { if (string.IsNullOrEmpty(model.NoticeShowType)) { return; } List <string> list = new List <string>(); if (model.NoticeShowType.Contains("1")) { list.AddRange(this.businessmanRepository.FindAllNoTracking().OfType <Carrier>().Select(x => x.Code).ToList()); } if (model.NoticeShowType.Contains("2")) { list.AddRange(this.businessmanRepository.FindAllNoTracking().OfType <Supplier>().Select(x => x.Code).ToList()); } if (list.Count > 0) { WebMessageManager.GetInstance().Send(EnumMessageCommand.Aannouncement, list.ToArray(), model.Title); } if (model.NoticeShowType.Contains("0")) { MessagePushManager.SendAll(EnumPushCommands.EnforcePopNoticeWindow, model.Title, false, new object[] { model.ID }); } } catch (Exception e) { Logger.WriteLog(LogType.ERROR, "公告异常", e); } }
/// <summary> /// 应用程序的主入口点。 /// </summary> static void Main() { #region MyCode //Stopwatch watch = new Stopwatch(); //watch.Start(); Func <Type[]> funcs = new Func <Type[]>(() => { Type[] types = { typeof(DateTimeService), typeof(LoginService), typeof(PublisherService), typeof(BusinessmanService), typeof(OrderService), typeof(PlatformRefundOrderService), typeof(AccountService), typeof(FundService), typeof(FinancialService), typeof(RiskControlService), typeof(TPosService), typeof(FlightDestineService), typeof(TravelPaperService), typeof(PlatformCfgService), typeof(DeductionGroupService), typeof(BehaviorStatService), typeof(PidService), typeof(FrePasserService), typeof(ConsoLocalPolicyService), typeof(InsuranceService), typeof(NoticeService), typeof(MemoryService), typeof(MyMessageService), typeof(PlatformPointGroupService), typeof(OperationLogService) }; // 这里耗时最多。 return(types); }); IAsyncResult result = funcs.BeginInvoke(new AsyncCallback(Callback), funcs); BootStrapper.Boot(); // 耗时! while (true) { if (isGoOn) { var ser = SettingSection.GetInstances().HttpServer; HttpServer server = new HttpServer(ser.Host, ser.Port); server.Start(); Console.WriteLine("Web服务启动成功"); //1106 //JoveZhao.Framework.DDD.Events.DomainEvents.Raise(new BPiaoBao.DomesticTicket.Domain.Models.RefundEvent.RefundTicketEvent() { SaleOrderId = 3797 }); while (true) { Console.WriteLine("请输入命令数字:"); EnumMessageCommand command = (EnumMessageCommand)int.Parse(Console.ReadLine()); Console.WriteLine("请输入商户号:"); string code = Console.ReadLine(); Console.WriteLine("请输入发送内容"); string content = Console.ReadLine(); WebMessageManager.GetInstance().Send(command, code, content); MessagePushManager.SendMsgByBuyerCodes(new string[] { code }, (Common.Enums.EnumPushCommands)(command), content, true); Console.WriteLine("消息已发送"); } } } #endregion #region OldCode //ServiceBase[] ServicesToRun; //ServicesToRun = new ServiceBase[] //{ // new Service1() //}; //ServiceBase.Run(ServicesToRun); //Stopwatch watch = new Stopwatch(); //watch.Start(); //BootStrapper.Boot(); //Type[] types = { // typeof(DateTimeService), // typeof(LoginService), // typeof(PublisherService), // typeof(BusinessmanService), // typeof(OrderService), // typeof(PlatformRefundOrderService), // typeof(AccountService), // typeof(FundService), // typeof(FinancialService), // typeof(RiskControlService), // typeof(TPosService), // typeof(FlightDestineService), // typeof(TravelPaperService), // typeof(PlatformCfgService), // typeof(DeductionGroupService), // typeof(BehaviorStatService), // typeof(PidService), // typeof(FrePasserService), // typeof(ConsoLocalPolicyService), // typeof(InsuranceService), // typeof(NoticeService) // }; //watch.Stop(); //var c = watch.ElapsedMilliseconds; // 反射耗时:6486(ms) = 6.486(s) //foreach (var t in types) //{ // ServiceHost host = new ServiceHost(t); // host.Opened += (p, q) => // { // Console.WriteLine(t.Name + "启动成功"); // }; // host.Open(); //} //AutoIssueManage.Start(); //Console.WriteLine("自动出票服务启动"); //DomesticService domesticService = ObjectFactory.GetInstance<DomesticService>(); //domesticService.AutoIssue("04654475181900151211"); //while (true) //{ // Console.WriteLine("清输入命令[数字]:"); // string inputCommand = Console.ReadLine(); // Console.WriteLine("输入发送内容:"); // string inputContent = Console.ReadLine(); // Console.WriteLine("请输入发送商户号"); // string code = Console.ReadLine(); // MessagePushManager.SendMsgByBuyerCodes(new string[] { code }, (Common.Enums.EnumPushCommands)(inputCommand.ToInt // ()), inputContent, true); // Console.WriteLine("消息已发送"); //} //while (true) //{ // Console.WriteLine("请输入Token:"); // string token = Console.ReadLine(); // MemAuthInfoStroage mi = new MemAuthInfoStroage(); // var u = mi.GetUserByToken(token); // Console.WriteLine(u.ToJson()); //} #endregion }