public ActionResult EditReference()
 {
     if (RouteData.Values["id"] != null)
     {
         var languages = LanguageManager.GetLanguages();
         var list      = new SelectList(languages, "Culture", "Language");
         ViewBag.LanguageList = list;
         int  nid      = 0;
         bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
         if (isnumber)
         {
             ImageHelperNew.DestroyImageCashAndSession(169, 62);
             References editreference = ReferenceManager.GetReferenceById(nid);
             var        photos        = PhotoManager.GetList(4, nid);
             ViewBag.Photos = photos;
             return(View(editreference));
         }
         else
         {
             return(View());
         }
     }
     else
     {
         return(View());
     }
     return(View());
 }
Exemple #2
0
        private String SaveAsFile(HttpPostedFileBase file, String FileType)
        {
            var _tmpFileMapPath = Server.MapPath("~/Documents/");
            var _tmpFilePath    = ("/Documents/");
            var fileName        = FileType + Path.GetFileName(file.FileName);

            //large_image_path
            var large_image_path = Path.Combine(_tmpFileMapPath, fileName);

            if (System.IO.File.Exists(large_image_path))
            {
                System.IO.File.Delete(large_image_path);
            }
            file.SaveAs(large_image_path);

            //thambnail_image_path
            if (String.Equals(FileType, "Image"))
            {
                var thambnail_image_path = Path.Combine(_tmpFileMapPath, "thambnail" + fileName);
                if (System.IO.File.Exists(thambnail_image_path))
                {
                    System.IO.File.Delete(thambnail_image_path);
                }

                byte[] bitmap = PhotoManager.ResizeImage(file, 124, 110);
                using (Image image = Image.FromStream(new MemoryStream(bitmap)))
                {
                    image.Save(thambnail_image_path, ImageFormat.Png);  // Or Png
                }
            }

            return(Path.Combine(_tmpFilePath, fileName));
        }
Exemple #3
0
        public ActionResult PlayerCreate(Player player, string passwordConfirm, int CityID, HttpPostedFileBase photo)
        {
            //檢查確認密碼是否輸入正確
            if (passwordConfirm != player.Password)
            {
                ModelState["Password"].Errors.Add("輸入的密碼和確認密碼不相符");
            }
            //檢查帳號是否重複
            if (db.Players.Any(m => m.Account == player.Account))
            {
                ModelState["Account"].Errors.Add("此帳號已經有人使用");
            }
            //檢查帳號及密碼是否符合規則
            UsefulTools.RegisterValidate(player.Account, ModelState["Account"].Errors.Add, false, false);
            UsefulTools.RegisterValidate(player.Password, ModelState["Password"].Errors.Add, true, false);
            //填入預設值
            player.ID           = UsefulTools.GetNextID(db.Players, 2);
            player.Points       = 0;
            player.IsBanned     = false;
            player.IsEmailValid = false;

            if (ModelState.IsValid)
            {
                player.Password = Hash.PwdHash(player.Password);
                db.Players.Add(player);
                db.SaveChanges();
                //儲存圖片(先將photo變為陣列再傳入)
                PhotoManager.Create(player.ID, new HttpPostedFileBase[] { photo });

                return(RedirectToAction("EmailValidate", "EmailValidate", new { Email = player.Email, id = player.ID }));
            }
            ViewBag.CityID     = new SelectList(db.Cities, "ID", "CityName", CityID);
            ViewBag.DistrictID = new SelectList(db.Districts, "ID", "DistrictName", player.DistrictID);
            return(View(player));
        }
        public ActionResult Create(CreateGalleryItemViewModel model, HttpPostedFileBase image)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "In forms is error, please correct your data.");
                return(View());
            }
            if (image == null)
            {
                ModelState.AddModelError("", "Image isn't sended");
                return(View());
            }
            if (image.ContentLength == 0)
            {
                ModelState.AddModelError("", "Image isn't sended");
                return(View());
            }
            var galleryItem = new Gallery
            {
                Position      = model.Position,
                Image         = PhotoManager.GetBytes(image),
                ImageMimeType = image.ContentType
            };

            _repository.Add(galleryItem);
            _repository.Save();
            TempData["Message"] = "The gallery item has been added.";
            return(RedirectToAction("Manage", "Gallery"));
        }
    private void Start()
    {
        videoManager = GetComponent <VideoManager>();
        photoManager = GetComponent <PhotoManager>();

        #region Editor Testing -- Delete before roll out

        if (skybox)
        {
            ChangeSkybox(1);
            this.structure.SetActive(true);
        }
        if (video)
        {
            videoManager.ChangeVideo360("D:/Downloads/test.mp4");
            RenderSettings.skybox = this.visuals[0];
            this.structure.SetActive(false);
        }
        if (photo)
        {
            photoManager.ChangePhoto360("D:/Downloads/testphoto.jpg");
            RenderSettings.skybox = this.visuals[1];
            this.structure.SetActive(false);
        }
        #endregion
    }
