Esempio n. 1
0
        /// <summary>
        /// Конструктор формы заполнения журнала условий калибровки.
        /// </summary>
        /// <param name="Session">Пользовательская сессия DV.</param>
        /// <param name="Context">Объектный контекст.</param>
        /// <param name="JournalItemType">Тип справочника.</param>
        /// <param name="CurrentItem">Текущая строка справочника.</param>
        /// <param name="CabinetNumber">Номер кабинета.</param>
        public JournalForm(UserSession Session, ObjectContext Context, BaseUniversalItemType JournalItemType, BaseUniversalItem CurrentItem, Int32 CabinetNumber)
        {
            InitializeComponent();
            this.Session = Session;
            this.Context = Context;
            IBaseUniversalService baseUniversalService = Context.GetService <IBaseUniversalService>();

            staffEmployee = Context.GetCurrentEmployee();
            itemCard      = baseUniversalService.OpenOrCreateItemCard(CurrentItem);
            CardData    itemCardData = Session.CardManager.GetCardData(Context.GetObjectRef <BaseUniversalItemCard>(itemCard).Id);
            SectionData CalibrationConditionsSection = itemCardData.Sections[itemCardData.Type.Sections["CalibrationConditions"].Id];
            RowData     CalibrationConditionsRow     = CalibrationConditionsSection.FirstRow;

            this.Text          = "Каб. №" + (CabinetNumber == 237 ? 226 : 228) + ". Условия на " + DateTime.Today.ToShortDateString();
            this.Date.DateTime = (DateTime?)CalibrationConditionsRow.GetDateTime("Date") ?? DateTime.Today;
            this.Employee.Text = CalibrationConditionsRow.GetString("Employee") != null?Context.GetEmployeeDisplay(new Guid(CalibrationConditionsRow.GetString("Employee"))) : staffEmployee.DisplayString;

            this.Temperature.Value = (decimal?)CalibrationConditionsRow.GetDecimal("Temperature") ?? 0;
            this.Humidity.Value    = (decimal?)CalibrationConditionsRow.GetDecimal("Humidity") ?? 0;
            this.Pressure.Value    = (decimal?)CalibrationConditionsRow.GetDecimal("Pressure") ?? 0;
        }