/// <summary> /// Констурктор формы редактирования графика технического обслуживания. /// </summary> /// <param name="BaseCard">Родительская карточка.</param> /// <param name="Type">Тип проверки (техническое обслуживание)</param> /// <param name="DateOfEvent">Дата проведения.</param> /// <param name="NextDateOfEvent">Дата следующего проведения.</param> /// <param name="EmployeeId">Идентификатор сотрудника.</param> /// <param name="Document">Идентификатор карточки документа.</param> /// <param name="Interval">Периодичность проверки.</param> /// <param name="Unit">Единица измерения времени.</param> public MaintenanceForm(MyBaseCard BaseCard, RefEquipmentCard.Enums.TypeOfInspection Type, DateTime DateOfEvent, DateTime NextDateOfEvent, Guid EmployeeId, Guid Document, Decimal Interval, RefEquipmentCard.Enums.Units Unit) { InitializeComponent(); this.Location = ComputeLocation(this.Size); this.BaseCard = BaseCard; Context = BaseCard.Context; this.Type = Type; this.Interval = Interval; this.Unit = Unit; this.Text = "Данные о проведении технического обслуживания:"; if (DateOfEvent != DateTime.MinValue) { this.DateOfEvent.EditValue = DateOfEvent; } if (NextDateOfEvent != DateTime.MinValue) { this.NextDateOfEvent.EditValue = NextDateOfEvent; } RespEmployee = EmployeeId == Guid.Empty ? null : Context.GetObject <DocsVision.BackOffice.ObjectModel.StaffEmployee>(EmployeeId); DocumentCard = Document == Guid.Empty ? null : Context.GetObject <DocsVision.BackOffice.ObjectModel.Document>(Document); this.Employee.Text = RespEmployee == null ? "" : RespEmployee.DisplayName; this.Position.Text = RespEmployee == null || RespEmployee.Position == null ? "" : RespEmployee.Position.Name; this.Document.Text = DocumentCard == null ? "" : DocumentCard.MainInfo.FileName; }
/// <summary> /// Обработчик кнопки поля "Ответственный сотрудник". /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Employee_ButtonClick(object sender, EventArgs e) { Object[] activateParams = new Object[] { RefStaff.Employees.ID.ToString("B").ToUpper(), String.Empty, MyHelper.RefStaff_MS.ToString("B").ToUpper(), false, String.Empty, false }; Object Id = BaseCard.CardScript.CardControl.CardHost.SelectFromCard(RefStaff.ID, "Выберите сотрудника...", activateParams); if (!Id.IsNull()) { RespEmployee = Context.GetObject <StaffEmployee>(Id.ToGuid()); this.Employee.Text = RespEmployee.DisplayName; this.Position.Text = RespEmployee.Position != null ? RespEmployee.Position.Name : ""; } }