Exemple #6
0
    protected void CancellaFotoGallery(object sender, ImageClickEventArgs e)
    {
        string idNews = Request.QueryString["NewsID"];

        DataSetVepAdminTableAdapters.AlbumsTableAdapter taAlbum = new DataSetVepAdminTableAdapters.AlbumsTableAdapter();
        DataTable dtAlbID = taAlbum.GetIdAlbum(int.Parse(idNews));

        if (dtAlbID.Rows.Count > 0)
        {
            string       albumID = dtAlbID.Rows[0]["AlbumID"].ToString();
            List <Photo> list    = new List <Photo>();
            list = PhotoManager.GetPhotos(int.Parse(albumID));
            for (int i = 0; i < list.Count; i++)
            {
                PhotoManager.RemovePhoto(list[i].AlbumID);
            }
            taAlbum.Delete(int.Parse(albumID));
            imgCancFotoG.Visible  = false;
            txtFotoGallery.Text   = "Nessun FotoAlbum associato";
            btnFotoAlbum.Text     = "ASSOCIA FotoAlbum";
            btnFotoAlbum.CssClass = "button green";
        }
        else
        {
            //messaggio notifica
        }
    }
Exemple #7
0
        public ActionResult Index()
        {
            var albums = PhotoManager.ZGetAlbums();
            List <List <Z.Album> > grpsOfAlbums = new List <List <Z.Album> >();
            List <Z.Album>         twoAlbums    = new List <Z.Album>();
            int i = 0;

            foreach (var a in albums)
            {
                twoAlbums.Add(a);
                i++;

                if ((i % 2) == 0)
                {
                    grpsOfAlbums.Add(twoAlbums);
                    twoAlbums = new List <Z.Album>();
                }
            }

            if ((i % 2) != 0)
            {
                grpsOfAlbums.Add(twoAlbums);
            }
            ViewResult v = View(grpsOfAlbums);

            return(v);
        }
Exemple #8
0
        public ActionResult AddImage(Photo newmodel, HttpPostedFileBase uploadfile, string language, string Title)
        {
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;

            Photo p = new Photo();

            if (Session["ModifiedImageId"] != null)
            {
                string imagename = "/Content/images/userfiles/news/" + Session["ModifiedImageId"].ToString();// +Session["WorkingImageExtension"].ToString();
                newmodel.Path = imagename + ".jpeg";
                ImageHelperNew.DestroyImageCashAndSession(0, 0);

                Helpers.ImageHelper.WaterMark(imagename, 100);
            }
            else
            {
                newmodel.Path = "/Content/images/front/noimage.jpeg";
            }

            p.CategoryId  = (int)PhotoTypes.Gallery;
            p.Title       = Title;
            p.Language    = language;
            p.Online      = true;
            p.SortOrder   = 9999;
            p.TimeCreated = DateTime.Now;
            p.Path        = newmodel.Path;

            ViewBag.ProcessMessage = PhotoManager.Save(p);

            return(View());
        }
        public ActionResult Edit(EditGalleryItemViewModel model, HttpPostedFileBase image)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "In forms is error, please correct your data.");
                return(View());
            }
            var galleryItem = new Gallery
            {
                Id       = model.Id,
                Position = model.Position
            };

            if (image != null)
            {
                galleryItem.Image         = PhotoManager.GetBytes(image);
                galleryItem.ImageMimeType = image.ContentType;
            }
            else
            {
                galleryItem.Image         = model.Image;
                galleryItem.ImageMimeType = model.ImageMimeType;
            }
            _repository.Update(galleryItem);
            _repository.Save();
            TempData["Message"] = "The gallery item has been changed.";
            return(RedirectToAction("Manage", "Gallery"));
        }
Exemple #10
0
        public ActionResult PlayerDelete(string playerID)
        {
            Player p = db.Players.Find(playerID);

            //刪除桌遊評論
            p.TableGameComments.ToList().ForEach(m => db.TableGameComments.Remove(m));
            //刪除相關圖片
            PhotoManager.Delete(playerID);
            //刪除優惠券明細
            p.PlayerCouponDetails.ToList().ForEach(m => db.PlayerCouponDetails.Remove(m));
            //刪除點數明細
            p.PlayerPointDetails.ToList().ForEach(m => db.PlayerPointDetails.Remove(m));
            //刪除揪桌人員明細
            p.TeamsForOtherPlayer.ToList().ForEach(m => m.OtherPlayers.Remove(p));
            //刪除揪桌主檔
            p.TeamsForLeader.ToList().ForEach(m =>
            {
                //先刪除該桌的訊息
                m.Messages.ToList().ForEach(n => db.Messages.Remove(n));
                db.Teams.Remove(m);
            });
            //刪除玩家本身
            db.Players.Remove(p);
            db.SaveChanges();
            return(RedirectToAction("PlayerIndex"));
        }
 static AlbumsPage()
 {
     foreach (var a in PhotoManager.GetAllAlbums())
     {
         hashAlbums.Add(a);
     }
 }
