Exemple #1
0
        public void ModifyPosition()
        {
            int     id  = Utils.GetIntFromConsole("Position ID to modify:");
            POZYCJE rec = _unitOfWork.PositionRepository.GetById(id);

            if (rec != null)
            {
                int mapId = Utils.GetIntFromConsole("MAP ID:");
                if (_unitOfWork.MapRepository.GetById(mapId) != null)
                {
                    rec.MAP_ID = mapId;
                }
                else
                {
                    Console.WriteLine("Map with this ID not work");
                    Thread.Sleep(2000);
                    return;
                }
                rec.X = Utils.GetDecimalFromConsole("X:");
                rec.Y = Utils.GetDecimalFromConsole("Y:");
                rec.Z = Utils.GetDecimalFromConsole("Z:");
                _unitOfWork.PositionRepository.Edit(rec);
                _unitOfWork.PositionRepository.Save();
                Console.WriteLine(" modified");
            }
            else
            {
                Console.WriteLine(" not found");
            }
            Thread.Sleep(2000);
        }
Exemple #2
0
        public void DeletePosition()
        {
            int     id  = Utils.GetIntFromConsole("Position ID to delete:");
            POZYCJE rec = _unitOfWork.PositionRepository.GetById(id);

            if (rec != null)
            {
                _unitOfWork.PositionRepository.Delete(rec);
                _unitOfWork.PositionRepository.Save();
                Console.WriteLine(" deleted");
                Thread.Sleep(1000);
            }
            else
            {
                Console.WriteLine(" not found");
                Thread.Sleep(1000);
            }
        }
Exemple #3
0
        public void PrintOnePosition()
        {
            int     id  = Utils.GetIntFromConsole("Position ID:");
            POZYCJE rec = _unitOfWork.PositionRepository.GetById(id);

            if (rec != null)
            {
                Console.WriteLine(
                    $"ID:{rec.ID} MAP ID: {rec.MAP_ID} X: {rec.X} Y: {rec.Y} Z: {rec.Z}  ");
                Console.WriteLine("Click any button to continue");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("not found");
                Thread.Sleep(1000);
            }
        }
Exemple #4
0
        public void CreatePosition()
        {
            POZYCJE rec   = new POZYCJE();
            int     mapId = Utils.GetIntFromConsole("MAP ID:");

            if (_unitOfWork.MapRepository.GetById(mapId) != null)
            {
                rec.MAP_ID = mapId;
            }
            else
            {
                Console.WriteLine("Map with this ID not work");
                Thread.Sleep(2000);
                return;
            }
            rec.X = Utils.GetDecimalFromConsole("X:");
            rec.Y = Utils.GetDecimalFromConsole("Y:");
            rec.Z = Utils.GetDecimalFromConsole("Z:");
            _unitOfWork.PositionRepository.Add(rec);
            _unitOfWork.PositionRepository.Save();
            Console.WriteLine(" created");
            Thread.Sleep(1000);
        }