private void Map_Drop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent("manifestation"))
     {
         Point         dropPosition            = e.GetPosition(Map);
         Manifestation manifToDrop             = e.Data.GetData("manifestation") as Manifestation;
         Manifestation underlyingManifestation = ClickedManifestation((int)dropPosition.X, (int)dropPosition.Y);
         if (underlyingManifestation != null && underlyingManifestation.Id != manifToDrop.Id)
         {
             MessageBox.Show($"Unable to place manifestation \"{manifToDrop.Name}\" on given position because manifestation \"{underlyingManifestation.Name}\" is in the way. Please try draging manifestation \"{manifToDrop.Name}\" to a different position.",
                             "Overlapping manifestations not allowed", MessageBoxButton.OK, MessageBoxImage.Warning);
             return;
         }
         if (manifToDrop.MapCoordinates.Count > 0 && AvailableMaifs.Contains(manifToDrop))
         {
             MessageBoxResult choince = MessageBox.Show($"Manifestation \"{manifToDrop.Id}\" is already placed on another map. Do you want do move it to this map?",
                                                        $"Change location of {manifToDrop.Id}", MessageBoxButton.YesNoCancel);
             if (choince != MessageBoxResult.Yes)
             {
                 return;
             }
         }
         ShowManifPointer(manifToDrop, (int)dropPosition.X, (int)dropPosition.Y);
     }
 }
Пример #2
0
        private void treeVMoveMouse(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Released)
            {
                return;
            }

            Point  mousePos = e.GetPosition(null);
            Vector diff     = startPoint - mousePos;

            if (e.LeftButton == MouseButtonState.Pressed &&
                Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance ||
                Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)
            {
                TreeView     treeView     = sender as TreeView;
                TreeViewItem treeViewItem = FindAnchestor <TreeViewItem>((DependencyObject)e.OriginalSource);
                try
                {
                    Manifestation val      = (Manifestation)treeView.ItemContainerGenerator.ItemFromContainer(treeViewItem);
                    DataObject    dragData = new DataObject("myFormat", val);
                    DragDrop.DoDragDrop(treeViewItem, dragData, DragDropEffects.Move);
                }
                catch (Exception)
                {
                }
            }
        }
        public ActionResult EditManifestation(Manifestation man, Address a)
        {
            if (!getSellers.ContainsKey(((User)Session["user"]).Username))
            {
                ViewBag.Error = "You do not have permision to access seller view!";
                return(View("Index"));
            }

            man.Picture = getManifestations[man.Name].Picture;
            man.Status  = getManifestations[man.Name].Status;
            List <Manifestation> temp = new List <Manifestation>();

            foreach (var item in getManifestations.Values)
            {
                temp.Add(item);
            }

            foreach (var m in temp)
            {
                if (man.Name == m.Name)
                {
                    getManifestations.Remove(m.Name);
                }
            }

            man.Address = a;
            getManifestations[man.Name] = man;
            PrintManifestations();

            return(View("Index"));
        }
Пример #4
0
        private void Map_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("manifestation"))
            {
                Point         dropPosition     = e.GetPosition(Map);
                Manifestation manifestationPin = e.Data.GetData("manifestation") as Manifestation;

                Manifestation manifestationOnThatPosition = Manifestation_Click((int)dropPosition.X, (int)dropPosition.Y);

                if (manifestationOnThatPosition != null && !manifestationPin.Id.Equals(manifestationOnThatPosition.Id))
                {
                    manifestationPin.X = (int)dropPosition.X + 16;
                    manifestationPin.Y = (int)dropPosition.Y + 16;
                }
                // if it is close to the edge, move it a little bit
                else if ((int)dropPosition.Y > -30 && (int)dropPosition.Y < 10)
                {
                    manifestationPin.X = (int)dropPosition.X - 16;
                    manifestationPin.Y = (int)dropPosition.Y + 8;
                }
                else if ((int)dropPosition.X > -30 && (int)dropPosition.X < 10)
                {
                    manifestationPin.X = (int)dropPosition.X + 8;
                    manifestationPin.Y = (int)dropPosition.Y - 16;
                }
                else
                {
                    manifestationPin.X = (int)dropPosition.X - 16;
                    manifestationPin.Y = (int)dropPosition.Y - 16;
                }
                Database.UpdateManifestation(manifestationPin.Id, manifestationPin);
                ManifestationPins_Draw();
            }
        }
