当前位置: 首页>>代码示例>>C#>>正文


C# PutAttributesRequest.WithAttribute方法代码示例

本文整理汇总了C#中Amazon.SimpleDB.Model.PutAttributesRequest.WithAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# PutAttributesRequest.WithAttribute方法的具体用法?C# PutAttributesRequest.WithAttribute怎么用?C# PutAttributesRequest.WithAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Amazon.SimpleDB.Model.PutAttributesRequest的用法示例。


在下文中一共展示了PutAttributesRequest.WithAttribute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveComments

        public static void SaveComments(string domainName, Comment comment)
        {
            PutAttributesRequest putAttrRequest = new PutAttributesRequest()
                .WithDomainName(domainName)
                .WithItemName(Convert.ToString(comment.CommentID));
            putAttrRequest.WithAttribute(new ReplaceableAttribute
            {
                Name = "NewsID",
                Value = Convert.ToString(comment.NewsID),
                Replace = false
            },

            new ReplaceableAttribute
            {
                Name = "UserName",
                Value = comment.UserName,
                Replace = false
            },
            new ReplaceableAttribute
            {
                Name = "CommentID",
                Value = Convert.ToString(comment.CommentID),
                Replace = false
            },
             new ReplaceableAttribute
             {
                 Name = "CommentAdded",
                 Value = Convert.ToString(comment.CommentAdded),
                 Replace = false
             }
             ,
             new ReplaceableAttribute
             {
                 Name = "CommentItem",
                 Value = SaveHtml(comment.CommentItem),
                 Replace = false
             }
              ,
             new ReplaceableAttribute
             {
                 Name = "CommentReplyID",
                 Value = comment.CommentReplyID,
                 Replace = false
             }
              ,
             new ReplaceableAttribute
             {
                 Name = "Likes",
                 Value = Convert.ToString(comment.Likes),
                 Replace = true
             }
               );
            sdbClient.PutAttributes(putAttrRequest);
        }
开发者ID:abrahamkapambwe,项目名称:ZambianNews,代码行数:54,代码来源:GetNewsFromAmazon.cs

示例2: SaveLikes

        public static void SaveLikes(string domainName, Comment comment)
        {
            PutAttributesRequest putAttrRequest = new PutAttributesRequest()
                .WithDomainName(domainName)
                .WithItemName(Convert.ToString(comment.CommentID));
            putAttrRequest.WithAttribute(new ReplaceableAttribute
            {
                Name = "Likes",
                Value = Convert.ToString(comment.Likes),
                Replace = true
            }

               );
            sdbClient.PutAttributes(putAttrRequest);
        }
开发者ID:abrahamkapambwe,项目名称:ZambianNews,代码行数:15,代码来源:GetNewsFromAmazon.cs