Exemple #12
0
    void OnSelect()
    {
        //MediaCapturePanelManager mc = this.gameObject.GetComponentInParent<MediaCapturePanelManager>();
        //mc.mediaMode = "photo";
        if (!isTakingPhoto)

        {
            foreach (MeshRenderer m in mr)
            {
                m.enabled = false;
            }

            isTakingPhoto = true;
            GameObject photoMessageObject;
            photoMessageObject = (GameObject)Instantiate(photoCaptureMessage, new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, Camera.main.transform.position.z + 2f), Quaternion.identity);
            photoMessageObject.AddComponent <Billboard>();
            Destroy(photoMessageObject, 2f);
            GestureManager.Instance.OverrideFocusedObject = gameObject;

            //Change cursor
        }
        else
        {
            isTakingPhoto = false;
            PhotoManager photoManager = new PhotoManager();
            photoManager.TakePhoto();
            foreach (MeshRenderer m in mr)
            {
                m.enabled = true;
            }
            GestureManager.Instance.OverrideFocusedObject = null;
        }

        //
    }
Exemple #13
0
        public ActionResult Edit(BeneficiaryViewModel beneficiaryViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            HttpPostedFileBase hasbandphoto = Request.Files["imgupload1"];
            HttpPostedFileBase wifephoto    = Request.Files["imgupload2"];
            //var beniMaster = _benificiaryService.GetBenificiaryById(beneficiaryViewModel.BeneficiaryId);
            var    user   = Session["UserDetails"] as UserViewModel;
            string hphoto = PhotoManager.savePhoto(hasbandphoto, 0, "Benificiary");
            string wphoto = PhotoManager.savePhoto(wifephoto, 0, "Benificiary");

            beneficiaryViewModel.Hasband_Photo = hphoto; //PhotoManager.ConvertToBytes(hasbandphoto);
            beneficiaryViewModel.Wife_Photo    = wphoto; //PhotoManager.ConvertToBytes(wifephoto);
            beneficiaryViewModel.ModifiedBy    = user.UserName;
            beneficiaryViewModel.ModifiedDate  = DateTime.Now;
            beneficiaryViewModel.CityId        = user.CityId;

            var beniMaster = Mapper.BeneficiaryMapper.Attach(beneficiaryViewModel);

            _benificiaryService.Update(beniMaster);
            _benificiaryService.SaveChanges();

            ViewBag.Message = "sussess message";
            return(RedirectToAction("Index"));
        }
Exemple #14
0
        //顯示單個桌遊詳細內容
        public ActionResult ShowTableGameDetail(string tableGameID)
        {
            //將此桌遊的相關連結傳入ViewBag
            ViewBag.relevantLinks = db.RelevantLinks.Where(m => m.TableGameID == tableGameID).ToList();
            //將此桌遊的圖片數量傳入ViewBag
            ViewBag.photoIDList = PhotoManager.GetPhotoIDList(tableGameID);
            //新增一筆桌遊閱覽紀錄(每月至多紀錄一筆)
            var statistic = db.TableGameVisitedStatistics.ToList().Where(s => s.VisitedDate.ToString("yyyy/MM") == DateTime.Today.ToString("yyyy/MM")).FirstOrDefault();

            if (statistic == null)
            {
                db.TableGameVisitedStatistics.Add(new TableGameVisitedStatistic
                {
                    VisitedDate = DateTime.Today,
                    Clicks      = 1,
                    TableGameID = tableGameID
                });
            }
            else
            {
                statistic.Clicks++;
            }
            db.SaveChanges();
            return(View(db.TableGames.Find(tableGameID)));
        }
Exemple #15
0
        public ActionResult Edit()
        {
            ImageHelperNew.DestroyImageCashAndSession(697, 410);
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;
            if (RouteData.Values["id"] != null)
            {
                int  nid      = 0;
                bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                if (isnumber)
                {
                    Photo editPhoto = PhotoManager.GetById(nid);
                    return(View(editPhoto));
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }
Exemple #16
0
        public ActionResult Add(Photo newmodel, HttpPostedFileBase uploadfile, string language)
        {
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;

            if (ModelState.IsValid)
            {
                if (Session["ModifiedImageId"] != null)
                {
                    newmodel.Path = "/Content/images/userfiles/news/" + Session["ModifiedImageId"].ToString() + Session["WorkingImageExtension"].ToString();
                    ImageHelperNew.DestroyImageCashAndSession(0, 0);
                }
                else
                {
                    newmodel.Path = "/Content/images/front/noimage.jpeg";
                }
                newmodel.Language      = language;
                newmodel.Online        = true;
                newmodel.SortOrder     = 9999;
                newmodel.TimeCreated   = DateTime.Now;
                ViewBag.ProcessMessage = PhotoManager.Save(newmodel);
                ModelState.Clear();
                // Response.Redirect("/yonetim/haberduzenle/" + newsmodel.NewsId);
                return(View());
            }
            else
            {
                return(View());
            }
        }
Exemple #17
0
        public ActionResult Index()
        {
            string lang   = FillLanguagesList();
            var    photos = PhotoManager.GetList(lang, 0);

            return(View(photos));
        }
 void Awake()
 {
     Instance       = this;
     LOADED         = false;
     filterSelector = filter.SMA;
     Initialize();
 }
Exemple #19
0
        public static void DeletePhotos(string[] photoNames, int serverId, int playerId)
        {
            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 0; i < photoNames.Length; i++)
            {
                if (!string.IsNullOrEmpty(photoNames[i]))
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.Append(":");
                    }
                    stringBuilder.Append(photoNames[i]);
                }
            }
            if (stringBuilder.Length == 0)
            {
                return;
            }
            string text = Path.Combine(Application.persistentDataPath, "photos");

            if (!Directory.Exists(text))
            {
                Directory.CreateDirectory(text);
            }
            PhotoManager.GetInstance().ExePhotoForDelete(stringBuilder.ToString(), text, serverId, playerId);
        }
