Ejemplo n.º 1
0
 public NewMarker(string userName)
 {
     InitializeComponent();
     loginName              = userName;
     DataContext            = markercontext;
     bll                    = new BllForUi();
     City_combo.ItemsSource = bll.GetAllCities();
     if (loginName == "admin")
     {
         MarkerType_combo.Visibility  = Visibility.Visible;
         MarkerType_combo.ItemsSource = bll.GetAllPlaceTypes();
     }
 }
Ejemplo n.º 2
0
        private void OpenNewMarker(object sender, RoutedEventArgs e)
        {
            NewMarker nm          = new NewMarker(LoginName);
            string    loginStatus = bll.GetLoginStatusOfUser(LoginName);

            if (LoginName != string.Empty)
            {
                nm.IsAdminUser = false;
                if (loginStatus == "admin")
                {
                    nm.IsAdminUser = true;
                    nm.MarkerType_combo.Visibility  = Visibility.Visible;
                    nm.MarkerType_combo.ItemsSource = bll.GetAllPlaceTypes();
                }
                nm.ShowDialog();
            }
            else
            {
                MessageBox.Show("You have to log in.");
            }
            //bool? res = nm.ShowDialog();
            //if (res.HasValue && res.Value)
            //{
            //    if (LoginName != string.Empty)
            //    {
            //        //Maybe new Task?
            //        AddUserPlace(nm.DataContext as MarkerContext);
            //    }
            //    AddNewMarkerToMap((nm.DataContext as MarkerContext).City, (nm.DataContext as MarkerContext).Street, (nm.DataContext as MarkerContext).StreetNumber, (nm.DataContext as MarkerContext).MyImageSource, (nm.DataContext as MarkerContext).Description, (nm.DataContext as MarkerContext).Contacts.ToArray());
            //}
            //else
            //{

            //}
            //nm.ShowDialog();
            //this.IsEnabled = false;
        }