示例3: SaveNewItems

        public static void SaveNewItems(string domainName, string bucketName, NewsComponents newsItem, AmazonSimpleDBClient sdbClient, AmazonS3Client s3Client)
        {
            try
            {

                foreach (var stream in newsItem.Images)
                {
                    PutObjectRequest putObjectRequest = new PutObjectRequest();
                    putObjectRequest.WithBucketName(bucketName);
                    putObjectRequest.CannedACL = S3CannedACL.PublicRead;
                    putObjectRequest.Key = stream.fileName;
                    putObjectRequest.InputStream = stream.photostreams;

                    using (S3Response response = s3Client.PutObject(putObjectRequest))
                    {
                        WebHeaderCollection headers = response.Headers;
                        foreach (string key in headers.Keys)
                        {
                            //log headers ("Response Header: {0}, Value: {1}", key, headers.Get(key));
                        }
                    }
                }

                PutObjectRequest putObjectNewsItem = new PutObjectRequest();
                putObjectNewsItem.WithBucketName(newsItem.BucketName);
                putObjectNewsItem.CannedACL = S3CannedACL.PublicRead;
                putObjectNewsItem.Key = Convert.ToString(newsItem.NewsID);
                putObjectNewsItem.ContentType = "text/html";
                putObjectNewsItem.ContentBody = newsItem.NewsItem;

                using (S3Response response = s3Client.PutObject(putObjectNewsItem))
                {
                    WebHeaderCollection headers = response.Headers;
                    foreach (string key in headers.Keys)
                    {
                        //log headers ("Response Header: {0}, Value: {1}", key, headers.Get(key));
                    }
                }

                PutAttributesRequest putAttrRequest = new PutAttributesRequest()
                .WithDomainName(domainName)
                .WithItemName(Convert.ToString(newsItem.NewsID));

                putAttrRequest.WithAttribute(
                     new ReplaceableAttribute
                        {
                            Name = "NewsID",
                            Value = Convert.ToString(newsItem.NewsID),
                            Replace = false
                        },
                        new ReplaceableAttribute
                        {
                            Name = "Source",
                            Value = newsItem.Source,
                            Replace = false
                        },
                        new ReplaceableAttribute
                        {
                            Name = "NewsHeadline",
                            Value = newsItem.NewsHeadline,
                            Replace = true
                        },
                        new ReplaceableAttribute
                        {
                            Name = "NewsAdded",
                            Value = Convert.ToString(newsItem.NewsAdded),
                            Replace = true
                        }
                        ,
                         new ReplaceableAttribute
                         {
                             Name = "Summary",
                             Value = newsItem.Summary,
                             Replace = true
                         }
                         ,
                         new ReplaceableAttribute
                         {
                             Name = "SummaryContent",
                             Value = newsItem.SummaryContent,
                             Replace = true
                         }
                          ,
                         new ReplaceableAttribute
                         {
                             Name = "Imagelabel",
                             Value = newsItem.Imagelabel,
                             Replace = true
                         },
                         new ReplaceableAttribute
                         {
                             Name = "Photos",
                             Value = newsItem.NewsPhotoUrl,
                             Replace = true
                         }
                        ,
                         new ReplaceableAttribute
                         {
                             Name = "Category",
                             Value = newsItem.Category,
//.........这里部分代码省略.........
开发者ID:abrahamkapambwe,项目名称:RSSNews,代码行数:101,代码来源:NewsMethods.cs

示例4: SaveViews

        public static void SaveViews(string domainName, NumberViews numberViews)
        {
            PutAttributesRequest putViewsAttrRequest = new PutAttributesRequest()
                .WithDomainName(domainName)
                .WithItemName(Convert.ToString(numberViews.ViewsID));
            putViewsAttrRequest.
                WithAttribute(new ReplaceableAttribute
                {
                    Name = "ViewsID",
                    Value = Convert.ToString(numberViews.ViewsID),
                    Replace = false
                },

                              new ReplaceableAttribute
                              {
                                  Name = "NewsID",
                                  Value = numberViews.NewsID,
                                  Replace = false
                              },
                              new ReplaceableAttribute
                              {
                                  Name = "Views",
                                  Value = Convert.ToString(numberViews.Views),
                                  Replace = true
                              });
            sdbClient.PutAttributes(putViewsAttrRequest);
        }
开发者ID:abrahamkapambwe,项目名称:NewsASPZM,代码行数:27,代码来源:GetNewsFromAmazon.cs

示例5: SaveVideoItems

        public static void SaveVideoItems(string domainName, Multimedia videoItem, AmazonSimpleDBClient sdbClient)
        {
            try
            {

                PutAttributesRequest putVideoRequest = new PutAttributesRequest()
                .WithDomainName(domainName)
                .WithItemName(Convert.ToString(videoItem.VideoId));

                putVideoRequest.WithAttribute(
                     new ReplaceableAttribute
                     {
                         Name = "VideoId",
                         Value = Convert.ToString(videoItem.VideoId),
                         Replace = false
                     },
                        new ReplaceableAttribute
                        {
                            Name = "YoutubeUrl",
                            Value = videoItem.YoutubeUrl,
                            Replace = false
                        },
                        new ReplaceableAttribute
                        {
                            Name = "Country",
                            Value = videoItem.Country,
                            Replace = true
                        },
                        new ReplaceableAttribute
                        {
                            Name = "Title",
                            Value = Convert.ToString(videoItem.Title),
                            Replace = true
                        }
                        ,
                         new ReplaceableAttribute
                         {
                             Name = "Content",
                             Value = videoItem.Content,
                             Replace = true
                         });

                sdbClient.PutAttributes(putVideoRequest);
            }

            catch (AmazonSimpleDBException amazonSimpleDBException)
            {
                string val = amazonSimpleDBException.ErrorCode;
            }
        }
开发者ID:abrahamkapambwe,项目名称:RSSNews,代码行数:50,代码来源:NewsMethods.cs

示例6: SaveVideoItems

        public static void SaveVideoItems(string domainName, Multimedia videoItem, AmazonSimpleDBClient sdbClient, AmazonS3Client s3Client)
        {
            try
            {

                PutObjectRequest putObjectRequest = new PutObjectRequest();
                putObjectRequest.WithBucketName(videoItem.BucketNameUrl);
                putObjectRequest.CannedACL = S3CannedACL.PublicRead;
                putObjectRequest.Key = videoItem.fileName;
                putObjectRequest.InputStream = videoItem.photostreams;

                using (S3Response response = s3Client.PutObject(putObjectRequest))
                {
                    WebHeaderCollection headers = response.Headers;
                    foreach (string key in headers.Keys)
                    {
                        //log headers ("Response Header: {0}, Value: {1}", key, headers.Get(key));
                    }
                }

                PutAttributesRequest putVideoRequest = new PutAttributesRequest()
                .WithDomainName(domainName)
                .WithItemName(Convert.ToString(videoItem.VideoId));

                putVideoRequest.WithAttribute(
                     new ReplaceableAttribute
                     {
                         Name = "VideoId",
                         Value = Convert.ToString(videoItem.VideoId),
                         Replace = false
                     },
                        new ReplaceableAttribute
                        {
                            Name = "YoutubeUrl",
                            Value = videoItem.YoutubeUrl,
                            Replace = false
                        },
                        new ReplaceableAttribute
                        {
                            Name = "Country",
                            Value = videoItem.Country,
                            Replace = true
                        },
                        new ReplaceableAttribute
                        {
                            Name = "Title",
                            Value = Convert.ToString(videoItem.Title),
                            Replace = true
                        }
                        ,
                        new ReplaceableAttribute
                        {
                            Name = "Publish",
                            Value = Convert.ToString(videoItem.Publish),
                            Replace = true
                        }
                        ,
                         new ReplaceableAttribute
                         {
                             Name = "Content",
                             Value = videoItem.Content,
                             Replace = true
                         }
                          ,
                         new ReplaceableAttribute
                         {
                             Name = "Url",
                             Value = videoItem.Url,
                             Replace = true
                         }
                          ,
                         new ReplaceableAttribute
                         {
                             Name = "Category",
                             Value = videoItem.Category,
                             Replace = true
                         }
                         ,
                         new ReplaceableAttribute
                         {
                             Name = "YouTubeAdded",
                             Value = Convert.ToString(videoItem.YouTubeAdded),
                             Replace = true
                         });

                sdbClient.PutAttributes(putVideoRequest);
            }

            catch (AmazonSimpleDBException amazonSimpleDBException)
            {
                string val = amazonSimpleDBException.ErrorCode;
            }
        }
开发者ID:abrahamkapambwe,项目名称:NewsEngine,代码行数:93,代码来源:NewsMethods.cs

示例7: SaveTagNames

        public static void SaveTagNames(string domainName, Tags tags, AmazonSimpleDBClient sdbClient)
        {
            PutAttributesRequest putTagRequest = new PutAttributesRequest()
                .WithDomainName(domainName)
                .WithItemName(Convert.ToString(tags.TagId));

            putTagRequest.WithAttribute(
                new ReplaceableAttribute
                {
                    Name = "TagId",
                    Value = Convert.ToString(tags.TagId),
                    Replace = false
                },
                new ReplaceableAttribute
                {
                    Name = "TagName",
                    Value = tags.TagName,
                    Replace = false
                }
                ,
                new ReplaceableAttribute
                {
                    Name = "Country",
                    Value = tags.Country,
                    Replace = false
                });
            sdbClient.PutAttributes(putTagRequest);
        }
开发者ID:abrahamkapambwe,项目名称:NewsEngine,代码行数:28,代码来源:NewsMethods.cs

示例8: PutPhoto

        public static void PutPhoto(string domainName, string itemName, string bucketName, string fileName, Stream fileContent, bool isPublic, AmazonSimpleDBClient sdbClient, AmazonS3Client s3Client)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                return;
            }

            BucketHelper.CheckForBucket(itemName, s3Client);

            PutObjectRequest putObjectRequest = new PutObjectRequest();
            putObjectRequest.WithBucketName(bucketName);
            putObjectRequest.CannedACL = S3CannedACL.PublicRead;
            putObjectRequest.Key = fileName;
            putObjectRequest.InputStream = fileContent;
            S3Response response = s3Client.PutObject(putObjectRequest);
            response.Dispose();

            DomainHelper.CheckForDomain(domainName, sdbClient);
            PutAttributesRequest putAttrRequest = new PutAttributesRequest()
                .WithDomainName(domainName)
                .WithItemName(itemName);
            putAttrRequest.WithAttribute(new ReplaceableAttribute
                {
                    Name = "PhotoThumbUrl",
                    Value = String.Format(Settings.Default.S3BucketUrlFormat, String.Format(Settings.Default.BucketNameFormat, HttpContext.Current.User.Identity.Name, itemName), fileName),
                    Replace = true
                });
            sdbClient.PutAttributes(putAttrRequest);

            if (isPublic)
            {
                DomainHelper.CheckForDomain(Settings.Default.PetBoardPublicDomainName, sdbClient);
                putAttrRequest.DomainName = Settings.Default.PetBoardPublicDomainName;
                sdbClient.PutAttributes(putAttrRequest);
            }
        }
开发者ID:bernardoleary,项目名称:MyBigBro,代码行数:36,代码来源:Pet.cs

示例9: Put

        public void Put(string domainName, string itemName, bool isPublic, AmazonSimpleDBClient sdbClient)
        {
            if (String.IsNullOrEmpty(domainName) ||
                String.IsNullOrEmpty(itemName))
            {
                return;
            }

            DomainHelper.CheckForDomain(domainName, sdbClient);
            PutAttributesRequest putAttrRequest = new PutAttributesRequest().WithDomainName(domainName).WithItemName(itemName);
            putAttrRequest.WithAttribute(
                    new ReplaceableAttribute { Name = "Public", Value = isPublic.ToString(), Replace = true },
                    new ReplaceableAttribute { Name = "PhotoThumbUrl", Value = !String.IsNullOrEmpty(this.PhotoThumbUrl) ? this.PhotoThumbUrl : String.Empty, Replace = true },
                    new ReplaceableAttribute { Name = "Name", Value = this.Name, Replace = true },
                    new ReplaceableAttribute { Name = "Type", Value = this.Type, Replace = true },
                    new ReplaceableAttribute { Name = "Breed", Value = this.Breed, Replace = true },
                    new ReplaceableAttribute { Name = "Sex", Value = this.Sex, Replace = true },
                    new ReplaceableAttribute { Name = "Birthdate", Value = this.Birthdate, Replace = true },
                    new ReplaceableAttribute { Name = "Likes", Value = this.Likes, Replace = true },
                    new ReplaceableAttribute { Name = "Dislikes", Value = this.Dislikes, Replace = true }
                );
            sdbClient.PutAttributes(putAttrRequest);

            if (isPublic)
            {
                DomainHelper.CheckForDomain(Settings.Default.PetBoardPublicDomainName, sdbClient);
                putAttrRequest.DomainName = Settings.Default.PetBoardPublicDomainName;
                sdbClient.PutAttributes(putAttrRequest);
            }
            else
            {
                DeleteAttributesRequest deleteAttributeRequest = new DeleteAttributesRequest().WithDomainName(Settings.Default.PetBoardPublicDomainName).WithItemName(itemName);
                sdbClient.DeleteAttributes(deleteAttributeRequest);
            }
        }
开发者ID:bernardoleary,项目名称:MyBigBro,代码行数:35,代码来源:Pet.cs


注:本文中的Amazon.SimpleDB.Model.PutAttributesRequest.WithAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。