Exemple #20
0
        public ActionResult EditProduct(int id = 0)
        {
            web.Areas.Admin.Models.VMProductGroupModel grouplist = new Models.VMProductGroupModel();
            grouplist.ProductGroup = ProductManager.GetProductGroupList("tr");
            ProductAddModel model = new ProductAddModel();

            model.VMProductGroupModel = grouplist;

            if (RouteData.Values["id"] != null)
            {
                ViewBag.SaveResult = true;
                ViewBag.ProductId  = id;

                Product prt = ProductManager.GetProductById(id);
                ViewBag.CategoryId = prt.ProductGroupId;
                model.Product      = prt;
                ViewBag.lang       = prt.Language;
            }
            else
            {
                ViewBag.SaveResult = false;
            }

            var photos = PhotoManager.GetList(11, id);

            ViewBag.Photos            = photos;
            model.VMProductGroupModel = grouplist;
            //      ViewBag.Groups = grouplist;
            return(View(model));
        }
Exemple #21
0
        public ActionResult MgShopCreate(Shop shop, HttpPostedFileBase[] photos)
        {
            //檢查帳號是否重複
            if (db.Shops.Any(m => m.Account == shop.Account))
            {
                ModelState["Account"].Errors.Add("此帳號已經有人使用");
            }
            //驗證帳號密碼是否符合規則
            UsefulTools.RegisterValidate(shop.Account, ModelState["Account"].Errors.Add, false, false);
            UsefulTools.RegisterValidate(shop.Password, ModelState["Password"].Errors.Add, true, true);

            if (ModelState.IsValid)
            {
                //填入必要資料
                shop.ID               = UsefulTools.GetNextID(db.Shops, 1);
                shop.Password         = Hash.PwdHash(shop.Password);
                shop.AccumulatedHours = 0;
                db.Shops.Add(shop);
                db.SaveChanges();

                //添加圖片
                PhotoManager.Create(shop.ID, photos);

                return(RedirectToAction("ShopIndex"));
            }
            ViewBag.DistrictID = new SelectList(db.Districts, "ID", "DistrictName");
            ViewBag.CityID     = new SelectList(db.Cities, "ID", "CityName", db.Districts.Find(shop.DistrictID).CityID);
            ViewBag.AreaScale  = new SelectList(new[]
            {
                new { Option = "大" },
                new { Option = "中" },
                new { Option = "小" }
            }, "Option", "Option");
            return(View(shop));
        }
Exemple #22
0
        public ActionResult ShopDelete(string id)
        {
            Shop s = db.Shops.Find(id);

            //刪除該店家的圖片
            PhotoManager.Delete(id);
            //刪除店內桌遊明細
            db.TableGameInShopDetails.RemoveRange(s.TableGameInShopDetails);
            //刪除一般優惠(活動)
            db.NormalOffers.RemoveRange(s.NormalOffers);
            //刪除優惠券主檔及其明細
            s.Coupons.ToList().ForEach(m => db.PlayerCouponDetails.RemoveRange(m.PlayerCouponDetails));
            db.Coupons.RemoveRange(s.Coupons);
            //刪除揪桌主檔及其相關資料
            foreach (Team t in s.Teams)
            {
                t.OtherPlayers.Clear();
                db.Messages.RemoveRange(t.Messages);
            }
            db.Teams.RemoveRange(s.Teams);
            //最後再刪除店家本身
            db.Shops.Remove(s);
            db.SaveChanges();

            return(RedirectToAction("ShopIndex"));
        }
        public ActionResult Create([Bind(Exclude = "Positions,MenuCategories")] CreateDishViewModel model,
                                   HttpPostedFileBase photo)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "In forms is error, please correct your data.");
                return(View());
            }
            var  menuCategory = _menuCatRep.GetByName(model.MenuCategoryName);
            Dish dish         = new Dish()
            {
                Description = model.Description,
                Name        = model.Name,
                Position    = model.Position,
                Price       = model.Price,
                MenuCatId   = menuCategory.Id
            };

            if (photo != null)
            {
                dish.Photo         = PhotoManager.GetBytes(photo);
                dish.PhotoMimeType = photo.ContentType;
            }
            _repository.Add(dish);
            _repository.Save();
            TempData["Message"] = "New dish:" + dish.Name + " has been added.";
            return(RedirectToAction("Manage", "Dish"));
        }
