public GalleryDetailPageViewModel Get_GalleryDetail_Page(int id)
        {
            GalleryDetailPageViewModel vm_page = new GalleryDetailPageViewModel();

            GalleryDetailViewModel vm_gallery = new GalleryDetailViewModel();
            ArtGalleryViewModel    gallery    = DataLayer.get_ArtGallery_byID(id);

            vm_gallery.fa_title       = gallery.fa_title;
            vm_gallery.openning_hours = gallery.fromHour + " - " + gallery.toHour;
            vm_gallery.visit_from     = gallery.fromDate;
            vm_gallery.visit_to       = gallery.toDate;
            vm_gallery.description    = gallery.description;
            vm_gallery.poster_path    = "/Upload/gallery_" + id + "/poster.jpg";
            vm_gallery.GalleryId      = id;

            List <string> str_images = DataLayer.get_gallery_images(id);

            for (int i = 0; i < str_images.Count; i++)
            {
                str_images[i] = ("gallery_" + id + "/" + str_images[i]);
            }

            vm_page.accordion_detail = vm_gallery;
            vm_page.photos           = str_images;

            return(vm_page);
        }
示例#2
0
        public void Insert_New_ArtGallery(ArtGalleryViewModel vm)
        {
            tbl_art_gallery gallery;

            if (vm.GalleryId == 0)
            {
                gallery = new tbl_art_gallery()
                {
                    description   = vm.description,
                    title         = vm.fa_title,
                    english_title = vm.eng_title,
                    fromDate      = vm.fromDate,
                    toDate        = vm.toDate,
                    fromHour      = vm.fromHour,
                    toHour        = vm.toHour
                };
                db.tbl_art_gallery.Add(gallery);
            }
            else
            {
                gallery = db.tbl_art_gallery.Find(vm.GalleryId);

                if (gallery != null)
                {
                    gallery.description   = vm.description;
                    gallery.title         = vm.fa_title;
                    gallery.english_title = vm.eng_title;
                    gallery.fromDate      = vm.fromDate;
                    gallery.toDate        = vm.toDate;
                    gallery.fromHour      = vm.fromHour;
                    gallery.toHour        = vm.toHour;
                }
            }
            db.SaveChanges();
        }
        public GalleryDetailViewModel Get_PartialDetail(int id, Controller ctrl)
        {
            GalleryDetailViewModel vm = new GalleryDetailViewModel();

            ArtGalleryViewModel gallery = DataLayer.get_ArtGallery_byID(id);

            vm.fa_title       = gallery.fa_title;
            vm.eng_title      = gallery.eng_title;
            vm.openning_hours = gallery.fromHour + " - " + gallery.toHour;
            vm.visit_from     = "Opening Day : " + gallery.fromDate;
            vm.visit_to       = "Continues to : " + gallery.toDate;

            string poster_path = "/Upload/gallery_" + gallery.GalleryId + "/poster.jpg";

            if (File.Exists(ctrl.Server.MapPath(@poster_path)))
            {
                vm.poster_path = poster_path + "?" + DateTime.Now.ToString("ddMMyyyyhhmmsstt");
            }
            else
            {
                vm.poster_path = "/images/empty.gif?" + DateTime.Now.ToString("ddMMyyyyhhmmsstt");
            }


            return(vm);
        }
        public ArtGalleryViewModel Get_Delete_Gallery(int?id, Controller ctrl)
        {
            ArtGalleryViewModel vm = new ArtGalleryViewModel();

            vm.GalleryId   = id.HasValue ? id.Value : 0;
            vm.filter_page = Get_SearchPagination_Params(ctrl);
            return(vm);
        }
        public void Post_Delete_Gallery(ArtGalleryViewModel vm, Controller ctrl)
        {
            DataLayer.Delet_ArtGallery(vm.GalleryId);
            string gallery_dir = ctrl.Server.MapPath(@"~\Upload\gallery_" + vm.GalleryId);

            if (Directory.Exists(gallery_dir))
            {
                Directory.Delete(gallery_dir, true);
            }
        }
