private void BtnEditType_Click(object sender, RoutedEventArgs e)
        {
            ManifestationType     type           = (ManifestationType)dgTypes.SelectedItem;
            EditManifestationType editTypeWindow = new EditManifestationType(type);

            editTypeWindow.Show();
        }
示例#2
0
        public Manifestation(int id, ManifestationType type, DateTime date, BitmapImage image, string name, string des,
                             string sa, string price, int visitors, bool sm, bool ia, bool fd, List <Tag> tags)

        {
            this.id             = id;
            this.type           = type;
            this.date           = date;
            this.name           = name;
            this.image          = image;
            this.description    = des;
            this.servingAlcohol = sa;
            this.priceCategory  = price;
            this.visitors       = visitors;
            this.smoking        = sm;
            this.inside         = ia;
            this.forDisabled    = fd;
            this.tags           = tags;
            this.pomId          = id.ToString();
            this.brojNaCanvasu  = -1;

            this.typeName  = type.Name;
            this.shortDate = date.ToShortDateString();
            this.prevucena = false;
            if (smoking)
            {
                this.smok  = "Allowed";
                this.smoke = "Yes";
            }
            else
            {
                this.smok  = "Not allowed";
                this.smoke = "No";
            }
            if (ia)
            {
                ins = "Yes";
            }
            else
            {
                ins = "No";
            }
            this.imgString = image.ToString();
            if (fd)
            {
                forDisPom = "yes";
            }
            else
            {
                forDisPom = "no";
            }
            if (ia)
            {
                place = "inside";
            }
            else
            {
                place = "outside";
            }
        }
示例#3
0
 public void Dodaj(ManifestationType o)
 {
     if (o.ID == Guid.Empty)
     {
         o.ID = Guid.NewGuid();
     }
     if (!_repozitorijum.ContainsKey(o.ID))
     {
         _repozitorijum.Add(o.ID, o);
     }
     MemorisiDatoteku();
 }