Exemple #24
0
        public ActionResult ShopEditForStore()
        {
            string shopID = Session["ShopID"].ToString();

            if (shopID == null)
            {
                return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
            }
            var shop = db.Shops.Find(shopID);

            ViewBag.CityID      = new SelectList(db.Cities, "ID", "CityName", shop.District.CityID);
            ViewBag.DistrictID  = new SelectList(db.Districts, "ID", "DistrictName", shop.DistrictID);
            ViewBag.photoIDList = PhotoManager.GetPhotoIDList(shopID);
            ViewBag.AreaScale   = new SelectList(new List <SelectListItem> {
                new SelectListItem {
                    Text = "大", Value = "大"
                },
                new SelectListItem {
                    Text = "中", Value = "中"
                },
                new SelectListItem {
                    Text = "小", Value = "小"
                }
            }, "Value", "Text", shop.AreaScale);
            TempData["Shop_ID"] = shopID;
            return(View(db.Shops.Find(shopID)));
        }
Exemple #25
0
        public ActionResult Index(FormCollection form)
        {
            string caption  = Request.Form["Title"];
            bool   isPublic = false;

            if (Request.Form["IsPublic"] == "on")
            {
                isPublic = true;
            }

            try
            {
                PhotoManager.ZAddAlbum(caption, isPublic);
                return(RedirectToAction("Index"));
            }
            catch
            {
                var a = new Z.Album()
                {
                    Caption = caption, IsPublic = isPublic
                };
                foreach (var e in a.GetRuleViolations())
                {
                    ModelState.AddModelError(e.TagName, e.ErrorMessage);
                    //e.PropertyName, is the name of the relevant Html input tag
                }
                if (!a.IsValid)
                {
                    //ModelState.AddModelError("_FORM", "Generic Form Error");
                }

                var albums = PhotoManager.GetAlbums();
                return(View(albums));
            }
        }
 public ActionResult Edit([Bind(Exclude = "Positions,MenuCategories")] EditDishViewModel model,
                          HttpPostedFileBase photo)
 {
     if (ModelState.IsValid)
     {
         var  menuCategory = _menuCatRep.GetByName(model.MenuCategoryName);
         Dish dish         = new Dish
         {
             Id          = model.DishID,
             Description = model.Description,
             Name        = model.Name,
             Price       = model.Price,
             Position    = model.Position,
             MenuCatId   = menuCategory.Id
         };
         if (photo != null)
         {
             dish.Photo         = PhotoManager.GetBytes(photo);
             dish.PhotoMimeType = photo.ContentType;
         }
         else
         {
             dish.PhotoMimeType = model.PhotoMimeType;
             dish.Photo         = model.Photo;
         }
         _repository.Update(dish);
         _repository.Save();
         TempData["Message"] = "The dish: " + model.Name + " has been changed.";
         return(RedirectToAction("Manage", "Dish"));
     }
     ModelState.AddModelError("", "Model is not valid.");
     return(View());
 }
Exemple #27
0
 private void Subscribe()
 {
     GameController.Interact += ConditionallyTriggerEvent;
     photoManager = GameObject.Find("PhotoManager").GetComponent<PhotoManager>();
     gameController = GameObject.Find("GameController").GetComponent<GameController>();
     activeMusic = new List<AudioSource>();
 }
Exemple #28
0
 // Use this for initialization
 void Start()
 {
     pm    = PhotoManager.Instance;
     myBar = gameObject;
     if (myBar.name == "XAxisBar")
     {
         otherBar1 = GameObject.Find("YAxisBar");
         otherBar2 = GameObject.Find("ZAxisBar");
         otherBar3 = GameObject.Find("SAxisBar");
         zSlider   = otherBar2.transform.Find("ZSlider").gameObject;
     }
     else if (myBar.name == "YAxisBar")
     {
         otherBar1 = GameObject.Find("XAxisBar");
         otherBar2 = GameObject.Find("ZAxisBar");
         otherBar3 = GameObject.Find("SAxisBar");
         zSlider   = otherBar2.transform.Find("ZSlider").gameObject;
     }
     else if (myBar.name == "ZAxisBar")
     {
         otherBar1 = GameObject.Find("XAxisBar");
         otherBar2 = GameObject.Find("YAxisBar");
         otherBar3 = GameObject.Find("SAxisBar");
         zSlider   = myBar.transform.Find("ZSlider").gameObject;
     }
     else if (myBar.name == "SAxisBar")
     {
         otherBar1 = GameObject.Find("XAxisBar");
         otherBar2 = GameObject.Find("YAxisBar");
         otherBar3 = GameObject.Find("ZAxisBar");
         zSlider   = otherBar3.transform.Find("ZSlider").gameObject;
     }
 }
