public GenusAvailableNameControl(TaxonViewModel taxon, User user)
            : base(taxon, user, "GenusAvailableNames")
        {
            InitializeComponent();

            txtReference.BindUser(user, LookupType.Reference);
            txtNameStatus.BindUser(user, PickListType.Phrase, "GAN Name Status", TraitCategoryType.Taxon);
            txtFixationMethod.BindUser(user, PickListType.Phrase, "Fixation Method", TraitCategoryType.Taxon);

            var data = Service.GetGenusAvailableName(taxon.TaxaID.Value);
            if (data == null) {
                data = new GenusAvailableName();
                data.BiotaID = taxon.TaxaID.Value;
            }
            _model = new GenusAvailableNameViewModel(data);

            this.DataContext = _model;
            _model.DataChanged += new DataChangedHandler((vm) => {
                RegisterUniquePendingChange(new UpdateGenusAvailableNameCommand(_model.Model));
                EnableTabs();
            });

            LoadIncludedSpeciesModel();

            EnableTabs();

            // The "insert included species" stored proc does not return the new identity for the
            // included species record, so we need to reload the model on update to get the ids...
            this.ChangesCommitted += new PendingChangesCommittedHandler((s) => {
                LoadIncludedSpeciesModel();
            });
        }
Пример #2
0
 public void InsertOrUpdateGenusAvailableName(GenusAvailableName name)
 {
     StoredProcUpdate("spGANInsertUpdate",
         _P("intBiotaID", name.BiotaID),
         _P("intRefID", name.RefID),
         _P("vchrRefPage", name.RefPage),
         _P("vchrAvailableNameStatus", name.AvailableNameStatus),
         _P("txtRefQual", name.RefQual),
         _P("sintDesignation", name.Designation),
         _P("vchrTypeSpecies", name.TypeSpecies),
         _P("vchrTSFixationMethod", name.TSFixationMethod)
     );
 }