// TODO public void RemoveQuestion(string id, string bankname) { // Find history by id QuestionHistory history = Histories.Find(his => his.Id == id); Debug.Log(JsonConvert.SerializeObject(history, Formatting.Indented)); // Modify the memory strength and date history.LastAttemptDate = DateTime.Now.AddDays(Properties.Instance.ADD_DAYS).ToShortDateString().ToString(); if (history.LastIsCorrect) { history.MemoryStrength += 2; } else { history.LastIsCorrect = true; history.MemoryStrength++; } // Update to db fb.UpdateHistory(Username, bankname, history); // TODO change to generic bankname // Remove from history list Histories.Remove(history); }
public void NodeTransit(string currentnode) { var node = Process.Nodes.FirstOrDefault(s => s.Name == currentnode); if (node is null) { throw new NullReferenceException(nameof(node)); } List <string> incompleted = new List <string>(); foreach (var item in CurrentNode.Activities) { if (!item.IsRequired) { continue; } if (Histories.FirstOrDefault(e => e.Activity.Name.Equals(item.Name) && e.IsCompleted == true) is null) { incompleted.Add(item.Name); } } if (incompleted.Count > 0) { throw new Exception($"you must complete all activities [{string.Join(", ", incompleted)}] before submit this action"); } if (CurrentState.StateType == StateType.end) { return; } CurrentNode = Process.NodeTransitFrom(node.Name); }
public override void OnNavigatedTo(INavigationParameters parameters) { if (RefreshCommand.CanExecute(null)) { RefreshCommand.Execute(null); } Observable.FromEventPattern <WatchHistoryRemovedEventArgs>( h => _watchHistoryManager.WatchHistoryRemoved += h, h => _watchHistoryManager.WatchHistoryRemoved -= h ) .Subscribe(e => { var args = e.EventArgs; var removedItem = Histories.FirstOrDefault(x => x.VideoId == args.VideoId); if (removedItem != null) { Histories.Remove(removedItem); } }) .AddTo(_CompositeDisposable); Observable.FromEventPattern( h => _watchHistoryManager.WatchHistoryAllRemoved += h, h => _watchHistoryManager.WatchHistoryAllRemoved -= h ) .Subscribe(_ => { Histories.Clear(); }) .AddTo(_CompositeDisposable); base.OnNavigatedTo(parameters); }
public async void CompleteTask(Task task, bool autoadvancetonextstate = false) { if (task is null) { throw new NullReferenceException(nameof(task)); } // var data = Data.FirstOrDefault(e => e.Activity.Name == task.Activity.Name && e.Activity.ActivityType == task.Activity.ActivityType); // if (data != null) // { // task.Activity.DoActivityThings(data); // } //check deadline task.IsDone = true; var temp = Tasks.FirstOrDefault(t => t.Id == task.Id); if (temp is null) { throw new NullReferenceException(nameof(temp)); } temp.IsDone = true; if (Histories is null) { Histories = new List <ActivityLog>(); } Histories.Add(new ActivityLog { Activity = temp.Activity, IsCompleted = true, User = "" }); if (autoadvancetonextstate) { TryTransitToNextState(); } }
private void SerializeSchemesHistory() { var histories = new Histories { AllHistories = History }; var historyFile = Path.Combine(HistoryDataPath, HistoryCacheFile); try { using (var fileStream = new FileStream(historyFile, FileMode.Create)) { var xmlSerializer = new XmlSerializer(typeof(Histories)); xmlSerializer.Serialize(fileStream, histories); } } catch (InvalidOperationException) { File.Delete(historyFile); } catch (XmlException) { File.Delete(historyFile); } }
async Task ExecuteSearchCommand() { if (!IsBusy) { try { IsBusy = true; var(chart, info) = await ChartApi.Current.GetChart(Airport); var item = new AiportHistory { Icao = Airport }; if (VerifyRepeated()) { BdService.Current.SaveItem(item); Histories.Add(item); } await Navigation.PushAsync <ListFlyChartsViewModel>(false, info, chart); } catch (Exception ex) { await DisplayAlert("Erro", $"Erro:{ex.Message}", "Ok"); } finally { IsBusy = false; } } return; }
private void SetFromHistory(int idxOffset) { var line = ""; if (idxOffset > 0) { for (int i = 0; i < idxOffset; i++) { line = Histories.Next(); } } else { for (int i = 0; i > idxOffset; i--) { line = Histories.Previous(); } } if (string.IsNullOrWhiteSpace(line)) { return; } Clear(); _currentIdx = line.Length; AddKey(line); }
private void WriteToDBByScannedResult(IDictionary <LibraryItemEntity, IList <DirectoryInfo> > result) { IList <HistoryEntity> addHistoryList = new List <HistoryEntity>(); IList <HistoryEntity> removeHistoryList = new List <HistoryEntity>(); IList <DirectoryInfo> scannedResult = new List <DirectoryInfo>(); foreach (KeyValuePair <LibraryItemEntity, IList <DirectoryInfo> > pair in result) { foreach (DirectoryInfo scannedItem in pair.Value) { string defaultCategoryName = scannedItem.Parent.Name; CategoryEntity category = Categories.FirstOrDefault(item => 0 == string.Compare(defaultCategoryName, item.Name, true)); if (category.IsNull()) { category = new CategoryEntity() { ID = -1, Name = defaultCategoryName }; if (1 == DBHelper.AddCategories(new List <CategoryEntity>() { category })) { Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(() => { categories.Add(category); })); } } HistoryEntity history = new HistoryEntity() { IsDeleted = false, Name = scannedItem.Name, Path = scannedItem.FullName, Comment = string.Empty, LibraryID = pair.Key.ID }; if (!category.IsNull()) { history.CategoryIDs.Add(category.ID); } if (Histories.FirstOrDefault(item => 0 == string.Compare(item.Path, history.Path, true)).IsNull()) { addHistoryList.Add(history); } scannedResult.Add(scannedItem); } } DBHelper.AddHistoryItems(addHistoryList); foreach (HistoryEntity history in this.Histories) { //if (scannedResult.FirstOrDefault(item => 0 == string.Compare(item.FullName, history.Path, true)).IsNull()) // removeHistoryList.Add(history); if (!Directory.Exists(history.Path)) { removeHistoryList.Add(history); } } DBHelper.DeleteHistoryItems(removeHistoryList); }
public void DeleteHistories(Applicant applicant) { var histories = (from history in Histories where history.ApplicantId == applicant.ApplicantId select history); Histories.RemoveRange(histories); }
public CaseObject() { NewAttachments = new DataAttachments(); IsTIPResultReturned = false; CaseHistories = new Histories(); attachments = new DataAttachments(); m_WorkstationResult = null; AnalysisStartTime = DateTime.Now; }
/// <summary> /// 发送了一次短信 /// </summary> public void Sent() { if (WhichDay != Today) { WhichDay = Today; ClearHistory(); } Histories.Add(DateTime.Now); }
public void ChangeVariable(String variable, int time) { VariableHistory variableHistory = Histories.Find(vh => vh.Variable == variable); if (variableHistory != null) { variableHistory.AddChange(time); } }
public void Played(IGame game, int score) { Histories.Add(new PlayerHistory() { PlayerId = Id, PuzzleGameId = game.Id, Score = score, }); }
/// <exception cref="InvalidCastException"><paramref /> cannot be cast to the element type of the current <see cref="T:System.Array" />.</exception> public override string ToString() { // loan StringBuilder sb = new StringBuilder().Append(PrintHeadersLine(typeof(NL_Loans))).Append(ToStringAsTable()).Append(Environment.NewLine); // freeze interest intervals if (FreezeInterestIntervals.Count > 0) { sb.Append("LoanInterestFreeze:") .Append(Environment.NewLine) .Append(PrintHeadersLine(typeof(NL_LoanInterestFreeze))); FreezeInterestIntervals.ForEach(s => sb.Append(s.ToString())); } //else sb.Append("No LoanInterestFreeze").Append(Environment.NewLine); if (LoanOptions.LoanOptionsID > 0) { sb.Append("LoanOptions:") .Append(Environment.NewLine) .Append(PrintHeadersLine(typeof(NL_LoanOptions))) .Append(LoanOptions.ToStringAsTable()); } //else sb.Append("No Loan options").Append(Environment.NewLine); // rollovers if (AcceptedRollovers.Count > 0) { sb.Append(Environment.NewLine) .Append("AcceptedRollovers:").Append(Environment.NewLine) .Append(PrintHeadersLine(typeof(NL_LoanRollovers))); AcceptedRollovers.ForEach(r => sb.Append(r.ToStringAsTable())); } //else sb.Append("No AcceptedRollovers").Append(Environment.NewLine); // fees if (Fees.Count > 0) { sb.Append(Environment.NewLine) .Append("Fees:").Append(Environment.NewLine) .Append(PrintHeadersLine(typeof(NL_LoanFees))); Fees.ForEach(s => sb.Append(s.ToStringAsTable())); } //else sb.Append("No Fees").Append(Environment.NewLine); // histories if (Histories != null) { sb.Append(Environment.NewLine) .Append("Histories:").Append(Environment.NewLine); Histories.ForEach(h => sb.Append(h.ToString())); } // else sb.Append("No Histories").Append(Environment.NewLine); // payments if (Payments.Count > 0) { sb.Append("Payments:"); Payments.ForEach(p => sb.Append(p.ToString())); } // else sb.Append("No Payments").Append(Environment.NewLine); return(sb.ToString()); }
public bool HadHistoryChanged(string variable, int time) { VariableHistory history = Histories.Find(vh => vh.Variable == variable); if (history == null) { return(false); } return(history.History.Contains(time)); }
public void InsertHistory(History history, int index = 0) { Histories.Remove(Histories.Find(h => h.FullName == history.FullName)); Histories.Insert(index, history); if (Histories.Count > Properties.Settings.Default.HistoryMaxCount) { Histories.RemoveAt(Histories.Count - 1); } }
public static MemoryStream Translate (Histories histories) { XmlSerializer mySerializer = new XmlSerializer(typeof(Histories)); MemoryStream strm = new MemoryStream(); mySerializer.Serialize(strm, histories); strm.Seek(0, SeekOrigin.Begin); return strm; }
public static MemoryStream Translate(Histories histories) { XmlSerializer mySerializer = new XmlSerializer(typeof(Histories)); MemoryStream strm = new MemoryStream(); mySerializer.Serialize(strm, histories); strm.Seek(0, SeekOrigin.Begin); return(strm); }
/// <summary> /// Start a new workflow /// </summary> /// <param name="json">The entire message body from the request</param> /// <returns></returns> public string StartWorkflow(string json) { // This presently uses the Event as the body of the start message because it's convenient // var workflowName = ""; var workflowVersion = ""; var executionId = Guid.NewGuid(); try { // Neither of these operation should ever fail as they cannot be conflicted var wfStartData = JsonConvert.DeserializeObject <WorkflowExecutionStartedEvent>(json); workflowName = wfStartData.WorkflowName; workflowVersion = wfStartData.WorkflowVersion; var wf = GetWorkflow(workflowName, workflowVersion); if (wf == null) { log.Error($"Unknown workflow definition - {workflowName} v {workflowVersion} "); throw new ApplicationException($"Unknown workflow definition - {workflowName} v {workflowVersion} "); } var wfDefinition = JsonConvert.DeserializeObject <WorkflowObj>(wf.Json); Executions.InsertOnSubmit(new Execution { ExecutionId = executionId, JobId = (string)wfStartData.Input.SelectToken("_jobId"), Workflow = wf, DecisionList = wfStartData.DecisionList ?? wfDefinition.DecisionList ?? "decider", ExecutionStartToCloseTimeout = (int?)(wfStartData.ExecutionStartToCloseTimeout ?? wfDefinition.DefaultExecutionStartToCloseTimeout), TaskStartToCloseTimeout = (int?)(wfStartData.TaskStartToCloseTimeout ?? wfDefinition.DefaultTaskStartToCloseTimeout), TaskScheduleToCloseTimeout = null, // What goes here? TaskScheduleToStartTimeout = null, // and here? HistorySeen = 0, AwaitingDecision = true, LastSeen = DateTime.UtcNow, ExecutionState = new ExecutionState { State = ExState.Running } }); wfStartData.ExecutionId = executionId; wfStartData.Id = 0; wfStartData.Timestamp = DateTime.UtcNow; Histories.InsertOnSubmit(wfStartData); SubmitChanges(ConflictMode.FailOnFirstConflict); } catch (ChangeConflictException ex) { log.Error("Failed to create new workflow execution", ex); throw new ApplicationException($"Failed to create new workflow execution - {workflowName} v {workflowVersion} "); } return(new JObject(new JProperty("executionId", executionId.ToString())).ToString(Formatting.None)); }
public virtual void Back(object obj) { var idx = int.Parse(obj.ToString()); for (int i = _histories.Count() - 1; i > idx; i--) { Histories.RemoveAt(i); } Depth = idx; ItemsSource = _histories.Last().Value; }
protected void AddToHistory(params IDownloadable[] downloadables) { foreach (var downloadable in downloadables) { Histories.Add(new MangaHistory(downloadable.Uri)); if (downloadable.DownloadedAt == null) { downloadable.DownloadedAt = DateTime.Now; } } }
public void DrillDown(object item) { var dataItem = item as Leaf; if (dataItem != null && dataItem.Items != null && dataItem.Items.Count() > 0) { Histories.Add(new KeyValuePair <string, Leaf[]>(dataItem.Type, dataItem.Items)); ItemsSource = dataItem.Items; Depth++; } }
private async void LoadedAction() { AppThemeService.LoadTheme(); var histories = await WorkTaskService.GetWorkTaskHistoriesAsync(); foreach (var history in histories) { Histories.AddOnScheduler(history); } }
private async void SaveAction() { IsBusy.Value = true; var result = await WorkTaskService.RegistWorkTaskAsync(Answer.Value); Answer.Value = string.Empty; Histories.Remove(result.Title); Histories.Insert(0, result.Title); IsBusy.Value = false; }
public override Task InitializeAsync(object[] args) { Histories.Clear(); var items = BdService.Current.GetItems <AiportHistory>(); foreach (var item in items) { Histories.Add(item); } return(base.InitializeAsync(args)); }
public string Create(Protocol protocol) { List <Histories> tempHist = new List <Histories>(); Histories histories = new Histories { UpdateDate = DateTime.Now.ToString("g"), Employee = protocol.Person.Name, //histories.EmployeeMail = protocol.Person.Contact.Email; Status = "Criado" }; tempHist.Add(histories); ServicoServices services = new ServicoServices { Name = protocol.Name, //Id = "3da85f34-5717-4562-b3fc-2c963f66afa6", Histories = tempHist, Date = DateTime.Now.ToString("g"), UpdateDate = DateTime.Now.ToString("g"), RequesterName = protocol.Person.Name, RequesterEmail = protocol.Person.Contact.Email, RequesterPhone = protocol.Person.Contact.Phone, Status = "Criado" }; var client = new HttpClient(); var json = JsonConvert.SerializeObject(services); JObject jObject = JObject.Parse(json); jObject.Property("Id").Remove(); json = jObject.ToString(); var projectJson = new StringContent( json, Encoding.UTF8, "application/json"); var response = client.PostAsync(Settings.HostApiGateWay + $"project", projectJson).Result; if (response.IsSuccessStatusCode) { var codigo = response.Content.ReadAsStringAsync().Result; return($"Protocolo Cadastrado: Código {codigo}"); } else { return($"Erro ao cadastrar protocolo. {response.ReasonPhrase}"); } }
public string Add(object action) { if (!Enabled) { return(string.Empty); } var history = new ActionHistory(action); Histories.Add(history); SendHistory?.Invoke(history); return(history.Id); }
public void Insert(int source, int destination, DateTime dateTime) { var newEntry = new History { Source = source, Destination = destination, Date = dateTime }; _db.Histories.InsertOnSubmit(newEntry); _db.SubmitChanges(); Histories.Add(newEntry); }
public async Task <bool> AddHistory(string userID, string userName, AppUser.History.Types typeid, string detail = default) { await Histories.AddAsync(new AppUser.History { UserID = userID, UserName = userName, Time = DateTime.Now, TypeID = typeid, Detail = detail }); return(true); }
public IMessage GetLastMessage(IMemberData currentChatMember) { if (currentChatMember == null || Histories.Count == 0) { return(null); } if (Histories.ContainsKey(currentChatMember.UID) && Histories[currentChatMember.UID].Count != 0) { decreaseMemberHistoryStatus(currentChatMember.UID); return(Histories[currentChatMember.UID].Dequeue()); } return(null); }
public void Reset(string id) { Checkout(id); foreach (var history in Histories.ToList()) { Commits.Remove(history); Histories.Remove(history); if (history.Equals(id)) { break; } } }
public static Histories Translate (DataAttachment dataAttachment) { Histories histories; XmlSerializer mySerializer = new XmlSerializer(typeof(Histories)); try { histories = (Histories)mySerializer.Deserialize(dataAttachment.attachmentData); } catch (Exception ex) { //TODO: Must be an old AnalysisHistory File, throw away and recreate a new one. histories = new Histories(); } return histories; }
public List<XRayImage> CreateImages (List<ViewObject> viewObjs, StatusBarItems statusBarItems, Histories histories, SysConfiguration SysConfig) { List<XRayImage> xrayImages = new List<XRayImage>(); string username = string.Empty; if (SysConfig.Profile != null) { username = SysConfig.Profile.UserName; } foreach (ViewObject viewObj in viewObjs) { int count = 0; try { if (viewObj.HighEnergy != null || viewObj.LowEnergy != null) { History history = histories.Find(viewObj.Name); if (history == null) { history = new History(); history.id = viewObj.Name; histories.History.Add(history); } if (SysConfig.Profile != null) { history.DefaultUser = SysConfig.Profile.UserName; } count++; XRayImage xrayImage = new XRayImage(viewObj, statusBarItems, history, SysConfig); xrayImage.AlgServerRequestEvent += new AlgServerRequestEventHandler(xrayImage_AlgServerRequestEvent); xrayImages.Add(xrayImage); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } foreach (XRayImage xrayImage in xrayImages) { foreach (XRayImage otherxrayImage in xrayImages) { if (otherxrayImage != xrayImage) { xrayImage.PanZoom_MenuItem.Click += new RoutedEventHandler(otherxrayImage.PanZoom_MenuItem_Click); xrayImage.Annotation_MenuItem.Click += new RoutedEventHandler(otherxrayImage.Annotation_MenuItem_Click); xrayImage.Measurements_MenuItem.Click += new RoutedEventHandler(otherxrayImage.Measurements_MenuItem_Click); xrayImage.Magnifier_MenuItem.Click += new RoutedEventHandler(otherxrayImage.Magnifier_MenuItem_Click); xrayImage.AOI_MenuItem.Click += new RoutedEventHandler(otherxrayImage.AOI_MenuItem_Click); xrayImage.Annotation_Rectangle.Click += new RoutedEventHandler(otherxrayImage.Annotation_Rectangle_MenuItem_Click); xrayImage.Annotation_Ellipse.Click += new RoutedEventHandler(otherxrayImage.Annotation_Ellipse_MenuItem_Click); xrayImage.Annotation_Show.Click += new RoutedEventHandler(otherxrayImage.Annotation_Show_MenuItem_Click); xrayImage.Annotation_Hide.Click += new RoutedEventHandler(otherxrayImage.Annotation_Hide_MenuItem_Click); xrayImage.Measurement_Show.Click += new RoutedEventHandler(otherxrayImage.Measurement_Show_MenuItem_Click); xrayImage.Measurement_Hide.Click += new RoutedEventHandler(otherxrayImage.Measurement_Hide_MenuItem_Click); } } } return xrayImages; }
/// <summary> /// Create a new Histories object. /// </summary> /// <param name="history_ID">Initial value of History_ID.</param> public static Histories CreateHistories(int history_ID) { Histories histories = new Histories(); histories.History_ID = history_ID; return histories; }
/// <summary> /// There are no comments for Histories in the schema. /// </summary> public void AddToHistories(Histories histories) { base.AddObject("Histories", histories); }
public List<XRayImage> CreateImages (List<ViewObject> viewObjs, StatusBarItems statusBarItems, Histories histories, SysConfiguration SysConfig) { List<XRayImage> xrayImages = new List<XRayImage>(); string username = string.Empty; if (SysConfig.Profile != null) { username = SysConfig.Profile.UserName; } foreach (ViewObject viewObj in viewObjs) { int count = 0; try { if (viewObj.HighEnergy != null || viewObj.LowEnergy != null) { History history = histories.Find(viewObj.Name); if (history == null) { history = new History(); history.id = viewObj.Name; histories.History.Add(history); } if (SysConfig.Profile != null) { history.DefaultUser = SysConfig.Profile.UserName; } count++; XRayImage xrayImage = new XRayImage(viewObj, statusBarItems, history, SysConfig); xrayImages.Add(xrayImage); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } foreach (XRayImage xrayImage in xrayImages) { foreach (XRayImage otherxrayImage in xrayImages) { if (otherxrayImage != xrayImage) { xrayImage.PanZoom_MenuItem.Click += new RoutedEventHandler(otherxrayImage.PanZoom_MenuItem_Click); xrayImage.FragmentMark_MenuItem.Click += new RoutedEventHandler(otherxrayImage.FragmentMark_MenuItem_Click); xrayImage.FragmentRegisterView_Ellipse.Click += new RoutedEventHandler(otherxrayImage.FragmentRegisterView_Ellipse_MenuItem_Click); xrayImage.FragmentUniformity_MenuItem.Click += new RoutedEventHandler(otherxrayImage.FragmentUniformity_MenuItem_Click); xrayImage.CreateFramgmentMark_Ellipse.Click += new RoutedEventHandler(otherxrayImage.CreateFramgmentMark_Ellipse_MenuItem_Click); xrayImage.FragmentMarks_Hide.Click += new RoutedEventHandler(otherxrayImage.FragmentAddMarks_Hide_MenuItem_Click); xrayImage.FragmentMarks_Show.Click += new RoutedEventHandler(otherxrayImage.FragmentAddMarks_Show_MenuItem_Click); } } } return xrayImages; }