示例#4
0
 public void Obrisi(ManifestationType o)
 {
     foreach (KeyValuePair <Guid, ManifestationType> e in _repozitorijum)
     {
         if (e.Value.Id.Equals(o.Id))
         {
             _repozitorijum.Remove(e.Key);
             break;
         }
     }
     //_repozitorijum.Remove(o.ID);
     MemorisiDatoteku();
 }
        private void BtnDeleteType_Click(object sender, RoutedEventArgs e)
        {
            ManifestationType type = (ManifestationType)dgTypes.SelectedItem;

            if (type != null)
            {
                string msg = "Are you sure you want to delete this type?";
                Delete pom = new Delete(msg);
                pom.ShowDialog();
                if (pom.Delete1)
                {
                    dgTypes.ItemsSource = null;
                    typeList.Remove(type);
                    repTipova.Obrisi(type);

                    dgTypes.ItemsSource = typeList;
                }
            }
        }
        public EditManifestationType(ManifestationType type)
        {
            InitializeComponent();
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            DataContext = this;

            txtID.Text     = (type.Id).ToString();
            txtName.Text   = type.Name;
            txtDesc.Text   = type.Description;
            imgType.Source = type.Imagee;
            typeImage      = type.Imagee;
            idStari        = type.Id;

            txtID.BorderBrush        = new SolidColorBrush(Colors.Transparent);
            txtID.BorderThickness    = new Thickness(0);
            txtName.BorderBrush      = new SolidColorBrush(Colors.Transparent);
            txtName.BorderThickness  = new Thickness(0);
            txtDesc.BorderBrush      = new SolidColorBrush(Colors.Transparent);
            txtDesc.BorderThickness  = new Thickness(0);
            lblImage.BorderBrush     = new SolidColorBrush(Colors.Transparent);
            lblImage.BorderThickness = new Thickness(0);

            error.Content = "";
        }
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            bool errorId       = false;
            bool errorType     = false;
            bool errorDate     = false;
            bool errorName     = false;
            bool errorDesc     = false;
            bool errorAlc      = false;
            bool errorPrice    = false;
            bool errorVisitors = false;
            bool errorSmoking  = false;
            bool errorInside   = false;



            //Content = "Some fields are not filled correctly!"

            if (String.IsNullOrEmpty(txtID.Text) || String.IsNullOrWhiteSpace(txtID.Text))
            {
                error.Content         = "Some fields are not filled correctly!";
                txtID.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtID.BorderThickness = new Thickness(4);
                errorId = true;
            }
            else
            {
                txtID.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtID.BorderThickness = new Thickness(0);
                errorId = false;
            }
            if (cmbType.SelectedItem == null)
            {
                error.Content           = "Some fields are not filled correctly!";
                cmbType.BorderBrush     = new SolidColorBrush(Colors.Red);
                cmbType.BorderThickness = new Thickness(4);
                errorType = true;
            }
            else
            {
                cmbType.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                cmbType.BorderThickness = new Thickness(0);
                errorType = false;
            }
            if (dpDate.SelectedDate == null)
            {
                error.Content          = "Some fields are not filled correctly!";
                dpDate.BorderBrush     = new SolidColorBrush(Colors.Red);
                dpDate.BorderThickness = new Thickness(4);
                errorDate = true;
            }
            else
            {
                dpDate.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                dpDate.BorderThickness = new Thickness(0);
                errorDate = false;
            }
            if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrWhiteSpace(txtName.Text))
            {
                error.Content           = "Some fields are not filled correctly!";
                txtName.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtName.BorderThickness = new Thickness(4);
                errorName = true;
            }
            else
            {
                txtName.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtName.BorderThickness = new Thickness(0);
                errorName = false;
            }
            if (String.IsNullOrEmpty(txtDesc.Text) || String.IsNullOrWhiteSpace(txtDesc.Text))
            {
                error.Content           = "Some fields are not filled correctly!";
                txtDesc.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtDesc.BorderThickness = new Thickness(4);
                errorDesc = true;
            }
            else
            {
                txtDesc.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtDesc.BorderThickness = new Thickness(0);
                errorDesc = false;
            }
            if (cmbAlc.SelectedItem == null)
            {
                error.Content          = "Some fields are not filled correctly!";
                cmbAlc.BorderBrush     = new SolidColorBrush(Colors.Red);
                cmbAlc.BorderThickness = new Thickness(4);
                errorAlc = true;
            }
            else
            {
                cmbAlc.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                cmbAlc.BorderThickness = new Thickness(0);
                errorAlc = false;
            }
            if (cmbPrice.SelectedItem == null)
            {
                error.Content            = "Some fields are not filled correctly!";
                cmbPrice.BorderBrush     = new SolidColorBrush(Colors.Red);
                cmbPrice.BorderThickness = new Thickness(4);
                errorPrice = true;
            }
            else
            {
                cmbPrice.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                cmbPrice.BorderThickness = new Thickness(0);
                errorPrice = false;
            }
            if (String.IsNullOrEmpty(txtVisitors.Text) || String.IsNullOrWhiteSpace(txtVisitors.Text))
            {
                error.Content               = "Some fields are not filled correctly!";
                txtVisitors.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtVisitors.BorderThickness = new Thickness(4);
                errorVisitors               = true;
            }
            else
            {
                int result;
                if (Int32.TryParse(txtVisitors.Text, out result))
                {
                    lblErrorVisitors.Visibility = Visibility.Hidden;
                    txtVisitors.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                    txtVisitors.BorderThickness = new Thickness(0);
                    errorVisitors = false;
                }
                else
                {
                    lblErrorVisitors.Visibility = Visibility.Visible;
                    txtVisitors.BorderBrush     = new SolidColorBrush(Colors.Red);
                    txtVisitors.BorderThickness = new Thickness(4);
                    errorVisitors = true;
                }
            }
            if (rbInside.IsChecked == false && rbOutside.IsChecked == false)
            {
                error.Content            = "Some fields are not filled correctly!";
                rtInside.Stroke          = new SolidColorBrush(Colors.Red);
                rtInside.StrokeThickness = 4;
                errorInside = true;
            }
            else
            {
                rtInside.Stroke          = new SolidColorBrush(Colors.Transparent);
                rtInside.StrokeThickness = 0;
                errorInside = false;
            }
            if (rbSmoking.IsChecked == false && rbNoSmoking.IsChecked == false)
            {
                error.Content             = "Some fields are not filled correctly!";
                rtSmoking.Stroke          = new SolidColorBrush(Colors.Red);
                rtSmoking.StrokeThickness = 4;
                errorSmoking = true;
            }
            else
            {
                rtSmoking.Stroke          = new SolidColorBrush(Colors.Transparent);
                rtSmoking.StrokeThickness = 0;
                errorSmoking = false;
            }
            if (!errorId && !errorType && !errorDate && !errorName && !errorDesc && !errorAlc && !errorPrice && !errorVisitors && !errorSmoking && !errorInside)
            {
                string            text = cmbType.Text;
                ManifestationType mt   = cmbType.SelectedItem as ManifestationType;


                bool smoking = false;
                if (rbSmoking.IsChecked == true)
                {
                    smoking = true;
                }

                bool inside = false;
                if (rbInside.IsChecked == true)
                {
                    inside = true;
                }

                bool forDisabled = false;
                if (cbDisabled.IsChecked == true)
                {
                    forDisabled = true;
                }


                List <Tag> tags = new List <Tag>();

                foreach (Tag t in TheList)
                {
                    bool x = t.Cekiran;
                    if (x == true)
                    {
                        Console.WriteLine(t.Id);
                        tags.Add(t);
                    }
                }

                if (takeTypePhoto)
                {
                    manifestationImage = mt.Imagee;
                }


                Manifestation m = new Manifestation(Int32.Parse(txtID.Text), mt, dpDate.SelectedDate.Value.Date, manifestationImage,
                                                    txtName.Text, txtDesc.Text, cmbAlc.Text, cmbPrice.Text, Int32.Parse(txtVisitors.Text),
                                                    smoking, inside, forDisabled, tags);



                foreach (Manifestation tt in MainWindow.manifestationList)
                {
                    if (tt.Id == idStari)
                    {
                        MainWindow.manifestationList.Remove(tt);
                        MainWindow.pomListManifest.Remove(tt);
                        MainWindow.repManifestacija.Obrisi(tt);
                        break;
                    }
                }

                MainWindow.manifestationList.Add(m);
                MainWindow.repManifestacija.Dodaj(m);
                // MainWindow.pomListManifest.Add(m);

                if (onMap)
                {
                    Image       image = new Image();
                    BitmapImage bit   = new BitmapImage(new Uri(pomM.ImgString, UriKind.Absolute));
                    image.Source = bit;

                    /* if (pomM.Prevucena == true)
                     * {
                     *
                     *       for (int i = 0; i < MainWindow.sliciceManifestacije.Count; i++)
                     *       {
                     *           Slicice slicica = MainWindow.sliciceManifestacije[i];
                     *           if (slicica.Manifestacija.Id == m.Id)
                     *           {
                     *               MainWindow.AppWindow.mapaSlika.Children.RemoveAt(i);
                     *               slicica.Manifestacija = m;
                     *               Image imagee = new Image();
                     *               imagee.Width = 60;
                     *               imagee.Height = 60;
                     *               BitmapImage bitt = new BitmapImage(new Uri(m.ImgString));
                     *               imagee.Source = bitt;
                     *
                     *               Canvas.SetLeft(imagee, slicica.X);
                     *               Canvas.SetTop(imagee, slicica.Y);
                     *
                     *               MainWindow.AppWindow.mapaSlika.Children.Insert(i, imagee);
                     *
                     *
                     *           }
                     *       }
                     *       //   MainWindow.sliciceManifestacije.Remove(bit);
                     *       //MainWindow.mapaSlika.Children.RemoveAt(s.brojNaCanvasu);
                     *       //    s.Prevucena = false;
                     *       //}
                     *       //s.brojNaCanvasu = -1;
                     *       //s.Prevucena = false;
                     * }*/
                }


                this.Close();
            }
        }
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            bool errorId   = false;
            bool errorName = false;
            bool errorDesc = false;
            bool errorImg  = false;

            // bool id2err = false;

            if (String.IsNullOrEmpty(txtID.Text) || String.IsNullOrWhiteSpace(txtID.Text))
            {
                error.Content         = "Some fields are not filled correctly!";
                txtID.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtID.BorderThickness = new Thickness(4);
                errorId = true;
            }
            else
            {
                txtID.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtID.BorderThickness = new Thickness(0);
                errorId = false;
            }
            if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrWhiteSpace(txtName.Text))
            {
                error.Content           = "Some fields are not filled correctly!";
                txtName.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtName.BorderThickness = new Thickness(4);
                errorName = true;
            }
            else
            {
                txtName.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtName.BorderThickness = new Thickness(0);
                errorName = false;
            }
            if (String.IsNullOrEmpty(txtDesc.Text) || String.IsNullOrWhiteSpace(txtDesc.Text))
            {
                error.Content           = "Some fields are not filled correctly!";
                txtDesc.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtDesc.BorderThickness = new Thickness(4);
                errorDesc = true;
            }
            else
            {
                txtDesc.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtDesc.BorderThickness = new Thickness(0);
                errorDesc = false;
            }
            if (errImg)
            {
                error.Content            = "Some fields are not filled correctly!";
                lblImage.BorderBrush     = new SolidColorBrush(Colors.Red);
                lblImage.BorderThickness = new Thickness(4);
                errorImg = true;
            }
            else
            {
                lblImage.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                lblImage.BorderThickness = new Thickness(0);
                errorImg = false;
            }


            if (!errorId && !errorName && !errorDesc && !errorImg)
            {
                ManifestationType t = new ManifestationType(Int32.Parse(txtID.Text), txtName.Text, txtDesc.Text, typeImage);

                foreach (ManifestationType tt in MainWindow.typeList)
                {
                    //if (tt.Id == t.Id)
                    //{
                    //    IdErrType errWindow = new IdErrType();
                    //    errWindow.Show();
                    //    id2err = true;
                    //    break;
                    //}
                    if (tt.Id == idStari)
                    {
                        MainWindow.typeList.Remove(tt);
                        MainWindow.repTipova.Obrisi(tt);
                        break;
                    }
                }

                MainWindow.typeList.Add(t);
                MainWindow.repTipova.Dodaj(t);



                this.Close();
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;

            DataContext          = this;
            tagList              = new ObservableCollection <Tag>();
            typeList             = new ObservableCollection <ManifestationType>();
            manifestationList    = new ObservableCollection <Manifestation>();
            repManifestacija     = new RepozitorijumManifestacija();
            repTipova            = new RepozitorijumTipova();
            repTagova            = new RepozitorijumTagova();
            repozitorijumSlici   = new RepozitorijumSlicica();
            sliciceManifestacije = new ObservableCollection <Slicice>();
            pomListManifest      = new ObservableCollection <Manifestation>();
            View = CollectionViewSource.GetDefaultView(tagList);
            KriterijumiPretrage = new ObservableCollection <string>()
            {
                "ID",
                "Name",
                "Description",
                "Type",
                "Alcohol",
                "Price",
                "Smoking",
                "For Disabled",
                "Place",
            };



            //group
            CollectionView           view             = (CollectionView)CollectionViewSource.GetDefaultView(manifestationList);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("typeName");

            view.GroupDescriptions.Add(groupDescription);

            foreach (Manifestation m in manifestationList)
            {
                pomListManifest.Add(m);
            }

            foreach (KeyValuePair <Guid, Manifestation> t in repManifestacija.getAll())
            {
                Manifestation m = new Manifestation(t.Value.Id, t.Value.Type, t.Value.Date, t.Value.Image, t.Value.Name,
                                                    t.Value.Description, t.Value.ServingAlcohol, t.Value.PriceCategory, t.Value.Visitors,
                                                    t.Value.Smoking, t.Value.Inside, t.Value.ForDisabled, t.Value.Tags);
                pomListManifest.Add(m);
            }


            foreach (KeyValuePair <Guid, Tag> t in repTagova.getAll())
            {
                Tag tag = new Tag(t.Value.Id, t.Value.Description, t.Value.Colour);
                tagList.Add(tag);
            }

            foreach (KeyValuePair <Guid, Slicice> t in repozitorijumSlici.getAll())
            {
                Slicice s = new Slicice(t.Value.X, t.Value.Y, t.Value.Manifestacija);

                Image ikonica = new Image();
                ikonica.Height = 65;
                ikonica.Width  = 65;

                BitmapImage ikonicaSource = new BitmapImage(new Uri(s.Manifestacija.ImgString));
                String      xxx           = "";
                foreach (Tag tx in s.Manifestacija.Tags)
                {
                    xxx += " " + tx.Description;
                }
                String toolTip = s.Manifestacija.Name + "\n" + s.Manifestacija.Type.Name + "\n" + xxx;

                ikonica.ToolTip = toolTip;


                s.Manifestacija.Prevucena = true;
                ikonica.Source            = ikonicaSource;
                this.mapaSlika.Children.Add(ikonica);
                Canvas.SetLeft(ikonica, s.X);
                Canvas.SetTop(ikonica, s.Y);
                sliciceManifestacije.Add(s);
            }
            foreach (KeyValuePair <Guid, ManifestationType> t in repTipova.getAll())
            {
                ManifestationType mt = new ManifestationType(t.Value.Id, t.Value.Name, t.Value.Description, t.Value.Imagee);
                typeList.Add(mt);
            }
            foreach (KeyValuePair <Guid, Manifestation> t in repManifestacija.getAll())
            {
                Manifestation m = new Manifestation(t.Value.Id, t.Value.Type, t.Value.Date, t.Value.Image, t.Value.Name,
                                                    t.Value.Description, t.Value.ServingAlcohol, t.Value.PriceCategory, t.Value.Visitors,
                                                    t.Value.Smoking, t.Value.Inside, t.Value.ForDisabled, t.Value.Tags);
                manifestationList.Add(m);
            }
            View        = CollectionViewSource.GetDefaultView(PomListManifest);
            View.Filter = filterManifestacije;
            DataContext = this;

            gridHome.Visibility               = Visibility.Hidden;
            gridViewTags.Visibility           = Visibility.Hidden;
            gridViewTypes.Visibility          = Visibility.Hidden;
            gridViewManifestations.Visibility = Visibility.Hidden;
            gridLogin.Visibility              = Visibility.Visible;
            gridSearch.Visibility             = Visibility.Hidden;

            errorName.Content       = "";
            errorPassword.Content   = "";
            txtName.BorderBrush     = new SolidColorBrush(Colors.Transparent);
            pass.BorderBrush        = new SolidColorBrush(Colors.Transparent);
            txtName.BorderThickness = new Thickness(0);
            pass.BorderThickness    = new Thickness(0);
        }
