public CheckListCAPItem(AuditCheck currentAuditCheck, WorkFlowStatus workFlowStatus) { InitializeComponent(); _currentAuditCheck = currentAuditCheck; _workFlowStatus = workFlowStatus; UpdateInformation(); }
public WorkflowCommentsTrackingForm(AuditCheck auditCheck) { InitializeComponent(); _auditCheck = auditCheck; UpdateChat(); _animatedThreadWorker.DoWork += AnimatedThreadWorkerDoLoad; _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted; _animatedThreadWorker.RunWorkerAsync(); }
public WorkflowCommentsForm(AuditCheck auditCheck) { InitializeComponent(); _auditCheck = auditCheck; _stageId = _auditCheck.Settings.WorkflowStageId; UpdateChat(); _animatedThreadWorker.DoWork += AnimatedThreadWorkerDoLoad; _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted; _animatedThreadWorker.RunWorkerAsync(); }
private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e) { if (_currentCheck == null) { return; } _currentCheck = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CheckListDTO, CheckLists>(_currentCheck.ItemId); _currentCheck.EditionNumber = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CheckListRevisionDTO, CheckListRevision>(_currentCheck.EditionId)?.Number.ToString() ?? ""; if (_currentCheck.RevisionId.HasValue) { _currentCheck.RevisionNumber = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CheckListRevisionDTO, CheckListRevision>(_currentCheck.RevisionId.Value)?.Number.ToString() ?? ""; } _currentAuditCheck = GlobalObjects.CaaEnvironment.NewLoader.GetObject <AuditCheckDTO, AuditCheck>(new List <Filter>() { new Filter("AuditId", _auditId), new Filter("CheckListId", _currentCheck.ItemId), }); if (_currentAuditCheck == null) { _currentAuditCheck = new AuditCheck() { CheckListId = _currentCheck.ItemId, AuditId = _auditId }; GlobalObjects.CaaEnvironment.NewKeeper.Save(_currentAuditCheck); } var records = GlobalObjects.CaaEnvironment.NewLoader.GetObjectList <CheckListRecordDTO, CheckListRecords>( new Filter("CheckListId", _currentCheck.ItemId)); _currentCheck.CheckListRecords.Clear(); _currentCheck.CheckListRecords.AddRange(records); _currentCheck.Level = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <FindingLevelsDTO, FindingLevels>(_currentCheck.Settings.LevelId) ?? FindingLevels.Unknown; var record = GlobalObjects.CaaEnvironment.NewLoader.GetObjectList <AuditPelRecordDTO, AuditPelRecord>(new List <Filter>() { new Filter("AuditId", _auditId), new Filter("CheckListId", _currentAuditCheck.CheckListId), }); var pel = record.FirstOrDefault(); _auditor = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <PelSpecialistDTO, PelSpecialist>(pel.AuditorId); }
// constructor public Bank(string nameOfBank_, string nameOfAuditor_) { nameOfBank = nameOfBank_; auditor = new Auditor(nameOfAuditor_); unFairContractors = new List<Contractor>(); regularContractors = new List<Contractor>(); // processing a deal (first auditor checks it and then we add or remove a client from an appropriate list) // also we increment our expenses processDeal = (deal) => { bool isFair = auditor.checkDeal(deal); // auditor fee is 0.2% of a deal's sum moneyForAuditor += deal.money * 0.002; if (isFair == false) { if (regularContractors.Find(contr => contr.name == deal.contractor.name) != default(Contractor)) { regularContractors.Remove(deal.contractor); } unFairContractors.Add(deal.contractor); exposedUnfairDealsMoney += deal.money; } else { if (regularContractors.Find(contr => contr.name == deal.contractor.name) == default(Contractor)) { regularContractors.Add(deal.contractor); } } return isFair; }; }
private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e) { if (_currentCheck == null) { return; } if (_currentCheck.AuditCheck.Settings.WorkflowStatusId == WorkFlowStatus.Open.ItemId && _currentCheck.AuditCheck.Settings.WorkflowStageId == WorkFlowStage.View.ItemId) { if (_currentCheck.PelRecord?.Auditor.ItemId == GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId) { _currentCheck.AuditCheck.Settings.IsAuditorReview = true; GlobalObjects.CaaEnvironment.NewKeeper.Save(_currentCheck.AuditCheck); } else if (_currentCheck.PelRecord?.Auditee.ItemId == GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId) { _currentCheck.AuditCheck.Settings.IsAuditeeReview = true; GlobalObjects.CaaEnvironment.NewKeeper.Save(_currentCheck.AuditCheck); } if (_currentCheck.AuditCheck.Settings.IsAuditorReview.HasValue && _currentCheck.AuditCheck.Settings.IsAuditeeReview.HasValue && _currentCheck.AuditCheck.Settings.IsAuditorReview.Value && _currentCheck.AuditCheck.Settings.IsAuditeeReview.Value) { _currentCheck.AuditCheck.Settings.WorkflowStatusId = WorkFlowStatus.Review.ItemId; GlobalObjects.CaaEnvironment.NewKeeper.Save(_currentCheck.AuditCheck); } } _currentCheck = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CheckListDTO, CheckLists>(_currentCheck.ItemId); _currentCheck.EditionNumber = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CheckListRevisionDTO, CheckListRevision>(_currentCheck.EditionId)?.Number.ToString() ?? ""; if (_currentCheck.RevisionId.HasValue) { _currentCheck.RevisionNumber = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CheckListRevisionDTO, CheckListRevision>(_currentCheck.RevisionId.Value)?.Number.ToString() ?? ""; } _currentAuditCheck = GlobalObjects.CaaEnvironment.NewLoader.GetObject <AuditCheckDTO, AuditCheck>(new List <Filter>() { new Filter("AuditId", _auditId), new Filter("CheckListId", _currentCheck.ItemId), }); if (_currentAuditCheck == null) { _currentAuditCheck = new AuditCheck() { CheckListId = _currentCheck.ItemId, AuditId = _auditId }; GlobalObjects.CaaEnvironment.NewKeeper.Save(_currentAuditCheck); } if (_currentAuditCheck.ItemId > 0) { _currentAuditCheckRecords = new List <AuditCheckRecord>( GlobalObjects.CaaEnvironment.NewLoader.GetObjectList <AuditCheckRecordDTO, AuditCheckRecord>( new Filter("AuditRecordId", _currentAuditCheck.ItemId))); } else { _currentAuditCheckRecords = new List <AuditCheckRecord>(); } var records = GlobalObjects.CaaEnvironment.NewLoader.GetObjectList <CheckListRecordDTO, CheckListRecords>( new Filter("CheckListId", _currentCheck.ItemId)); foreach (var rec in records) { var find = _currentAuditCheckRecords.FirstOrDefault(i => i.CheckListRecordId == rec.ItemId); if (find == null) { var newRecord = new AuditCheckRecord() { CheckListRecordId = rec.ItemId, AuditRecordId = _currentAuditCheck.ItemId, CheckListRecord = rec }; GlobalObjects.CaaEnvironment.NewKeeper.Save(newRecord); _currentAuditCheckRecords.Add(newRecord); } else { find.CheckListRecord = rec; } } _currentCheck.CheckListRecords.Clear(); _currentCheck.CheckListRecords.AddRange(records); _currentCheck.Level = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <FindingLevelsDTO, FindingLevels>(_currentCheck.Settings.LevelId) ?? FindingLevels.Unknown; }
private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e) { if (_currentCheck == null) { return; } _fromList.Clear(); _toList.Clear(); _currentCheck = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CheckListDTO, CheckLists>(_currentCheck.ItemId); _currentCheck.EditionNumber = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CheckListRevisionDTO, CheckListRevision>(_currentCheck.EditionId)?.Number.ToString() ?? ""; if (_currentCheck.RevisionId.HasValue) { _currentCheck.RevisionNumber = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CheckListRevisionDTO, CheckListRevision>(_currentCheck.RevisionId.Value)?.Number.ToString() ?? ""; } _currentAuditCheck = GlobalObjects.CaaEnvironment.NewLoader.GetObject <AuditCheckDTO, AuditCheck>(new List <Filter>() { new Filter("AuditId", _auditId), new Filter("CheckListId", _currentCheck.ItemId), }); if (_currentAuditCheck == null) { _currentAuditCheck = new AuditCheck() { CheckListId = _currentCheck.ItemId, AuditId = _auditId }; GlobalObjects.CaaEnvironment.NewKeeper.Save(_currentAuditCheck); } var records = GlobalObjects.CaaEnvironment.NewLoader.GetObjectList <CheckListRecordDTO, CheckListRecords>( new Filter("CheckListId", _currentCheck.ItemId)); _currentCheck.CheckListRecords.Clear(); _currentCheck.CheckListRecords.AddRange(records); _currentCheck.Level = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <FindingLevelsDTO, FindingLevels>(_currentCheck.Settings.LevelId) ?? FindingLevels.Unknown; var record = GlobalObjects.CaaEnvironment.NewLoader.GetObjectList <AuditPelRecordDTO, AuditPelRecord>(new List <Filter>() { new Filter("AuditId", _auditId), new Filter("CheckListId", _currentAuditCheck.CheckListId), }); var pel = record.FirstOrDefault(); _auditor = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <PelSpecialistDTO, PelSpecialist>(pel.AuditorId); var audit = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CAAAuditDTO, CAAAudit>(_auditId); var roots = GlobalObjects.CaaEnvironment.NewLoader.GetObjectList <RootCauseDTO, RootCause>(new Filter("OperatorId", new List <int>() { audit.OperatorId, AllOperators.Unknown.ItemId })); foreach (var root in roots) { if ((bool)_currentAuditCheck.Settings.RootCauseIds?.Any(i => i == root.ItemId)) { _toList.Add(root); } else { _fromList.Add(root); } } }