コード例 #1
0
        public override void UpdateView()
        {
            if (fRecord != null)
            {
                fView.AquariumCombo.AddRange(fModel.QueryAquariumsList(!fRecord.IsNewRecord));
                fView.AquariumCombo.SetSelectedTag(fRecord.AquariumId);

                var pointsList = ALData.GetEntityNamesList(fModel.TSDB.GetPoints());
                fView.TSPointsCombo.AddItem(" --- ", 0);
                foreach (var item in pointsList)
                {
                    fView.TSPointsCombo.Add(item);
                }
                fView.TSPointsCombo.SetSelectedTag(fRecord.PointId);

                fView.BrandCombo.AddRange(fModel.QueryDeviceBrands(), true);
                fView.BrandCombo.Text = fRecord.Brand;

                fView.TypeCombo.SetSelectedTag(fRecord.Type);
                fView.NameField.Text       = fRecord.Name;
                fView.EnabledCheck.Checked = fRecord.Enabled;
                fView.DigitalCheck.Checked = fRecord.Digital;
                fView.PowerField.SetDecimalVal(fRecord.Power);
                fView.WorkTimeField.SetDecimalVal(fRecord.WorkTime);
                fView.NoteField.Text = fRecord.Note;

                var namesList = ALData.GetItemStateNamesList(ItemType.Device);
                fView.StateCombo.AddRange(namesList, false);
                fView.StateCombo.SetSelectedTag(fRecord.State);
            }
        }
コード例 #2
0
        public override void UpdateView()
        {
            var speciesList  = fModel.QuerySpecies();
            var species      = speciesList.FirstOrDefault(sp => sp.Id == fRecord.SpeciesId);
            var speciesNames = ALData.GetEntityNamesList(speciesList);

            fView.SpeciesCombo.AddRange(speciesNames);
            fView.SpeciesCombo.SetSelectedTag(fRecord.SpeciesId);

            fView.NameField.Text = fRecord.Name;
            fView.NoteField.Text = fRecord.Note;
            fView.SexCombo.SetSelectedTag(fRecord.Sex);

            ItemType itemType;

            if (species != null)
            {
                itemType = ALCore.GetItemType(species.Type);
                ItemState itemState;
                DateTime  exclusionDate;
                fModel.GetItemState(fRecord.Id, itemType, out itemState, out exclusionDate);
                bool noTransferState = (itemState == ItemState.Unknown);
                fView.StateCombo.Enabled = noTransferState;

                if (!noTransferState)
                {
                    SetState(itemType, fRecord.State);
                }
            }
            else
            {
                itemType = ItemType.None;
                fView.StateCombo.Clear();
            }

            fView.SetImage(itemType, fRecord.Id);
        }