public ContactPageInfoSnippit(ContactPortraitSnippit para_portraitSnippit, string para_shortDescription, PhotoAlbum para_photoAlbum) { portraitSnippit = para_portraitSnippit; shortDescription = para_shortDescription; photoAlbum = para_photoAlbum; }
public ActionResult Create() { var photoAlbum = new PhotoAlbum(); foreach (var culture in SupportedCulture.GetList()) photoAlbum.PhotoAlbums_Locale.Add(new PhotoAlbum_Locale() { Culture = culture }); return View(photoAlbum); }
public static PhotoAlbum GetData() { PhotoAlbum photoAlbum = new PhotoAlbum("Album 1"); photoAlbum.AddPhoto(new Photo("Photo 1")); photoAlbum.AddPhoto(new Photo("Photo 2")); photoAlbum.AddPhoto(new Photo("Photo 3")); return photoAlbum; }
public static PhotoAlbum GetProxyData() { PhotoAlbum photoAlbum = new PhotoAlbum("Album 2 (Proxy)"); photoAlbum.AddPhoto(new PhotoProxy("Proxy Photo 1")); photoAlbum.AddPhoto(new PhotoProxy("Proxy Photo 2")); photoAlbum.AddPhoto(new PhotoProxy("Proxy Photo 3")); return photoAlbum; }
public ContactSlot(int para_charID, CharacterStatus para_status, int para_numBioSectionsUnlocked, List<DifficultyMetaData> para_associatedDifficulties) { characterID = para_charID; status = para_status; numBioSectionsUnlocked = para_numBioSectionsUnlocked; album= new PhotoAlbum(para_charID,para_associatedDifficulties); enc = null; }
public void DetailsView1_InsertItem() { PhotoAlbum photoAlbum = new PhotoAlbum(); TryUpdateModel(photoAlbum); if (ModelState.IsValid) { using (var myEntities = new PlanetWroxEntities()) { myEntities.PhotoAlbums.Add(photoAlbum); myEntities.SaveChanges(); } Response.Redirect(string.Format("ManagePhotoAlbum?PhotoAlbumId={0}", photoAlbum.Id.ToString())); } }
public PhotoAlbum GetAccountPhotoAlbumByTitle(int account, string title) { PhotoAlbum result; try { result = this.db.PhotoAlbums.Single((PhotoAlbum a) => a.AccountId == account && a.Title == title); } catch (Exception) { result = new PhotoAlbum { PhotoAlbumId = -1 }; } return result; }
public void init(PhotoAlbum para_albumData, Sprite[] para_photoCompletionIcons,ProgressScript c) { control = c; //Debug.Log("START ALBUM"); contentsPageChild = transform.FindChild("PhotoAlbum_Contents"); photoPageChild = transform.FindChild("PhotoAlbum_PhotoPage"); Rect contentsAreaGUIBounds = WorldSpawnHelper.getWorldToGUIBounds(contentsPageChild.FindChild("ContentsScrollArea").renderer.bounds,new bool[]{false,true,false}); templateContentsRow = new Rect(0,0,contentsAreaGUIBounds.width,contentsAreaGUIBounds.height / (3.5f)); templateContentsRowText = new Rect(0,0,templateContentsRow.width * 0.75f,templateContentsRow.height); templateContentsRowImg = new Rect(templateContentsRow.width * 0.7f,templateContentsRow.height * 0.1f,templateContentsRow.width * 0.25f,templateContentsRow.height - (2 * (templateContentsRow.height * 0.1f))); album = para_albumData; availablePhotoPages = album.getAllAvailablePages(); photoCompletionIcons = para_photoCompletionIcons; displayContentsView(); }
public ActionResult Create(PhotoAlbum photoAlbum, IList<PhotoAlbum_Locale> locales) { foreach (var locale in locales) locale.PhotoAlbum = photoAlbum; if (ModelState.IsValid) { photoAlbum.Order = db.PhotoAlbums.Any() ? db.PhotoAlbums.Max(dc => dc.Order) + 1 : 1; db.PhotoAlbums.AddObject(photoAlbum); db.SaveChanges(); Directory.CreateDirectory(Server.MapPath(Path.Combine("~/Content/Images/PhotoAlbum", photoAlbum.Id.ToString()))); TempData["Result"] = Resource.ChangesSaved; return RedirectToAction("Index"); } else { return Create(); } }
public void Update(PhotoAlbum photoAlbum) { _socialNetworkContext.Entry(photoAlbum).State = EntityState.Modified; _socialNetworkContext.SaveChanges(); }
/// <summary> /// There are no comments for PhotoAlbum in the schema. /// </summary> public void AddToPhotoAlbum(PhotoAlbum photoAlbum) { base.AddObject("PhotoAlbum", photoAlbum); }
public virtual Result Update(PhotoAlbum album) { return(db.update(album)); }
public void setPhotoAlbum(PhotoAlbum aux) { album = aux; }
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "QuickUpdate") { string PhotoAlbumCategoryID, Priority, IsShowOnMenu, IsShowOnHomePage, IsAvailable; var oPhotoAlbumCategory = new PhotoAlbumCategory(); foreach (GridDataItem item in RadGrid1.Items) { PhotoAlbumCategoryID = item.GetDataKeyValue("PhotoAlbumCategoryID").ToString(); Priority = ((RadNumericTextBox)item.FindControl("txtPriority")).Text.Trim(); IsShowOnMenu = ((CheckBox)item.FindControl("chkIsShowOnMenu")).Checked.ToString(); IsShowOnHomePage = ((CheckBox)item.FindControl("chkIsShowOnHomePage")).Checked.ToString(); IsAvailable = ((CheckBox)item.FindControl("chkIsAvailable")).Checked.ToString(); oPhotoAlbumCategory.PhotoAlbumCategoryQuickUpdate( PhotoAlbumCategoryID, IsShowOnMenu, IsShowOnHomePage, IsAvailable, Priority ); } } else if (e.CommandName == "DeleteSelected") { var oPhotoAlbum = new PhotoAlbum(); foreach (GridDataItem item in RadGrid1.SelectedItems) { string strImageName = ((HiddenField)item.FindControl("hdnImageName")).Value; DeleteImage(strImageName); var PhotoAlbumCategoryID = item["PhotoAlbumCategoryID"].Text; var dtPhotoAlbum = oPhotoAlbum.PhotoAlbumSelectAll("", "", "", PhotoAlbumCategoryID, "", "", ""); if (dtPhotoAlbum.Rows.Count > 0) { foreach (DataRow dr in dtPhotoAlbum.Rows) { strImageName = dr["ImageName"].ToString(); DeletePhotoAlbum(strImageName); } } } } else if (e.CommandName == "InitInsert" || e.CommandName == "EditSelected" || e.CommandName == "Edit") { TempImage.Rows.Clear(); } else if (e.CommandName == "PerformInsert" || e.CommandName == "Update") { var command = e.CommandName; var row = command == "PerformInsert" ? (GridEditFormInsertItem)e.Item : (GridEditFormItem)e.Item; var FileImageName = (RadUpload)row.FindControl("FileImageName"); string PhotoAlbumCategoryID = ((HiddenField)row.FindControl("hdnPhotoAlbumCategoryID")).Value; string strPhotoAlbumCategoryName = ((RadTextBox)row.FindControl("txtPhotoAlbumCategoryName")).Text.Trim(); string strPhotoAlbumCategoryNameEn = ((RadTextBox)row.FindControl("txtPhotoAlbumCategoryNameEn")).Text.Trim(); string strConvertedPhotoAlbumCategoryName = Common.ConvertTitle(strPhotoAlbumCategoryName); string strImageName = FileImageName.UploadedFiles.Count > 0 ? FileImageName.UploadedFiles[0].GetName() : ""; string strIsAvailable = ((CheckBox)row.FindControl("chkIsAvailable")).Checked.ToString(); string strIsShowOnMenu = ((CheckBox)row.FindControl("chkIsShowOnMenu")).Checked.ToString(); string strIsShowOnHomePage = ((CheckBox)row.FindControl("chkIsShowOnHomePage")).Checked.ToString(); string strPriority = ((RadNumericTextBox)row.FindControl("txtPriority")).Text.Trim(); var oPhotoAlbumCategory = new PhotoAlbumCategory(); if (e.CommandName == "PerformInsert") { strImageName = oPhotoAlbumCategory.PhotoAlbumCategoryInsert( strImageName, strPhotoAlbumCategoryName, strPhotoAlbumCategoryNameEn, strConvertedPhotoAlbumCategoryName, strIsShowOnMenu, strIsShowOnHomePage, strIsAvailable, strPriority ); string strFullPath = "~/res/photoalbumcategory/" + strImageName; if (!string.IsNullOrEmpty(strImageName)) { FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath)); //ResizeCropImage.ResizeByCondition(strFullPath, 200, 200); } PhotoAlbumCategoryID = oPhotoAlbumCategory.PhotoAlbumCategoryID; //Insert Album's Images if (TempImage.Rows.Count > 0) { var oPhotoAlbum = new PhotoAlbum(); foreach (DataRow dr in TempImage.Rows) { oPhotoAlbum.PhotoAlbumInsert(dr["ImageName"].ToString(), "", "", "", "", "", PhotoAlbumCategoryID, "True", ""); } } RadGrid1.Rebind(); } else { var dsUpdateParam = ObjectDataSource1.UpdateParameters; var strPhotoAlbumCategoryID = row.GetDataKeyValue("PhotoAlbumCategoryID").ToString(); var strOldImageName = ((HiddenField)row.FindControl("hdnImageName")).Value; var strOldImagePath = Server.MapPath("~/res/photoalbumcategory/" + strOldImageName); dsUpdateParam["PhotoAlbumCategoryName"].DefaultValue = strPhotoAlbumCategoryName; dsUpdateParam["ConvertedPhotoAlbumCategoryName"].DefaultValue = strConvertedPhotoAlbumCategoryName; dsUpdateParam["ImageName"].DefaultValue = strImageName; dsUpdateParam["IsShowOnMenu"].DefaultValue = strIsShowOnMenu; dsUpdateParam["IsShowOnHomePage"].DefaultValue = strIsShowOnHomePage; dsUpdateParam["IsAvailable"].DefaultValue = strIsAvailable; if (!string.IsNullOrEmpty(strImageName)) { var strFullPath = "~/res/photoalbumcategory/" + strConvertedPhotoAlbumCategoryName + "-" + strPhotoAlbumCategoryID + strImageName.Substring(strImageName.LastIndexOf('.')); if (File.Exists(strOldImagePath)) { File.Delete(strOldImagePath); } FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath)); //ResizeCropImage.ResizeByCondition(strFullPath, 200, 200); } } } else if (e.CommandName == "Cancel") { if (TempImage.Rows.Count > 0) { foreach (DataRow row in TempImage.Rows) { DeletePhotoAlbum(row["ImageName"].ToString()); } TempImage.Rows.Clear(); } } else if (e.CommandName == "DeleteImage") { var oPhotoAlbumCategory = new PhotoAlbumCategory(); var lnkDeleteImage = (LinkButton)e.CommandSource; var s = lnkDeleteImage.Attributes["rel"].ToString().Split('#'); var strPhotoAlbumCategoryID = s[0]; var strImageName = s[1]; oPhotoAlbumCategory.PhotoAlbumCategoryImageDelete(strPhotoAlbumCategoryID); DeleteImage(strImageName); RadGrid1.Rebind(); } }
public void openGhostbook(int charID) { openGhostbook(); playerSelectedCharSnippit = gbMang.getContactPageInfoSnippit(charID); playerSelectedCharAlbum = playerSelectedCharSnippit.getPhotoAlbum(); //Debug.Log("OWNER "+playerSelectedCharAlbum.ownerID); loadFriendPage(); tabToCurrPageMap[0] = 1; selectTab(0,1); }
private Dictionary <string, AttributeValue> MapPhotoAlbumToItem(PhotoAlbum album, bool isView = false) { try { var item = new Dictionary <string, AttributeValue>(); item[TableContent.ContentType.ToString()] = new AttributeValue { S = isView ? ContentType.PhotoAlbumView.ToString() : ContentType.PhotoAlbum.ToString() }; if (!string.IsNullOrEmpty(album.uniqueName)) { item[TableContent.Name.ToString()] = new AttributeValue { S = album.uniqueName }; } if (!string.IsNullOrEmpty(album.name)) { item[TableContent.Title.ToString()] = new AttributeValue { S = album.name }; } if (!string.IsNullOrEmpty(album.description)) { item[TableContent.Description.ToString()] = new AttributeValue { S = album.description }; } if (album.pictures != null) { item[TableContent.Content.ToString()] = new AttributeValue { S = JsonConvert.SerializeObject(album.pictures, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }) }; } if (!string.IsNullOrEmpty(album.author)) { item[TableContent.Author.ToString()] = new AttributeValue { S = album.author }; } if (!string.IsNullOrEmpty(album.feature)) { item[TableContent.Feature.ToString()] = new AttributeValue { S = album.feature }; } if (!string.IsNullOrEmpty(album.thumb)) { item[TableContent.Feature.ToString()] = new AttributeValue { S = album.thumb }; } item[TableContent.CreatedOn.ToString()] = new AttributeValue { N = album.createdOn.ToString() }; if (album.modifiedOn.HasValue) { item[TableContent.ModifiedOn.ToString()] = new AttributeValue { N = album.modifiedOn.Value.ToString() }; } if (album.tags != null && album.tags.Any()) { item[TableContent.Tags.ToString()] = new AttributeValue { S = JsonConvert.SerializeObject(album.tags, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }) }; } return(item); } catch (Exception ex) { Console.WriteLine($"ERROR: MapPhotoAlbumToItem problem. Error: {ex.Message}. {ex.StackTrace}."); return(null); } }
/// <summary> /// Method to fill the PhotoAlbum object to get the list of photo albums /// </summary> /// <returns>Filled PhotoAlbum entity</returns> private PhotoAlbum GetPhotoAlbumObject() { PhotoAlbum objAlbum = new PhotoAlbum(); objAlbum.UserTributeId = _tributeId; objAlbum.PageNumber = currentPage; objAlbum.PageSize = pageSize; return objAlbum; }
public abstract bool updPhotoAlbum(Guid id, PhotoAlbum upd);
public PhotoAlbumProxy(PhotoAlbum album) { this.Id = album.Id; this.Photos = new List <PhotoProxy>(); }
public PhotoAlbum Insert(PhotoAlbum album) { var svc = new AlbumService(); return(svc.Insert(album)); }
/* Routing options: * 1. myAlbums: only display ablums created by the logged in user * 2. selectedPhotoCategoryId: displays photo albums for that category * 3. selectedPhotoCategoryId + selectedPhotoAlbumId: displays photos in that album * "Back" button returns to gallery with selected category. * 4. selectedPhotoAlbumId: displays photos in that album. * "Back" button returns to gallery with no category selected. * 5. None: displays a list of categories to filter by and all photo albums */ public IActionResult OnGet(int selectedPhotoCategoryId, int selectedPhotoAlbumId, bool myAlbums = false) { // View initilization is required. PhotoGalleryVM = new PhotoGalleryVM(); PhotoAlbum = new PhotoAlbum(); MyAlbums = myAlbums; //Get Id of current user for displaying edit/add buttons CurrentOwner = _unitOfWork.Owner.GetFirstOrDefault(u => u.Id == _userManager.GetUserId(User)); //Category list should always include everything. //Use where in the html to display what is needed. PhotoGalleryVM.PhotoCategoryList = _unitOfWork.PhotoCategory.GetAll(null, c => c.OrderBy(c => c.Name)); //Prevent display or usage of empty categories manually entered into URL if (selectedPhotoCategoryId != 0) { if (_unitOfWork.PhotoAlbum.GetFirstOrDefault(a => a.PhotoCategoryId == selectedPhotoCategoryId) == null) { return(RedirectToPage("Index")); } } //1 //Only allow logged in users to access "My Albums" if (myAlbums == true && User.Identity.IsAuthenticated && selectedPhotoAlbumId == 0) { PhotoGalleryVM.PhotoAlbumList = _unitOfWork.PhotoAlbum.GetAll(a => a.OwnerId == CurrentOwner.Id, a => a.OrderBy(a => a.Title), "Owner"); //Prevents undesired page loads if category or album ID's are manually entered too. return(Page()); } //Prevent breaking page display by manually entering myAblums=True when not logged in. else if (myAlbums == true && !User.Identity.IsAuthenticated) { return(RedirectToPage("Index")); } else { //Only display albums with photos in them unless logged in as admin or the album owner //Get all albums IEnumerable <PhotoAlbum> allAlbumList = _unitOfWork.PhotoAlbum.GetAll(null, a => a.OrderBy(a => a.Title), "Owner"); //Store desired albums here ICollection <PhotoAlbum> filteredAlbumList = new List <PhotoAlbum>(); //Add only albums that have photos in them unless logged in as admin or the album owner foreach (PhotoAlbum tempAlbum in allAlbumList) { if (_unitOfWork.Photo.GetFirstOrDefault(p => p.PhotoAlbumId == tempAlbum.Id) != null || (CurrentOwner != null && tempAlbum.OwnerId == CurrentOwner.Id) || User.IsInRole(SD.AdministratorRole)) { filteredAlbumList.Add(tempAlbum); } } //Copy desired albums into ViewModel. PhotoGalleryVM.PhotoAlbumList = filteredAlbumList; } //Category selection does NOT display if myAlbums == true. //2 if (selectedPhotoCategoryId != 0 && selectedPhotoAlbumId == 0) { //Prevent invalid id's from being manually entered into URL if (_unitOfWork.PhotoCategory.GetFirstOrDefault(c => c.Id == selectedPhotoCategoryId) == null) { return(RedirectToPage("Index")); } PhotoGalleryVM.SelectedPhotoCategory = _unitOfWork.PhotoCategory.GetFirstOrDefault(c => c.Id == selectedPhotoCategoryId); } //3 else if (selectedPhotoCategoryId != 0 && selectedPhotoAlbumId != 0) { //Prevent invalid id's from being manually entered into URL if (_unitOfWork.PhotoCategory.GetFirstOrDefault(c => c.Id == selectedPhotoCategoryId) == null || _unitOfWork.PhotoAlbum.GetFirstOrDefault(a => a.Id == selectedPhotoAlbumId) == null) { return(RedirectToPage("Index")); } PhotoGalleryVM.SelectedPhotoCategory = _unitOfWork.PhotoCategory.GetFirstOrDefault(c => c.Id == selectedPhotoCategoryId); PhotoGalleryVM.SelectedPhotoAlbum = _unitOfWork.PhotoAlbum.GetFirstOrDefault(a => a.Id == selectedPhotoAlbumId, "Owner"); PhotoGalleryVM.PhotoList = _unitOfWork.Photo.GetAll(p => p.PhotoAlbumId == selectedPhotoAlbumId); } //4 else if (selectedPhotoCategoryId == 0 && selectedPhotoAlbumId != 0) { //Prevent invalid id's from being manually entered into URL if (_unitOfWork.PhotoAlbum.GetFirstOrDefault(a => a.Id == selectedPhotoAlbumId) == null) { return(RedirectToPage("Index")); } PhotoGalleryVM.SelectedPhotoCategory = null; PhotoGalleryVM.SelectedPhotoAlbum = _unitOfWork.PhotoAlbum.GetFirstOrDefault(a => a.Id == selectedPhotoAlbumId, "Owner"); PhotoGalleryVM.PhotoList = _unitOfWork.Photo.GetAll(p => p.PhotoAlbumId == selectedPhotoAlbumId); } //5 else { PhotoGalleryVM.SelectedPhotoCategory = null; } return(Page()); }
public int addPhotoAlbum(PhotoAlbum album) { this.db.PhotoAlbums.InsertOnSubmit(album); this.db.SubmitChanges(); return album.PhotoAlbumId; }
public abstract bool insPhotoAlbum(Guid id, PhotoAlbum ins);
public PhotoAlbum getPhotoAlbum(int photoAlbumId) { PhotoAlbum result; try { result = this.db.PhotoAlbums.Single((PhotoAlbum a) => a.PhotoAlbumId == photoAlbumId); } catch (Exception) { result = new PhotoAlbum { PhotoAlbumId = -1 }; } return result; }
public async Task DetectBibNumbers(PhotoAlbum album) { try { var connectionString = ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ConnectionString; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);//CloudStorageAccount.Parse("UseDevelopmentStorage=true");tionManager.ConnectionStrings["AzureStorageConnection"].ConnectionString);//CloudStorageAccount.Parse("UseDevelopmentStorage=true"); CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); CloudQueue queue = queueClient.GetQueueReference("detectbibnumbersqueue"); queue.CreateIfNotExists(); var albumJson = await JsonConvert.SerializeObjectAsync(album); queue.AddMessage(new CloudQueueMessage(albumJson)); } catch (Exception ex) { } }
public ActionResult Processalbum(string meta, string uploads) { string[] array = uploads.Split(new char[] { ';' }); string[] array2 = meta.Split(new char[] { '~' }); IPhotoAlbumRepository photoAlbumRepository = new PhotoAlbumRepository(new yslDataContext()); Request.Cookies.Get("ysl"); int num = 5; PhotoAlbum photoAlbum; if (photoAlbumRepository.AccountPhotoAlbumExists(num, array2[0])) { photoAlbum = photoAlbumRepository.GetAccountPhotoAlbumByTitle(num, array2[0]); } else { PhotoAlbum album = new PhotoAlbum { AccountId = num, Title = array2[0], Description = array2[1] }; int photoAlbumId = photoAlbumRepository.addPhotoAlbum(album); photoAlbum = photoAlbumRepository.getPhotoAlbum(photoAlbumId); } for (int i = 0; i < array.Length; i++) { if (!string.IsNullOrWhiteSpace(array[i])) { string[] array3 = array[i].Split(new char[] { ',' }); string text = array3[0]; text = text.Replace("/temp", ""); string text2 = HostingEnvironment.MapPath(array3[0]); string destFileName = text2.Replace("\\temp", ""); try { System.IO.File.Move(text2, destFileName); Photo photo = new Photo { AccountId = num, Title = array3[1], Description = "", Location = text }; photoAlbum.PhotoAlbumItems.Add(new PhotoAlbumItem { Photo = photo, Created = DateTime.Now, PhotoAlbumId = photoAlbum.PhotoAlbumId }); photoAlbumRepository.updatePhotoAlbum(photoAlbum); } catch { } } } return View(); }
public void CreatePhotoAlbum(PhotoAlbum photoAlbum) { _photoAlbumRepository.Create(photoAlbum); }
public void AddToPhotoAlbums(PhotoAlbum photoAlbum) { base.AddObject("PhotoAlbums", photoAlbum); }
//private PhotoAlbum GetDefaultAlbum( int userId ) { // return db.find<PhotoAlbum>( "IsDefault=1 and OwnerId=" + userId ).first(); //} public virtual Result Create(PhotoAlbum album) { return(db.insert(album)); }
public void Update(PhotoAlbum album) { var albumAdapter = new AlbumAdapter(); albumAdapter.Update(album); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); //var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); //SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; //DrawerLayout drawer = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); //ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); //drawer.AddDrawerListener(toggle); //toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); #region RecyclerView var recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView_main); var manager = new GridLayoutManager(this, 2); mPhotoAlbum = new PhotoAlbum(); mAdapter = new PhotoAlbumAdapter(mPhotoAlbum); mAdapter.ItemClick += OnItemClick; manager.SetSpanSizeLookup(new MySpanSizeLookup(mAdapter)); recyclerView.SetLayoutManager(manager); recyclerView.SetAdapter(mAdapter); UIHander uIHander = new UIHander(HandleiAction); recyclerView.AddOnScrollListener(new RecyclerViewOnScrollListtener(AddList, manager, uIHander)); #endregion swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.switch_refresh); swipeRefreshLayout.SetColorSchemeColors(Resource.Color.colorPrimary); swipeRefreshLayout.Refresh += SwipeRefreshLayout_Refresh; imagebutton = FindViewById <RoundImageView>(Resource.Id.iv_userphoto_mycenter_myprofile); imagebutton.Click += Imagebutton_Click; // 更新用户头像 ThreadPool.QueueUserWorkItem(q => SetImage()); Init(); }
public void respondToEvent(string para_sourceID, string para_eventID, System.Object para_eventData) { if(para_sourceID == "AlbumInnerViewScript") { if(para_eventID == "Close") { isInAlbumInnerView = false; //isInPhotoCloseupView = false; //isInTeacherView = false; } else if(para_eventID == "IsInPhotoCloseupView") { //isInPhotoCloseupView = true; } else if(para_eventID == "IsInTeacherView") { //isInTeacherView = true; } } else if(para_eventID == "ClickEvent") { if((currSelectedTabID == 0)&&(currSelectedPageID == 0))//Contact list { System.Object[] parsedEventData = (System.Object[]) para_eventData; float[] clickPos = (float[]) parsedEventData [0]; RaycastHit hitInf; if(Physics.Raycast(Camera.main.ScreenPointToRay(new Vector3(clickPos[0],clickPos[1],0)),out hitInf)) { if(hitInf.collider.name.Contains("Portrait")) { // Player has selected a portrait from the contact grid. Load that character's friend page. int reqCharID = int.Parse(hitInf.collider.name.Split('-')[1]); playerSelectedCharSnippit = gbMang.getContactPageInfoSnippit(reqCharID); playerSelectedCharAlbum = playerSelectedCharSnippit.getPhotoAlbum(); //Debug.Log("OWNER "+playerSelectedCharAlbum.ownerID); loadFriendPage(); tabToCurrPageMap[0] = 1; selectTab(0,1); } } } else if((currSelectedTabID == 1)&&(currSelectedPageID == 0))//Events { System.Object[] parsedEventData = (System.Object[]) para_eventData; float[] clickPos = (float[]) parsedEventData [0]; RaycastHit hitInf; if(Physics.Raycast(Camera.main.ScreenPointToRay(new Vector3(clickPos[0],clickPos[1],0)),out hitInf)) { if(hitInf.collider.name.Contains("EventsBanner")) { int reqEventIndex = int.Parse(hitInf.collider.gameObject.transform.parent.name.Split('-')[1]); if(availableEvents != null) { if(availableEvents.Count > 0) { if(reqEventIndex < availableEvents.Count) { //eventClickIndex = reqEventIndex; //int reqEventIndex = eventClickIndex; EventSummarySnippit reqSnip = availableEvents[reqEventIndex]; Encounter encounterDataForEvent = reqSnip.getRelatedEncData(); //eventClickIndex = -1; control.launchQuest( new ExternalParams( reqSnip.getApplicationID(), reqSnip.getQuestGiverCharID(), encounterDataForEvent.getLanguageArea(), encounterDataForEvent.getDifficulty(), encounterDataForEvent.getLevel(), false), LocalisationMang.getOwnerNpcOfActivity(reqSnip.getApplicationID()), "Event", Mode.PLAY); //performEventClickProcedureFlag = true; } } } } } } } }
public PhotoAlbum AddPhotoAlbum(HttpSessionStateBase session, int timestamp, string albumTitle = "Untitled Album", byte privacy = 0) { string privacyRegex = @"^(0|1|10)$"; if (String.IsNullOrWhiteSpace(albumTitle) || !Regex.IsMatch(privacy.ToString(), privacyRegex)) { throw new Exception("Album title is unavailable."); } IList<ImageInfo> uploadedImages = (IList<ImageInfo>)session[Globals.SESSIONKEY_UPLOADED_PHOTOS + sessionManager.GetUser().UserId]; if (uploadedImages == null || uploadedImages.Count == 0) { throw new Exception("Have no any uploaded photo. Please add at least a photo or more."); } // Insert new photo album string orginAlbumTitle = Globals.UrlDecode(albumTitle); PhotoAlbum photoAlbum = new PhotoAlbum() { Name = Globals.HtmlEncode(orginAlbumTitle), User = sessionManager.GetUser(), ProfileId = 0, Privacy = privacy, PrivacyComment = NSNPrivacyCommentMode.PUBLIC, Timestamp = timestamp }; return photoAlbumRepo.Create(photoAlbum); }
public async Task<ActionResult> Search(int id, FormCollection form) { var query = form["SearchQuery"]; if(string.IsNullOrWhiteSpace(query)) { return HttpNotFound(); } int bibNumber = -1; if(!int.TryParse(query, out bibNumber)) { return HttpNotFound(); } PhotoAlbum photoAlbum = await db.PhotoAlbumSet.FindAsync(id); if (photoAlbum == null) { return HttpNotFound(); } PhotoAlbum resultsAlbum = new PhotoAlbum(); var results = photoAlbum.Photos.Where(p => p.BibNumbersAsString.Contains(query)).ToList(); resultsAlbum.Photos = results; TempData["SearchQuery"] = query; return View(resultsAlbum); }
public void AddPhotosFromSession(HttpSessionStateBase session, PhotoAlbum photoAlbum, int timetamp, byte privacy = NSNPrivacyMode.PUBLIC) { IList<ImageInfo> uploadedImages = (IList<ImageInfo>)session[Globals.SESSIONKEY_UPLOADED_PHOTOS + sessionManager.GetUser().UserId]; foreach (ImageInfo imageInfo in uploadedImages) { Photo photo = new Photo() { Album = photoAlbum, User = sessionManager.GetUser(), Privacy = privacy, Image = imageInfo.FileName, AllowComment = true, Timestamp = timetamp }; Photo newPhoto = photoRepo.Create(photo); this.AddPhotoInfo(newPhoto, imageInfo); } }
/// <summary> /// Create a new PhotoAlbum object. /// </summary> /// <param name="id">Initial value of Id.</param> /// <param name="name">Initial value of Name.</param> /// <param name="creationDate">Initial value of CreationDate.</param> /// <param name="status">Initial value of Status.</param> public static PhotoAlbum CreatePhotoAlbum(global::System.Guid id, string name, global::System.DateTime creationDate, int status) { PhotoAlbum photoAlbum = new PhotoAlbum(); photoAlbum.Id = id; photoAlbum.Name = name; photoAlbum.CreationDate = creationDate; photoAlbum.Status = status; return photoAlbum; }
public ActionResult Album(int id) { PhotoAlbum album = this.photoRepository.GetAlbumById(id); return(this.View(album)); }
/// <summary> /// Method to get Photo Album data /// </summary> /// <returns>Filled PhotoAlbum entity.</returns> private PhotoAlbum GetAlbumData() { string albumName = txtAlbumName.Text; string albumDesc = txtAlbumDesc.Text; //if (Session["AlbumName"] != null) //{ // albumName = Session["AlbumName"].ToString(); //} //if (Session["AlbumDesc"] != null) //{ // albumDesc = Session["AlbumDesc"].ToString(); //} PhotoAlbum objPhotoAlbum = new PhotoAlbum(); objPhotoAlbum.PhotoAlbumId = PhotoAlbumID; objPhotoAlbum.PhotoAlbumCaption = albumName; objPhotoAlbum.PhotoAlbumDesc = albumDesc; objPhotoAlbum.ModuleTypeName = MODULE_TYPE_NAME; objPhotoAlbum.UserId = _userId; objPhotoAlbum.UserTributeId = _tributeId; objPhotoAlbum.CreatedBy = _userId; objPhotoAlbum.CreatedDate = DateTime.Now; objPhotoAlbum.IsActive = true; objPhotoAlbum.IsDeleted = false; objPhotoAlbum.UserName = _userName; objPhotoAlbum.TributeName = _tributeName; objPhotoAlbum.TributeType = _tributeType; objPhotoAlbum.TributeUrl = _tributeUrl; objPhotoAlbum.PhotoCount = ExistingPhotoCount + UploadedPhotoCount; objPhotoAlbum.PathToVisit = Request.ServerVariables["SERVER_NAME"] + Request.ApplicationPath; return objPhotoAlbum; }
protected void FileImageAlbum_FileUploaded(object sender, FileUploadedEventArgs e) { var FileImageAlbum = (RadAsyncUpload)sender; var Parent = FileImageAlbum.NamingContainer; var PhotoAlbumCategoryID = ((HiddenField)Parent.FindControl("hdnPhotoAlbumCategoryID")).Value; var RadListView1 = (RadListView)Parent.FindControl("RadListView1"); var RadListView2 = (RadListView)Parent.FindControl("RadListView2"); string targetFolder = "~/res/photoalbum/"; string newName = Guid.NewGuid().GetHashCode().ToString("X") + e.File.GetExtension(); e.File.SaveAs(Server.MapPath(targetFolder + newName)); ResizeCropImage.ResizeByCondition(targetFolder + newName, 800, 800); ResizeCropImage.CreateThumbNailByCondition("~/res/photoalbum/", "~/res/photoalbum/thumbs/", newName, 120, 120); if (string.IsNullOrEmpty(PhotoAlbumCategoryID)) { TempImage.Rows.Add(new object[] { newName }); RadListView2.DataSource = TempImage; RadListView2.DataBind(); } else { var oPhotoAlbum = new PhotoAlbum(); oPhotoAlbum.PhotoAlbumInsert(newName, "", "", "", "", "", PhotoAlbumCategoryID, "True", ""); RadListView1.Rebind(); } }
public virtual void Delete(PhotoAlbum album) { db.updateBatch <PhotoPost>("SaveStatus=" + SaveStatus.Delete, "CategoryId=" + album.Id); db.delete(album); }
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "QuickUpdate") { string PhotoAlbumCategoryID, Priority, IsShowOnMenu, IsShowOnHomePage, IsAvailable; var oPhotoAlbumCategory = new PhotoAlbumCategory(); foreach (GridDataItem item in RadGrid1.Items) { PhotoAlbumCategoryID = item.GetDataKeyValue("PhotoAlbumCategoryID").ToString(); Priority = ((RadNumericTextBox)item.FindControl("txtPriority")).Text.Trim(); IsShowOnMenu = ((CheckBox)item.FindControl("chkIsShowOnMenu")).Checked.ToString(); IsShowOnHomePage = ((CheckBox)item.FindControl("chkIsShowOnHomePage")).Checked.ToString(); IsAvailable = ((CheckBox)item.FindControl("chkIsAvailable")).Checked.ToString(); oPhotoAlbumCategory.PhotoAlbumCategoryQuickUpdate( PhotoAlbumCategoryID, IsShowOnMenu, IsShowOnHomePage, IsAvailable, Priority ); } } else if (e.CommandName == "DeleteSelected") { var oPhotoAlbum = new PhotoAlbum(); foreach (GridDataItem item in RadGrid1.SelectedItems) { string strImageName = ((HiddenField)item.FindControl("hdnImageName")).Value; DeleteImage(strImageName); var PhotoAlbumCategoryID = item["PhotoAlbumCategoryID"].Text; var dtPhotoAlbum = oPhotoAlbum.PhotoAlbumSelectAll("", "", "", PhotoAlbumCategoryID, "", "", ""); if (dtPhotoAlbum.Rows.Count > 0) { foreach (DataRow dr in dtPhotoAlbum.Rows) { strImageName = dr["ImageName"].ToString(); DeletePhotoAlbum(strImageName); } } } } else if (e.CommandName == "InitInsert" || e.CommandName == "EditSelected" || e.CommandName == "Edit") { TempImage.Rows.Clear(); } else if (e.CommandName == "PerformInsert" || e.CommandName == "Update") { var command = e.CommandName; var row = command == "PerformInsert" ? (GridEditFormInsertItem)e.Item : (GridEditFormItem)e.Item; var FileImageName = (RadUpload)row.FindControl("FileImageName"); string PhotoAlbumCategoryID = ((HiddenField)row.FindControl("hdnPhotoAlbumCategoryID")).Value; string strPhotoAlbumCategoryName = ((RadTextBox)row.FindControl("txtPhotoAlbumCategoryName")).Text.Trim(); string strPhotoAlbumCategoryNameEn = ((RadTextBox)row.FindControl("txtPhotoAlbumCategoryNameEn")).Text.Trim(); string strConvertedPhotoAlbumCategoryName = Common.ConvertTitle(strPhotoAlbumCategoryName); string strImageName = FileImageName.UploadedFiles.Count > 0 ? FileImageName.UploadedFiles[0].GetName() : ""; string strIsAvailable = ((CheckBox)row.FindControl("chkIsAvailable")).Checked.ToString(); string strIsShowOnMenu = ((CheckBox)row.FindControl("chkIsShowOnMenu")).Checked.ToString(); string strIsShowOnHomePage = ((CheckBox)row.FindControl("chkIsShowOnHomePage")).Checked.ToString(); string strPriority = ((RadNumericTextBox)row.FindControl("txtPriority")).Text.Trim(); var oPhotoAlbumCategory = new PhotoAlbumCategory(); if (e.CommandName == "PerformInsert") { strImageName = oPhotoAlbumCategory.PhotoAlbumCategoryInsert( strImageName, strPhotoAlbumCategoryName, strPhotoAlbumCategoryNameEn, strConvertedPhotoAlbumCategoryName, strIsShowOnMenu, strIsShowOnHomePage, strIsAvailable, strPriority ); string strFullPath = "~/res/photoalbumcategory/" + strImageName; if (!string.IsNullOrEmpty(strImageName)) { FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath)); ResizeCropImage.ResizeByCondition(strFullPath, 200, 200); } PhotoAlbumCategoryID = oPhotoAlbumCategory.PhotoAlbumCategoryID; //Insert Album's Images if (TempImage.Rows.Count > 0) { var oPhotoAlbum = new PhotoAlbum(); foreach (DataRow dr in TempImage.Rows) oPhotoAlbum.PhotoAlbumInsert(dr["ImageName"].ToString(), "", "", "", "", "", PhotoAlbumCategoryID, "True", ""); } RadGrid1.Rebind(); } else { var dsUpdateParam = ObjectDataSource1.UpdateParameters; var strPhotoAlbumCategoryID = row.GetDataKeyValue("PhotoAlbumCategoryID").ToString(); var strOldImageName = ((HiddenField)row.FindControl("hdnImageName")).Value; var strOldImagePath = Server.MapPath("~/res/photoalbumcategory/" + strOldImageName); dsUpdateParam["PhotoAlbumCategoryName"].DefaultValue = strPhotoAlbumCategoryName; dsUpdateParam["ConvertedPhotoAlbumCategoryName"].DefaultValue = strConvertedPhotoAlbumCategoryName; dsUpdateParam["ImageName"].DefaultValue = strImageName; dsUpdateParam["IsShowOnMenu"].DefaultValue = strIsShowOnMenu; dsUpdateParam["IsShowOnHomePage"].DefaultValue = strIsShowOnHomePage; dsUpdateParam["IsAvailable"].DefaultValue = strIsAvailable; if (!string.IsNullOrEmpty(strImageName)) { var strFullPath = "~/res/photoalbumcategory/" + strConvertedPhotoAlbumCategoryName + "-" + strPhotoAlbumCategoryID + strImageName.Substring(strImageName.LastIndexOf('.')); if (File.Exists(strOldImagePath)) File.Delete(strOldImagePath); FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath)); ResizeCropImage.ResizeByCondition(strFullPath, 200, 200); } } } else if (e.CommandName == "Cancel") { if (TempImage.Rows.Count > 0) { foreach (DataRow row in TempImage.Rows) { DeletePhotoAlbum(row["ImageName"].ToString()); } TempImage.Rows.Clear(); } } else if (e.CommandName == "DeleteImage") { var oPhotoAlbumCategory = new PhotoAlbumCategory(); var lnkDeleteImage = (LinkButton)e.CommandSource; var s = lnkDeleteImage.Attributes["rel"].ToString().Split('#'); var strPhotoAlbumCategoryID = s[0]; var strImageName = s[1]; oPhotoAlbumCategory.PhotoAlbumCategoryImageDelete(strPhotoAlbumCategoryID); DeleteImage(strImageName); RadGrid1.Rebind(); } }
// Loads the PhotoAlbumAdapter with the PhotoAlbum public PhotoAlbumAdapter(PhotoAlbum photoAlbum) { mPhotoAlbum = photoAlbum; }
//Saves the uploaded image and a thumbnail of that image to wwwroot with link in database. void SaveImage(int selectedPhotoAlbumId) { string webRootPath = _hostingEnvironment.WebRootPath; var files = HttpContext.Request.Form.Files; int thumbWidth = 200; int thumbHeight = 200; //Upload image //Rename file to something unique to avoid duplicate file names. string fileName = Guid.NewGuid().ToString(); //Set storage Path //@ sign means to interpret string literally (includes slashes) var uploads = Path.Combine(webRootPath, @"images\photoGallery"); //Keep original file extension (.jpg, etc) after Guid rename. var extension = Path.GetExtension(files[0].FileName); //Create storage path if it does not exist bool exists = Directory.Exists(uploads); if (!exists) { Directory.CreateDirectory(uploads); } //Store the image file using (var fileStream = new FileStream(Path.Combine(uploads, fileName + extension), FileMode.Create)) { files[0].CopyTo(fileStream); } //Create then store the thumb file using (Stream stream = files[0].OpenReadStream()) { Image image = Image.FromStream(stream); Image thumb = image.GetThumbnailImage(thumbWidth, thumbHeight, () => false, IntPtr.Zero); thumb.Save(Path.Combine(uploads, fileName + "_thumb" + extension)); } //Save string Path to image file to database PhotoObj.Image = @"\images\photoGallery\" + fileName + extension; //Save string Path to thumb file to database PhotoObj.Thumb = @"\images\photoGallery\" + fileName + "_thumb" + extension; //Make latest photo the thumbnail for the album PhotoAlbum PhotoAlbumObj = new PhotoAlbum(); PhotoAlbumObj = _unitOfWork.PhotoAlbum.GetFirstOrDefault(a => a.Id == selectedPhotoAlbumId); PhotoAlbumObj.Thumb = @"\images\photoGallery\" + fileName + "_thumb" + extension; //Keep track of album photo belongs to. PhotoObj.PhotoAlbumId = selectedPhotoAlbumId; _unitOfWork.PhotoAlbum.Update(PhotoAlbumObj); }
public void Create(PhotoAlbum photoAlbum) { _socialNetworkContext.PhotoAlbums.Add(photoAlbum); }
private void BindPhoto() { this.rpt_img.DataSource = PhotoAlbum.GetPhotoAlbumByPID(base.OpID); this.rpt_img.DataBind(); }
public bool updatePhotoAlbum(PhotoAlbum album) { PhotoAlbum photoAlbum = this.db.PhotoAlbums.Single((PhotoAlbum a) => a.PhotoAlbumId == album.PhotoAlbumId); if (photoAlbum.PhotoAlbumId > 0) { photoAlbum.Title = album.Title; photoAlbum.Description = album.Description; photoAlbum.Updated = new DateTime?(DateTime.Now); photoAlbum.PhotoAlbumItems = album.PhotoAlbumItems; this.db.SubmitChanges(); return true; } return false; }
protected void EntityDataSource1_Inserting(object sender, EntityDataSourceChangingEventArgs e) { PhotoAlbum myPhotoAlbum = (PhotoAlbum)e.Entity; myPhotoAlbum.UserName = User.Identity.Name; }
public async Task <AlbumWithPhoto> ExpandAlbum(PhotoAlbum album, CancellationToken token, ILog log) { var photos = await GetAllPagesAsync(PhotosInAlbum(album.OwnerId.Value, GetAlbumType(album.Id)), 1000, token, log, true); return(new AlbumWithPhoto(album, photos)); }
public ActionResult AjaxGetUploadPhotoResult() { List<Maticsoft.Model.SNS.UserAlbums> userAblumsByUserID = new Maticsoft.BLL.SNS.UserAlbums().GetUserAblumsByUserID(base.currentUser.UserID); PhotoAlbum model = new PhotoAlbum(); List<Maticsoft.Model.SNS.Categories> allList = Maticsoft.BLL.SNS.Categories.GetAllList(1); model.UserAlbums = userAblumsByUserID; model.PhotoCateList = (from c in allList where c.Depth == 1 select c).ToList<Maticsoft.Model.SNS.Categories>(); ((dynamic) base.ViewBag).ImageUrl = base.Request["image"]; ((dynamic) base.ViewBag).ImageData = base.Request["data"]; return this.PartialView(base.CurrentThemeViewPath + "/Partial/_UploadPhotoResultLayOut.cshtml", model); }
private PhotoAlbum MapItemToPhotoAlbum(Dictionary <string, AttributeValue> item) { try { var photoAlbum = new PhotoAlbum(); if (item.ContainsKey(TableContent.Name.ToString())) { photoAlbum.uniqueName = item[TableContent.Name.ToString()].S; } if (item.ContainsKey(TableContent.Title.ToString())) { photoAlbum.name = item[TableContent.Title.ToString()].S; } if (item.ContainsKey(TableContent.Description.ToString())) { photoAlbum.description = item[TableContent.Description.ToString()].S; } if (item.ContainsKey(TableContent.Content.ToString())) { photoAlbum.pictures = JsonConvert.DeserializeObject <Picture[]>(item[TableContent.Content.ToString()].S); } if (item.ContainsKey(TableContent.Author.ToString())) { photoAlbum.author = item[TableContent.Author.ToString()].S; } if (item.ContainsKey(TableContent.Feature.ToString())) { photoAlbum.feature = item[TableContent.Feature.ToString()].S; } if (item.ContainsKey(TableContent.Thumbnail.ToString())) { photoAlbum.thumb = item[TableContent.Thumbnail.ToString()].S; } if (item.ContainsKey(TableContent.CreatedOn.ToString())) { var success = int.TryParse(item[TableContent.CreatedOn.ToString()].N, out int date); if (success) { photoAlbum.createdOn = date; } } if (item.ContainsKey(TableContent.ModifiedOn.ToString())) { var success = int.TryParse(item[TableContent.ModifiedOn.ToString()].N, out int date); if (success) { photoAlbum.modifiedOn = date; } } if (item.ContainsKey(TableContent.Tags.ToString()) && !string.IsNullOrEmpty(item[TableContent.Tags.ToString()].S)) { photoAlbum.tags = item[TableContent.Tags.ToString()].S.Split(','); } if (item.ContainsKey(TableContent.IsActive.ToString())) { photoAlbum.isActive = item[TableContent.IsActive.ToString()].BOOL; } return(photoAlbum); } catch (Exception ex) { Console.WriteLine($"ERROR: MapItemToPhotoAlbum problem. Error: {ex.Message}. {ex.StackTrace}."); return(null); } }
public void SendPhotosNotification(PhotoAlbum albumContainingNewPhotos, string uploaderName) { this.photosNotificationDelegate.BeginInvoke(albumContainingNewPhotos, uploaderName, null, null); }
protected void EntityDataSource1_Inserted(object sender, EntityDataSourceChangedEventArgs e) { PhotoAlbum myPhotoAlbum = (PhotoAlbum)e.Entity; Response.Redirect(string.Format("ManagePhotoAlbum.aspx?PhotoAlbumId={0}", myPhotoAlbum.Id.ToString())); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); List <Photo> mBuiltInPhotos = new List <Photo>(); mPhotoAlbum = new PhotoAlbum(mBuiltInPhotos);// переход в метод public PhotoAlbum() SetContentView(Resource.Layout.activity_list_tasks); mRecyclerView = FindViewById <RecyclerView>(Resource.Id.RecyclerViewListTask); FabCreateTask = FindViewById <FloatingActionButton>(Resource.Id.ListTaskFabCreateTask); // Plug in the linear layout manager: mLayoutManager = new LinearLayoutManager(this); mRecyclerView.SetLayoutManager(mLayoutManager); // Plug in my adapter: mAdapter = new PhotoAlbumAdapter(mPhotoAlbum); mRecyclerView.SetAdapter(mAdapter); #region Нажатие кнопки FabCreateTask.Click += delegate { LayoutInflater layoutInflater = LayoutInflater.From(this); View view = layoutInflater.Inflate(Resource.Layout.activity_create_task, null); Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this); alert.SetView(view); #region Объявление переменных в диалоговом окне var EditName = view.FindViewById <EditText>(Resource.Id.EditCreateTaskName); var EditTime = view.FindViewById <EditText>(Resource.Id.EditCreateTaskTime); var EditNote = view.FindViewById <EditText>(Resource.Id.EditCreateTaskNote); var RatingImportance = view.FindViewById <RatingBar>(Resource.Id.RatingCreateTaskImportance); var CheckBoxkReminder = view.FindViewById <CheckBox>(Resource.Id.CheckBoxCreateTaskReminder); var timePicker = view.FindViewById <TimePicker>(Resource.Id.TimePickerCreateTask); timePicker.Visibility = ViewStates.Invisible; timePicker.SetIs24HourView(Java.Lang.Boolean.True); EditTime.Click += delegate { timePicker.Visibility = ViewStates.Visible; }; #endregion alert.SetCancelable(false) .SetPositiveButton("Создать", delegate { EditTime.Text = timePicker.CurrentHour.ToString() + ":" + timePicker.CurrentMinute.ToString(); Photo b = new Photo(EditName.Text, EditTime.Text, EditNote.Text, CheckBoxkReminder.Checked, RatingImportance.NumStars); mBuiltInPhotos.Add(b); mAdapter = new PhotoAlbumAdapter(mPhotoAlbum); mRecyclerView.SetAdapter(mAdapter); }) .SetNegativeButton("Отмена", delegate { alert.Dispose(); }); Dialog dialog = alert.Create(); dialog.Show(); }; #endregion }
private PhotoAlbum createAlbum(int para_charID) { List<DifficultyMetaData> difficulties = new List<DifficultyMetaData>(); int lA = characterLanguageAreas[ para_charID] ; //Debug.Log("Creating album for character "+para_charID+" and LA "+lA); foreach(int diff in characterDifficulties[para_charID]){ if(unlockedDifficulties[lA][diff]){ difficulties.Add(new DifficultyMetaData(lA+"*"+diff, createDifficultyShortDescription(lA,diff),createExplanation(lA,diff))); //Debug.Log(lA+"*"+diff+" -> "+difficultyShortDescription); } } PhotoAlbum pPA = new PhotoAlbum(para_charID, difficulties ); foreach(PhotoPage page in pPA.getAllAvailablePages()){ int i = 0; foreach(Photo photo in satchel.getPhotos()[page.getLangArea()][page.getDifficulty()]){ page.addPhoto(photo,i++); } } return pPA; }
public void ProcessImagesForAlbum(int id) { PhotoAlbum album = this.photoRepository.GetAlbumById(id); this.photoRepository.GenerateImagesForUnprocessedUploads(album); }
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "alpha" || e.CommandName == "NoFilter") { String value = null; switch (e.CommandName) { case ("alpha"): { value = string.Format("{0}%", e.CommandArgument); break; } case ("NoFilter"): { value = "%"; break; } } ObjectDataSource1.SelectParameters["keyWord"].DefaultValue = value; ObjectDataSource1.DataBind(); RadGrid1.Rebind(); } else if (e.CommandName == "DeleteSelected") { var oPhotoAlbum = new PhotoAlbum(); string ide, OldImageName, OldVideoName; foreach (GridDataItem item in RadGrid1.SelectedItems) { ide = item.GetDataKeyValue("ide").ToString(); OldImageName = ((HiddenField)item.FindControl("hdnImage")).Value; OldVideoName = ((HiddenField)item.FindControl("hdnVideo")).Value; DeleteImage(OldImageName); DeleteVideo(OldVideoName); oPhotoAlbum.PhotoAlbumDelete(ide); } } else if (e.CommandName == "PerformInsert" || e.CommandName == "Update") { var command = e.CommandName; var row = command == "PerformInsert" ? (GridEditFormInsertItem)e.Item : (GridEditFormItem)e.Item; var FileImagePath = (RadUpload)row.FindControl("FileImagePath"); var FileVideoPath = (RadUpload)row.FindControl("FileVideoPath"); string strID = ((HiddenField)row.FindControl("hdnID")).Value; var strOldImagePath = ((HiddenField)row.FindControl("hdnOldImage")).Value; var strOldVideoPath = ((HiddenField)row.FindControl("hdnOldVideo")).Value; var strImagePath = FileImagePath.UploadedFiles.Count > 0 ? FileImagePath.UploadedFiles[0].GetName() : ""; var strVideoPath = FileVideoPath.UploadedFiles.Count > 0 ? FileVideoPath.UploadedFiles[0].GetName() : ""; var strTitle = ((TextBox)row.FindControl("txtTitle")).Text.Trim(); var strConvertedTitle = Common.ConvertTitle(strTitle); var strDescription = ((TextBox)row.FindControl("txtDescription")).Text.Trim(); //var strTitleEn = ((TextBox)row.FindControl("txtTitleEn")).Text.Trim(); //var strDescriptionEn = ((TextBox)row.FindControl("txtDescriptionEn")).Text.Trim(); var oVideoXML = new VideoXML(); strID = !string.IsNullOrEmpty(strID) ? strID : oVideoXML.VideoSelectTopID("~/playlist.xml"); strImagePath = string.IsNullOrEmpty(strImagePath) ? strOldImagePath : "video_" + strID + strImagePath.Substring(strImagePath.LastIndexOf('.')); strVideoPath = string.IsNullOrEmpty(strVideoPath) ? strOldVideoPath : "video_" + strID + strVideoPath.Substring(strVideoPath.LastIndexOf('.')); if (e.CommandName == "PerformInsert") { var dsInsertParam = ObjectDataSource1.InsertParameters; oVideoXML.VideoInsert("~/playlist.xml", strTitle, strDescription, "res/videoxml/" + strVideoPath, "res/videoxml/thumbs/" + strImagePath); if (FileImagePath.UploadedFiles.Count > 0) { strImagePath = "~/res/videoxml/thumbs/" + strImagePath; FileImagePath.UploadedFiles[0].SaveAs(Server.MapPath(strImagePath)); } if (FileVideoPath.UploadedFiles.Count > 0) { strVideoPath = "~/res/videoxml/" + strVideoPath; FileVideoPath.UploadedFiles[0].SaveAs(Server.MapPath(strVideoPath)); } } else { var dsUpdateParam = ObjectDataSource1.UpdateParameters; oVideoXML.VideoUpdate("~/playlist.xml", strID, strTitle, strDescription, "res/videoxml/" + strVideoPath, "res/videoxml/thumbs/" + strImagePath); if (FileImagePath.UploadedFiles.Count > 0) { strOldImagePath = Server.MapPath("~/" + strOldImagePath); if (File.Exists(strOldImagePath)) File.Delete(strOldImagePath); strImagePath = "~/res/videoxml/thumbs/" + strImagePath; FileImagePath.UploadedFiles[0].SaveAs(Server.MapPath(strImagePath)); } if (FileVideoPath.UploadedFiles.Count > 0) { strOldVideoPath = Server.MapPath("~/" + strOldVideoPath); if (File.Exists(strOldVideoPath)) File.Delete(strOldVideoPath); strVideoPath = "~/res/videoxml/" + strVideoPath; FileVideoPath.UploadedFiles[0].SaveAs(Server.MapPath(strVideoPath)); } } } }
public PhotoAlbum Insert(PhotoAlbum album) { var albumAdapter = new AlbumAdapter(); return(albumAdapter.Insert(album)); }
public static PhotoAlbum CreatePhotoAlbum(byte photoAlbumID, string albumCoverUrl, bool isActive, bool isPermanent) { PhotoAlbum photoAlbum = new PhotoAlbum(); photoAlbum.PhotoAlbumID = photoAlbumID; photoAlbum.AlbumCoverUrl = albumCoverUrl; photoAlbum.IsActive = isActive; photoAlbum.IsPermanent = isPermanent; return photoAlbum; }
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "alpha" || e.CommandName == "NoFilter") { String value = null; switch (e.CommandName) { case ("alpha"): { value = string.Format("{0}%", e.CommandArgument); break; } case ("NoFilter"): { value = "%"; break; } } ObjectDataSource1.SelectParameters["keyWord"].DefaultValue = value; ObjectDataSource1.DataBind(); RadGrid1.Rebind(); } else if (e.CommandName == "DeleteSelected") { var oPhotoAlbum = new PhotoAlbum(); string ide, OldImageName, OldVideoName; foreach (GridDataItem item in RadGrid1.SelectedItems) { ide = item.GetDataKeyValue("ide").ToString(); OldImageName = ((HiddenField)item.FindControl("hdnImage")).Value; OldVideoName = ((HiddenField)item.FindControl("hdnVideo")).Value; DeleteImage(OldImageName); DeleteVideo(OldVideoName); oPhotoAlbum.PhotoAlbumDelete(ide); } } else if (e.CommandName == "PerformInsert" || e.CommandName == "Update") { var command = e.CommandName; var row = command == "PerformInsert" ? (GridEditFormInsertItem)e.Item : (GridEditFormItem)e.Item; var FileImagePath = (RadUpload)row.FindControl("FileImagePath"); var FileVideoPath = (RadUpload)row.FindControl("FileVideoPath"); string strID = ((HiddenField)row.FindControl("hdnID")).Value; var strOldImagePath = ((HiddenField)row.FindControl("hdnOldImage")).Value; var strOldVideoPath = ((HiddenField)row.FindControl("hdnOldVideo")).Value; var strImagePath = FileImagePath.UploadedFiles.Count > 0 ? FileImagePath.UploadedFiles[0].GetName() : ""; var strVideoPath = FileVideoPath.UploadedFiles.Count > 0 ? FileVideoPath.UploadedFiles[0].GetName() : ""; var strTitle = ((TextBox)row.FindControl("txtTitle")).Text.Trim(); var strConvertedTitle = Common.ConvertTitle(strTitle); var strDescription = ((TextBox)row.FindControl("txtDescription")).Text.Trim(); //var strTitleEn = ((TextBox)row.FindControl("txtTitleEn")).Text.Trim(); //var strDescriptionEn = ((TextBox)row.FindControl("txtDescriptionEn")).Text.Trim(); var oVideoXML = new VideoXML(); strID = !string.IsNullOrEmpty(strID) ? strID : oVideoXML.VideoSelectTopID("~/playlist.xml"); strImagePath = string.IsNullOrEmpty(strImagePath) ? strOldImagePath : "video_" + strID + strImagePath.Substring(strImagePath.LastIndexOf('.')); strVideoPath = string.IsNullOrEmpty(strVideoPath) ? strOldVideoPath : "video_" + strID + strVideoPath.Substring(strVideoPath.LastIndexOf('.')); if (e.CommandName == "PerformInsert") { var dsInsertParam = ObjectDataSource1.InsertParameters; oVideoXML.VideoInsert("~/playlist.xml", strTitle, strDescription, "res/videoxml/" + strVideoPath, "res/videoxml/thumbs/" + strImagePath); if (FileImagePath.UploadedFiles.Count > 0) { strImagePath = "~/res/videoxml/thumbs/" + strImagePath; FileImagePath.UploadedFiles[0].SaveAs(Server.MapPath(strImagePath)); } if (FileVideoPath.UploadedFiles.Count > 0) { strVideoPath = "~/res/videoxml/" + strVideoPath; FileVideoPath.UploadedFiles[0].SaveAs(Server.MapPath(strVideoPath)); } } else { var dsUpdateParam = ObjectDataSource1.UpdateParameters; oVideoXML.VideoUpdate("~/playlist.xml", strID, strTitle, strDescription, "res/videoxml/" + strVideoPath, "res/videoxml/thumbs/" + strImagePath); if (FileImagePath.UploadedFiles.Count > 0) { strOldImagePath = Server.MapPath("~/" + strOldImagePath); if (File.Exists(strOldImagePath)) { File.Delete(strOldImagePath); } strImagePath = "~/res/videoxml/thumbs/" + strImagePath; FileImagePath.UploadedFiles[0].SaveAs(Server.MapPath(strImagePath)); } if (FileVideoPath.UploadedFiles.Count > 0) { strOldVideoPath = Server.MapPath("~/" + strOldVideoPath); if (File.Exists(strOldVideoPath)) { File.Delete(strOldVideoPath); } strVideoPath = "~/res/videoxml/" + strVideoPath; FileVideoPath.UploadedFiles[0].SaveAs(Server.MapPath(strVideoPath)); } } } }