示例#6
0
        public ArtGalleryViewModel get_gallery_in_date(string dt)
        {
            ArtGalleryViewModel gallery = (from g in db.tbl_art_gallery
                                           where dt.CompareTo(g.toDate.Substring(g.toDate.Length - 10, 10)) <= 0 && dt.CompareTo(g.fromDate.Substring(g.fromDate.Length - 10, 10)) >= 0
                                           select new ArtGalleryViewModel()
            {
                GalleryId = g.ID,
                fa_title = g.title,
                eng_title = g.title,
                fromHour = g.fromHour,
                toHour = g.toHour,
                fromDate = g.fromDate,
                toDate = g.toDate,
                description = g.description
            }).FirstOrDefault();


            return(gallery);
        }
        /*********Website Area*******/
        public HomePageViewModel Get_HomePage()
        {
            ArtGalleryViewModel week_gallery       = DataLayer.get_gallery_in_date(get_today(0));
            ArtGalleryViewModel next_week_gallery  = DataLayer.get_gallery_in_date(get_today(7));
            ArtGalleryViewModel next_2week_gallery = DataLayer.get_gallery_in_date(get_today(14));
            ArtGalleryViewModel next_3week_gallery = DataLayer.get_gallery_in_date(get_today(21));

            List <ArtGalleryViewModel> lst_gallery = new List <ArtGalleryViewModel>();

            lst_gallery.Add(week_gallery);
            lst_gallery.Add(next_week_gallery);
            lst_gallery.Add(next_2week_gallery);
            lst_gallery.Add(next_3week_gallery);

            HomePageViewModel vm_page = new HomePageViewModel();

            vm_page.lst_current_gallery = lst_gallery;
            return(vm_page);
        }
示例#8
0
        public ArtGalleryViewModel get_ArtGallery_byID(int id)
        {
            ArtGalleryViewModel result = new ArtGalleryViewModel();

            tbl_art_gallery gallery = db.tbl_art_gallery.Find(id);

            if (gallery != null)
            {
                result.GalleryId   = id;
                result.fa_title    = gallery.title;
                result.description = gallery.description;
                result.eng_title   = gallery.english_title;
                result.fromDate    = gallery.fromDate;
                result.toDate      = gallery.toDate;
                result.fromHour    = gallery.fromHour;
                result.toHour      = gallery.toHour;
            }

            return(result);
        }
        public ArtGalleryViewModel Get_Insert_New_Gallery(int?id, Controller ctrl)
        {
            int gallery_id = id.HasValue ? id.Value : 0;

            ArtGalleryViewModel vm;

            if (gallery_id == 0)
            {
                vm          = new ArtGalleryViewModel();
                vm.fromHour = "16:00";
                vm.toHour   = "20:00";
            }
            else
            {
                vm = DataLayer.get_ArtGallery_byID(gallery_id);
            }

            vm.filter_page = Get_SearchPagination_Params(ctrl);

            return(vm);
        }
        public GalleryImagesViewModel Get_PartialPoster(int id, Controller ctrl)
        {
            GalleryImagesViewModel vm = new GalleryImagesViewModel();

            ArtGalleryViewModel gallery = DataLayer.get_ArtGallery_byID(id);

            vm.GalleryID   = id;
            vm.GalleryName = gallery.fa_title.Length > 50 ? (gallery.fa_title.Substring(0, 50) + "...") : gallery.fa_title;

            string poster_path = "/Upload/gallery_" + vm.GalleryID + "/poster.jpg";

            if (File.Exists(ctrl.Server.MapPath(@poster_path)))
            {
                vm.image_path = poster_path + "?" + DateTime.Now.ToString("ddMMyyyyhhmmsstt");
            }
            else
            {
                vm.image_path = "/images/empty.gif?" + DateTime.Now.ToString("ddMMyyyyhhmmsstt");
            }

            vm.filter_page = Get_SearchPagination_Params(ctrl);

            return(vm);
        }
 public void Post_Insert_New_Gallery(ArtGalleryViewModel vm)
 {
     DataLayer.Insert_New_ArtGallery(vm);
 }
 public ActionResult Delete_Gallery(ArtGalleryViewModel vm)
 {
     NegahenoService.Post_Delete_Gallery(vm, this);
     return(Json(new { page_index = vm.filter_page.page, filter = vm.filter_page.filter + "" }));
 }
        public ActionResult Delete_Gallery(int?id)
        {
            ArtGalleryViewModel vm = NegahenoService.Get_Delete_Gallery(id, this);

            return(PartialView("_PartialDeleteGallery", vm));
        }
 public ActionResult Insert_New_Gallery(ArtGalleryViewModel vm)
 {
     NegahenoService.Post_Insert_New_Gallery(vm);
     return(Json(new { page_index = vm.filter_page.page, filter = vm.filter_page.filter + "" }));
 }
        public ActionResult Insert_New_Gallery(int?id)
        {
            ArtGalleryViewModel vm = NegahenoService.Get_Insert_New_Gallery(id, this);

            return(PartialView("_PartialAddGallery", vm));
        }