示例#10
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            bool errorId       = false;
            bool errorType     = false;
            bool errorDate     = false;
            bool errorName     = false;
            bool errorDesc     = false;
            bool errorAlc      = false;
            bool errorPrice    = false;
            bool errorVisitors = false;
            bool errorSmoking  = false;
            bool errorInside   = false;

            //Content = "Some fields are not filled correctly!"

            if (String.IsNullOrEmpty(txtID.Text) || String.IsNullOrWhiteSpace(txtID.Text))
            {
                error.Content         = "Some fields are not filled correctly!";
                txtID.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtID.BorderThickness = new Thickness(4);
                errorId = true;
            }
            else
            {
                int result;
                if (Int32.TryParse(txtID.Text, out result))
                {
                    lblErrorIDNaN.Visibility = Visibility.Hidden;
                    txtID.BorderBrush        = new SolidColorBrush(Colors.Transparent);
                    txtID.BorderThickness    = new Thickness(0);
                    errorId = false;
                }
                else
                {
                    lblErrorIDNaN.Visibility = Visibility.Visible;
                    txtID.BorderBrush        = new SolidColorBrush(Colors.Red);
                    txtID.BorderThickness    = new Thickness(4);
                    errorId = true;
                }
            }
            if (cmbType.SelectedItem == null)
            {
                error.Content           = "Some fields are not filled correctly!";
                cmbType.BorderBrush     = new SolidColorBrush(Colors.Red);
                cmbType.BorderThickness = new Thickness(4);
                errorType = true;
            }
            else
            {
                cmbType.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                cmbType.BorderThickness = new Thickness(0);
                errorType = false;
            }
            if (dpDate.SelectedDate == null)
            {
                error.Content          = "Some fields are not filled correctly!";
                dpDate.BorderBrush     = new SolidColorBrush(Colors.Red);
                dpDate.BorderThickness = new Thickness(4);
                errorDate = true;
            }
            else
            {
                dpDate.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                dpDate.BorderThickness = new Thickness(0);
                errorDate = false;
            }
            if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrWhiteSpace(txtName.Text))
            {
                error.Content           = "Some fields are not filled correctly!";
                txtName.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtName.BorderThickness = new Thickness(4);
                errorName = true;
            }
            else
            {
                txtName.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtName.BorderThickness = new Thickness(0);
                errorName = false;
            }
            if (String.IsNullOrEmpty(txtDesc.Text) || String.IsNullOrWhiteSpace(txtDesc.Text))
            {
                error.Content           = "Some fields are not filled correctly!";
                txtDesc.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtDesc.BorderThickness = new Thickness(4);
                errorDesc = true;
            }
            else
            {
                txtDesc.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtDesc.BorderThickness = new Thickness(0);
                errorDesc = false;
            }
            if (cmbAlc.SelectedItem == null)
            {
                error.Content          = "Some fields are not filled correctly!";
                cmbAlc.BorderBrush     = new SolidColorBrush(Colors.Red);
                cmbAlc.BorderThickness = new Thickness(4);
                errorAlc = true;
            }
            else
            {
                cmbAlc.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                cmbAlc.BorderThickness = new Thickness(0);
                errorAlc = false;
            }
            if (cmbPrice.SelectedItem == null)
            {
                error.Content            = "Some fields are not filled correctly!";
                cmbPrice.BorderBrush     = new SolidColorBrush(Colors.Red);
                cmbPrice.BorderThickness = new Thickness(4);
                errorPrice = true;
            }
            else
            {
                cmbPrice.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                cmbPrice.BorderThickness = new Thickness(0);
                errorPrice = false;
            }
            if (String.IsNullOrEmpty(txtVisitors.Text) || String.IsNullOrWhiteSpace(txtVisitors.Text))
            {
                error.Content               = "Some fields are not filled correctly!";
                txtVisitors.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtVisitors.BorderThickness = new Thickness(4);
                errorVisitors               = true;
            }
            else
            {
                int result;
                if (Int32.TryParse(txtVisitors.Text, out result))
                {
                    lblErrorVisitors.Visibility = Visibility.Hidden;
                    txtVisitors.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                    txtVisitors.BorderThickness = new Thickness(0);
                    errorVisitors = false;
                }
                else
                {
                    lblErrorVisitors.Visibility = Visibility.Visible;
                    txtVisitors.BorderBrush     = new SolidColorBrush(Colors.Red);
                    txtVisitors.BorderThickness = new Thickness(4);
                    errorVisitors = true;
                }
            }
            if (rbInside.IsChecked == false && rbOutside.IsChecked == false)
            {
                error.Content            = "Some fields are not filled correctly!";
                rtInside.Stroke          = new SolidColorBrush(Colors.Red);
                rtInside.StrokeThickness = 4;
                errorInside = true;
            }
            else
            {
                rtInside.Stroke          = new SolidColorBrush(Colors.Transparent);
                rtInside.StrokeThickness = 0;
                errorInside = false;
            }
            if (rbSmoking.IsChecked == false && rbNoSmoking.IsChecked == false)
            {
                error.Content             = "Some fields are not filled correctly!";
                rtSmoking.Stroke          = new SolidColorBrush(Colors.Red);
                rtSmoking.StrokeThickness = 4;
                errorSmoking = true;
            }
            else
            {
                rtSmoking.Stroke          = new SolidColorBrush(Colors.Transparent);
                rtSmoking.StrokeThickness = 0;
                errorSmoking = false;
            }
            if (!errorId && !errorType && !errorDate && !errorName && !errorDesc && !errorAlc && !errorPrice && !errorVisitors && !errorSmoking && !errorInside)
            {
                bool errId = false;
                foreach (Manifestation m in MainWindow.manifestationList)
                {
                    int x = Int32.Parse(txtID.Text);
                    if (x == m.Id)
                    {
                        errId = true;
                        IdErrManifestation errWindow = new IdErrManifestation();
                        errWindow.Show();
                    }
                }
                if (errId == false)
                {
                    string            text = cmbType.Text;
                    ManifestationType mt   = cmbType.SelectedItem as ManifestationType;


                    bool smoking = false;
                    if (rbSmoking.IsChecked == true)
                    {
                        smoking = true;
                    }

                    bool inside = false;
                    if (rbInside.IsChecked == true)
                    {
                        inside = true;
                    }

                    bool forDisabled = false;
                    if (cbDisabled.IsChecked == true)
                    {
                        forDisabled = true;
                    }

                    //   comboBoxTags.Chil
                    List <Tag> tags = new List <Tag>();

                    foreach (Tag t in TheList)
                    {
                        bool x = t.Cekiran;
                        if (x == true)
                        {
                            Console.WriteLine(t.Id);
                            tags.Add(t);
                        }
                    }

                    if (takeTypePhoto)
                    {
                        manifestationImage = mt.Imagee;
                    }


                    Manifestation manifestation = new Manifestation(Int32.Parse(txtID.Text), mt, dpDate.SelectedDate.Value.Date, manifestationImage,
                                                                    txtName.Text, txtDesc.Text, cmbAlc.Text, cmbPrice.Text, Int32.Parse(txtVisitors.Text),
                                                                    smoking, inside, forDisabled, tags);
                    MainWindow.manifestationList.Add(manifestation);
                    MainWindow.repManifestacija.Dodaj(manifestation);
                    MainWindow.pomListManifest.Add(manifestation);


                    this.Close();
                }
            }
        }
