Esempio n. 1
0
        private void Click_CreateUpdateTag(object sender, RoutedEventArgs e)
        {
            bool IsUnique = true;

            foreach (TagType TempTagType in Data.TagTypes)
            {
                if (TempTagType.MyOrg.Id.ToString() == Data.ActiveOrg.Id.ToString() && TempTagType.Value == TagTypeField.Text)
                {
                    IsUnique = false;
                }
            }

            if (IsUnique)
            {
                TagType Temp = Data.ActiveOrg.NewTagType();
                //NEED SOME VALIDATION HERE ###
                Temp.Value = TagTypeField.Text;

                if (Temp.Create())
                {
                    Data.TagTypes.Add(Temp);
                    MessageBox.Show("Tag type created successfully", "Success");
                    MyWin_BugAddTag.UpdateTagTypes();
                }
                else
                {
                    MessageBox.Show("There was an error creating tagtype", "Error");
                }
            }
            else
            {
                MessageBox.Show("A tag type with this name has already been made for this organisation", "Error");
            }
        }