public override int GetHashCode() { unchecked { var hashCode = CardsFixedAtLevel?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (ComputerDifficulty != null ? ComputerDifficulty.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DisplayInfo != null ? DisplayInfo.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Hide.GetHashCode(); hashCode = (hashCode * 397) ^ (Id?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Image != null ? Image.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsNew.GetHashCode(); hashCode = (hashCode * 397) ^ IsQuickmatchPlaylist.GetHashCode(); hashCode = (hashCode * 397) ^ IsTeamGamePlaylist.GetHashCode(); hashCode = (hashCode * 397) ^ LonelyPartyUsesWildcard.GetHashCode(); hashCode = (hashCode * 397) ^ MatchTicketTimeoutDurationSeconds; hashCode = (hashCode * 397) ^ MaxPartySize; hashCode = (hashCode * 397) ^ MaxPlayerCount; hashCode = (hashCode * 397) ^ MinPartySize; hashCode = (hashCode * 397) ^ MinPlayerCount; hashCode = (hashCode * 397) ^ (MpsdHopperName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (MpsdHopperStatName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (PlaylistEntries?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (StatsClassification?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (TargetPlatform?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ThumbnailImage != null ? ThumbnailImage.GetHashCode() : 0); hashCode = (hashCode * 397) ^ UsesBanRules.GetHashCode(); hashCode = (hashCode * 397) ^ Voting.GetHashCode(); return(hashCode); } }
protected void btnADD_Click(object sender, EventArgs e) { EasyDataProvide ModulePictures = new EasyDataProvide("ModulePictures"); FileUploadSetup fus = new FileUploadSetup(); fus.name = "picUrl"; fus.fileType = FileUploadSetup.UpfileType.Image; fus.allowNoFile = false; ThumbnailImage timg = new ThumbnailImage(); timg.suffix = "s"; timg.maxWidth = 142; timg.MaxHight = 89; fus.ThumbnailImages.Add(timg); ModulePictures.FileUploadSetups.Add(fus); try { ModulePictures.SetPageFormQuest(); } catch (Exception ex1) { lblError.Text = ex1.Message; return; } ModulePictures.AddParameter("publishID", Request["publishID"].ToString()); ModulePictures.Insert(); string Publish = "_News_Pictures.aspx?ModuleID=" + Request["ModuleID"] + "&ID=" + Request["publishID"]; My.WebForm.doJavaScript(String.Format("parent.tb_remove();parent.location='{0}';", Publish)); }
/// <summary> /// Returns the thumbnail image for a source. /// </summary> /// <param name="source">Either a Data URI or a HTTP URL pointing to an image.</param> /// <param name="targetWidth">The max width of the thumbnail.</param> /// <param name="targetHeight">The max height of the thumbnail.</param> /// <remarks> /// The case when <paramref name="source"/> is an external (HTTP) URL is not implemented /// </remarks> public async Task <ThumbnailImage> GetAsync(string source, int targetWidth, int targetHeight) { if (!source.StartsWith("data")) { throw new NotImplementedException($"{nameof(source)} must be a Data URI"); } if (targetWidth < 10) { throw new ArgumentOutOfRangeException(nameof(targetWidth)); } if (targetHeight < 10) { throw new ArgumentOutOfRangeException(nameof(targetHeight)); } CacheKey key = new CacheKey(source, targetWidth, targetHeight); ThumbnailImage item = await _cache.GetOrCreateAsync(key, c => { c.SlidingExpiration = TimeSpan.FromDays(1); return(Task.Run(() => { ThumbnailImage image = ThumbnailImage.FromDataUri(source); image.Resize(targetWidth, targetHeight); return image; })); }); return(item); }
public async Task <IActionResult> Create([FromForm] ImageRequest request) { var userInfo = _sessionService.GetDataFromToken(); if (userInfo.UserId != request.UserId) { return(StatusCode(401, new { Message = "This userId is not yours" })); } var user = await _context.Users.FindAsync(request.UserId); if (user == null) { return(NotFound(new { Message = "Can not find user with id = " + request.UserId })); } var newImages = new List <ThumbnailImage>(); for (int i = 0; i < request.Images.Count; i++) { var image = new ThumbnailImage(); image.CreatedAt = DateTime.Now; image.Title = request.Title; image.UserId = request.UserId; if (request.Images[i] != null) { image.ImagePath = await _storageService.SaveFile(request.Images[i]); } newImages.Add(image); } user.NumberOfImages += newImages.Count; var imagesResponse = new List <ImageResponse>(); try { _context.Users.Update(user); imagesResponse = await _imageApplication.CreateImages(newImages); } catch (Exception e) { return(StatusCode(501, new { Message = e.InnerException })); } return(Ok(imagesResponse)); }
private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser webBrowser = (WebBrowser)sender; webBrowser.ClientSize = new Size(this.BrowserWidth, this.BrowserHeight); webBrowser.ScrollBarsEnabled = false; this.ThumbnailImage = new Bitmap(webBrowser.Bounds.Width, webBrowser.Bounds.Height); webBrowser.BringToFront(); webBrowser.DrawToBitmap(ThumbnailImage, webBrowser.Bounds); this.ThumbnailImage = (Bitmap)ThumbnailImage.GetThumbnailImage(Width, Height, null, IntPtr.Zero); }
public void ClearThumbnail() { pbThumbnail.Image = null; if (ThumbnailImage != null) { ThumbnailImage.Dispose(); ThumbnailImage = null; } ThumbnailSourceFilePath = null; }
public ImageResponse(ThumbnailImage image, IStorageService storageService) { Id = image.Id; UserId = image.UserId; Title = image.Title; ImagePath = image.ImagePath; CreatedAt = image.CreatedAt; NumberOfLikes = image.NumberOflikes; ImagePath = storageService.GetFileUrl(image.ImagePath); //GetImagePath(image); }
public ImageResponse(ThumbnailImage image, IStorageService storageService) { this._storageService = storageService; Id = image.Id; UserId = image.UserId; Title = image.Title; ImagePath = image.ImagePath; CreatedAt = image.CreatedAt; NumberOfLikes = image.NumberOflikes; GetImagePath(image); }
/// <summary> /// 单方面修改头像 /// </summary> void ImageMouseBtnUp() { //WinImageClipping winImage=new WinImageClipping(); //winImage.Show(); Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog(); ofd.Filter = "图像文件|*.jpg;*.png;*.jpeg;*.bmp;*.gif|所有文件|*.*"; //ofd.InitialDirectory = @"C:\Users\Public\Pictures"; ofd.InitialDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonPictures); ofd.Multiselect = false; if (ofd.ShowDialog() == true) { //此处做你想做的事 ...=ofd.FileName; //MessageBox.Show(ofd.FileName);//显示文件完整路径 ThreadPool.QueueUserWorkItem((obj) => { System.Drawing.Image image = new Bitmap(ofd.FileName); int minValue = image.Height > image.Width ? image.Width : image.Height; Bitmap bmp = ThumbnailImage.CutImage(image, minValue, minValue); Bitmap bmp_60 = new Bitmap(bmp); bmp.Dispose(); if (!Directory.Exists(Path.GetDirectoryName(SavePath.UserIconEdit))) { Directory.CreateDirectory(Path.GetDirectoryName(SavePath.UserIconEdit)); } bmp_60.Save(SavePath.UserIconEdit, ImageFormat.Png); bmp_60.Dispose(); Bll.Account account = new Account(); string msg = account.EditOwnInfo(AccountInfo.Token, new[] { SavePath.UserIconEdit }, null); JObject Jo = (JObject)JsonConvert.DeserializeObject(msg); if (JObjectHelper.GetStrNum(Jo["code"].ToString()) == 200) { AccountInfo.IconImage = Jo["dataList"]["icon"].ToString(); string NewFilePath = Path.Combine(SavePath.UserInfo, Path.GetFileNameWithoutExtension(AccountInfo.IconImage)); SavePath.UserIcon_30x30 = Path.Combine(NewFilePath, "_30x30.bmp"); if (!Directory.Exists(NewFilePath)) { Directory.CreateDirectory(NewFilePath); } File.Copy(SavePath.UserIconEdit, Path.Combine(NewFilePath, Path.GetFileName(AccountInfo.IconImage))); System.Drawing.Image _image = new Bitmap(Path.Combine(NewFilePath, Path.GetFileName(AccountInfo.IconImage))); Bitmap icon_30x30 = ThumbnailImage.SizeImageWithOldPercent(_image, 30, 30); Bitmap bmp30 = new Bitmap(icon_30x30); icon_30x30.Dispose(); bmp30.Save(SavePath.UserIcon_30x30, ImageFormat.Bmp); HeaderPath = Path.Combine(NewFilePath, Path.GetFileName(AccountInfo.IconImage)); ImagePath = SavePath.UserIcon_30x30; } }); } }
public void Dispose() { if (ThumbnailImage != null) { ThumbnailImage.Dispose(); ThumbnailImage = null; } if (Image != null) { Image.Dispose(); Image = null; } }
private void GetImagePath(ThumbnailImage image) { try { byte[] imageBits = System.IO.File.ReadAllBytes($"./{_storageService.GetFileUrl(image.ImagePath)}"); this.ImagePath = Convert.ToBase64String(imageBits); this.HasImage = true; } catch { this.HasImage = false; this.ImagePath = image.ImagePath; } }
public NewsResponse(ThumbnailImage image, IStorageService storageService) { Id = image.Id; UserId = image.UserId; Title = image.Title; ImagePath = image.ImagePath; CreatedAt = image.CreatedAt; NumberOfLikes = image.NumberOflikes; FullName = image.User.FullName; Location = image.User.Location.ToString(); ImagePath = storageService.GetFileUrl(image.ImagePath); AvatarPath = storageService.GetFileUrl(image.User.AvatarPath); //GetImagePath(image); //GetAvatarPath(image.User); }
private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { const int dotsPerInch = 700; // define the quality in DPI const double widthInInch = 6; // width of the bitmap in INCH const double heightInInch = 1; // height of the bitmap in INCH WebBrowser webBrowser = (WebBrowser)sender; webBrowser.ClientSize = new Size(this.BrowserWidth, this.BrowserHeight); // webBrowser.ClientSize = new Size( (int)(widthInInch * dotsPerInch), (int)(heightInInch * dotsPerInch)); webBrowser.ScrollBarsEnabled = true; this.ThumbnailImage = new Bitmap(webBrowser.Bounds.Width, webBrowser.Bounds.Height); // this.ThumbnailImage = new Bitmap( (int)(widthInInch * dotsPerInch), (int)(heightInInch * dotsPerInch) ); this.ThumbnailImage.SetResolution(dotsPerInch, dotsPerInch); webBrowser.BringToFront(); webBrowser.DrawToBitmap(ThumbnailImage, webBrowser.Bounds); this.ThumbnailImage = (Bitmap)ThumbnailImage.GetThumbnailImage(Width, Height, null, IntPtr.Zero); }
public bool Equals(DestinySeasonPreviewImageDefinition input) { if (input == null) { return(false); } return (( ThumbnailImage == input.ThumbnailImage || (ThumbnailImage != null && ThumbnailImage.Equals(input.ThumbnailImage)) ) && ( HighResImage == input.HighResImage || (HighResImage != null && HighResImage.Equals(input.HighResImage)) )); }
protected void Button8_Click(object sender, EventArgs e) { data_conn cn = new data_conn(); if (FileUpload1.FileName.ToString() != "") { if (FileUpload1.FileName.ToString().Substring(FileUpload1.FileName.ToString().Length - 4, 4) != ".jpg" && FileUpload1.FileName.ToString().Substring(FileUpload1.FileName.ToString().Length - 4, 4) != ".bmp" && FileUpload1.FileName.ToString().Substring(FileUpload1.FileName.ToString().Length - 4, 4) != ".JPG" && FileUpload1.FileName.ToString().Substring(FileUpload1.FileName.ToString().Length - 4, 4) != ".BMP") { MessageBox("公司照片格式错误", "公司照片格式错误"); return; } string filepath; filepath = Server.MapPath("/member/companyhead/") + Request.Cookies["user_id"].Value.ToString() + "(old).jpg"; FileUpload1.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("/member/companyhead/") + Request.Cookies["user_id"].Value.ToString() + ".jpg", 256, 256); cn.mdb_exe("update TB_User set Login2_Head=1 where UserId=" + Request.Cookies["user_id"].Value.ToString()); } if (FileUpload2.FileName.ToString() != "") { if (FileUpload2.FileName.ToString().Substring(FileUpload2.FileName.ToString().Length - 4, 4) != ".jpg" && FileUpload2.FileName.ToString().Substring(FileUpload2.FileName.ToString().Length - 4, 4) != ".bmp") { MessageBox("个人头像格式错误", "个人头像格式错误"); return; } string filepath; filepath = Server.MapPath("/member/companyhead/") + Request.Cookies["user_id"].Value.ToString() + "(old).jpg"; FileUpload2.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("/member/companyhead/") + Request.Cookies["user_id"].Value.ToString() + ".jpg", 256, 256); cn.mdb_exe("update TB_User set HeadURL=1 where UserId=" + Request.Cookies["user_id"].Value.ToString()); } string sql = "update TB_User set sign='" + TextBox1.Text + "',User_Level=2 where UserID=" + this.Request.Cookies["user_id"].Value.ToString(); cn.mdb_exe(sql); ScriptManager.RegisterStartupScript(this, this.GetType(), "提示", "alert('修改成功');window.location.href='useredit1.aspx'", true); //this.Response.Redirect("useredit1.aspx"); //displayDiv(); }
/// <summary> /// 縮圖 /// </summary> /// <param name="path">The path.</param> /// <param name="maxPix">The maximum pix.</param> /// <param name="isCenter"></param> /// <param name="height"></param> /// <returns></returns> public static string Start(string path, int maxPix = 320, bool isCenter = false, int height = 0) { var fileName = Path.GetFileName(path); var filePath = path.Remove(path.Length - (string.IsNullOrEmpty(fileName) ? 0 : fileName.Length)); var fileOnlyName = Path.GetFileNameWithoutExtension(path); var ext = Path.GetExtension(fileName); var fileExtension = string.IsNullOrEmpty(ext) ? string.Empty : ext.ToLower(); var thumbnailFileName = (!isCenter) ? $"{fileOnlyName}.{maxPix}.thumbnail{fileExtension}" : (height > 0) ? $"{fileOnlyName}.{maxPix}x{height}.center.thumbnail{fileExtension}" : $"{fileOnlyName}.{maxPix}x{maxPix}.center.thumbnail{fileExtension}"; var thumbnailFilePath = filePath + thumbnailFileName; object thumbnailLock = null; lock (ThumbnailLock) { if (!Locklist.ContainsKey(thumbnailFilePath)) { Locklist.Add(thumbnailFilePath, new object()); } thumbnailLock = Locklist[thumbnailFilePath]; } lock (thumbnailLock) { if (!File.Exists(thumbnailFilePath)) { if (!isCenter) { ThumbnailImage.SaveThumbPic(path, maxPix, thumbnailFilePath); } else { ThumbnailImage.SaveCenterThumbPic(path, maxPix, thumbnailFilePath, height); } } } return(thumbnailFileName); }
private async void LoadMovieData() { Bitmap image = null; ShowProgessBar(); await Task.Run(() => { UserCollectionItem = DBHandler.Instance.GetCollectionItems(UserCollection[0].ID); Movie = TMDbHandler.Instance.GetMovieDetails(MovieID); image = Helper.GetImageBitmapFromUrl(TMDbHandler.Instance.GetMovieImage(Movie).ToString()); }); ThumbnailImage.SetImageBitmap(image); MovieTitleText.Text = Movie.Title.ToString(); DescriptionText.Text = Movie.Overview.ToString(); HideProgressBar(); }
void MouseEnterFile(object sender, FileMouseEventArgs e) { //只对下面的图标文件类型生成缩略图 if ((".jpg.jpeg.png.bmp").IndexOf(Utils.CutString(e.FileInfo.FileName, e.FileInfo.FileName.LastIndexOf(".") + 1).ToLower()) >= 0) { BitmapImage bitimage = new BitmapImage(); try { bitimage.SetSource(e.FileInfo.ViewStream); ThumbnailImage.Source = bitimage; ThumbnailImage.Visibility = Visibility.Visible; Canvas.SetLeft(ThumbnailImageBorder, e.X + 50); Canvas.SetTop(ThumbnailImageBorder, e.Y - 30); object o = ThumbnailImage.GetValue(Canvas.ActualHeightProperty); ThumbnailImageBorder.Height = ThumbnailImage.Height + 10; expandImage.Begin(); } catch { } } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (OriginalImage != null) { OriginalImage.Dispose(); OriginalImage = null; } if (ThumbnailImage != null) { ThumbnailImage.Dispose(); ThumbnailImage = null; } if (FilteredImage != null) { FilteredImage.Dispose(); FilteredImage = null; } } }
public void SetLoading(bool loading) { if (loading) { LoadingIndicator.StartAnimating(); UIBlurEffect blurEffect = UIBlurEffect.FromStyle(UIBlurEffectStyle.Light); blurSubview = new UIVisualEffectView(blurEffect); blurSubview.Frame = ThumbnailImage.Frame; ThumbnailImage.AddSubview(blurSubview); } else { if (blurSubview != null) { blurSubview.RemoveFromSuperview(); blurSubview = null; } LoadingIndicator.StopAnimating(); } }
/// <summary> /// Determines whether the specified <see cref="System.Object" />, is equal to this instance. /// </summary> /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public override bool Equals(Course obj) { if (obj == null) { return(false); } if (ReferenceEquals(this, obj)) { return(true); } return (base.Equals(obj) && Chapters.NullSafeSequenceEquals(obj.Chapters) && Description == obj.Description && Language.NullSafeEquals(obj.Language) && Name == obj.Name && ShortName == obj.ShortName && Tags.NullSafeSequenceEquals(obj.Tags) && ThumbnailImage.NullSafeEquals(obj.ThumbnailImage) && Version == obj.Version); }
/// <summary> /// A simple function that takes a string and returns both the upper and lower case version of the string. /// </summary> /// <param name="input"></param> /// <param name="context"></param> /// <returns></returns> public async Task <ThumbnailInfo> FunctionHandler(Input input, ILambdaContext context) { Dimensions size = input.ExtractedMetadata.Dimensions; decimal scalingFactor = Math.Min( MAX_WIDTH / size.Width, MAX_HEIGHT / size.Height ); int width = Convert.ToInt32(scalingFactor * size.Width); int height = Convert.ToInt32(scalingFactor * size.Height); ThumbnailImage image = await GenerateThumbnail(input.Bucket, input.SourceKey, width, height); string keyPrefix = input.SourceKey.Substring(0, input.SourceKey.IndexOf("/uploads/")); string orignalPhotoName = input.SourceKey.Substring(input.SourceKey.LastIndexOf("/") + 1); string destinationKey = ThumbnailKey(keyPrefix, orignalPhotoName); using (var inStream = image.thumbnailImage) using (var stream = new MemoryStream()) { image.thumbnailImage.Save(stream, image.format); stream.Position = 0; context.Logger.LogLine($"Saving thumbnail to {destinationKey} with size {stream.Length}"); await this.S3Client.PutObjectAsync(new PutObjectRequest { BucketName = input.Bucket, Key = destinationKey, InputStream = stream }); return(new ThumbnailInfo(width, height, destinationKey, input.Bucket)); } }
/**************************************************** OTHER METHODS ******************************************************/ /// <summary> /// <para>parses and returns the FeedData in the form of list</para> /// </summary> /// <param name="ParsedJson"></param> /// <returns></returns> private List<FeedData> ParseFeeds(dynamic ParsedJson) { // CREATE FEEDDATA LIST List<FeedData> Data = new List<FeedData>(); foreach (dynamic Post in ParsedJson.data) { // CREATE FEEDDATA OBJECT FeedData Feed = new FeedData(); // CREATE ATTRIBUTION OBJECT; if (Post.attribution == null) { Feed.Attribution = null; } else { AttributionData Attribution = new AttributionData(); Attribution.Website = Post.Attribution.website; Attribution.ItunesUrl = Post.Attribution.itunes_url; Attribution.Name = Post.Attribution.name; Feed.Attribution = Attribution; } // SET TAGS List<String> Tags = new List<String>(); foreach (dynamic Tag in Post.tags) { Tags.Add(Tag.ToString()); } Feed.Tags = Tags; // SET TYPE Feed.Type = Post.type; // SET LOCATION if (Post.location == null) { Feed.Location = null; } else { LocationData Location = new LocationData(); Location.Id = Post.location.id; Location.Latitude = Post.location.latitude; Location.Longitude = Post.location.longitude; Location.Name = Post.location.name; Feed.Location = Location; } // SET COMMENTS CommentData Comments = new CommentData(); Comments.Count = Post.comments.count; List<Comment> CommentData = new List<Comment>(); foreach (dynamic EachComment in Post.comments.data) { // CREATE COMMENT OBJECT Comment Comment = new Comment(); Comment.CreatedTime = new DateTime(long.Parse(EachComment.created_time.ToString())); Comment.Id = EachComment.id; Comment.Text = EachComment.text; // CREATE USER OBJECT User CommentedBy = new User(); CommentedBy.UserName = EachComment.from.username; CommentedBy.ProfilePicture = EachComment.from.profile_pciture; CommentedBy.Id = EachComment.from.id; CommentedBy.FullName = EachComment.from.full_name; // ASSOCIATE COMMENT WITH USER Comment.From = CommentedBy; // ADD COMMENT TO THE LIST CommentData.Add(Comment); } Comments.Data = CommentData; Feed.Comments = Comments; // SET FILTER Feed.Filter = Post.filter; // SET CREATED TIME Feed.CreatedTime = new DateTime(long.Parse(Post.created_time.ToString())); // SET LINK Feed.Link = Post.link; // SET LIKES LikesData Likes = new LikesData(); Likes.Count = Post.likes.count; List<User> LikedByUsers = new List<User>(); foreach (dynamic EachLike in Post.likes.data) { // CREATE USER OBJECT User LikedBy = new User(); LikedBy.UserName = EachLike.username; LikedBy.ProfilePicture = EachLike.profile_picture; LikedBy.Id = EachLike.id; LikedBy.FullName = EachLike.full_name; // ADD USER TO THE LIST LikedByUsers.Add(LikedBy); } Likes.Data = LikedByUsers; Feed.Likes = Likes; // SET VIDEO if (Feed.Type.Equals("video")) { VideosData VideoData = new VideosData(); LowResolutionVideo LRVideo = new LowResolutionVideo(); LRVideo.url = Post.videos.low_resolution.url; LRVideo.width = Post.videos.low_resolution.width; LRVideo.height = Post.videos.low_resolution.height; VideoData.LowResolution = LRVideo; StandardResolutionVideo SRVideo = new StandardResolutionVideo(); SRVideo.url = Post.videos.standard_resolution.url; SRVideo.width = Post.videos.standard_resolution.width; SRVideo.height = Post.videos.standard_resolution.height; VideoData.StandardResolution = SRVideo; Feed.Videos = VideoData; } else { Feed.Videos = null; } // SET IMAGES ImagesData Images = new ImagesData(); StandardResolutionImage SRImage = new StandardResolutionImage(); SRImage.url = Post.images.standard_resolution.url; SRImage.width = Post.images.standard_resolution.width; SRImage.height = Post.images.standard_resolution.height; Images.StandardResolution = SRImage; ThumbnailImage TImage = new ThumbnailImage(); TImage.url = Post.images.thumbnail.url; TImage.width = Post.images.thumbnail.width; TImage.height = Post.images.thumbnail.height; Images.Thumbnail = TImage; LowResolutionImage LRImage = new LowResolutionImage(); LRImage.url = Post.images.low_resolution.url; LRImage.width = Post.images.low_resolution.width; LRImage.height = Post.images.low_resolution.height; Images.LowResolution = LRImage; Feed.Images = Images; // SET CAPTIONS CaptionData Caption = new CaptionData(); Caption.CreratedTime = new DateTime(long.Parse(Post.caption.created_time.ToString())); Caption.Text = Post.caption.text; Caption.Id = Post.caption.id; User CaptionedBy = new User(); CaptionedBy.UserName = Post.caption.from.username; CaptionedBy.ProfilePicture = Post.caption.from.profile_pciture; CaptionedBy.Id = Post.caption.from.id; CaptionedBy.FullName = Post.caption.from.full_name; Caption.From = CaptionedBy; Feed.Caption = Caption; // SET TAGGED USER List<TaggedUser> UserInPhotos = new List<TaggedUser>(); if (Post.users_in_photo != null) { foreach (dynamic UserTag in Post.users_in_photo) { // CREATE TAGGED USER OBJECT TaggedUser TUser = new TaggedUser(); // SET USER User TaggedUser = new User(); TaggedUser.UserName = UserTag.user.username; TaggedUser.FullName = UserTag.user.full_name; TaggedUser.Id = UserTag.user.id; TaggedUser.ProfilePicture = UserTag.user.profile_picture; TUser.User = TaggedUser; // SET POSITION Position TagPosition = new Position(); TagPosition.x = float.Parse(UserTag.position.x.ToString()); TagPosition.y = float.Parse(UserTag.position.y.ToString()); TUser.Position = TagPosition; // ADD TO LIST UserInPhotos.Add(TUser); } } Feed.UsersInPhoto = UserInPhotos; // SET USER LIKE Feed.UserHasLiked = false; // BY DEAFULT SET TO FALSE SINCE IT'S AN APPLICATION ACCESS // SET ID Feed.Id = Post.id; // SET USER User FeedBy = new User(); FeedBy.UserName = Post.user.username; FeedBy.Website = Post.user.webste; FeedBy.ProfilePicture = Post.user.profile_picture; FeedBy.FullName = Post.user.full_name; FeedBy.Bio = Post.user.bio; FeedBy.Id = Post.user.id; Feed.User = FeedBy; // ADD FEED TO LIST Data.Add(Feed); } return Data; }
public async Task <IActionResult> Create([FromForm] ImageRequest request) { var userInfo = _sessionService.GetDataFromToken(); if (userInfo.UserId != request.UserId) { return(StatusCode(401, new { Message = "This userId is not yours" })); } var user = await _context.Users.FindAsync(request.UserId); if (user == null) { return(NotFound(new { Message = "Can not find user with id = " + request.UserId })); } int notOk = 0; var newImages = new List <ThumbnailImage>(); var imageScores = await _imageScoreApplication.GetImageScore(); if (imageScores.Active) { for (int i = 0; i < request.Images.Count; i++) { var image = new ThumbnailImage(); image.CreatedAt = DateTime.Now; image.Title = request.Title; image.UserId = request.UserId; bool isOk = false; if (request.Images[i] != null) { image.ImagePath = await _storageService.SaveFile(request.Images[i]); try { var score = _detectService.DetectImage("." + _storageService.GetFileUrlWithoutDomain(image.ImagePath)); isOk = await _imageScoreApplication.ValidateImage(score); } catch (Exception e) { Console.WriteLine("Không thể kết nối đến detect image service."); isOk = true; } } if (!isOk) { if (imageScores.AutoFilter) { image.Status = ImageStatus.BlockOut; } else { image.Status = ImageStatus.Waiting; } notOk++; } else { image.Status = ImageStatus.Approved; } newImages.Add(image); } } else { for (int i = 0; i < request.Images.Count; i++) { var image = new ThumbnailImage(); image.CreatedAt = DateTime.Now; image.Title = request.Title; image.UserId = request.UserId; if (request.Images[i] != null) { image.ImagePath = await _storageService.SaveFile(request.Images[i]); } image.Status = ImageStatus.Approved; newImages.Add(image); } } user.NumberOfImages += (newImages.Count - notOk); List <ImageResponse> imagesResponse; try { _context.Users.Update(user); imagesResponse = await _imageApplication.CreateImages(newImages); } catch (Exception e) { return(StatusCode(501, new { Message = e.InnerException })); } string message; bool Approved; if (notOk == 0) { message = "Hình của bạn đã được upload!"; Approved = true; } else { Approved = false; message = "Hình ảnh có thể đã vi phạm chuẩn mực của chúng tôi, có thể cần kiểm duyệt, xin lỗi vì sự bất tiện này!"; } return(Ok(new { Data = imagesResponse, Message = message, Approved = Approved })); }
protected void Button2_Click(object sender, EventArgs e) { if (txtStorage.Value != "" && txtCity.Value != "" && txtStoragearea.Value != "" && txtFieldarea.Value != "" && txtAddress.Value != "" && txtIntro.Value != "" && txtValue.Value != "") { string value; if (txtValue.Value == "请填写20'40'40H'的内装价格") { value = ""; } else { value = txtValue.Value; } check ck = new check(); string sql = "insert into TB_Storage (StorageName,City,TypeName,Storage_area,Field_area,Address,intro,inbuiltValue,Company,linkmen,Phone,Postdate,UserID) values "; sql += "('" + ck.CheckInput(txtStorage.Value) + "','" + ck.CheckInput(txtCity.Value) + "','" + ck.CheckInput(DropDownList1.SelectedItem.Text) + "'," + ck.CheckInput(txtStoragearea.Value) + "," + ck.CheckInput(txtFieldarea.Value) + ",'" + ck.CheckInput(txtAddress.Value) + "','" + ck.CheckInput(txtIntro.Value) + "','" + ck.CheckInput(value) + "','" + ck.CheckInput(txtCompany.Value) + "','" + ck.CheckInput(txtlinkmen.Value) + "','" + ck.CheckInput(txtPhone.Value) + "',getdate()," + this.Request.Cookies["user_id"].Value.ToString() + ")"; string id = mdb_exe_return(sql); if (FileUpload1.FileName != "") { string filepath = Server.MapPath("images/") + "/Storage/upload/old/" + id + "_1.jpg"; FileUpload1.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_1.jpg", 48, 48); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_big_1.jpg", 210, 150); } if (FileUpload2.FileName != "") { string filepath = Server.MapPath("images/") + "/Storage/upload/old/" + id + "_2.jpg"; FileUpload2.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_2.jpg", 48, 48); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_big_2.jpg", 210, 150); } if (FileUpload3.FileName != "") { string filepath = Server.MapPath("images/") + "/Storage/upload/old/" + id + "_3.jpg"; FileUpload3.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_3.jpg", 48, 48); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_big_3.jpg", 210, 150); } //if (FileUpload4.FileName != "") //{ // string filepath = Server.MapPath("images/") + "/Storage/upload/old/" + id + "_4.jpg"; // FileUpload4.SaveAs(filepath); // ThumbnailImage thumbnailimage = new ThumbnailImage(); // thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_4.jpg", 48, 48); // thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_big_4.jpg", 210, 150); //} //if (FileUpload5.FileName != "") //{ // string filepath = Server.MapPath("images/") + "/Storage/upload/old/" + id + "_5.jpg"; // FileUpload5.SaveAs(filepath); // ThumbnailImage thumbnailimage = new ThumbnailImage(); // thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_5.jpg", 48, 48); // thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("images/") + "/Storage/upload/" + id + "_big_5.jpg", 210, 150); //} this.Response.Redirect("Storage.aspx"); } else { MessageBox("", "*必填"); } }
protected void Button2_Click(object sender, EventArgs e) { check ck = new check(); if (!(sex_2.Checked || sex_1.Checked)) { MessageBox("opfail", "性别为空"); } //else if (Phone.Value == "") //{ // MessageBox("opfail", "电话为空"); //} else if (CompanyType.Value == "0") { MessageBox("opfail", "公司类型为空"); } else if (ddlcity1.SelectedValue == "0" || ddlcity2.SelectedValue == "0") { MessageBox("opfail", "公司所在地为空"); } else { string sql = ""; sql = sql + "UPDATE "; sql = sql + "TB_User "; sql = sql + "SET "; if (sex_1.Checked) { sql = sql + "Sex = 0,"; } else { sql = sql + "Sex = 1,"; } sql = sql + "WPosition = '" + ck.CheckInput(Position.Value) + "',"; //sql = sql + "Phone = '" + ck.CheckInput(Phone.Value) + "',"; //sql = sql + "Phone2 = '" + ck.CheckInput(Phone2.Value) + "',"; sql = sql + "Fax = '" + ck.CheckInput(Fax.Value) + "',"; sql = sql + "MovePhone = '" + ck.CheckInput(MovePhone.Value) + "',"; sql = sql + "Usermsn = '" + ck.CheckInput(Msn.Value) + "',"; sql = sql + "Userqq = '" + ck.CheckInput(QQ.Value) + "',"; sql = sql + "sign = '" + ck.CheckInput(sign.Value) + "',"; if (Portrait.FileName.ToString() != "") { string filepath; filepath = Server.MapPath("/member/Head/") + Request.Cookies["user_id"].Value.ToString() + "(old).jpg"; Portrait.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("/member/Head/") + Request.Cookies["user_id"].Value.ToString() + ".jpg", 70, 70); sql = sql + "HeadURL = 1,"; } //sql = sql + "CompanyName = '" + ck.CheckInput(Company.Value) + "',"; sql = sql + "CompanyType = '" + ck.CheckInput(CompanyType.Value) + "',"; sql = sql + "Login2_Locus1 = '" + ck.CheckInput(ddlcity1.SelectedItem.Text) + "', "; sql = sql + "Login2_Locus2 = '" + ck.CheckInput(ddlcity2.SelectedItem.Text) + "', "; sql = sql + "Address = '" + ck.CheckInput(Address.Value) + "',"; sql = sql + "PostNumber = '" + ck.CheckInput(PostNumber.Value) + "',"; sql = sql + "introduction = '" + ck.CheckInput(introduction.Value) + "',"; //if (CoPortrait.FileName.ToString() != "") //{ // string filepath; // filepath = Server.MapPath("/member/companyhead/") + Request.Cookies["user_id"].Value.ToString() + "(old).jpg"; // CoPortrait.SaveAs(filepath); // ThumbnailImage thumbnailimage = new ThumbnailImage(); // thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("/member/companyhead/") + Request.Cookies["user_id"].Value.ToString() + ".jpg", 256, 256); // sql = sql + "Login2_Head = 1,"; //} sql = sql + "User_Level = 1 "; sql = sql + "WHERE UserID = " + Request.Cookies["user_id"].Value.ToString(); data_conn cn = new data_conn(); cn.mdb_exe(sql); string Login2_Adventage_Type_fcl, Login2_Adventage_Type_lcl, Login2_Adventage_Type_air, Login2_Adventage_Type_input, Login2_Adventage_Type_particular, Login2_Adventage_Type_cold, Login2_Adventage_Type_dangerous, Login2_Adventage_Type_tank, Login2_Adventage_Type_BULK, Login2_Adventage_type, Login2_Adventage_Line, Login2_Adventage_Line2, Login2_Adventage_Shipper, Login2_introduction; Login2_Adventage_Type_fcl = "0"; Login2_Adventage_Type_lcl = "0"; Login2_Adventage_Type_air = "0"; Login2_Adventage_Type_input = "0"; Login2_Adventage_Type_particular = "0"; Login2_Adventage_Type_cold = "0"; Login2_Adventage_Type_dangerous = "0"; Login2_Adventage_Type_tank = "0"; Login2_Adventage_Type_BULK = "0"; if (checkall.Checked == true) { Login2_Adventage_Type_fcl = "1"; Login2_Adventage_Type_lcl = "1"; Login2_Adventage_Type_air = "1"; } if (checkfcl.Checked == true) { Login2_Adventage_Type_fcl = "1"; } if (checklcl.Checked == true) { Login2_Adventage_Type_lcl = "1"; } if (checkair.Checked == true) { Login2_Adventage_Type_air = "1"; } if (checkinput.Checked == true) { Login2_Adventage_Type_input = "1"; } if (checkparticular.Checked == true) { Login2_Adventage_Type_particular = "1"; } if (checkcold.Checked == true) { Login2_Adventage_Type_cold = "1"; } if (checkdangerous.Checked == true) { Login2_Adventage_Type_dangerous = "1"; } if (checktank.Checked == true) { Login2_Adventage_Type_tank = "1"; } if (checkBULK.Checked == true) { Login2_Adventage_Type_BULK = "1"; } //if (Login2_Adventage_Type_fcl == "0" && Login2_Adventage_Type_lcl == "0" && Login2_Adventage_Type_air == "0") //{ // MessageBox("经营类型不能为空", "经营类型不能为空"); // return; //} Login2_Adventage_Line = ""; Login2_Adventage_Line2 = ""; if ((chk_ship_Europe.Checked == true)) { Login2_Adventage_Line += chk_ship_Europe.Value + "|"; } if ((chk_ship_SOUTH_AMERICA.Checked == true)) { Login2_Adventage_Line += chk_ship_SOUTH_AMERICA.Value + "|"; } if ((chk_ship_Australia.Checked == true)) { Login2_Adventage_Line += chk_ship_Australia.Value + "|"; } if ((chk_ship_Caribbean.Checked == true)) { Login2_Adventage_Line += chk_ship_Caribbean.Value + "|"; } if ((chk_ship_offing.Checked == true)) { Login2_Adventage_Line += chk_ship_offing.Value + "|"; } if ((chk_ship_Japan_Korea.Checked == true)) { Login2_Adventage_Line += chk_ship_Japan_Korea.Value + "|"; } if ((chk_ship_CIMEX.Checked == true)) { Login2_Adventage_Line += chk_ship_CIMEX.Value + "|"; } if ((chk_ship_Red_Sea.Checked == true)) { Login2_Adventage_Line += chk_ship_Red_Sea.Value + "|"; } if ((chk_ship_Africa.Checked == true)) { Login2_Adventage_Line += chk_ship_Africa.Value + "|"; } if ((chk_air_North_America.Checked == true)) { Login2_Adventage_Line2 += chk_air_North_America.Value + "|"; } if ((chk_air_Europe.Checked == true)) { Login2_Adventage_Line2 += chk_air_Europe.Value + "|"; } if ((chk_air_poncho.Checked == true)) { Login2_Adventage_Line2 += chk_air_poncho.Value + "|"; } if ((chk_air_Asia.Checked == true)) { Login2_Adventage_Line2 += chk_air_Asia.Value + "|"; } if ((chk_air_Africa.Checked == true)) { Login2_Adventage_Line2 += chk_air_Africa.Value + "|"; } if ((chk_air_Australia.Checked == true)) { Login2_Adventage_Line2 += chk_air_Australia.Value + "|"; } if ((chk_air_internal.Checked == true)) { Login2_Adventage_Line2 += chk_air_internal.Value + "|"; } if ((string.IsNullOrEmpty(Login2_Adventage_Line)) && (string.IsNullOrEmpty(Login2_Adventage_Line2))) { //MessageBox("优势航线不能为空", "优势航线不能为空"); //return; } else { if (Login2_Adventage_Line.Length != 0) { Login2_Adventage_Line = Login2_Adventage_Line.Substring(0, Login2_Adventage_Line.Length - 1); } } Login2_Adventage_Shipper = Hidtypes.Value; if ((!string.IsNullOrEmpty(othershipper.Text))) { Login2_Adventage_Shipper += othershipper.Text; } sql = "update TB_User set Login2_Adventage_Type_fcl=" + Login2_Adventage_Type_fcl + ",Login2_Adventage_Type_lcl=" + Login2_Adventage_Type_lcl + ",Login2_Adventage_Type_air=" + Login2_Adventage_Type_air + ",Login2_Adventage_Type_input=" + Login2_Adventage_Type_input + ",Login2_Adventage_Type_particular=" + Login2_Adventage_Type_particular + ",Login2_Adventage_Type_dangerous=" + Login2_Adventage_Type_dangerous + ",Login2_Adventage_Type_cold=" + Login2_Adventage_Type_cold + ",Login2_Adventage_Type_tank=" + Login2_Adventage_Type_tank + ",Login2_Adventage_Type_BULK=" + Login2_Adventage_Type_BULK + ",Login2_Adventage_Line='" + ck.CheckInput(Login2_Adventage_Line) + "',Login2_Adventage_Line2='" + ck.CheckInput(Login2_Adventage_Line2) + "',Login2_Adventage_Shipper='" + ck.CheckInput(Login2_Adventage_Shipper) + "',User_Level=1 where UserID=" + this.Request.Cookies["user_id"].Value.ToString(); cn.mdb_exe(sql); if (CompanyType.Value == "1") { Response.Redirect("/accounts/login4.aspx"); } else if (CompanyType.Value == "2") { Response.Redirect("/accounts/login3.aspx"); } else { Response.Redirect("/accounts/regsuccess.aspx"); } } }
/**************************************************** OTHER METHODS ******************************************************/ /// <summary> /// <para>parses and returns the FeedData in the form of list</para> /// </summary> /// <param name="ParsedJson"></param> /// <returns></returns> private List <FeedData> ParseFeeds(dynamic ParsedJson) { // CREATE FEEDDATA LIST List <FeedData> Data = new List <FeedData>(); foreach (dynamic Post in ParsedJson.data) { // CREATE FEEDDATA OBJECT FeedData Feed = new FeedData(); // CREATE ATTRIBUTION OBJECT; if (Post.attribution == null) { Feed.Attribution = null; } else { AttributionData Attribution = new AttributionData(); Attribution.Website = Post.Attribution.website; Attribution.ItunesUrl = Post.Attribution.itunes_url; Attribution.Name = Post.Attribution.name; Feed.Attribution = Attribution; } // SET TAGS List <String> Tags = new List <String>(); foreach (dynamic Tag in Post.tags) { Tags.Add(Tag.ToString()); } Feed.Tags = Tags; // SET TYPE Feed.Type = Post.type; // SET LOCATION if (Post.location == null) { Feed.Location = null; } else { LocationData Location = new LocationData(); Location.Id = Post.location.id; Location.Latitude = Post.location.latitude; Location.Longitude = Post.location.longitude; Location.Name = Post.location.name; Feed.Location = Location; } // SET COMMENTS CommentData Comments = new CommentData(); Comments.Count = Post.comments.count; List <Comment> CommentData = new List <Comment>(); foreach (dynamic EachComment in Post.comments.data) { // CREATE COMMENT OBJECT Comment Comment = new Comment(); Comment.CreatedTime = new DateTime(long.Parse(EachComment.created_time.ToString())); Comment.Id = EachComment.id; Comment.Text = EachComment.text; // CREATE USER OBJECT User CommentedBy = new User(); CommentedBy.UserName = EachComment.from.username; CommentedBy.ProfilePicture = EachComment.from.profile_pciture; CommentedBy.Id = EachComment.from.id; CommentedBy.FullName = EachComment.from.full_name; // ASSOCIATE COMMENT WITH USER Comment.From = CommentedBy; // ADD COMMENT TO THE LIST CommentData.Add(Comment); } Comments.Data = CommentData; Feed.Comments = Comments; // SET FILTER Feed.Filter = Post.filter; // SET CREATED TIME Feed.CreatedTime = new DateTime(long.Parse(Post.created_time.ToString())); // SET LINK Feed.Link = Post.link; // SET LIKES LikesData Likes = new LikesData(); Likes.Count = Post.likes.count; List <User> LikedByUsers = new List <User>(); foreach (dynamic EachLike in Post.likes.data) { // CREATE USER OBJECT User LikedBy = new User(); LikedBy.UserName = EachLike.username; LikedBy.ProfilePicture = EachLike.profile_picture; LikedBy.Id = EachLike.id; LikedBy.FullName = EachLike.full_name; // ADD USER TO THE LIST LikedByUsers.Add(LikedBy); } Likes.Data = LikedByUsers; Feed.Likes = Likes; // SET VIDEO if (Feed.Type.Equals("video")) { VideosData VideoData = new VideosData(); LowResolutionVideo LRVideo = new LowResolutionVideo(); LRVideo.url = Post.videos.low_resolution.url; LRVideo.width = Post.videos.low_resolution.width; LRVideo.height = Post.videos.low_resolution.height; VideoData.LowResolution = LRVideo; StandardResolutionVideo SRVideo = new StandardResolutionVideo(); SRVideo.url = Post.videos.standard_resolution.url; SRVideo.width = Post.videos.standard_resolution.width; SRVideo.height = Post.videos.standard_resolution.height; VideoData.StandardResolution = SRVideo; Feed.Videos = VideoData; } else { Feed.Videos = null; } // SET IMAGES ImagesData Images = new ImagesData(); StandardResolutionImage SRImage = new StandardResolutionImage(); SRImage.url = Post.images.standard_resolution.url; SRImage.width = Post.images.standard_resolution.width; SRImage.height = Post.images.standard_resolution.height; Images.StandardResolution = SRImage; ThumbnailImage TImage = new ThumbnailImage(); TImage.url = Post.images.thumbnail.url; TImage.width = Post.images.thumbnail.width; TImage.height = Post.images.thumbnail.height; Images.Thumbnail = TImage; LowResolutionImage LRImage = new LowResolutionImage(); LRImage.url = Post.images.low_resolution.url; LRImage.width = Post.images.low_resolution.width; LRImage.height = Post.images.low_resolution.height; Images.LowResolution = LRImage; Feed.Images = Images; // SET CAPTIONS CaptionData Caption = new CaptionData(); if (Post.caption != null) { Caption.CreratedTime = new DateTime(long.Parse(Post.caption.created_time.ToString())); Caption.Text = Post.caption.text; Caption.Id = Post.caption.id; User CaptionedBy = new User(); CaptionedBy.UserName = Post.caption.from.username; CaptionedBy.ProfilePicture = Post.caption.from.profile_pciture; CaptionedBy.Id = Post.caption.from.id; CaptionedBy.FullName = Post.caption.from.full_name; Caption.From = CaptionedBy; } Feed.Caption = Caption; // SET TAGGED USER List <TaggedUser> UserInPhotos = new List <TaggedUser>(); if (Post.users_in_photo != null) { foreach (dynamic UserTag in Post.users_in_photo) { // CREATE TAGGED USER OBJECT TaggedUser TUser = new TaggedUser(); // SET USER User TaggedUser = new User(); TaggedUser.UserName = UserTag.user.username; TaggedUser.FullName = UserTag.user.full_name; TaggedUser.Id = UserTag.user.id; TaggedUser.ProfilePicture = UserTag.user.profile_picture; TUser.User = TaggedUser; // SET POSITION Position TagPosition = new Position(); TagPosition.x = float.Parse(UserTag.position.x.ToString()); TagPosition.y = float.Parse(UserTag.position.y.ToString()); TUser.Position = TagPosition; // ADD TO LIST UserInPhotos.Add(TUser); } } Feed.UsersInPhoto = UserInPhotos; // SET USER LIKE Feed.UserHasLiked = Post.user_has_liked; // SET ID Feed.Id = Post.id; // SET USER User FeedBy = new User(); FeedBy.UserName = Post.user.username; FeedBy.Website = Post.user.webste; FeedBy.ProfilePicture = Post.user.profile_picture; FeedBy.FullName = Post.user.full_name; FeedBy.Bio = Post.user.bio; FeedBy.Id = Post.user.id; Feed.User = FeedBy; // ADD FEED TO LIST Data.Add(Feed); } return(Data); }
protected void Button2_Click(object sender, EventArgs e) { if (txtStorage.Value != "" && txtCity.Value != "" && txtStoragearea.Value != "" && txtFieldarea.Value != "" && txtAddress.Value != "" && txtIntro.Value != "" && txtValue.Value != "") { string check; if (CheckBox1.Checked) { check = "1"; } else { check = "0"; } string id = this.Request["id"].ToString(); check ck = new check(); string sql = "update TB_Storage set StorageName='" + txtStorage.Value + "',City='" + txtCity.Value + "',TypeName='" + DropDownList1.SelectedItem.Text + "',Storage_area=" + txtStoragearea.Value + ",Field_area=" + txtFieldarea.Value + ",Address='" + txtAddress.Value + "',intro='" + txtIntro.Value + "',inbuiltValue='" + txtValue.Value + "',Company='" + txtCompany.Value + "',linkmen='" + txtlinkmen.Value + "',Phone='" + txtPhone.Value + "',state=" + check + " where id=" + this.Request["id"].ToString(); data_conn cn = new data_conn(); cn.mdb_exe(sql); //string sql = "insert into TB_Storage (StorageName,City,TypeName,Storage_area,Field_area,Address,intro,inbuiltValue,Company,linkmen,Phone,Postdate) values "; //sql += "('" + ck.CheckInput(txtStorage.Value) + "','" + ck.CheckInput(txtCity.Value) + "','" + ck.CheckInput(DropDownList1.SelectedItem.Text) + "'," + ck.CheckInput(txtStoragearea.Value) + "," + ck.CheckInput(txtFieldarea.Value) + ",'" + ck.CheckInput(txtAddress.Value) + "','" + ck.CheckInput(txtIntro.Value) + "','" + ck.CheckInput(value) + "','" + ck.CheckInput(txtCompany.Value) + "','" + ck.CheckInput(txtlinkmen.Value) + "','" + ck.CheckInput(txtPhone.Value) + "',getdate())"; //string id = mdb_exe_return(sql); if (FileUpload1.FileName != "") { string filepath = Server.MapPath("../../bis/images/") + "/Storage/upload/old/" + id + "_1.jpg"; FileUpload1.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_1.jpg", 48, 48); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_big_1.jpg", 210, 150); } if (FileUpload2.FileName != "") { string filepath = Server.MapPath("../../bis/images/") + "/Storage/upload/old/" + id + "_2.jpg"; FileUpload2.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_2.jpg", 48, 48); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_big_2.jpg", 210, 150); } if (FileUpload3.FileName != "") { string filepath = Server.MapPath("../../bis/images/") + "/Storage/upload/old/" + id + "_3.jpg"; FileUpload3.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_3.jpg", 48, 48); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_big_3.jpg", 210, 150); } if (FileUpload4.FileName != "") { string filepath = Server.MapPath("../../bis/images/") + "/Storage/upload/old/" + id + "_4.jpg"; FileUpload4.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_4.jpg", 48, 48); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_big_4.jpg", 210, 150); } if (FileUpload5.FileName != "") { string filepath = Server.MapPath("../../bis/images/") + "/Storage/upload/old/" + id + "_5.jpg"; FileUpload5.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_5.jpg", 48, 48); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("../../bis/images/") + "/Storage/upload/" + id + "_big_5.jpg", 210, 150); } this.Response.Redirect("Storagelist.aspx"); } else { MessageBox("", "*必填"); } }
void Page_Loaded(object sender, RoutedEventArgs e) { LayoutRoot2.MouseEnter += new MouseEventHandler(LayoutRoot2_MouseEnter); LayoutRoot.MouseLeftButtonUp += new MouseButtonEventHandler(LayoutRoot_MouseLeftButtonUp); controlsContainer.MouseLeave += new MouseEventHandler(controlsContainer_MouseLeave); // TODO: check if there isn't one and show an image mediaPlayer.Source = App.Current.Resources["m"] as Uri; #region Additional Startup Params if (App.Current.Resources.Contains("autostart")) { mediaPlayer.AutoPlay = Convert.ToBoolean(App.Current.Resources["autostart"]); } if (App.Current.Resources.Contains("thumbnail")) { ThumbnailImage.SetValue(Image.SourceProperty, App.Current.Resources["thumbnail"].ToString()); Thumbnail.Visibility = Visibility.Visible; } if (App.Current.Resources.Contains("markers")) { mediaControls.EnableMarkers = Convert.ToBoolean(App.Current.Resources["markers"]); } if (App.Current.Resources.Contains("cc")) { mediaControls.EnableCC = Convert.ToBoolean(App.Current.Resources["cc"]); } if (App.Current.Resources.Contains("markerpath")) { mediaControls.MarkerPath = App.Current.Resources["markerpath"] as Uri; } if (App.Current.Resources.Contains("muted")) { mediaPlayer.IsMuted = Convert.ToBoolean(App.Current.Resources["muted"]); } if (App.Current.Resources.Contains("autohide")) { _autoHideControls = Convert.ToBoolean(App.Current.Resources["autohide"]); } if (App.Current.Resources.Contains("canscrub")) { mediaControls.sliderTimeline.IsHitTestVisible = Convert.ToBoolean(App.Current.Resources["canscrub"]); } #endregion mediaControls.Media = mediaPlayer; _defaultPlayerWidth = this.Width; _defaultPlayerHeight = this.Height; RepositionCenterPlay(); mediaControls.FullScreenClicked += new mediaControl.EventHandler(mediaControls_FullScreenClicked); mediaControls.PlayClicked += new mediaControl.EventHandler(mediaControls_PlayClicked); mediaControls.PauseClicked += new mediaControl.EventHandler(mediaControls_PauseClicked); mediaControls.StopClicked += new mediaControl.EventHandler(mediaControls_StopClicked); mediaControls.BufferingStart += new mediaControl.EventHandler(mediaControls_BufferingStart); mediaControls.BufferingEnd += new mediaControl.EventHandler(mediaControls_BufferingEnd); mediaControls.MediaCompleted += new mediaControl.EventHandler(mediaControls_MediaCompleted); mediaControls.SoundChanged += new mediaControl.SoundEventHandler(mediaControls_SoundChanged); mediaControls.MarkerReached += new mediaControl.MarkerEventHandler(mediaControls_MarkerReached); controlsContainer.Visibility = Visibility.Visible; controlsIn.Begin(); }
protected void ImageButton1_Click1(object sender, ImageClickEventArgs e) { check ck = new check(); if (Request.Cookies["user_id"] != null) { if (Request.Cookies["user_id"].Value.ToString() != "") { if (CompanyType.Value == "0") { MessageBox("opfail", "公司类型为空"); } else if (ddlcity1.SelectedValue == "0" || ddlcity2.SelectedValue == "0") { MessageBox("opfail", "公司所在地为空"); } else if (introduction.Value == "") { MessageBox("opfail", "公司介绍为空"); } else if (Address.Value.Length > 50) { MessageBox("opfail", "联系地址不能大于50个字符"); } else if (PostNumber.Value.Length > 50) { MessageBox("opfail", "邮政编码不能大于50个字符"); } else if (Position.Value.Length > 20) { MessageBox("opfail", "职位不能大于20个字符"); } else if (Fax.Value.Length > 50) { MessageBox("opfail", "传真不能大于50个字符"); } else if (MovePhone.Value.Length > 50) { MessageBox("opfail", "手机不能大于50个字符"); } else if (Msn.Value.Length > 50) { MessageBox("opfail", "MSN不能大于50个字符"); } else if (QQ.Value.Length > 50) { MessageBox("opfail", "QQ不能大于50个字符"); } else if (sign.Value.Length > 200) { MessageBox("opfail", "个性签名不能大于200个字符"); } else if (introduction.Value.Length > 800) { MessageBox("opfail", "公司介绍不能大于800个字符"); } else { string sql = ""; sql = sql + "UPDATE "; sql = sql + "TB_User "; sql = sql + "SET "; sql = sql + "Sex = " + RadioButtonList1.SelectedValue + ","; sql = sql + "WPosition = '" + ck.CheckInput(Position.Value) + "',"; //sql = sql + "Phone = '" + ck.CheckInput(Phone.Value) + "',"; //sql = sql + "Phone2 = '" + ck.CheckInput(Phone2.Value) + "',"; sql = sql + "Fax = '" + ck.CheckInput(Fax.Value) + "',"; sql = sql + "MovePhone = '" + ck.CheckInput(MovePhone.Value) + "',"; sql = sql + "Usermsn = '" + ck.CheckInput(Msn.Value) + "',"; sql = sql + "Userqq = '" + ck.CheckInput(QQ.Value) + "',"; sql = sql + "sign = '" + ck.CheckInput(sign.Value) + "',"; if (Portrait.FileName.ToString() != "") { string filepath; filepath = Server.MapPath("/member/Head/") + Request.Cookies["user_id"].Value.ToString() + "(old).jpg"; Portrait.SaveAs(filepath); ThumbnailImage thumbnailimage = new ThumbnailImage(); thumbnailimage.GetThumbnailImage(filepath, Server.MapPath("/member/Head/") + Request.Cookies["user_id"].Value.ToString() + ".jpg", 70, 70); sql = sql + "HeadURL = 1,"; } sql = sql + "CompanyType = '" + ck.CheckInput(CompanyType.Value) + "',"; sql = sql + "Login2_Locus1 = '" + ck.CheckInput(ddlcity1.SelectedItem.Text) + "', "; sql = sql + "Login2_Locus2 = '" + ck.CheckInput(ddlcity2.SelectedItem.Text) + "', "; sql = sql + "Address = '" + ck.CheckInput(Address.Value) + "',"; sql = sql + "PostNumber = '" + ck.CheckInput(PostNumber.Value) + "',"; sql = sql + "introduction = '" + ck.CheckInput(introduction.Value) + "',"; sql = sql + "User_Level = 1 "; sql = sql + "WHERE UserID = " + Request.Cookies["user_id"].Value.ToString(); data_conn cn = new data_conn(); cn.mdb_exe(sql); if (CompanyType.Value == "1") { Response.Redirect("/accounts/login4.aspx"); } else if (CompanyType.Value == "2") { Response.Redirect("/accounts/login3.aspx"); } else { Response.Redirect("/accounts/regsuccess.aspx"); } } } else { Response.Redirect("/accounts/refill.aspx"); } } else { Response.Redirect("/accounts/refill.aspx"); } }
public ThumbnailImageViewModel(ThumbnailImage model) : this(model.SourceUri, model.DisplayUri) { }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Version.Length != 0) { hash ^= Version.GetHashCode(); } hash ^= authors_.GetHashCode(); if (Copyrights.Length != 0) { hash ^= Copyrights.GetHashCode(); } if (ContactInformation.Length != 0) { hash ^= ContactInformation.GetHashCode(); } if (Reference.Length != 0) { hash ^= Reference.GetHashCode(); } if (thumbnailImage_ != null) { hash ^= ThumbnailImage.GetHashCode(); } if (AvatarPermission != global::VrmProtobuf.Meta.Types.AvatarPermissionType.OnlyAuthor) { hash ^= AvatarPermission.GetHashCode(); } if (ViolentUsage != false) { hash ^= ViolentUsage.GetHashCode(); } if (SexualUsage != false) { hash ^= SexualUsage.GetHashCode(); } if (GameUsage != false) { hash ^= GameUsage.GetHashCode(); } if (CommercialUsage != global::VrmProtobuf.Meta.Types.CommercialUsageType.PersonalNonCommercialNonProfit) { hash ^= CommercialUsage.GetHashCode(); } if (PoliticalOrReligiousUsage != false) { hash ^= PoliticalOrReligiousUsage.GetHashCode(); } if (OtherPermissionUrl.Length != 0) { hash ^= OtherPermissionUrl.GetHashCode(); } if (CreditNotation != global::VrmProtobuf.Meta.Types.CreditNotationType.Required) { hash ^= CreditNotation.GetHashCode(); } if (AllowRedistribution != false) { hash ^= AllowRedistribution.GetHashCode(); } if (Modify != global::VrmProtobuf.Meta.Types.ModifyType.Prohibited) { hash ^= Modify.GetHashCode(); } if (OtherLicenseUrl.Length != 0) { hash ^= OtherLicenseUrl.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }