Exemplo n.º 1
0
        public IActionResult DeleteExpositionSubmit(Exposition exposition)
        {
            if (HttpContext.Session.GetString("auth") != "true")
            {
                return(RedirectToAction("Index", "Login"));
            }
            exposition = bookManager.getExposition(exposition.id);
            ImageManager imageManager = new ImageManager(environment, "images/covers/expositions");
            bool         result       = imageManager.deleteImage(exposition.frontcover);

            if (result)
            {
                bool result2 = imageManager.deleteImage(exposition.backcover);
                if (result2)
                {
                    bookManager.Remove(exposition);
                    bookManager.SaveChanges();
                }
                else
                {
                    Console.WriteLine("\n\n\n***There has been an error deleting the back cover file!***\n\n\n");
                }
            }
            else
            {
                Console.WriteLine("\n\n\n***There has been an error deleting the front cover file!***\n\n\n");
            }
            return(RedirectToAction("Expositions"));
        }
Exemplo n.º 2
0
        public IActionResult AddExpositionSubmit(Exposition exposition, IFormFile frontcover, IFormFile backcover)
        {
            if (HttpContext.Session.GetString("auth") != "true")
            {
                return(RedirectToAction("Index", "Login"));
            }
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("AddExposition"));
            }
            ImageManager imageManager = new ImageManager(environment, "images/covers/expositions");
            int          result       = imageManager.uploadImage(frontcover);

            switch (result)
            {
            case 1:
                Console.WriteLine("\n\n\n*** Wrong File Type! ***");
                ViewData["feedback"] = "Wrong File Type";
                return(RedirectToAction("AddExposition"));

            case 2:
                Console.WriteLine("\n\n\n*** File Too Large! ***");
                ViewData["feedback"] = "File Too Large";
                return(RedirectToAction("AddExposition"));

            case 3:
                Console.WriteLine("\n\n\n*** File Name Too Long! ***");
                ViewData["feedback"] = "File Name Too Long";
                return(RedirectToAction("AddExposition"));

            case 4:
                Console.WriteLine("\n\n\n*** Error Saving File! ***");
                ViewData["feedback"] = "Error Saving File";
                return(RedirectToAction("AddExposition"));

            case 5:
                ViewData["feedback"]  = "Success";
                exposition.frontcover = imageManager.fileName;
                int result2 = imageManager.uploadImage(backcover);
                if (result2 == 5)
                {
                    exposition.backcover = imageManager.fileName;
                    bookManager.Add(exposition);
                    bookManager.SaveChanges();
                    return(RedirectToAction("Expositions"));
                }
                else
                {
                    Console.WriteLine("\n\n\n***There has been an error adding the back cover!***");
                    return(RedirectToAction("AddExposition"));
                }

            default:
                Console.WriteLine("\n\n\n*** No File Selected! ***");
                ViewData["feedback"] = "No File Selected";
                return(RedirectToAction("AddExposition"));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Валидация
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public ValidationResult Validate(Exposition element)
        {
            //if (string.IsNullOrEmpty(element.Name))
            //{
            //    return new ValidationResult(ValidatorResources.ExpositionValidator_NameIsNull);
            //}

            return(new ValidationResult());
        }
Exemplo n.º 4
0
        //---------------------------------------------------------- expositions
        public IActionResult AddExposition()
        {
            if (HttpContext.Session.GetString("auth") != "true")
            {
                return(RedirectToAction("Index", "Login"));
            }
            ViewBag.Current = "";
            Exposition exposition = new Exposition();

            return(View(exposition));
        }
Exemplo n.º 5
0
        public IActionResult EditExposition(int id)
        {
            if (HttpContext.Session.GetString("auth") != "true")
            {
                return(RedirectToAction("Index", "Login"));
            }
            ViewBag.Current = "";
            Exposition exposition = new Exposition();

            exposition = bookManager.getExposition(id);
            return(View(exposition));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Добавить экспозицию в спецификацию
        /// </summary>
        /// <param name="exposition"></param>
        public void AddExpositionToSpecification(Exposition exposition)
        {
            if (exposition == null || exposition.Count <= 0)
            {
                return;
            }

            exposition.Count--;

            var orderSpesific = AddToOrderSpecificationItems(exposition.Nomenclature, exposition.Feature);

            _orderSpecificView.AddToSpecificationGrid(orderSpesific);
        }
Exemplo n.º 7
0
        public IEnumerator <object> Task()
        {
            const float animationLength = 0.5f;

            while (true)
            {
                var sv = SceneView.Instance;
                if (sv.Input.ConsumeKeyPress(MainKey) || sv.Input.ConsumeKeyPress(MultiSelectKey))
                {
                    Audio.GloballyEnable            = false;
                    Document.Current.ExpositionMode = true;
                    Document.Current.PreviewScene   = true;
                    using (var exposition = new Exposition(sv.Frame, sv.Input)) {
                        float t = 0;
                        float animationSpeed = CalcAnimationSpeed(exposition.ItemCount);
                        while (true)
                        {
                            if ((sv.Input.IsKeyPressed(MainKey) || sv.Input.IsKeyPressed(MultiSelectKey)) && !exposition.Closed())
                            {
                                if (t < animationLength)
                                {
                                    t += Lime.Task.Current.Delta * animationSpeed;
                                    if (t >= animationLength)
                                    {
                                        exposition.RunItemAnimations();
                                    }
                                }
                            }
                            else
                            {
                                t -= Lime.Task.Current.Delta * 3f * animationSpeed;
                                if (t < 0)
                                {
                                    break;
                                }
                            }
                            exposition.Morph(CalcMorphKoeff(t, animationLength));
                            yield return(null);
                        }
                    }
                    Audio.GloballyEnable            = true;
                    Document.Current.ExpositionMode = false;
                    Document.Current.PreviewScene   = false;
                }
                yield return(Lime.Task.WaitForInput());
            }
        }
Exemplo n.º 8
0
        private void AddExposit(Feature charModel, ApplicationDbContext uf)
        {
            for (int i = 0; i < 2; i++)
            {
                var guid    = Guid.NewGuid();
                var newExpo = new Exposition()
                {
                    Guid         = guid,
                    Nomenclature = charModel.Nomenclature,
                    Feature      = charModel,
                    IsEnabled    = i == 1,
                    Count        = i,
                    Price        = 100
                };

                uf.Set <Exposition>().Add(newExpo);
                uf.SaveChanges();
            }
        }
        static public void insert(DataTable data)
        {
            HashSet <string> countries   = new HashSet <string>();
            HashSet <string> movements   = new HashSet <string>();
            HashSet <string> pictures    = new HashSet <string>();
            HashSet <string> expositions = new HashSet <string>();

            HashSet <Artist> artists = new HashSet <Artist>();

            foreach (DataRow row in data.Rows)
            {
                Country    country    = new Country(row["country"].ToString());
                Exposition exposition = new Exposition(row["exposition"].ToString());
                Movement   movement   = new Movement(row["movement"].ToString());
                Picture    picture    = new Picture(row["picture"].ToString());

                string name        = row["name"].ToString();
                string surname     = row["surname"].ToString();
                string second_name = row["second_name"].ToString();

                setDirectory(countries, country.Name);
                setDirectory(movements, movement.Name);
                setDirectory(pictures, picture.Name);
                setDirectory(expositions, exposition.Name);

                Artist artist = new Artist(name, surname, second_name, country, movement, picture, exposition);
                addOrUpdateArtist(artists, artist);
            }

            insertDirectory(countries, "countries");
            insertDirectory(movements, "movements");
            insertDirectory(pictures, "pictures");
            insertDirectory(expositions, "expositions");

            insertArtists(artists);
        }
Exemplo n.º 10
0
        public IActionResult EditExpositionSubmit(Exposition exposition, IFormFile newfrontcover, IFormFile newbackcover)
        {
            if (HttpContext.Session.GetString("auth") != "true")
            {
                return(RedirectToAction("Index", "Login"));
            }
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("EditExposition", exposition.id));
            }
            ImageManager imageManager = new ImageManager(environment, "images/covers/expositions");

            if ((newfrontcover != null) && (newfrontcover.FileName != "") && (exposition.frontcover != newfrontcover.FileName))
            {
                Console.WriteLine("\n\n\n***Front Image was not null so we're changing it.");
                bool delete = imageManager.deleteImage(exposition.frontcover);
                if (delete)
                {
                    int result = imageManager.uploadImage(newfrontcover);
                    if (result == 5)
                    {
                        ViewData["feedback"] = "Success";
                        Console.WriteLine("\n\n\n***Successfully uploaded image to server!***");
                        exposition.frontcover = imageManager.fileName;
                    }
                    else
                    {
                        Console.WriteLine("\n\n\n***Error!***");
                        return(RedirectToAction("EditExposition", exposition.id));
                    }
                }
                else
                {
                    Console.WriteLine("\n\n\n***There has been an error deleting old image file!***");
                    return(RedirectToAction("EditExposition", exposition.id));
                }
            }
            else
            {
                Console.WriteLine("\n\n\n***Front Cover Image was null so we're moving on.");
                Console.WriteLine("\n\n\nCurrent Front Cover: " + exposition.frontcover);
            }
            if ((newbackcover != null) && (newbackcover.FileName != "") && (exposition.backcover != newbackcover.FileName))
            {
                Console.WriteLine("\n\n\n***Back Image was not null so we're changing it.");
                bool bool2 = imageManager.deleteImage(exposition.backcover);
                if (bool2)
                {
                    int result2 = imageManager.uploadImage(newbackcover);
                    exposition.backcover = imageManager.fileName;
                }
            }
            else
            {
                Console.WriteLine("\n\n\n***Backcover was null so we're moving on.");
                Console.WriteLine("\n\n\nCurrent Back Cover: " + exposition.backcover);
            }

            bookManager.Update(exposition);
            bookManager.SaveChanges();
            return(RedirectToAction("Expositions"));
        }
Exemplo n.º 11
0
 // Option 1: Use parametrized constructor
 // Pass the instance reference of the other class while
 // constructing the object
 public MyClass(Exposition exposition)
 {
     this.exposition = exposition;
 }
Exemplo n.º 12
0
 // Option 2: Use an initialize method
 public void Initialize(Exposition exposition)
 {
     this.exposition = exposition;
 }
Exemplo n.º 13
0
 public override string ToString()
 {
     return
         ($"Date:  {CaptureTime.ToString("dd/MM/yyyy")}\nDevice: {TheDevice.SeriesNumber}. \n - Exposition: {Exposition.ToString("0.00")} - Temperature: {Temperature}\n");
 }
Exemplo n.º 14
0
        protected override void Seed(MuseumContext context)
        {
            List <string> ExpositionName = new List <string> {
                "Cigar and world", "Space", "Brain", "Fluid or sphere", "Nut", "Give me a cake"
            };
            List <string> GuideNames = new List <string>()
            {
                "Kari Hensien", "Terry Adams", "Dan Park", "Peter Houston", "Lukas Keller", "Mathew Charles", "John Smith"
            };
            List <string> ExpositionTheme = new List <string> {
                "Philosophy", "Science", "Science", "Abstraction", "Rave", "Rave"
            };
            int time = 2;

            for (int i = 0; i < ExpositionName.Count; i++)
            {
                var exposition = new Exposition()
                {
                    ExpositionName = ExpositionName[i], Theme = ExpositionTheme[i], TargetAudience = 16, Plane = "+_+", Price = 150
                };
                var grafik = new Grafik()
                {
                    //Id = exposition.Id,
                    Exposition = exposition,
                    StartTime  = new TimeSpan(6 + i + i, 0, 15),
                    EndTime    = new TimeSpan(6 + i + i + time, 0, 15)
                };

                var excursionsSchedule = new ExcursionsSchedule()
                {
                    Id = grafik.Id, Grafik = grafik
                };

                var guide = new Guide()
                {
                    Name = GuideNames[i]
                };
                var excursion = new Excursion()
                {
                    Guide = guide, StartTime = grafik.StartTime, Time = time, ExcursionsSchedule = excursionsSchedule, Id = excursionsSchedule.Id
                };
                guide.Excursions.Add(excursion);

                excursionsSchedule.Excursion = excursion;
                var customExcursion = new CustomExcursion()
                {
                    Guide = guide, StartTime = grafik.StartTime, Time = time, ExcursionsSchedule = excursionsSchedule
                };
                guide.CustomExcursion.Add(customExcursion);

                for (int j = 0; j < 10; j++)
                {
                    var customer = new Customer {
                        Name = "Tourist_" + j * (i + 1), Age = 20, CustomExcursions = customExcursion
                    };
                    customExcursion.Customers.Add(customer);
                    context.Customer.Add(customer);
                }
                excursionsSchedule.CustomExcursions.Add(customExcursion);
                context.Exposition.Add(exposition);
                context.Grafik.Add(grafik);
                context.ExcursionsSchedules.Add(excursionsSchedule);
                context.Guide.Add(guide);
                context.Excursion.Add(excursion);
                context.CustomExcursions.Add(customExcursion);
            }
            context.SaveChanges();;
        }