public async Task AddAsync(PostShare entity)
        {
            await DbContextManager.BeginTransactionAsync();

            var spParameters = new SqlParameter[2];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "userid", Value = entity.UserId
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "postid", Value = entity.PostId
            };

            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spInsertShare", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception)
            {
                DbContextManager.RollbackTransaction();
            }
        }
        private async Task <string> Publish_Link_Share(UserAuthorization user, string ownerUrn)
        {
            try
            {
                var text = new PostShareText()
                {
                    Annotations = null,
                    Text        = $"Publish Link test from { DateTime.Now}"
                };

                var postItem = new PostShare()
                {
                    Content = new PostShareContent()
                    {
                        Title           = "Test title",
                        ContentEntities = new List <PostShareContentEntities>()
                        {
                            new PostShareContentEntities()
                            {
                                EntityLocation = "https://yandex.ru/",
                                Thumbnails     = new List <PostShareContentThumbnails>()
                                {
                                    new PostShareContentThumbnails()
                                    {
                                        ResolvedUrl          = "https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png",
                                        ImageSpecificContent = {}
                                    }
                                }
                            }
                        }
                    },
                    Distribution = new Distribution()
                    {
                        LinkedInDistributionTarget = new LinkedInDistributionTarget()
                        {
                            VisibleToGuest = true
                        }
                    },
                    Subject = " Test Description",
                    Owner   = ownerUrn,
                    Text    = text
                };

                var response = await api.Shares.PostAsync(user, postItem);

                var postUrn = "urn:li:share:" + response.Id;

                return(postUrn);
            }
            catch (LinkedInApiException ex)
            {
                errors.Add(ex.ToString());
                return(null);
            }
            catch (Exception ex)
            {
                errors.Add(ex.ToString());
                return(null);
            }
        }
        View GetView(PostShare item, int position, View convertView, ViewGroup parent)
        {
            View view = convertView;

            if (view == null)
            {
                view = Activity.LayoutInflater.Inflate(Resource.Layout.PostLikeItem, null);
            }

            view.FindViewById <TextView>(Resource.Id.lblName).Text = item.FirstName + " " + item.LastName;

            var profileImageView = view.FindViewById <ImageViewAsync>(Resource.Id.imgProfile);

            profileImageView.Tag?.CancelPendingTask(item.ProfileUrl);
            var task = ImageService.Instance.LoadUrl(item.ProfileUrl)
                       .Retry(3, 300)
                       .LoadingPlaceholder(Resource.Drawable.DefProfPic.ToString(), ImageSource.CompiledResource)
                       .Transform(new CircleTransformation())
                       .Into(profileImageView);

            profileImageView.Tag = new ImageLoaderHelper(task);


            return(view);
        }
        public IHttpActionResult PutPostShare(int id, PostShare postShare)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != postShare.id)
            {
                return(BadRequest());
            }

            db.Entry(postShare).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PostShareExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        private async Task <string> Publish_Article_Share(UserAuthorization user, string ownerUrn, string mediaUrl)
        {
            try
            {
                var imagesData = DownladFromUrlToByte(mediaUrl);

                var text = new PostShareText()
                {
                    Annotations = null,
                    Text        = $"Publish Document test from { DateTime.Now}"
                };

                var postItem = new PostShare()
                {
                    Distribution = new Distribution()
                    {
                        LinkedInDistributionTarget = new LinkedInDistributionTarget()
                        {
                            VisibleToGuest = true
                        }
                    },
                    Owner = ownerUrn,
                    Text  = text
                };

                if (imagesData != null)
                {
                    var contentEntities = new List <PostShareContentEntities>
                    {
                        new PostShareContentEntities()
                        {
                            EntityLocation = mediaUrl
                        }
                    };

                    postItem.Content = new PostShareContent()
                    {
                        ContentEntities = contentEntities,
                        MediaCategory   = "ARTICLE"
                    };
                }

                var response = await api.Shares.PostAsync(user, postItem);

                var postUrn = "urn:li:share:" + response.Id;

                return(postUrn);
            }
            catch (LinkedInApiException ex)
            {
                errors.Add(ex.ToString());
                return(null);
            }
            catch (Exception ex)
            {
                errors.Add(ex.ToString());
                return(null);
            }
        }
        public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath, PostShare item)
        {
            var cell = tableView.DequeueReusableCell("PostShareCell", indexPath) as PostShareCell;

            cell.SetData(item);
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            return(cell);
        }
Ejemplo n.º 7
0
 public void SetData(PostShare item)
 {
     lblName.Text = item.FirstName + " " + item.LastName;
     imageTask?.Cancel(item.ProfileUrl);
     if (!string.IsNullOrEmpty(item.ProfileUrl))
     {
         imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile", null, new CircleTransformation());
     }
 }
        public IHttpActionResult GetPostShare(int id)
        {
            PostShare postShare = db.PostShares.Find(id);

            if (postShare == null)
            {
                return(NotFound());
            }

            return(Ok(postShare));
        }
        public IHttpActionResult PostPostShare(PostShare postShare)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PostShares.Add(postShare);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = postShare.id }, postShare));
        }
        public IHttpActionResult DeletePostShare(int id)
        {
            PostShare postShare = db.PostShares.Find(id);

            if (postShare == null)
            {
                return(NotFound());
            }

            db.PostShares.Remove(postShare);
            db.SaveChanges();

            return(Ok(postShare));
        }
Ejemplo n.º 11
0
        private async Task <string> Publish_Status_Share(UserAuthorization user, string ownerUrn)
        {
            try
            {
                var text = new PostShareText()
                {
                    Annotations = null,
                    Text        = $"Publish Status test from { DateTime.Now}"
                };

                var postItem = new PostShare()
                {
                    Distribution = new Distribution()
                    {
                        LinkedInDistributionTarget = new LinkedInDistributionTarget()
                        {
                            VisibleToGuest = true
                        }
                    },
                    Owner = ownerUrn,
                    Text  = text
                };

                var response = await api.Shares.PostAsync(user, postItem);

                var postUrn = "urn:li:share:" + response.Id;

                return(postUrn);
            }
            catch (LinkedInApiException ex)
            {
                errors.Add(ex.ToString());
                return(null);
            }
            catch (Exception ex)
            {
                errors.Add(ex.ToString());
                return(null);
            }
        }
Ejemplo n.º 12
0
        public async Task <object> GetBy(PostShare parameters)
        {
            return(await Uow.Repository <PostShare>().FindByAsync(t => t.PostId == parameters.PostId));

            throw new NotImplementedException();
        }
Ejemplo n.º 13
0
 public Task DeleteAsync(PostShare parameters)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 14
0
 public HashSet <string> DeleteValidation(PostShare parameters)
 {
     return(ValidationMessages);
 }
Ejemplo n.º 15
0
        public async Task UpdateAsync(PostShare entity)
        {
            await Uow.RegisterDirtyAsync(entity);

            await Uow.CommitAsync();
        }
Ejemplo n.º 16
0
 public HashSet <string> UpdateValidation(PostShare entity)
 {
     return(ValidationMessages);
 }
Ejemplo n.º 17
0
        public async Task AddAsync(PostShare entity)
        {
            await Uow.RegisterNewAsync(entity);

            await Uow.CommitAsync();
        }
Ejemplo n.º 18
0
 public Task <object> GetAsync(PostShare parameters)
 {
     throw new NotImplementedException();
 }