Exemple #1
0
        /// <summary>
        /// Will manager the textbox term when updated by the user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void picklistAddTextbox_TextChanged(object sender, TextChangedEventArgs e)
        {
            //Cast
            TextBox senderBox = sender as TextBox;


            if (senderBox.Text != null && senderBox.Text != string.Empty && senderBox.Text != "")
            {
                //Set description
                _addModifyObject.Description = senderBox.Text;

                //Set code and id
                if (!_picklistValueCodes.Contains(_addModifyObject.Code))
                {
                    _addModifyObject.Code      = senderBox.Text;
                    _addModifyObject.RelatedTo = _selectedParent;

                    //New id
                    DataIDCalculation idCalculator = new DataIDCalculation();
                    _addModifyObject.TermID = idCalculator.CalculateTermID();

                    //Set coded theme and visibility
                    if (_picklistValues.Count == 0)
                    {
                        //_picklistValues.Add(_addModifyObject);
                        //RaisePropertyChanged("PicklistValues");

                        _addModifyObject.CodedTheme = _selectedPicklist;
                    }
                    else
                    {
                        _addModifyObject.CodedTheme = _picklistValues[0].CodedTheme;
                    }

                    _addModifyObject.Visibility = Dictionaries.DatabaseLiterals.boolYes;
                    _addModifyObject.Editable   = boolYes;

                    //Set an order
                    _addModifyObject.Order = 0.0;
                }

                //Select parent if there is one
                if (_addModifyObject.RelatedTo != string.Empty && _addModifyObject.RelatedTo != null)
                {
                    _selectedParent = _addModifyObject.RelatedTo;
                    RaisePropertyChanged("SelectedParent");
                }

                //Update
                RaisePropertyChanged("AddModifyObject");
            }
        }