示例#11
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            bool errorId   = false;
            bool errorName = false;
            bool errorDesc = false;
            bool errorImg  = false;

            if (String.IsNullOrEmpty(txtID.Text) || String.IsNullOrWhiteSpace(txtID.Text))
            {
                error.Content         = "Some fields are not filled correctly!";
                txtID.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtID.BorderThickness = new Thickness(4);
                errorId = true;
            }
            else
            {
                int result;
                if (Int32.TryParse(txtID.Text, out result))
                {
                    lblErrorIDNaN.Visibility = Visibility.Hidden;
                    txtID.BorderBrush        = new SolidColorBrush(Colors.Transparent);
                    txtID.BorderThickness    = new Thickness(0);
                    errorId = false;
                }
                else
                {
                    lblErrorIDNaN.Visibility = Visibility.Visible;
                    txtID.BorderBrush        = new SolidColorBrush(Colors.Red);
                    txtID.BorderThickness    = new Thickness(4);
                    errorId = true;
                }
            }
            if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrWhiteSpace(txtName.Text))
            {
                error.Content           = "Some fields are not filled correctly!";
                txtName.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtName.BorderThickness = new Thickness(4);
                errorName = true;
            }
            else
            {
                txtName.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtName.BorderThickness = new Thickness(0);
                errorName = false;
            }
            if (String.IsNullOrEmpty(txtDesc.Text) || String.IsNullOrWhiteSpace(txtDesc.Text))
            {
                error.Content           = "Some fields are not filled correctly!";
                txtDesc.BorderBrush     = new SolidColorBrush(Colors.Red);
                txtDesc.BorderThickness = new Thickness(4);
                errorDesc = true;
            }
            else
            {
                txtDesc.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                txtDesc.BorderThickness = new Thickness(0);
                errorDesc = false;
            }
            if (errImg)
            {
                error.Content            = "Some fields are not filled correctly!";
                lblImage.BorderBrush     = new SolidColorBrush(Colors.Red);
                lblImage.BorderThickness = new Thickness(4);
                errorImg = true;
            }
            else
            {
                lblImage.BorderBrush     = new SolidColorBrush(Colors.Transparent);
                lblImage.BorderThickness = new Thickness(0);
                errorImg = false;
            }

            if (!errorId && !errorName && !errorDesc && !errorImg)
            {
                bool errId = false;
                foreach (ManifestationType m in MainWindow.typeList)
                {
                    int x = Int32.Parse(txtID.Text);
                    if (x == m.Id)
                    {
                        errId = true;
                        IdErrType errWindow = new IdErrType();
                        errWindow.Show();
                    }
                }

                if (errId == false)
                {
                    ManifestationType manifestationType = new ManifestationType(Int32.Parse(txtID.Text), txtName.Text, txtDesc.Text, typeImage);
                    MainWindow.typeList.Add(manifestationType);
                    MainWindow.repTipova.Dodaj(manifestationType);
                    this.Close();
                }
            }
        }