Пример #5
0
        private void borderDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("myFormat"))
            {
                int winH = (int)imagePanel.Height;
                int winW = (int)imagePanel.Width;

                Manifestation val = e.Data.GetData("myFormat") as Manifestation;

                Button b = return_shape(val);

                var relativePosition = e.GetPosition(imagePanel);
                var point            = PointToScreen(relativePosition);

                int marginB = winH - ((int)point.Y + (int)SystemParameters.CaptionHeight + (int)SystemParameters.BorderWidth - 190);
                int marginR = winW - ((int)point.X + 60 + (int)SystemParameters.BorderWidth - 235);

                b.Margin = new Thickness(relativePosition.X - 35, relativePosition.Y - 45, marginR, marginB);

                val.X_position = relativePosition.X - 35;
                val.Y_position = relativePosition.Y - 45;
                //--
                val.MarginB = marginB;
                val.MarginR = marginR;

                manifestationsInTree.Remove(val);
                manifestationsOnBoard.Add(val);

                updateFromB_ToMain(val);

                imagePanel.Children.Add(b);
            }
        }
        public string RegisterManifestation(Manifestation register)
        {
            register.Id       = Guid.NewGuid();
            register.Pictures = "";
            register.IsActive = true;

            List <Manifestation> manifestations = new List <Manifestation>();

            manifestations = GetAllManifestations();

            if (manifestations.Count != 0)
            {
                foreach (Manifestation m in manifestations)
                {
                    if (m.EventTime == register.EventTime && m.Place == register.Place)
                    {
                        return("Already has event in that time and place");
                    }
                }
            }

            manifestationDB.Insert(register);

            return(register.Id.ToString());
        }
