Exemplo n.º 1
0
        public static CommentImage CommentImageDTO_To_CommentImage(CommentImageDTO commentImageDTO)
        {
            var          mapper       = new MapperConfiguration(cfg => cfg.CreateMap <CommentImageDTO, CommentImage>()).CreateMapper();
            CommentImage commentImage = mapper.Map <CommentImageDTO, CommentImage>(commentImageDTO);

            return(commentImage);
        }
Exemplo n.º 2
0
        public void PostImageComment(CommentImageDTO commentImageDTO)
        {
            CommentEntity commentEntity = MapperModule.CommentImageDTO_To_CommentEntity(commentImageDTO);

            Comment      comment      = MapperModule.CommentImageDTO_To_Comment(commentImageDTO);
            CommentImage commentImage = MapperModule.CommentImageDTO_To_CommentImage(commentImageDTO);

            comment.commentEntity = commentEntity;
            comment.commentImage  = commentImage;


            Database.Comments.Create(comment);
            Database.Save();
        }
        public async Task <OperationResult <CommentImageUploadResponse> > Post(IFormFile file, int id)
        {
            var response = new OperationResult <CommentImageUploadResponse>();

            if (IsLoggedIn)
            {
                try
                {
                    var messages = ValidateRequest(id);
                    messages.AddRange(ValidateFile(file));
                    messages.AddRange(IsCommentExisted(id));

                    if (messages.Count > 0)
                    {
                        response.Messages = messages;
                        response.Success  = false;
                        return(response);
                    }

                    var          filePath     = Path.Combine("wwwroot\\data", Path.GetRandomFileName());
                    CommentImage commentImage = new CommentImage();
                    commentImage.CommentId = id;
                    commentImage.ImagePath = filePath;

                    using (var stream = new FileStream(filePath, FileMode.Create))
                    {
                        await file.CopyToAsync(stream);

                        response.Success = true;
                        var result = await DbContext.CommentImages.AddAsync(commentImage);

                        await DbContext.SaveChangesAsync();
                    }

                    response.Content = new CommentImageUploadResponse()
                    {
                        CommentId = commentImage.CommentId,
                        FilePath  = commentImage.ImagePath
                    };
                }
                catch
                {
                    response.Messages.Add("InternalError");
                }
            }

            return(response);
        }
