private void OnElapsedTime(object source, ElapsedEventArgs e) { LOG.Log(Environment.NewLine + "> Service RECALLED at " + DateTime.Now); if (!starting) { List <TaskScheduleModel> tasks = TaskManagerService.GetPendingTasks(); LOG.Log($">> Pending Tasks: {tasks.Count()} at " + DateTime.Now); foreach (TaskScheduleModel task in tasks) { LOG.Log($">> Processing Task: {task.Description} at " + DateTime.Now); bool taskResult = RunTask(task); LOG.Log($">> Processed Task: {task.Description} at " + DateTime.Now); if (taskResult) { TaskManagerService.RemoveTask(task.TaskId); LOG.Log($">> Removed Task: {task.Description} at " + DateTime.Now); } else { TaskManagerService.MarkAsPendingTask(task.TaskId, 555); LOG.Log($">> Pending Task: {task.Description} at " + DateTime.Now); } } } else { LOG.Log("===> Service STARTED at " + DateTime.Now); starting = false; } LOG.Log("< Service ENDED at " + DateTime.Now); }
protected ClassConverter( string relativePath, string sourceProjectPath, SemanticModel sourceFileSemanticModel, TypeDeclarationSyntax originalDeclarationSyntax, INamedTypeSymbol originalClassSymbol, TaskManagerService taskManager) { _relativePath = relativePath; _sourceProjectPath = sourceProjectPath; _fullPath = Path.Combine(sourceProjectPath, relativePath); _sourceFileSemanticModel = sourceFileSemanticModel; _originalDeclarationSyntax = originalDeclarationSyntax; _originalClassSymbol = originalClassSymbol; _taskManager = taskManager; // We want to force the use of the task manager even if each class doesn't // necessarily have to do any managed runs, this is because they may end up // unblocking other processes by simply running normally _taskId = _taskManager.RegisterNewTask(); LogHelper.LogInformation(string.Format( Constants.RegisteredAsTaskLogTemplate, GetType().Name, OriginalClassName, _fullPath, _taskId)); }
public override async Task UpdateHistoricalQuote(int stockID, DateTime from, DateTime to) { try { string EODapiToken = ConfigService.GetConfigs().Where(c => c.ConfigName == "EOD_APIToken").Select(c => c.ConfigValue).FirstOrDefault(); string quotesURL = ConfigService.GetConfigs().Where(c => c.ConfigName == "EOD_HistoricalQuotes_URL").Select(c => c.ConfigValue).FirstOrDefault(); StockModel stock = StockService.GetStocks().Where(s => s.Id == stockID).FirstOrDefault(); using (WebClient web = new WebClient()) { string jsonHistoricalData = await web.DownloadStringTaskAsync(String.Format(quotesURL, stock.symbol, from.ToString("yyyy-MM-dd"), to.ToString("yyyy-MM-dd"), EODapiToken)); List <jsonmdlEODHistorical> data = JsonConvert.DeserializeObject <List <jsonmdlEODHistorical> >(jsonHistoricalData); List <HistoricalQuoteEOD> historicalQuotes = data.Select(h => new HistoricalQuoteEOD() { adj_close = h.AdjustedClose, closing = h.Close, date_round = h.Date, maximun = h.High, minimun = h.Low, opening = h.Open, stock_id = stockID, volume = h.Volume }).ToList <HistoricalQuoteEOD>(); QuotesService.SaveHistoricalQuote(historicalQuotes.ToList <IHistoricalQuote>()); } } catch (Exception ex) { //TODO - Log error TaskManagerService.LogTaskError("EODQuotesProvider - UpdateHistoricalQuote", ex.Message); } }
public IHttpActionResult GetAllTask() { service = new TaskManagerService(); List <Task> tasks = service.GetAllTask(); return(Ok(tasks)); }
public IHttpActionResult GetParentTask() { service = new TaskManagerService(); List <DropDown> DD = service.GetAllParent(); return(Ok(DD)); }
public IHttpActionResult GetAllTaskBySearch(SearchTask Search) { service = new TaskManagerService(); List <Task> tasks = service.GetAllTaskBySearchCriteria(Search); return(Ok(tasks)); }
public async Task <string> ScheduleIntradiaryUpdate(string taskType, DateTime nextTime) { TaskManagerService.LogTaskError($"{taskType}_RunIntradiaryUpdate", DateTime.Now.ToString()); QuotesProvider quotesProvider = null; TaskScheduleType taskScheduleType = (TaskScheduleType)Enum.Parse(typeof(TaskScheduleType), taskType); switch (taskScheduleType) { case TaskScheduleType.UpdateIntradiaryBOLSAR: quotesProvider = new BOLSARQuotesProvider(); break; case TaskScheduleType.UpdateIntradiaryBOLSARINDEX: quotesProvider = new BOLSARINDEXQuotesProvider(); break; case TaskScheduleType.UpdateIntradiaryEOD: quotesProvider = new EODQuotesProvider(); break; } if (quotesProvider != null) { string jsonQuotes = await quotesProvider.GetQuotesFromExternalInJsonFormatAsync(); TaskManagerService.ScheduleTask(taskScheduleType, jsonQuotes, nextTime); } return(taskType + " Schedulled"); }
public string ScheduleTenantTypeExpirationValidation(string taskType) { TaskScheduleType task = (TaskScheduleType)Enum.Parse(typeof(TaskScheduleType), taskType); TaskManagerService.ScheduleTask(task, "", DateTime.Now); return(taskType + " Schedulled"); }
public string ScheduleDeleteIntradiary(string taskType) { TaskScheduleType task = (TaskScheduleType)Enum.Parse(typeof(TaskScheduleType), taskType); TaskManagerService.ScheduleTask(task, "", DateTime.Now); return(taskType + " Schedulled"); }
public string ScheduleDailyReportUpdate(string taskType) { TaskScheduleType task = (TaskScheduleType)Enum.Parse(typeof(TaskScheduleType), taskType); TaskManagerService.ScheduleTask(task, "", DateTime.Now); return(taskType + " Schedulled"); }
/// <summary> /// 注册 /// </summary> public void register() { new driverService().Register(); new MessgeService().Register(); new orderService().Register(); var ws = UseSocket.CreateSocket(); ws.Message = (username, message) => { var request = Newtonsoft.Json.JsonConvert.DeserializeObject <Request>(message); request.Head.Add("wxcount", username); if (request.ClientType.Other.Equals("uploadLocation")) { request.AddService = () => { IDbConnection con = new MySqlConnection(this.Configuration["mysql"]); var driverState = con.ExecuteScalar <long>("select count(1) from orders where driverid=" + request.Head["KeyID"] + " and state=2"); return(driverState.ToString()); } } ; var result = Hup.CreateMsg.Run(request); }; } void outTimeOrders() { var t = Startup.GlobConfiguration["mysql"]; IDbConnection db = new MySql.Data.MySqlClient.MySqlConnection(this.Configuration["mysql"]); db.Open(); JObject obj = new JObject(); obj.Add("state", 3); var lists = db.Query <orders>("select * from orders where state='0' "); TaskManagerService tak = TaskManagerService.Factory(); TokenService token = new TokenService(this.Configuration["appsecret"], this.Configuration["AppID"]); foreach (var key in lists) { Task.Run(async() => { await tak.AutoRun(key.StartTime, keys => { IDbConnection _db = new MySql.Data.MySqlClient.MySqlConnection(this.Configuration["mysql"]); JObject js = JObject.Parse(key.ordersInfo); string sql = uilt.uiltT.Update(obj, "orders", " where id='" + key.id + "' "); _db.Execute(sql); uilt.uiltT.SendWxMessage(token, "您的订单从" + js["startingPoint"] + "到" + js["endingPoint"] + "的 行程,由于长时间没有司机接单已经超时,请重新创建行程。", js["openid"].ToString()); _db.Close(); return(Task.CompletedTask); }); }); } db.Close(); } }
public ActionResult AddEditTask(int id) { var model = new EditTaskViewModel(); model.Task = TaskManagerService.FindTaskModel(id, CurrentCompany, CurrentUser, true); prepareEditModel(model); model.LGS = TaskManagerService.LockTask(model.Task); return(View("AddEditTask", model)); }
public IHttpActionResult GetTaskById(int Id) { service = new TaskManagerService(); Task task = service.GetTaskByID(Id); if (task == null) { return(NotFound()); } return(Ok(task)); }
public int payOrder(string sing) { if (ActionList.ContainsKey(sing)) { ActionList[sing](); ActionList.Remove(sing); TaskManagerService.Factory().deleteJob(sing); return(1); } return(0); }
public bool Put(int id, [FromBody] JObject value, string openid = null) { if (value["state"] != null) { TaskManagerService.Factory().deleteJob("task" + id); } if (value["state"].ToString() == "2") { Task.Run(async() => { string wxcount = HttpContext.Session.GetString("openid"); if (driverService.driverinfo.ContainsKey(wxcount)) { driverService.driverinfo[wxcount].status = 0; } await TaskManagerService.Factory().AutoRun(DateTime.Now.AddMinutes(5), key => { _list.Remove(id.ToString()); return(Task.CompletedTask); }); }); } if (value["state"].ToString() == "-1" && _list.Contains(id.ToString())) { return(false); } if (value["state"].ToString() == "-1") { var order = Get(id); var info = order.ordersInfo; if (!string.IsNullOrEmpty(info)) { string wxcount = HttpContext.Session.GetString("openid"); if (driverService.driverinfo.ContainsKey(wxcount)) { driverService.driverinfo[wxcount].status = 1; } else { var obj = JObject.Parse(info); var driver = this.Uc.readById(obj["userid"].ToString()); if (driverService.driverinfo.ContainsKey(wxcount)) { driverService.driverinfo[wxcount].status = 1; } } } } int n = this.db.Execute(uiltT.Update(value, "orders", "where id=" + id)); return(n > 0 ? true : false); }
public ViewFileConverter( string sourceProjectPath, string fullPath, ViewImportService viewImportService, TaskManagerService taskManagerService, WebFormMetricContext metricsContext) : base(sourceProjectPath, fullPath, taskManagerService) { _viewImportService = viewImportService; _controlActions = new List <ControlConversionAction>(); _metricsContext = metricsContext; }
public IHttpActionResult DeleteTask(int Id) { try { service = new TaskManagerService(); service.DeleteTask(Id); return(Ok("Success")); } catch (Exception) { return(Ok("Error")); } }
public IHttpActionResult EndTask(int ID) { try { service = new TaskManagerService(); service.EndTask(ID, "EndTask"); return(Ok()); } catch (Exception) { return(Ok("Error")); } }
public ClassConverterFactory(string sourceProjectPath, LifecycleManagerService lcManager, TaskManagerService taskManager, WebFormMetricContext metricsContext) { _sourceProjectPath = sourceProjectPath; _lifecycleManager = lcManager; _taskManager = taskManager; _metricsContext = metricsContext; // TODO: Receive services required for ClassConverters // via constructor parameters }
public PageCodeBehindClassConverter( string relativePath, string sourceProjectPath, SemanticModel sourceFileSemanticModel, TypeDeclarationSyntax originalDeclarationSyntax, INamedTypeSymbol originalClassSymbol, TaskManagerService taskManager, WebFormMetricContext metricsContext) : base(relativePath, sourceProjectPath, sourceFileSemanticModel, originalDeclarationSyntax, originalClassSymbol, taskManager) { _newLifecycleLines = new Dictionary <BlazorComponentLifecycleEvent, IEnumerable <StatementSyntax> >(); _metricsContext = metricsContext; }
public ControlCodeBehindClassConverter( string relativePath, string sourceProjectPath, SemanticModel sourceFileSemanticModel, TypeDeclarationSyntax originalDeclarationSyntax, INamedTypeSymbol originalClassSymbol, TaskManagerService taskManager, WebFormMetricContext metricsContext) : base(relativePath, sourceProjectPath, sourceFileSemanticModel, originalDeclarationSyntax, originalClassSymbol, taskManager) { _metricsContext = metricsContext; // TODO: Register with the necessary services }
public ActionResult Delete(int index, int id) { var model = new TaskListModel(); model.GridIndex = index; try { TaskManagerService.DeleteTask(id); } catch (Exception e1) { model.Error.Icon = ErrorIcon.Error; model.Error.Message = "Error: " + e1.Message; } return(Json(model, JsonRequestBehavior.AllowGet)); }
public override Tuple <List <IRealTimeQuote>, List <IHistoricalQuote> > GetQuotesFromJson(string json) { try { int utc_offset = ConfigService.GetConfigs().Where(c => c.ConfigName == "ARG_UTCOffset").Select(c => int.Parse(c.ConfigValue)).FirstOrDefault(); DateTime date = DateTime.UtcNow.AddHours(utc_offset); Dictionary <string, int> symbols = StockService.GetStocks().Where(s => s.market_id == 1 && s.active).ToDictionary(s => s.symbol, s => s.Id); List <jsonmdlBOLSARRealTime> data = JsonConvert.DeserializeObject <List <jsonmdlBOLSARRealTime> >(json).Where(x => x.Vencimiento == "48hs" && symbols.ContainsKey(x.Simbolo)).ToList(); //INTRADIARY DATA List <IRealTimeQuote> realTimeQuotes = data.Select(rt => new RealTimeQuoteBOLSAR() { ask = rt.PrecioVenta, ask_size = rt.CantidadNominalVenta, bid = rt.PrecioCompra, bid_size = rt.CantidadNominalCompra, change = rt.Tendencia, change_percent = rt.Variacion, datetime = date, last_trade_date = DateTime.Now, last_trade_price = rt.Ultimo, last_trade_size = 0, last_trade_time = "", opening = rt.Ultimo, prev_closing = rt.CierreAnterior, stock_id = symbols[rt.Simbolo] }).ToList <IRealTimeQuote>(); //HISTORICAL DATA List <IHistoricalQuote> historicalQuotes = data.Select(h => new HistoricalQuoteBOLSAR() { adj_close = 0, closing = h.Ultimo, date_round = date, maximun = h.Maximo, minimun = h.Minimo, opening = h.Apertura, stock_id = symbols[h.Simbolo], volume = h.VolumenNominal }).ToList <IHistoricalQuote>(); return(new Tuple <List <IRealTimeQuote>, List <IHistoricalQuote> >(realTimeQuotes, historicalQuotes)); } catch (Exception ex) { //TODO - Log error TaskManagerService.LogTaskError("ERROR => BOLSARQuotesProvider - GetQuotesFromJson", ex.Message); return(null); } }
public override Tuple <List <IRealTimeQuote>, List <IHistoricalQuote> > GetQuotesFromJson(string json) { try { int utc_offset = ConfigService.GetConfigs().Where(c => c.ConfigName == "USA_UTCOffset").Select(c => int.Parse(c.ConfigValue)).FirstOrDefault(); DateTime date = DateTime.UtcNow.AddHours(utc_offset); Dictionary <string, int> symbols = StockService.GetStocks().Where(s => (s.market_id == 2 || s.market_id == 3) && s.active).ToDictionary(s => s.symbol + ".US", s => s.Id); IEnumerable <jsonmdlEODRealTime> data = JsonConvert.DeserializeObject <List <jsonmdlEODRealTime> >(json).Where(rt => symbols.ContainsKey(rt.Code)); //INTRADIARY DATA List <IRealTimeQuote> realTimeQuotes = data.Select(rt => new RealTimeQuoteEOD() { ask = 0, ask_size = 0, bid = 0, bid_size = 0, change = 0, change_percent = rt.Change, datetime = date, last_trade_date = DateTime.Now, last_trade_price = rt.Close, last_trade_size = 0, last_trade_time = "", opening = rt.Close, prev_closing = rt.PreviousClose, stock_id = symbols[rt.Code] }).ToList <IRealTimeQuote>(); //HISTORICAL DATA List <IHistoricalQuote> historicalQuotes = data.Select(h => new HistoricalQuoteEOD() { adj_close = 0, closing = h.Close, date_round = date, maximun = Math.Max(h.Close, h.Open), minimun = Math.Min(h.Close, h.Open), opening = h.Open, stock_id = symbols[h.Code], volume = h.Volume }).ToList <IHistoricalQuote>(); return(new Tuple <List <IRealTimeQuote>, List <IHistoricalQuote> >(realTimeQuotes, historicalQuotes)); } catch (Exception ex) { //TODO - Log error TaskManagerService.LogTaskError("EODQuotesProvider - GetQuotesFromJson", ex.Message); return(null); } }
public bool meetOrder(int id, [FromBody] JObject value) { lock (this) { string wxcount = HttpContext.Session.GetString("openid"); long t = (long)this.db.ExecuteScalar("select count(1) from orders where id=" + id + " and state =0"); if (t == 0) { return(false); } int n = this.db.Execute(uiltT.Update(value, "orders", "where id=" + id)); TaskManagerService.Factory().deleteJob("task" + id); return(n > 0 ? true : false); } }
public ProjectFileConverter( string sourceProjectPath, string fullPath, WorkspaceManagerService blazorWorkspaceManager, ProjectAnalyzer projectAnalyzer, TaskManagerService taskManagerService, WebFormMetricContext metricsContext ) : base(sourceProjectPath, fullPath, taskManagerService) { _blazorWorkspaceManager = blazorWorkspaceManager; _projectAnalyzer = projectAnalyzer; _metricsContext = metricsContext; _blazorWorkspaceManager.NotifyNewExpectedProject(); }
public HttpHandlerClassConverter( string relativePath, string sourceProjectPath, SemanticModel sourceFileSemanticModel, TypeDeclarationSyntax originalDeclarationSyntax, INamedTypeSymbol originalClassSymbol, LifecycleManagerService lifecycleManager, TaskManagerService taskManager, WebFormMetricContext metricsContext) : base(relativePath, sourceProjectPath, sourceFileSemanticModel, originalDeclarationSyntax, originalClassSymbol, taskManager) { _lifecycleManager = lifecycleManager; _lifecycleManager.NotifyExpectedMiddlewareSource(); _metricsContext = metricsContext; }
public IHttpActionResult UpdateTask(Task editTask) { try { if (!ModelState.IsValid) { return(BadRequest()); } service = new TaskManagerService(); service.EditTask(editTask); return(Ok("Success")); } catch (Exception) { return(Ok("Error")); } }
public override async void UpdateAuthToken() { try { /*BOLSAR_Quotes_LoginURL * homologacion => https://hs-wss-bolsar-bcba.sba.com.ar/Seguridad.svc/sg?us={0}&tk={1} * Production => https://wss-bolsar.bcba.sba.com.ar/Seguridad.svc/sg?us={0}&tk={1} */ string loginURL = ConfigService.GetConfig("BOLSAR_Quotes_LoginURL").ConfigValue; /*BOLSAR_Quotes_Username * homologacion => grau * Production => grauwss */ string username = ConfigService.GetConfig("BOLSAR_Quotes_Username").ConfigValue; /*BOLSAR_Quotes_Password * homologacion => 53bpueDi * Production => i76sljJs */ string password = ConfigService.GetConfig("BOLSAR_Quotes_Password").ConfigValue; string requestURL = String.Format(loginURL, username, ComputeHash(password)); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(requestURL); HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync(); using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { var strResponse = reader.ReadToEnd(); dynamic result = JsonConvert.DeserializeObject <dynamic>(strResponse); ConfigModel current_auth_token = ConfigService.GetConfig("BOLSAR_Auth_Token"); current_auth_token.ConfigValue = result.Resultado; ConfigService.UpdateConfig(current_auth_token); } } } catch (Exception ex) { //TODO - Log error TaskManagerService.LogTaskError("ERROR => BOLSARQuotesProvider - UpdateAuthToken", ex.Message); } }
public ActionResult DoAddTask(EditTaskViewModel model, string command) { prepareEditModel(model); if (command == "additem" || command == "complete") { if (ModelState.IsValid) { if (command == "complete") { model.Task.CompletedById = CurrentUser.Id; model.Task.CompletionDate = DateTimeOffset.Now; var status = LookupService.FindLOVItemsModel(CurrentCompany, LOVName.TaskStatus) .Where(s => s.ItemText == "Completed" || s.ItemText == "Actioned" || s.ItemText == "Completed/Actioned") .FirstOrDefault(); if (status != null) { model.Task.StatusId = status.Id; } } var error = TaskManagerService.InsertOrUpdateTask(model.Task, model.LGS); if (error.IsError) { ModelState.AddModelError("Task_" + error.FieldName, error.Message); } else if (model.Followup.AddFollowup) { var followupTask = TaskManagerService.MapToModel(model.Task); followupTask.Id = 0; followupTask.CreatedDate = DateTime.Now; followupTask.DueDate = model.Followup.FollowupDate; followupTask.Title = ("Follow-up: " + model.Task.Title).ShrinkString(128); followupTask.Description = model.Followup.FollowupNote; error = TaskManagerService.InsertOrUpdateTask(followupTask, ""); if (error.IsError) { ModelState.AddModelError("Task_" + error.FieldName, error.Message); } } } } return(View("AddEditTask", model)); }