Пример #7
0
        private void buttonGravar_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Tem certeza que deseja salvar as alterações?", "Alerta", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

            if (result == DialogResult.OK)
            {
                Manifestation manifestation = new Manifestation();

                int codInteiro = Convert.ToInt32(textBoxProtocolo.Text);
                manifestation.cod_manifestacao = codInteiro;
                manifestation.status           = comboBoxStatus.Text;
                manifestation.detalhamento     = textBoxDetalhamento.Text;
                manifestation.resolucao        = textBoxResolucao.Text;

                manifestation.EditarManifestacao();

                MessageBox.Show("Dados alterados com sucesso!", "Alteração Efetuada", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("Operação Cancelada pelo usuário", "Operação Cancelada", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }
        public Manifestation GetOneManifestation(string idEvent)
        {
            string        idTemp = idEvent;
            Manifestation ret    = null;

            ret = manifestationDB.GetOneById(idTemp);
            return(ret);
        }
        public ChangeManifestDialog(int index)
        {
            InitializeComponent();

            selectedManifestation = MainWindow.Manifestations.ElementAt(index);

            this.DataContext = this;
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            Manifestation manifestation = context.Manifestations.Find(id);

            context.Manifestations.Remove(manifestation);
            context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #11
0
 public Slicice(double x, double y, Manifestation manifestacija, double xx, double yy, Manifestation mmanifestacija)
 {
     X             = x;
     Y             = y;
     Manifestacija = manifestacija;
     X             = xx;
     Y             = yy;
     Manifestacija = mmanifestacija;
 }
        private void EditManifClicked(object sender, RoutedEventArgs e)
        {
            Manifestation target = focusedManifestation;

            if (target == null)
            {
                return;
            }
            mainWindow.showManifestationEditView(target.Id);
        }
 private void ShowManifPointer(Manifestation manif, int x, int y)
 {
     MapToShow.PlaceManifAtPos(manif, x, y);
     if (AvailableMaifs.Contains(manif))
     {
         manifsOnMap.Add(manif);
         AvailableMaifs.Remove(manif);
     }
     drawManifPointers();
     Repository.GetInstance().SaveData();
 }
Пример #14
0
        private void Map_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            Point mousePosition = e.GetPosition(Map);

            ClickedManifestation = Manifestation_Click((int)mousePosition.X, (int)mousePosition.Y);

            if (ClickedManifestation != null)
            {
                var Map = sender as Canvas;
                Map.ContextMenu.IsOpen = true;
            }
        }
        public string UpdateCapacity(Manifestation manifestation)
        {
            Manifestation temp = manifestationDB.GetOneById(Convert.ToString(manifestation.Id));

            temp.Capacity        = manifestation.Capacity;
            temp.CapacityFunPit  = manifestation.CapacityFunPit;
            temp.CapacityRegular = manifestation.CapacityRegular;
            temp.CapacityVIP     = manifestation.CapacityVIP;

            manifestationDB.UpdateCapacity(temp);
            return("Success!");
        }
        private void Map_ContextMenu(object sender, MouseButtonEventArgs e)
        {
            Point mousePosition = e.GetPosition(Map);

            focusedManifestation = ClickedManifestation((int)mousePosition.X, (int)mousePosition.Y);

            if (focusedManifestation != null)
            {
                var cmnu = this.FindResource("mapContextMenu") as ContextMenu;
                cmnu.IsOpen = true;
            }
        }
        public string GetStatus(string idEvent, string status)
        {
            Manifestation temp = manifestationDB.GetOneById(idEvent);

            if (temp.Status == "NotApproved")
            {
                temp.Status = "Approved";
            }

            manifestationDB.UpdateStatus(temp);
            return("Success");
        }
Пример #18
0
        public AddManifestDialog()
        {
            InitializeComponent();
            dateManifPicker.SelectedDate     = DateTime.Now.Date;
            dateManifPicker.DisplayDateStart = DateTime.Now.Date;

            setDefault();

            manifestation = new Manifestation();

            this.DataContext = manifestation;
        }
Пример #19
0
 private void updateFromB_ToMain(Manifestation manif)
 {
     for (int i = 0; i < manifestations.Count; i++)
     {
         if (manifestations.ElementAt(i).IdManifest.Equals(manif.IdManifest))
         {
             manifestations.ElementAt(i).X_position = manif.X_position;
             manifestations.ElementAt(i).Y_position = manif.Y_position;
             manifestations.ElementAt(i).MarginB    = manif.MarginB;
             manifestations.ElementAt(i).MarginR    = manif.MarginR;
             break;
         }
     }
 }
Пример #20
0
        private void Map_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Point mousePosition = e.GetPosition(Map);

            ClickedManifestation = Manifestation_Click((int)mousePosition.X, (int)mousePosition.Y);
            if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
            {
                if (ClickedManifestation != null)
                {
                    EditManifestation edit = new EditManifestation(ClickedManifestation.Id);
                    edit.Show();
                }
            }
        }
 // POST: Manifestations/Edit/ id
 public ActionResult Edit(Manifestation manifestation)
 {
     if (ModelState.IsValid)
     {
         if (manifestation.Status == "cl")
         {
             manifestation.ClosingDate = DateTime.Now;
         }
         context.Entry(manifestation).State =
             EntityState.Modified;
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(manifestation));
 }
        public void UpdateStatus(Manifestation manifestation)
        {
            string Query = "UPDATE Manifestations set Status=@Status " +
                           "WHERE Id='" + manifestation.Id + "'";

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                using (SqlCommand cmd = new SqlCommand(Query, con))
                {
                    con.Open();
                    cmd.Parameters.Add("@Status", SqlDbType.NVarChar).Value = manifestation.Status;
                    cmd.ExecuteNonQuery();
                }
            }
        }
