public void Run(JobContext context) { var activeCallLogList = CallLogService.GetActiveCallLogList(); if (null != activeCallLogList && activeCallLogList.Count > 0) { int processedCount = 0; foreach (var logInfo in activeCallLogList) { var serviceConfig = CallServicesConfigManager.ServicesConfigList.SingleOrDefault(x => x.ServiceName.ToLower() == logInfo.MethodName.ToLower()); if (logInfo.RetryCount >= Convert.ToInt32(ConfigurationManager.AppSettings["MaxRetryCount"])) { continue; } //ThreadStart thread = new ThreadStart(() => //{ CallServiceManager serviceMgr = new CallServiceManager(logInfo, serviceConfig); serviceMgr.CallServiceFinished += serviceMgr_CallServiceFinished; serviceMgr.Do(); //}); //Thread thr = new Thread(thread); //thr.Start(); processedCount++; } Console.WriteLine("成功处理了{0}个请求.", processedCount); } }
public async Task <List <Ticket_CallLogDTO> > SingleListCallLog([FromBody] Ticket_CallLogFilterDTO Ticket_CallLogFilterDTO) { if (!ModelState.IsValid) { throw new BindException(ModelState); } CallLogFilter CallLogFilter = new CallLogFilter(); CallLogFilter.Skip = 0; CallLogFilter.Take = 20; CallLogFilter.OrderBy = CallLogOrder.Id; CallLogFilter.OrderType = OrderType.ASC; CallLogFilter.Selects = CallLogSelect.ALL; CallLogFilter.Id = Ticket_CallLogFilterDTO.Id; CallLogFilter.EntityReferenceId = Ticket_CallLogFilterDTO.EntityReferenceId; CallLogFilter.CallTypeId = Ticket_CallLogFilterDTO.CallTypeId; CallLogFilter.CallEmotionId = Ticket_CallLogFilterDTO.CallEmotionId; CallLogFilter.AppUserId = Ticket_CallLogFilterDTO.AppUserId; CallLogFilter.Title = Ticket_CallLogFilterDTO.Title; CallLogFilter.Content = Ticket_CallLogFilterDTO.Content; CallLogFilter.Phone = Ticket_CallLogFilterDTO.Phone; CallLogFilter.CallTime = Ticket_CallLogFilterDTO.CallTime; List <CallLog> CallLogs = await CallLogService.List(CallLogFilter); List <Ticket_CallLogDTO> Ticket_CallLogDTOs = CallLogs .Select(x => new Ticket_CallLogDTO(x)).ToList(); return(Ticket_CallLogDTOs); }
static void serviceMgr_CallServiceFinished(object sender, CallServiceCompletedEventArgs e) { CallLogService.UpdateCallLogResult( e.LogInfo.SysNo , e.IsSuccess , e.ResponseMessage , e.CallTime , e.CostMillionSeconds , e.IsSuccess ? CallLogStatus.Deactive : CallLogStatus.Active , e.LogInfo.RetryCount + 1); }
public async Task <ActionResult <Contact_CallLogDTO> > GetCallLog([FromBody] Contact_CallLogDTO Contact_CallLogDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } CallLog CallLog = await CallLogService.Get(Contact_CallLogDTO.Id); return(new Contact_CallLogDTO(CallLog)); }
public async Task <ActionResult <int> > CountCallLog([FromBody] Contact_CallLogFilterDTO Contact_CallLogFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } CallLogFilter CallLogFilter = ConvertFilterCallLog(Contact_CallLogFilterDTO); CallLogFilter = await CallLogService.ToFilter(CallLogFilter); int count = await CallLogService.Count(CallLogFilter); return(count); }
private static void Main(string[] args) { string username = ""; string password = ""; string accountId = ""; Task.Run(async() => { RingbaApiRequester client = await RingbaApiRequester.LoginAsync(username, password, accountId); var service = new CallLogService(client); foreach (var record in (await service.GetCallLogsAsync(DateTime.Now, 500)).Where(r => r.IsLive)) { Console.WriteLine($"{record.Id}\t{record.CallerId}\t{record.DialedNumber}\t{record.TargetNumber}"); } }).Wait(); }
public async Task <ActionResult <List <Contact_CallLogDTO> > > ListCallLog([FromBody] Contact_CallLogFilterDTO Contact_CallLogFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } CallLogFilter CallLogFilter = ConvertFilterCallLog(Contact_CallLogFilterDTO); CallLogFilter = await CallLogService.ToFilter(CallLogFilter); List <CallLog> CallLogs = await CallLogService.List(CallLogFilter); List <Contact_CallLogDTO> Contact_CallLogDTOs = CallLogs .Select(c => new Contact_CallLogDTO(c)).ToList(); return(Contact_CallLogDTOs); }
public void SetUp() { repository = Substitute.For <IRepository <CallRecord> >(); service = new CallLogService(repository); }
public Recent() { InitializeComponent(); callLogService = CallLogService.Instance; }
public CallLogController() { callLogService = new CallLogService(new HomeworkHotlineEntities()); }