private void UpdateInformation() { if (_currentItem == null) { return; } labelFirstNameValue.Text = _currentItem.FirstName; labelLastNameValue.Text = _currentItem.LastName; labelDateOfBirthValue.Text = Convert.GetDateFormat(_currentItem.DateOfBirth); labelSexValue.Text = _currentItem.Gender.ToString(); labelNationalityValue.Text = _currentItem.Citizenship.ToString(); labelAddressValue.Text = _currentItem.Address; labelInformationValue.Text = _currentItem.Information; labelFamilyStatusValue.Text = _currentItem.FamilyStatus.ToString(); labelOccupationValue.Text = _currentItem.Specialization.ToString(); labelEducationValue.Text = _currentItem.Education.ToString(); labelPositionValue.Text = _currentItem.Position.ToString(); labelLocationVAlue.Text = _currentItem.Facility.ToString(); labelStatusValue.Text = _currentItem.Status.ToString(); labelPhoneMobileValue.Text = _currentItem.PhoneMobile; labelPhoneValue.Text = _currentItem.Phone; labelEmailValue.Text = _currentItem.Email; labelSkypeValue.Text = _currentItem.Skype; _pictureBoxTransparentLogotype.BackgroundImage = _currentItem.PhotoImage; pictureBoxSign.BackgroundImage = _currentItem.SignImage; labelGradeValue.Text = _currentItem.GradeNumber.ToString(); labelClassValue.Text = _currentItem.ClassNumber.ToString(); var ratingString = ""; foreach (var license in _currentItem.Licenses) { if (license.LicenseRatings.Count == 0) { continue; } if (ratingString != "") { ratingString += " / "; } ratingString += license.AircraftType.ShortName; ratingString += "-"; foreach (var rating in license.LicenseRatings.GroupBy(r => r.LicenseFunction)) { ratingString += $"{rating.Key} ({string.Join(",", rating.Select(r => r.Rights.ShortName).ToArray())}) "; } } labelRightVAlue.Text = ratingString; }
/// <summary> /// Происзодит обновление отображения элементов /// </summary> private void UpdateInformation() { if (CurrentAircraft != null) { labelTitle.Text = "Date as of: " + Convert.GetDateFormat(DateTime.Today) + " Aircraft TSN/CSN: " + GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft); } else { labelTitle.Text = ""; labelTitle.Status = Statuses.NotActive; } AnimatedThreadWorker.RunWorkerAsync(); }
protected override List <CustomCell> GetListViewSubItems(MailChats item) { var operatorName = GlobalObjects.CasEnvironment.Operators[0].Name; var from = item.SupplierFrom != Supplier.Unknown ? item.SupplierFrom.ToString() : operatorName; var to = item.SupplierTo != Supplier.Unknown ? item.SupplierTo.ToString() : operatorName; var author = GlobalObjects.CasEnvironment.GetCorrector(item); var fromTo = $"{from} - {to}"; return(new List <CustomCell> { CreateRow(fromTo, fromTo), CreateRow(item.Description, item.Description), CreateRow(Convert.GetDateFormat(item.CreateDate), item.CreateDate), CreateRow(author, author) }); }
protected override List <CustomCell> GetListViewSubItems(MailRecords item) { var subItems = new List <CustomCell>(); var status = item.IsClosed ? "Closed" : "Open"; var parformUpToDate = item.PerformeUpTo ? Convert.GetDateFormat(item.PerformeUpToDate) : ""; var author = GlobalObjects.CasEnvironment.GetCorrector(item); subItems.Add(CreateRow(item.Status.ToString(), item.Status)); subItems.Add(CreateRow(item.DocClass.ToString(), item.DocClass)); subItems.Add(CreateRow(item.DocType.ToString(), item.DocType)); subItems.Add(CreateRow(Convert.GetDateFormat(item.ReceiveMailDate), item.ReceiveMailDate)); subItems.Add(CreateRow(item.MailNumber, item.MailNumber)); subItems.Add(CreateRow(Convert.GetDateFormat(item.CreateMailRecordDate), item.CreateMailRecordDate)); if (item.Status == MailStatus.Published) { subItems.Add(CreateRow(Convert.GetDateFormat(item.PublishingDate), item.PublishingDate)); } else { subItems.Add(CreateRow("", "")); } if (item.Status == MailStatus.Closed) { subItems.Add(CreateRow(Convert.GetDateFormat(item.ClosingDate), item.ClosingDate)); } else { subItems.Add(CreateRow("", "")); } subItems.Add(CreateRow(item.ReferenceNumber.ToString(), item.ReferenceNumber)); subItems.Add(CreateRow(item.ParentId > 0 ? item.ParentId.ToString() : "", item.ParentId)); subItems.Add(CreateRow(item.Title, item.Title)); subItems.Add(CreateRow(parformUpToDate, item.CreateMailRecordDate)); subItems.Add(CreateRow(item.Nomenclature.ToString(), item.Nomenclature)); subItems.Add(CreateRow(item.Location.ToString(), item.Location)); subItems.Add(CreateRow(item.Department.ToString(), item.Department)); subItems.Add(CreateRow(item.Specialization.ToString(), item.Specialization)); subItems.Add(CreateRow(item.Specialist.ToString(), item.Specialist)); subItems.Add(CreateRow(author, author)); return(subItems); }
/// <summary> /// Заполняет краткую информацию о директиве /// </summary> public void UpdateInformation() { if ((_currentDefferedItem == null) || _currentDefferedItem.ParentBaseComponent == null) { return; } var aircraft = GlobalObjects.AircraftsCore.GetParentAircraft(_currentDefferedItem); //GlobalObjects.PerformanceCalculator.GetNextPerformance(_currentDefferedItem); var ata = _currentDefferedItem.ATAChapter; labelDirectiveValue.Text = _currentDefferedItem.Title + " for"; labelDescriptionValue.Text = _currentDefferedItem.Description; labelEffectiveDateValue.Text = Convert.GetDateFormat(_currentDefferedItem.Threshold.EffectiveDate); labelSBValue.Text = _currentDefferedItem.ServiceBulletinNo; labelEOValue.Text = _currentDefferedItem.EngineeringOrders; labelATAChapterValue.Text = ata != null?ata.ToString() : ""; labelApplicabilityValue.Text = _currentDefferedItem.Applicability; linkDetailInfoFirst.Text = aircraft.RegistrationNumber; labelRemarksLast.Text = ""; if (CurrentAircraft != null) { linkDirectiveStatus.Text = BackLinkText; } if (_currentDefferedItem.Remains != null && _currentDefferedItem.Condition != ConditionState.NotEstimated) { if (_currentDefferedItem.Remains.IsOverdue() && _currentDefferedItem.Condition == ConditionState.Overdue) { labelRemains.Text = "Overdue:"; imageLinkLabelStatus.Status = Statuses.NotSatisfactory; } else if (_currentDefferedItem.Condition == ConditionState.Notify) { labelRemains.Text = "Remains:"; imageLinkLabelStatus.Status = Statuses.Notify; } else if (_currentDefferedItem.Condition == ConditionState.Satisfactory) { labelRemains.Text = "Remains:"; imageLinkLabelStatus.Status = Statuses.Satisfactory; } else { labelRemains.Text = "Remains:"; imageLinkLabelStatus.Status = Statuses.NotActive; } } imageLinkLabelStatus.Text = _currentDefferedItem.WorkType.ToString(); labelRemainsValue.Text = ""; if (_currentDefferedItem.Remains != null) { labelRemainsValue.Text = _currentDefferedItem.Remains.ToString(); } labelCostValue.Text = _currentDefferedItem.Cost.ToString(); labelManHoursValue.Text = _currentDefferedItem.ManHours.ToString(); labelKitValue.Text = _currentDefferedItem.KitRequired == "" ? "N" : _currentDefferedItem.KitRequired; labelNDTvalue.Text = _currentDefferedItem.NDTType.ShortName; labelRemarksValue.Text = _currentDefferedItem.Remarks; labelHiddenRemarksValue.Text = ""; if (labelHiddenRemarksValue.Text == "") { labelHiddenRemarksValue.Text = "No Important information"; // labelHiddenRemarks.Visible = false; } labelDateLast.Text = ""; labelAircraftTsnCsnLast.Text = ""; labelDateNext.Text = "n/a"; labelAircraftTsnCsnNext.Text = "n/a"; labelComponentTsnCsnNext.Text = "n/a"; labelRemarksValue.Text = ""; BaseComponent parentBaseComponent = _currentDefferedItem.ParentBaseComponent; if (_currentDefferedItem.LastPerformance != null) { labelDateLast.Text = Convert.GetDateFormat(_currentDefferedItem.LastPerformance.RecordDate); if (!_currentDefferedItem.LastPerformance.OnLifelength.IsNullOrZero()) { labelComponentTsnCsnLast.Text = _currentDefferedItem.LastPerformance.OnLifelength.ToString(); labelAircraftTsnCsnLast.Text = GlobalObjects.CasEnvironment.Calculator. GetFlightLifelengthOnEndOfDay(parentBaseComponent, _currentDefferedItem.LastPerformance.RecordDate).ToString(); } } /////////////////////////////////////////////////////////////////////////////////////////////// labelFirstPerformanceValue.Text = "n/a"; labelRptIntervalValue.Text = "n/a"; if (_currentDefferedItem.Threshold.FirstPerformanceSinceNew != null && !_currentDefferedItem.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { labelFirstPerformanceValue.Text = "s/n: " + _currentDefferedItem.Threshold.FirstPerformanceSinceNew; } if (_currentDefferedItem.Threshold.FirstPerformanceSinceEffectiveDate != null && !_currentDefferedItem.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero()) { if (labelFirstPerformanceValue.Text != "n/a") { labelFirstPerformanceValue.Text += " or "; } else { labelFirstPerformanceValue.Text = ""; } labelFirstPerformanceValue.Text += "s/e.d: " + _currentDefferedItem.Threshold.FirstPerformanceSinceEffectiveDate; } if (_currentDefferedItem.Threshold.RepeatInterval != null) { labelRptIntervalValue.Text = _currentDefferedItem.Threshold.RepeatInterval.IsNullOrZero() ? "n/a" : _currentDefferedItem.Threshold.RepeatInterval.ToString(); } //////////////////////////////////////////////////////////////////////////////////////////////// labelRemarksValue.Text = _currentDefferedItem.Remarks; if (_currentDefferedItem.IsClosed) { return; //если директива принудительно закрыта пользователем } //то вычисление следующего выполнения не нужно labelDateNext.Text = labelAircraftTsnCsnNext.Text = "n/a"; if (_currentDefferedItem.LastPerformance == null) { if (_currentDefferedItem.Threshold.PerformSinceNew && _currentDefferedItem.Threshold.FirstPerformanceSinceNew != null && !_currentDefferedItem.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { //если наработка исчисляется с момента выпуска if (_currentDefferedItem.Threshold.FirstPerformanceSinceNew.Days != null) { //если в первом выполнении заданы дни //то выводится точная дата следующего выполнения labelDateNext.Text = Convert.GetDateFormat( parentBaseComponent.ManufactureDate.AddDays( (double)_currentDefferedItem.Threshold.FirstPerformanceSinceNew.Days)) + " s/n"; } else { //иначе, если (дополнительно) дата не определена labelDateNext.Text = "n/a"; } labelComponentTsnCsnNext.Text = "s/n: " + _currentDefferedItem.Threshold.FirstPerformanceSinceNew; //labelAircraftTsnCsnNext.Text = "s/n: " + currentDirective.Threshold.SinceNew.ToString(); } if (_currentDefferedItem.Threshold.PerformSinceEffectiveDate && _currentDefferedItem.Threshold.FirstPerformanceSinceEffectiveDate != null && !_currentDefferedItem.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero()) { //если наработка исчисляется с эффективной даты //Определение даты исполнения if (_currentDefferedItem.Threshold.FirstPerformanceSinceEffectiveDate.Days != null) { //если в первом выполнении заданы дни //то выводится точная дата следующего выполнения if (labelDateNext.Text != "n/a") { labelDateNext.Text += " or "; } else { labelDateNext.Text = ""; } labelDateNext.Text += Convert.GetDateFormat( _currentDefferedItem.Threshold.EffectiveDate.AddDays ((double)_currentDefferedItem.Threshold.FirstPerformanceSinceEffectiveDate.Days)) + " s/e.d."; } else { //иначе, дату определить нельзя if (labelDateNext.Text == "") { labelDateNext.Text = "n/a"; } } //Определение наработки if (_currentDefferedItem.Threshold.EffectiveDate < DateTime.Today) { Lifelength sinceEffDate = GlobalObjects.CasEnvironment.Calculator. GetFlightLifelengthOnEndOfDay(parentBaseComponent, _currentDefferedItem.Threshold.EffectiveDate); sinceEffDate.Add(_currentDefferedItem.Threshold.FirstPerformanceSinceEffectiveDate); sinceEffDate.Resemble(_currentDefferedItem.Threshold.FirstPerformanceSinceEffectiveDate); if (labelComponentTsnCsnNext.Text != "n/a") { labelComponentTsnCsnNext.Text += " or "; } else { labelComponentTsnCsnNext.Text = ""; } labelComponentTsnCsnNext.Text += "s/e.d: " + sinceEffDate; } } } else { if (_currentDefferedItem.Threshold.PerformRepeatedly && _currentDefferedItem.Threshold.RepeatInterval != null) { //повторяющаяся директива //если есть последнне выполнение, то следующая дата расчитывается //по повторяющемуся интервалу if (_currentDefferedItem.Threshold.RepeatInterval.Days != null) { //если в первом выполнении заданы дни //то выводится точная дата следующего выполнения labelDateNext.Text = Convert.GetDateFormat( _currentDefferedItem.LastPerformance.RecordDate.AddDays( (double)_currentDefferedItem.Threshold.RepeatInterval.Days)); } else { //иначе, точную дату выполнения расчитать нельзя labelDateNext.Text = "n/a"; labelComponentTsnCsnNext.Text = "n/a"; } //Определение наработки if (!_currentDefferedItem.Threshold.RepeatInterval.IsNullOrZero()) { Lifelength nextTsnCsn; if (!_currentDefferedItem.LastPerformance.OnLifelength.IsNullOrZero()) { nextTsnCsn = new Lifelength(_currentDefferedItem.LastPerformance.OnLifelength); } else { nextTsnCsn = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnEndOfDay(parentBaseComponent, _currentDefferedItem. LastPerformance. RecordDate); } Lifelength nextAircraftTsnCsn = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnEndOfDay( parentBaseComponent, _currentDefferedItem. LastPerformance. RecordDate); nextTsnCsn.Add(_currentDefferedItem.Threshold.RepeatInterval); nextTsnCsn.Resemble(_currentDefferedItem.Threshold.RepeatInterval); labelComponentTsnCsnNext.Text = nextTsnCsn.ToString(); nextAircraftTsnCsn.Add(_currentDefferedItem.Threshold.RepeatInterval); nextAircraftTsnCsn.Resemble(_currentDefferedItem.Threshold.RepeatInterval); labelAircraftTsnCsnNext.Text = nextAircraftTsnCsn.ToString(); if (labelComponentTsnCsnNext.Text == "") { labelComponentTsnCsnNext.Text = "n/a"; } if (labelAircraftTsnCsnNext.Text == "") { labelAircraftTsnCsnNext.Text = "n/a"; } } else { labelComponentTsnCsnNext.Text = "n/a"; } } } }