Exemplo n.º 4
0
        //Reply
        public CommentAdapterViewHolder(View itemView, ReplyCommentAdapter commentAdapter, CommentClickListener postClickListener, CommentObjectExtra commentObject = null) : base(itemView)
        {
            try
            {
                MainView = itemView;

                if (commentObject != null)
                {
                    ReplyCommentObject = commentObject;
                }
                ReplyCommentAdapter = commentAdapter;
                PostClickListener   = postClickListener;
                TypeClass           = "Reply";

                MainCommentLayout = MainView.FindViewById <RelativeLayout>(Resource.Id.mainComment);
                BubbleLayout      = MainView.FindViewById <LinearLayout>(Resource.Id.bubble_layout);
                Image             = MainView.FindViewById <CircleImageView>(Resource.Id.card_pro_pic);
                CommentText       = MainView.FindViewById <SuperTextView>(Resource.Id.active);
                CommentText?.SetTextInfo(CommentText);

                UserName                    = MainView.FindViewById <TextView>(Resource.Id.username);
                TimeTextView                = MainView.FindViewById <TextView>(Resource.Id.time);
                ReplyTextView               = MainView.FindViewById <TextView>(Resource.Id.reply);
                LikeTextView                = MainView.FindViewById <TextView>(Resource.Id.Like);
                DislikeTextView             = MainView.FindViewById <TextView>(Resource.Id.dislike);
                CommentImage                = MainView.FindViewById <ImageView>(Resource.Id.image);
                CountLikeSection            = MainView.FindViewById <LinearLayout>(Resource.Id.countLikeSection);
                CountLike                   = MainView.FindViewById <TextView>(Resource.Id.countLike);
                ImageCountLike              = MainView.FindViewById <ImageView>(Resource.Id.ImagecountLike);
                CountLikeSection.Visibility = ViewStates.Gone;
                RatingBar                   = itemView.FindViewById <RatingBar>(Resource.Id.RatingBar);
                RatingText                  = itemView.FindViewById <Button>(Resource.Id.RatingText);
                RatingLinearLayout          = itemView.FindViewById <LinearLayout>(Resource.Id.RatingLinearLayout);
                CountRating                 = MainView.FindViewById <TextView>(Resource.Id.countRating);
                try
                {
                    VoiceLayout   = MainView.FindViewById <LinearLayout>(Resource.Id.voiceLayout);
                    PlayButton    = MainView.FindViewById <CircleButton>(Resource.Id.playButton);
                    DurationVoice = MainView.FindViewById <TextView>(Resource.Id.Duration);
                    TimeVoice     = MainView.FindViewById <TextView>(Resource.Id.timeVoice);

                    PlayButton?.SetOnClickListener(this);
                }
                catch (Exception e)
                {
                    Methods.DisplayReportResultTrack(e);
                }

                var font = Typeface.CreateFromAsset(MainView.Context.Resources?.Assets, "ionicons.ttf");
                UserName.SetTypeface(font, TypefaceStyle.Normal);

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    BubbleLayout.SetBackgroundResource(Resource.Drawable.comment_rounded_right_layout);
                }

                if (AppSettings.PostButton == PostButtonSystem.DisLike || AppSettings.PostButton == PostButtonSystem.Wonder)
                {
                    DislikeTextView.Visibility = ViewStates.Visible;
                }

                ReplyTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                DislikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                MainView.SetOnLongClickListener(this);
                Image.SetOnClickListener(this);
                LikeTextView.SetOnClickListener(this);
                DislikeTextView.SetOnClickListener(this);
                ReplyTextView.SetOnClickListener(this);
                CommentImage?.SetOnClickListener(this);
                CountLikeSection?.SetOnClickListener(this);
                RatingLinearLayout?.SetOnClickListener(this);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 删除实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Delete(CommentImage model)
 {
     this._CommentImageBiz.Delete(model);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 修改实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Update(CommentImage model)
 {
     this._CommentImageBiz.Update(model);
 }
Exemplo n.º 7
0
 /// <summary>
 /// 添加实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public CommentImage Insert(CommentImage model)
 {
     return(this._CommentImageBiz.Insert(model));
 }
        //Comment
        public CommentAdapterViewHolder(View itemView, CommentAdapter commentAdapter, CommentClickListener postClickListener, string typeClass = "Comment") : base(itemView)
        {
            try
            {
                MainView = itemView;

                CommentAdapter    = commentAdapter;
                PostClickListener = postClickListener;
                TypeClass         = typeClass;

                MainCommentLayout = MainView.FindViewById <RelativeLayout>(Resource.Id.mainComment);
                BubbleLayout      = MainView.FindViewById <LinearLayout>(Resource.Id.bubble_layout);
                Image             = MainView.FindViewById <CircleImageView>(Resource.Id.card_pro_pic);
                CommentText       = MainView.FindViewById <SuperTextView>(Resource.Id.active);
                CommentText?.SetTextInfo(CommentText);

                UserName                    = MainView.FindViewById <TextView>(Resource.Id.username);
                TimeTextView                = MainView.FindViewById <TextView>(Resource.Id.time);
                ReplyTextView               = MainView.FindViewById <TextView>(Resource.Id.reply);
                LikeTextView                = MainView.FindViewById <TextView>(Resource.Id.Like);
                DislikeTextView             = MainView.FindViewById <TextView>(Resource.Id.dislike);
                CommentImage                = MainView.FindViewById <ImageView>(Resource.Id.image);
                CountLikeSection            = MainView.FindViewById <LinearLayout>(Resource.Id.countLikeSection);
                CountLike                   = MainView.FindViewById <TextView>(Resource.Id.countLike);
                ImageCountLike              = MainView.FindViewById <ImageView>(Resource.Id.ImagecountLike);
                CountLikeSection.Visibility = ViewStates.Gone;
                try
                {
                    VoiceLayout   = MainView.FindViewById <LinearLayout>(Resource.Id.voiceLayout);
                    PlayButton    = MainView.FindViewById <CircleButton>(Resource.Id.playButton);
                    DurationVoice = MainView.FindViewById <TextView>(Resource.Id.Duration);
                    TimeVoice     = MainView.FindViewById <TextView>(Resource.Id.timeVoice);

                    PlayButton?.SetOnClickListener(this);
                }
                catch (Exception e)
                {
                    Methods.DisplayReportResultTrack(e);
                }

                var font = Typeface.CreateFromAsset(MainView.Context.Resources?.Assets, "ionicons.ttf");
                UserName.SetTypeface(font, TypefaceStyle.Normal);

                switch (AppSettings.FlowDirectionRightToLeft)
                {
                case true:
                    BubbleLayout.SetBackgroundResource(Resource.Drawable.comment_rounded_right_layout);
                    break;
                }

                switch (AppSettings.PostButton)
                {
                case PostButtonSystem.DisLike:
                case PostButtonSystem.Wonder:
                    DislikeTextView.Visibility = ViewStates.Visible;
                    break;
                }

                /*ReplyTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                 * LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                 * DislikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);*/
                ReplyTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.ParseColor("#888888"));
                LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.ParseColor("#888888"));
                DislikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.ParseColor("#888888"));

                MainView.SetOnLongClickListener(this);
                Image.SetOnClickListener(this);
                LikeTextView.SetOnClickListener(this);
                DislikeTextView.SetOnClickListener(this);
                ReplyTextView.SetOnClickListener(this);
                CommentImage?.SetOnClickListener(this);
                CountLikeSection?.SetOnClickListener(this);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (MainImage != null)
            {
                MainImage.Dispose();
                MainImage = null;
            }

            if (Name != null)
            {
                Name.Dispose();
                Name = null;
            }

            if (Date != null)
            {
                Date.Dispose();
                Date = null;
            }

            if (Description != null)
            {
                Description.Dispose();
                Description = null;
            }

            if (ForkImage != null)
            {
                ForkImage.Dispose();
                ForkImage = null;
            }

            if (CommentImage != null)
            {
                CommentImage.Dispose();
                CommentImage = null;
            }

            if (StarsImage != null)
            {
                StarsImage.Dispose();
                StarsImage = null;
            }

            if (Forks != null)
            {
                Forks.Dispose();
                Forks = null;
            }

            if (Comments != null)
            {
                Comments.Dispose();
                Comments = null;
            }

            if (Stars != null)
            {
                Stars.Dispose();
                Stars = null;
            }
        }
        //Comment
        public CommentAdapterViewHolder(View itemView, CommentAdapter commentAdapter, CommentClickListener postClickListener, string typeClass = "Comment") : base(itemView)
        {
            try
            {
                MainView = itemView;

                CommentAdapter    = commentAdapter;
                PostClickListener = postClickListener;
                TypeClass         = typeClass;

                BubbleLayout    = MainView.FindViewById <LinearLayout>(Resource.Id.bubble_layout);
                Image           = MainView.FindViewById <CircleImageView>(Resource.Id.card_pro_pic);
                CommentText     = MainView.FindViewById <AutoLinkTextView>(Resource.Id.active);
                UserName        = MainView.FindViewById <TextView>(Resource.Id.username);
                TimeTextView    = MainView.FindViewById <TextView>(Resource.Id.time);
                ReplyTextView   = MainView.FindViewById <TextView>(Resource.Id.reply);
                LikeTextView    = MainView.FindViewById <TextView>(Resource.Id.Like);
                DislikeTextView = MainView.FindViewById <TextView>(Resource.Id.dislike);
                CommentImage    = MainView.FindViewById <ImageView>(Resource.Id.image);

                try
                {
                    VoiceLayout   = MainView.FindViewById <LinearLayout>(Resource.Id.voiceLayout);
                    PlayButton    = MainView.FindViewById <CircleButton>(Resource.Id.playButton);
                    DurationVoice = MainView.FindViewById <TextView>(Resource.Id.Duration);
                    TimeVoice     = MainView.FindViewById <TextView>(Resource.Id.timeVoice);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                var font = Typeface.CreateFromAsset(MainView.Context.Resources.Assets, "ionicons.ttf");
                UserName.SetTypeface(font, TypefaceStyle.Normal);

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    BubbleLayout.SetBackgroundResource(Resource.Drawable.comment_rounded_right_layout);
                }

                if (AppSettings.PostButton == PostButtonSystem.DisLike || AppSettings.PostButton == PostButtonSystem.Wonder)
                {
                    DislikeTextView.Visibility = ViewStates.Visible;
                }

                ReplyTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                DislikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                MainView.SetOnLongClickListener(this);
                Image.SetOnClickListener(this);
                LikeTextView.SetOnClickListener(this);
                DislikeTextView.SetOnClickListener(this);
                ReplyTextView.SetOnClickListener(this);
                CommentImage?.SetOnClickListener(this);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 /// <summary>
 /// 删除实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Delete(CommentImage model)
 {
     this._repoCommentImage.Delete(model);
 }
 /// <summary>
 /// 修改实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Update(CommentImage model)
 {
     this._repoCommentImage.Update(model);
 }
 public CommentImage Insert(CommentImage model)
 {
     return(this._repoCommentImage.Insert(model));
 }