Пример #23
0
        private Manifestation CreateCharacterManifestation(CharacterEntry character)
        {
            using var unitOfWork = _gameUnitOfWorkFactory.CreateChar();
            var characterAppearances = unitOfWork.CharacterAppearances.GetByCharacterId(character.Id);

            var newCharacter = new Manifestation()
            {
                AppearanceData = characterAppearances,
                IsRunning      = character.RunState == 1,
                Position       = new Vector3((float)character.CoordX, (float)character.CoordY, (float)character.CoordZ)
            };

            newCharacter.GenerateGUID(EntityType.Character, character.Id);

            return(newCharacter);
        }
 public AddManifestationView()
 {
     InitializeComponent();
     comboBoxTypes.DataContext = Repository.GetInstance();
     Labels                         = Repository.GetInstance().Labels;
     DataContext                    = new Manifestation();
     label.DataContext              = this;
     isItOutside.DataContext        = this;
     alcoholConsumption.DataContext = this;
     priceCategory.DataContext      = this; label.DataContext = this;
     Editing                        = false;
     labelText                      = "";
     isOut          = "";
     selectedLabels = new ObservableCollection <model.Label>();
     descriptionInput.Focus();
 }
        public string GetImage(string idEvent, string ImgName)
        {
            Manifestation temp = manifestationDB.GetOneById(idEvent);

            if (temp.Pictures == "")
            {
                temp.Pictures = ImgName;
            }
            else
            {
                temp.Pictures = temp.Pictures + ";" + ImgName;
            }

            manifestationDB.UpdatePicture(temp);
            return("Success");
        }
Пример #26
0
        private Manifestation CreateCharacterManifestation(CharacterEntry character)
        {
            using var unitOfWork = _gameUnitOfWorkFactory.CreateChar();
            var characterAppearances = unitOfWork.CharacterAppearances.GetByCharacterId(character.Id);

            var newCharacter = new Manifestation
            {
                AppearanceData = characterAppearances,
                Gender         = character.Gender,
                IsRunning      = character.IsRunning(),
                Position       = character.GetPositionVector()
            };

            newCharacter.GenerateGUID(EntityType.Character, character.Id);

            return(newCharacter);
        }
        public string Update(Manifestation manifestation)
        {
            Manifestation temp = new Manifestation();

            temp.Id              = manifestation.Id;
            temp.Name            = manifestation.Name;
            temp.Type            = manifestation.Type;
            temp.Price           = manifestation.Price;
            temp.Capacity        = manifestation.Capacity;
            temp.CapacityVIP     = manifestation.CapacityVIP;
            temp.CapacityRegular = manifestation.CapacityRegular;
            temp.CapacityFunPit  = manifestation.CapacityFunPit;
            temp.EventTime       = manifestation.EventTime;

            manifestationDB.Update(temp);
            return("Success!");
        }
        private void DeleteManifClicked(object sender, RoutedEventArgs e)
        {
            Manifestation target = focusedManifestation;

            if (target == null)
            {
                return;
            }
            MessageBoxResult choice = MessageBox.Show($"Are you sure that you want to permanently delete manifestation \"{target.Id}\"?", "Delete manifestation", MessageBoxButton.YesNoCancel);

            if (choice == MessageBoxResult.Yes)
            {
                ManifsOnMap.Remove(target);
                drawManifPointers();
                Repository.GetInstance().DeleteManifestation(target.Id);
            }
        }
        public void UpdateCapacity(Manifestation manifestation)
        {
            string Query = "UPDATE Manifestations set Capacity=@Capacity, CapacityVIP=@CapacityVIP, CapacityRegular=@CapacityRegular, CapacityFunPit=@CapacityFunPit " +
                           "WHERE Id='" + manifestation.Id + "'";

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                using (SqlCommand cmd = new SqlCommand(Query, con))
                {
                    con.Open();
                    cmd.Parameters.Add("@Capacity", SqlDbType.Int).Value        = manifestation.Capacity;
                    cmd.Parameters.Add("@CapacityVIP", SqlDbType.Int).Value     = manifestation.CapacityVIP;
                    cmd.Parameters.Add("@CapacityRegular", SqlDbType.Int).Value = manifestation.CapacityRegular;
                    cmd.Parameters.Add("@CapacityFunPit", SqlDbType.Int).Value  = manifestation.CapacityFunPit;
                    cmd.ExecuteNonQuery();
                }
            }
        }
        // GET: Manifestations/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new
                       HttpStatusCodeResult(
                           HttpStatusCode.BadRequest));
            }

            Manifestation manifestation = context.Manifestations.Find(id);

            if (manifestation == null)
            {
                return(HttpNotFound());
            }

            return(View(manifestation));
        }