Exemple #29
0
        public ActionResult EditService()
        {
            FillLanguagesList();

            if (RouteData.Values["id"] != null)
            {
                int  nid      = 0;
                bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                if (isnumber)
                {
                    Service editrecord = ServiceManager.GetServiceById(nid);
                    var     photos     = PhotoManager.GetList(5, nid);
                    ViewBag.Photos = photos;
                    return(View(editrecord));
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }
        // DELETE: api/UserProfileLog/5
        public void Delete(int id)
        {
            var userProfileId = Helper_Classes.UserHelpers.GetUserProfile().Id;
            //var userCheck = _context.UserProfiles.Include(m=>m.UserProgressLog).SingleOrDefault(m=>m.);
            var progressLogInDb = _context.UserProgressLogs.SingleOrDefault(c => c.Id == id && c.UserProfileId == userProfileId);

            if (progressLogInDb == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            var userPhotoId = progressLogInDb.UserPhotoId;



            _context.UserProgressLogs.Remove(progressLogInDb);
            _context.SaveChanges();

            if (userPhotoId != null)
            {
                var photoManager = new PhotoManager();
                photoManager.DeletePhotoFromDb((int)userPhotoId);
                _context.SaveChanges();
            }
        }
Exemple #31
0
	void Awake(){
		instance = this;
		for(int i=0; i<imageCache.Length; i++){
			imageCache[i] = new ImageByID();
		}
	}
Exemple #32
0
    protected void AddNewPhotoButton_Click(object sender, ImageClickEventArgs e)
    {
        string name = "";

        #region ValidarConFoto

        if (((FileUpload)FormView1.FindControl("PhotoFile")).FileBytes.Length > 0)
        {
            DirectoryInfo d = new DirectoryInfo(((FileUpload)FormView1.FindControl("PhotoFile")).PostedFile.FileName.Replace(((FileUpload)FormView1.FindControl("PhotoFile")).FileName, ""));
            name = ((FileUpload)FormView1.FindControl("PhotoFile")).PostedFile.FileName;

            FileInfo f = new FileInfo(((FileUpload)FormView1.FindControl("PhotoFile")).PostedFile.FileName);
            byte[] buffer = new byte[((FileUpload)FormView1.FindControl("PhotoFile")).FileBytes.Length];
            f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);

            Photo objPhoto = new Photo();
            PhotoManager objPhotoManager = new PhotoManager();
            //objPhoto = (Photo)FormView1.DataItem;
        #region AsignarVariablesPhoto
            // objPhoto.PhotoID = (TextBox)FormView1.FindControl("txtPhotoID");
            objPhoto.Caption = ((TextBox)FormView1.FindControl("txtCaption")).Text;
            objPhoto.Categoria = ((TextBox)FormView1.FindControl("txtCategoria")).Text;
            objPhoto.CodigoProducto = ((TextBox)FormView1.FindControl("txtCodigoProducto")).Text;
            objPhoto.CodigoFabricante = ((TextBox)FormView1.FindControl("txtCodigoFabricante")).Text;
            objPhoto.NombreComercial = ((TextBox)FormView1.FindControl("txtNombreComercial")).Text;
            objPhoto.Descripcion = ((TextBox)FormView1.FindControl("txtDescripcion")).Text;
            objPhoto.Presentacion = ((TextBox)FormView1.FindControl("txtPresentacion")).Text;
            objPhoto.PartidaArancelaria = ((TextBox)FormView1.FindControl("txtPartidaArancelaria")).Text;
            objPhoto.PrecioCompra = ((TextBox)FormView1.FindControl("txtPrecioCompra")).Text;
            objPhoto.PrecioVenta = ((TextBox)FormView1.FindControl("txtPrecioVenta")).Text;
            objPhoto.CostoEnvioProm = ((TextBox)FormView1.FindControl("txtCostoEnvioProm")).Text;
            objPhoto.Tamanio = ((TextBox)FormView1.FindControl("txtTamanio")).Text;
            objPhoto.Peso = ((TextBox)FormView1.FindControl("txtPeso")).Text;
            objPhoto.TipoEmpaque = ((TextBox)FormView1.FindControl("txtTipoEmpaque")).Text;
            objPhoto.Historia = ((TextBox)FormView1.FindControl("txtHistoria")).Text;
            objPhoto.Material = ((TextBox)FormView1.FindControl("txtMaterial")).Text;
            objPhoto.Tecnica = ((TextBox)FormView1.FindControl("txtTecnica")).Text;
        #endregion

            #region ConFoto

            objPhotoManager.AddPhoto(
                Convert.ToInt32(Request.QueryString["AlbumID"]),
                objPhoto.Caption,
              buffer,
              objPhoto.Categoria,
              objPhoto.CodigoProducto,
              objPhoto.CodigoFabricante,
              objPhoto.NombreComercial,
              objPhoto.Descripcion,
              objPhoto.Presentacion,
              objPhoto.PartidaArancelaria,
              objPhoto.PrecioCompra,
              objPhoto.PrecioVenta,
              objPhoto.CostoEnvioProm,
              objPhoto.Tamanio,
              objPhoto.Peso,
              objPhoto.TipoEmpaque,
              objPhoto.Historia,
              objPhoto.Material,
              objPhoto.Tecnica

               );

            #endregion

        }
        #endregion
        #region SinFoto
        else
        {

            Photo objPhoto = new Photo();
            PhotoManager objPhotoManager = new PhotoManager();
            objPhoto.Caption = ((TextBox)FormView1.FindControl("txtCaption")).Text;
            objPhoto.Categoria = ((TextBox)FormView1.FindControl("txtCategoria")).Text;
            objPhoto.CodigoProducto = ((TextBox)FormView1.FindControl("txtCodigoProducto")).Text;
            objPhoto.CodigoFabricante = ((TextBox)FormView1.FindControl("txtCodigoFabricante")).Text;
            objPhoto.NombreComercial = ((TextBox)FormView1.FindControl("txtNombreComercial")).Text;
            objPhoto.Descripcion = ((TextBox)FormView1.FindControl("txtDescripcion")).Text;
            objPhoto.Presentacion = ((TextBox)FormView1.FindControl("txtPresentacion")).Text;
            objPhoto.PartidaArancelaria = ((TextBox)FormView1.FindControl("txtPartidaArancelaria")).Text;
            objPhoto.PrecioCompra = ((TextBox)FormView1.FindControl("txtPrecioCompra")).Text;
            objPhoto.PrecioVenta = ((TextBox)FormView1.FindControl("txtPrecioVenta")).Text;
            objPhoto.CostoEnvioProm = ((TextBox)FormView1.FindControl("txtCostoEnvioProm")).Text;
            objPhoto.Tamanio = ((TextBox)FormView1.FindControl("txtTamanio")).Text;
            objPhoto.Peso = ((TextBox)FormView1.FindControl("txtPeso")).Text;
            objPhoto.TipoEmpaque = ((TextBox)FormView1.FindControl("txtTipoEmpaque")).Text;
            objPhoto.Historia = ((TextBox)FormView1.FindControl("txtHistoria")).Text;
            objPhoto.Material = ((TextBox)FormView1.FindControl("txtMaterial")).Text;
            objPhoto.Tecnica = ((TextBox)FormView1.FindControl("txtTecnica")).Text;

            #region SinFoto

            FileInfo f = new FileInfo(Server.MapPath("~/Images") + "\\" + "resume-photo.jpg");
            byte[] buffer = new byte[f.Length];

            f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);

            objPhotoManager.AddPhoto(
                Convert.ToInt32(Request.QueryString["AlbumID"]),
              objPhoto.Caption,
              buffer,
              objPhoto.Categoria,
              objPhoto.CodigoProducto,
              objPhoto.CodigoFabricante,
              objPhoto.NombreComercial,
              objPhoto.Descripcion,
              objPhoto.Presentacion,
              objPhoto.PartidaArancelaria,
              objPhoto.PrecioCompra,
              objPhoto.PrecioVenta,
              objPhoto.CostoEnvioProm,
              objPhoto.Tamanio,
              objPhoto.Peso,
              objPhoto.TipoEmpaque,
              objPhoto.Historia,
              objPhoto.Material,
              objPhoto.Tecnica

               );

            #endregion
        }

        #endregion

        ((Label)(FormView1.FindControl("lblMensaje"))).Text = "Se guarda adicion";
        GridView1.DataBind();
    }
    protected void AlbumPhotoAdditionFacebookWallPost()
    {
        string tributeHome;
        string photoAlbumUrl;
        string photoUrlBase;
        if (TributesPortal.Utilities.WebConfig.ApplicationMode.Equals("local"))
        {
            tributeHome = Session["APP_PATH"] + _tributeUrl;
        }
        else
        {
            tributeHome = "http://" + _tributeType.Replace("New Baby", "newbaby").ToLower() + "." +
            WebConfig.TopLevelDomain + "/" + _tributeUrl;
        }
        tributeHome += "/";
        photoAlbumUrl = tributeHome + "photoalbum.aspx";
        photoUrlBase = tributeHome + "photo.aspx";

        string query_string = string.Empty;
        if (TributesPortal.Utilities.WebConfig.ApplicationMode.Equals("local"))
        {
            query_string = "?TributeType=" + HttpUtility.UrlEncode(_tributeType);
            photoAlbumUrl = photoAlbumUrl + query_string;
            tributeHome = tributeHome + query_string;
            photoUrlBase = photoUrlBase + query_string;
        }
        aTributeHome.HRef = tributeHome;

        StateManager objStateManager = StateManager.Instance;
        if (Request.QueryString["post_on_facebook"] != null)
        {
            if (Request.QueryString["post_on_facebook"].ToString().Equals("True"))
            {
                int _newPhotoAlbumID = _photoAlbumID;
                if (objStateManager.Get("NewPhotoAlbumId", StateManager.State.Session) != null)
                {
                    _newPhotoAlbumID = int.Parse(objStateManager.Get("NewPhotoAlbumId", StateManager.State.Session).ToString());
                }
                Photos objPhoto = new Photos();
                objPhoto.PhotoAlbumId = _newPhotoAlbumID;
                objPhoto.PageNumber = 1;
                objPhoto.PageSize = 3;
                objPhoto.SortOrder = "desc";

            PhotoAlbum objAlbumDetails = null;
            PhotoManager mgr = new PhotoManager();
            objAlbumDetails = mgr.GetPhotoAlbumDetail(objPhoto);

            string[] getPath = CommonUtilities.GetPath();
            List<Photos> objPhotoList = mgr.GetPhotos(objPhoto);

            photoAlbumUrl += (photoAlbumUrl.Contains("?") ? "&" : "?") + "PhotoAlbumId=" + _newPhotoAlbumID.ToString();

            StringBuilder sb = new StringBuilder();
            sb.Append("<script type=\"text/javascript\">\n");
            sb.Append("$(document).addEvent('fb_connected', function() {\n");
            sb.Append("    var attachments = {\n");
            sb.Append("        name: '");
            sb.Append(string.Format("{0} added photos to the: {1} {2} Tribute", _userName, _tributeName, _tributeType));
            sb.Append("',\n");
            sb.Append("        href: '");
            sb.Append(photoAlbumUrl);
            sb.Append("',\n");
            sb.Append("        caption: '<b>Website:</b> ");
            sb.Append(tributeHome);
            sb.Append("',\n");
            sb.Append("        description: '<b>Photo Album:</b> ");
            sb.Append(objAlbumDetails.PhotoAlbumCaption);
            sb.Append("',\n");
            sb.Append("        media: [\n");
            foreach (Photos obj in objPhotoList)
            {
                if (_tributeType != null)
                {
                    // in my Common\\XML\\PhotoConfiguration.xml file getPath[2] already ends with '/'
                    obj.PhotoImage = getPath[2] + getPath[3] + "/" + _tributeUrl.Replace(" ", "_") + "_" + _tributeType.Replace(" ", "_") + "/" + obj.PhotoImage;

                    string photoUrl = photoUrlBase + (photoUrlBase.Contains("?") ? "&" : "?") +
                        "PhotoId=" + obj.PhotoId.ToString();

                    sb.Append("{type: 'image', href: '");
                    sb.Append(photoUrl);
                    sb.Append("', src: '");
                    sb.Append(obj.PhotoImage);
                    sb.Append("'}");
                    sb.Append(",");
                }
            }
            if (objPhotoList.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            sb.Append("               ]\n");
            sb.Append("    };\n");
            sb.Append("    var action_link = [{\n");
            sb.Append("        text: '");
            sb.Append(string.Format("Visit {0} Tribute", _tributeType));
            sb.Append("',\n");
            sb.Append("        href: '");
            sb.Append(photoAlbumUrl);
            sb.Append("'\n");
            sb.Append("    }]\n");
            sb.Append("    publish_stream('', attachments, action_link, null, null, function() {});");
            sb.Append("});\n");
            sb.Append("</script>");

                ClientScript.RegisterStartupScript(GetType(), "facebook_wall_post", sb.ToString());
            }
        }
    }
Exemple #34
0
    protected void Button1_Click(object sender, ImageClickEventArgs e)
    {
        int seq = 0;
        seq = int.Parse(((TextBox)FormView1.FindControl("txtSecuencia")).Text);
        PhotoManager objPhotoManager = new PhotoManager();

        DirectoryInfo d = new DirectoryInfo(Server.MapPath("~/Upload"));
        foreach (FileInfo f in d.GetFiles("*.jpg"))
        {
            byte[] buffer = new byte[f.OpenRead().Length];
            f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);
            objPhotoManager.AddPhoto(
                Convert.ToInt32(Request.QueryString["AlbumID"])
                , f.Name
                , buffer
                , ((TextBox)FormView1.FindControl("txtCategoria")).Text
                , ((TextBox)FormView1.FindControl("txtCodigoProducto")).Text + AutocompletarCerosIzquierda(seq) + (string)(seq.ToString())
                , ((TextBox)FormView1.FindControl("txtCodigoFabricante")).Text
                , ((TextBox)FormView1.FindControl("txtNombreComercial")).Text
                , ((TextBox)FormView1.FindControl("txtDescripcion")).Text
                , ((TextBox)FormView1.FindControl("txtPresentacion")).Text
                , ((TextBox)FormView1.FindControl("txtPartidaArancelaria")).Text
                , ((TextBox)FormView1.FindControl("txtPrecioCompra")).Text
                , ((TextBox)FormView1.FindControl("txtPrecioVenta")).Text
                , ((TextBox)FormView1.FindControl("txtCostoEnvioProm")).Text
                , ((TextBox)FormView1.FindControl("txtTamanio")).Text
                , ((TextBox)FormView1.FindControl("txtPeso")).Text
                , ((TextBox)FormView1.FindControl("txtTipoEmpaque")).Text
                , ((TextBox)FormView1.FindControl("txtHistoria")).Text
                , ((TextBox)FormView1.FindControl("txtMaterial")).Text
                , ((TextBox)FormView1.FindControl("txtTecnica")).Text

                );
            seq = seq + 1;
        }
        GridView1.DataBind();
        lblMensajeMasivo.Text = "Se guardo Correctamente Masivo";
        UploadList.DataBind();
    }