コード例 #1
0
        private RequestBodyBuilder PopulateRequestParameters(TroubleshooterCategoryRequest troubleshooterCategoryRequest, RequestTypes requestType)
        {
            troubleshooterCategoryRequest.EnsureValidData(requestType);

            var parameters = new RequestBodyBuilder();

            parameters.AppendRequestDataNonEmptyString("title", troubleshooterCategoryRequest.Title);
            parameters.AppendRequestData("categorytype", EnumUtility.ToApiString(troubleshooterCategoryRequest.CategoryType));

            if (requestType == RequestTypes.Create)
            {
                parameters.AppendRequestDataNonNegativeInt("staffid", troubleshooterCategoryRequest.StaffId);
            }

            if (troubleshooterCategoryRequest.DisplayOrder.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("displayorder", troubleshooterCategoryRequest.DisplayOrder.Value);
            }

            parameters.AppendRequestDataNonEmptyString("description", troubleshooterCategoryRequest.Description);
            parameters.AppendRequestDataBool("uservisibilitycustom", troubleshooterCategoryRequest.UserVisibilityCustom);
            parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", troubleshooterCategoryRequest.UserGroupIdList);
            parameters.AppendRequestDataBool("staffvisibilitycustom", troubleshooterCategoryRequest.StaffVisibilityCustom);
            parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", troubleshooterCategoryRequest.StaffGroupIdList);

            return(parameters);
        }
コード例 #2
0
        private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseArticleRequest knowledgebaseArticleRequest, RequestTypes requestType)
        {
            knowledgebaseArticleRequest.EnsureValidData(requestType);

            RequestBodyBuilder parameters = new RequestBodyBuilder();

            parameters.AppendRequestDataNonEmptyString("subject", knowledgebaseArticleRequest.Subject);
            parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseArticleRequest.Contents);

            if (requestType == RequestTypes.Create && knowledgebaseArticleRequest.CreatorId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("creatorid", knowledgebaseArticleRequest.CreatorId.Value);
            }

            if (knowledgebaseArticleRequest.ArticleStatus.HasValue)
            {
                parameters.AppendRequestData("articlestatus", EnumUtility.ToApiString(knowledgebaseArticleRequest.ArticleStatus.Value));
            }

            parameters.AppendRequestDataBool("isfeatured", knowledgebaseArticleRequest.IsFeatured);
            parameters.AppendRequestDataBool("allowcomments", knowledgebaseArticleRequest.AllowComments);
            parameters.AppendRequestDataArrayCommaSeparated("categoryid", knowledgebaseArticleRequest.CategoryIds);

            if (requestType == RequestTypes.Update && knowledgebaseArticleRequest.EditedStaffId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("editedstaffid", knowledgebaseArticleRequest.EditedStaffId.Value);
            }

            return(parameters);
        }
コード例 #3
0
        private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseCommentRequest knowledgebaseCommentRequest, RequestTypes requestType)
        {
            knowledgebaseCommentRequest.EnsureValidData(requestType);

            RequestBodyBuilder parameters = new RequestBodyBuilder();

            parameters.AppendRequestDataNonNegativeInt("knowledgebasearticleid", knowledgebaseCommentRequest.KnowledgebaseArticleId);
            parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseCommentRequest.Contents);
            parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(knowledgebaseCommentRequest.CreatorType));

            if (knowledgebaseCommentRequest.CreatorId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("creatorid", knowledgebaseCommentRequest.CreatorId.Value);
            }
            else
            {
                parameters.AppendRequestDataNonEmptyString("fullname", knowledgebaseCommentRequest.FullName);
            }

            parameters.AppendRequestDataNonEmptyString("email", knowledgebaseCommentRequest.Email);

            if (knowledgebaseCommentRequest.ParentCommentId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("parentcommentid", knowledgebaseCommentRequest.ParentCommentId.Value);
            }

            return(parameters);
        }
コード例 #4
0
        public NewsItemComment CreateNewsItemComment(NewsItemCommentRequest newsItemCommentRequest)
        {
            newsItemCommentRequest.EnsureValidData(RequestTypes.Create);

            RequestBodyBuilder parameters = new RequestBodyBuilder();

            parameters.AppendRequestData("newsitemid", newsItemCommentRequest.NewsItemId);
            parameters.AppendRequestDataNonEmptyString("contents", newsItemCommentRequest.Contents);
            parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(newsItemCommentRequest.CreatorType));

            if (newsItemCommentRequest.CreatorId != null)
            {
                parameters.AppendRequestData("creatorid", newsItemCommentRequest.CreatorId);
            }
            else
            {
                parameters.AppendRequestDataNonEmptyString("fullname", newsItemCommentRequest.FullName);
            }

            parameters.AppendRequestDataNonEmptyString("email", newsItemCommentRequest.Email);
            parameters.AppendRequestData("parentcommentid", newsItemCommentRequest.ParentCommentId);

            var newsItemComments = Connector.ExecutePost <NewsItemCommentCollection>(NewsItemCommentBaseUrl, parameters.ToString());

            if (newsItemComments != null && newsItemComments.Count > 0)
            {
                return(newsItemComments[0]);
            }

            return(null);
        }
コード例 #5
0
        private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseAttachmentRequest knowledgebaseAttachmentRequest, RequestTypes requestType)
        {
            knowledgebaseAttachmentRequest.EnsureValidData(requestType);

            RequestBodyBuilder parameters = new RequestBodyBuilder();

            parameters.AppendRequestDataNonNegativeInt("kbarticleid", knowledgebaseAttachmentRequest.KnowledgebaseArticleId);
            parameters.AppendRequestDataNonEmptyString("filename", knowledgebaseAttachmentRequest.FileName);
            parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseAttachmentRequest.Contents);

            return(parameters);
        }
コード例 #6
0
        private static RequestBodyBuilder PopulateRequestParameters(TroubleshooterAttachmentRequest troubleshooterAttachmentRequest, RequestTypes requestType)
        {
            troubleshooterAttachmentRequest.EnsureValidData(requestType);

            var parameters = new RequestBodyBuilder();

            parameters.AppendRequestDataNonNegativeInt("troubleshooterstepid", troubleshooterAttachmentRequest.TroubleshooterStepId);
            parameters.AppendRequestDataNonEmptyString("filename", troubleshooterAttachmentRequest.FileName);
            parameters.AppendRequestDataNonEmptyString("contents", troubleshooterAttachmentRequest.Contents);

            return(parameters);
        }
コード例 #7
0
        private RequestBodyBuilder PopulateRequestParameters(TroubleshooterStepRequest troubleshooterStepRequest, RequestTypes requestType)
        {
            troubleshooterStepRequest.EnsureValidData(requestType);

            var parameters = new RequestBodyBuilder();

            if (requestType == RequestTypes.Create)
            {
                parameters.AppendRequestData("categoryid", troubleshooterStepRequest.CategoryId);
            }

            parameters.AppendRequestDataNonEmptyString("subject", troubleshooterStepRequest.Subject);
            parameters.AppendRequestDataNonEmptyString("contents", troubleshooterStepRequest.Contents);

            parameters.AppendRequestDataNonNegativeInt(requestType == RequestTypes.Create ? "staffid" : "editedstaffid",
                                                       troubleshooterStepRequest.StaffId);

            if (troubleshooterStepRequest.DisplayOrder.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("displayorder", troubleshooterStepRequest.DisplayOrder.Value);
            }

            parameters.AppendRequestDataBool("allowcomments", troubleshooterStepRequest.AllowComments);
            parameters.AppendRequestDataBool("enableticketredirection", troubleshooterStepRequest.EnableTicketRedirection);

            if (troubleshooterStepRequest.RedirectDepartmentId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("redirectdepartmentid", troubleshooterStepRequest.RedirectDepartmentId.Value);
            }

            if (troubleshooterStepRequest.TicketTypeId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("tickettypeid", troubleshooterStepRequest.TicketTypeId.Value);
            }

            if (troubleshooterStepRequest.TicketPriorityId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("ticketpriorityid", troubleshooterStepRequest.TicketPriorityId.Value);
            }

            parameters.AppendRequestDataNonEmptyString("ticketsubject", troubleshooterStepRequest.TicketSubject);

            if (troubleshooterStepRequest.StepStatus.HasValue)
            {
                parameters.AppendRequestData("stepstatus", EnumUtility.ToApiString(troubleshooterStepRequest.StepStatus.Value));
            }

            parameters.AppendRequestDataArrayCommaSeparated("parentstepidlist", troubleshooterStepRequest.ParentStepIdList);

            return(parameters);
        }
コード例 #8
0
        private RequestBodyBuilder PopulateRequestParameters(TroubleshooterCommentRequest troubleshooterCommentRequest, RequestTypes requestType)
        {
            troubleshooterCommentRequest.EnsureValidData(requestType);

            var parameters = new RequestBodyBuilder();

            parameters.AppendRequestDataNonNegativeInt("troubleshooterstepid", troubleshooterCommentRequest.TroubleshooterStepId);
            parameters.AppendRequestDataNonEmptyString("contents", troubleshooterCommentRequest.Contents);
            parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(troubleshooterCommentRequest.CreatorType));
            parameters.AppendRequestDataNonNegativeInt("creatorid", troubleshooterCommentRequest.CreatorId);
            parameters.AppendRequestDataNonEmptyString("fullname", troubleshooterCommentRequest.FullName);
            parameters.AppendRequestDataNonEmptyString("email", troubleshooterCommentRequest.Email);
            parameters.AppendRequestDataNonNegativeInt("parentcommentid", troubleshooterCommentRequest.ParentCommentId);

            return(parameters);
        }
コード例 #9
0
        private static RequestBodyBuilder PopulateRequestParameters(NewsItemRequest newsItem, RequestTypes requestType)
        {
            newsItem.EnsureValidData(requestType);

            RequestBodyBuilder parameters = new RequestBodyBuilder();

            parameters.AppendRequestDataNonEmptyString("subject", newsItem.Subject);
            parameters.AppendRequestDataNonEmptyString("contents", newsItem.Contents);

            if (requestType == RequestTypes.Create)
            {
                parameters.AppendRequestDataNonNegativeInt("staffid", newsItem.StaffId);
            }
            else
            {
                parameters.AppendRequestDataNonNegativeInt("editedstaffid", newsItem.StaffId);
            }

            if (requestType == RequestTypes.Create && newsItem.NewsItemType.HasValue)
            {
                parameters.AppendRequestData("newstype", EnumUtility.ToApiString(newsItem.NewsItemType));
            }

            if (newsItem.NewsItemStatus.HasValue)
            {
                parameters.AppendRequestData("newsstatus", EnumUtility.ToApiString(newsItem.NewsItemStatus));
            }

            parameters.AppendRequestDataNonEmptyString("fromname", newsItem.FromName);
            parameters.AppendRequestDataNonEmptyString("email", newsItem.Email);
            parameters.AppendRequestDataNonEmptyString("customemailsubject", newsItem.CustomEmailSubject);
            parameters.AppendRequestDataBool("sendemail", newsItem.SendEmail);
            parameters.AppendRequestDataBool("allowcomments", newsItem.AllowComments);
            parameters.AppendRequestDataBool("uservisibilitycustom", newsItem.UserVisibilityCustom);
            parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", newsItem.UserGroupIdList);
            parameters.AppendRequestDataBool("staffvisibilitycustom", newsItem.StaffVisibilityCustom);
            parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", newsItem.StaffGroupIdList);
            parameters.AppendRequestData("expiry", newsItem.Expiry.DateTime.ToString("M/d/yyyy"));
            parameters.AppendRequestDataArrayCommaSeparated("newscategoryidlist", newsItem.Categories);

            return(parameters);
        }
コード例 #10
0
        private RequestBodyBuilder PopulateRequestParameters(NewsSubscriberRequest newsSubscriberRequest, RequestTypes requestTypes)
        {
            newsSubscriberRequest.EnsureValidData(requestTypes);

            var requestBodyBuilder = new RequestBodyBuilder();

            requestBodyBuilder.AppendRequestDataNonEmptyString("email", newsSubscriberRequest.Email);

            if (requestTypes == RequestTypes.Create)
            {
                requestBodyBuilder.AppendRequestDataBool("isvalidated", newsSubscriberRequest.IsValidated);
            }

            return(requestBodyBuilder);
        }
コード例 #11
0
        private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseCategoryRequest knowledgebaseCategoryRequest, RequestTypes requestType)
        {
            knowledgebaseCategoryRequest.EnsureValidData(requestType);

            RequestBodyBuilder parameters = new RequestBodyBuilder();

            parameters.AppendRequestDataNonEmptyString("title", knowledgebaseCategoryRequest.Title);

            if (knowledgebaseCategoryRequest.CategoryType.HasValue)
            {
                parameters.AppendRequestData("categorytype",
                                             EnumUtility.ToApiString(knowledgebaseCategoryRequest.CategoryType.Value));
            }

            if (knowledgebaseCategoryRequest.ParentCategoryId.HasValue)
            {
                parameters.AppendRequestData("parentcategoryid", knowledgebaseCategoryRequest.ParentCategoryId.Value);
            }

            if (knowledgebaseCategoryRequest.DisplayOrder.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("displayorder", knowledgebaseCategoryRequest.DisplayOrder.Value);
            }

            if (knowledgebaseCategoryRequest.ArticleSortOrder.HasValue)
            {
                parameters.AppendRequestData("articlesortorder",
                                             EnumUtility.ToApiString(knowledgebaseCategoryRequest.ArticleSortOrder.Value));
            }

            parameters.AppendRequestDataBool("allowcomments", knowledgebaseCategoryRequest.AllowComments);
            parameters.AppendRequestDataBool("allowrating", knowledgebaseCategoryRequest.AllowRating);
            parameters.AppendRequestDataBool("ispublished", knowledgebaseCategoryRequest.IsPublished);
            parameters.AppendRequestDataBool("uservisibilitycustom", knowledgebaseCategoryRequest.UserVisibilityCustom);
            parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", knowledgebaseCategoryRequest.UserGroupIdList);
            parameters.AppendRequestDataBool("staffvisibilitycustom", knowledgebaseCategoryRequest.StaffVisibilityCustom);
            parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", knowledgebaseCategoryRequest.StaffGroupIdList);

            if (requestType == RequestTypes.Create && knowledgebaseCategoryRequest.StaffId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("staffid", knowledgebaseCategoryRequest.StaffId.Value);
            }

            return(parameters);
        }
コード例 #12
0
		private RequestBodyBuilder PopulateRequestParameters(TroubleshooterAttachmentRequest troubleshooterAttachmentRequest, RequestTypes requestType)
		{
			troubleshooterAttachmentRequest.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestDataNonNegativeInt("troubleshooterstepid", troubleshooterAttachmentRequest.TroubleshooterStepId);
			parameters.AppendRequestDataNonEmptyString("filename", troubleshooterAttachmentRequest.FileName);
			parameters.AppendRequestDataNonEmptyString("contents", troubleshooterAttachmentRequest.Contents);

			return parameters;
		}
コード例 #13
0
		private RequestBodyBuilder PopulateRequestParameters(TroubleshooterCommentRequest troubleshooterCommentRequest, RequestTypes requestType)
		{
			troubleshooterCommentRequest.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestDataNonNegativeInt("troubleshooterstepid", troubleshooterCommentRequest.TroubleshooterStepId);
			parameters.AppendRequestDataNonEmptyString("contents", troubleshooterCommentRequest.Contents);
			parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(troubleshooterCommentRequest.CreatorType));
			parameters.AppendRequestDataNonNegativeInt("creatorid", troubleshooterCommentRequest.CreatorId);
			parameters.AppendRequestDataNonEmptyString("fullname", troubleshooterCommentRequest.FullName);
			parameters.AppendRequestDataNonEmptyString("email", troubleshooterCommentRequest.Email);
			parameters.AppendRequestDataNonNegativeInt("parentcommentid", troubleshooterCommentRequest.ParentCommentId);

			return parameters;
		}
コード例 #14
0
		private RequestBodyBuilder PopulateRequestParameters(TroubleshooterStepRequest troubleshooterStepRequest, RequestTypes requestType)
		{
			troubleshooterStepRequest.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();

			if (requestType == RequestTypes.Create)
			{
				parameters.AppendRequestData("categoryid", troubleshooterStepRequest.CategoryId);
			}

			parameters.AppendRequestDataNonEmptyString("subject", troubleshooterStepRequest.Subject);
			parameters.AppendRequestDataNonEmptyString("contents", troubleshooterStepRequest.Contents);

			parameters.AppendRequestDataNonNegativeInt(requestType == RequestTypes.Create ? "staffid" : "editedstaffid",
			                                           troubleshooterStepRequest.StaffId);

			if (troubleshooterStepRequest.DisplayOrder.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("displayorder", troubleshooterStepRequest.DisplayOrder.Value);
			}

			parameters.AppendRequestDataBool("allowcomments", troubleshooterStepRequest.AllowComments);
			parameters.AppendRequestDataBool("enableticketredirection", troubleshooterStepRequest.EnableTicketRedirection);

			if (troubleshooterStepRequest.RedirectDepartmentId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("redirectdepartmentid", troubleshooterStepRequest.RedirectDepartmentId.Value);
			}

			if (troubleshooterStepRequest.TicketTypeId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("tickettypeid", troubleshooterStepRequest.TicketTypeId.Value);
			}

			if(troubleshooterStepRequest.TicketPriorityId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("ticketpriorityid", troubleshooterStepRequest.TicketPriorityId.Value);
			}

			parameters.AppendRequestDataNonEmptyString("ticketsubject", troubleshooterStepRequest.TicketSubject);
			
			if (troubleshooterStepRequest.StepStatus.HasValue)
			{
				parameters.AppendRequestData("stepstatus", EnumUtility.ToApiString(troubleshooterStepRequest.StepStatus.Value));
			}

			parameters.AppendRequestDataArrayCommaSeparated("parentstepidlist", troubleshooterStepRequest.ParentStepIdList);

			return parameters;
		}
コード例 #15
0
		private RequestBodyBuilder PopulateRequestParameters(TroubleshooterCategoryRequest troubleshooterCategoryRequest, RequestTypes requestType)
		{
			troubleshooterCategoryRequest.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestDataNonEmptyString("title", troubleshooterCategoryRequest.Title);
			parameters.AppendRequestData("categorytype", EnumUtility.ToApiString(troubleshooterCategoryRequest.CategoryType));

			if (requestType == RequestTypes.Create)
			{
				parameters.AppendRequestDataNonNegativeInt("staffid", troubleshooterCategoryRequest.StaffId);
			}

			if (troubleshooterCategoryRequest.DisplayOrder.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("displayorder", troubleshooterCategoryRequest.DisplayOrder.Value);
			}

			parameters.AppendRequestDataNonEmptyString("description", troubleshooterCategoryRequest.Description);
			parameters.AppendRequestDataBool("uservisibilitycustom", troubleshooterCategoryRequest.UserVisibilityCustom);
			parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", troubleshooterCategoryRequest.UserGroupIdList);
			parameters.AppendRequestDataBool("staffvisibilitycustom", troubleshooterCategoryRequest.StaffVisibilityCustom);
			parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", troubleshooterCategoryRequest.StaffGroupIdList);

			return parameters;
		}
コード例 #16
0
		private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseAttachmentRequest knowledgebaseAttachmentRequest, RequestTypes requestType)
		{
			knowledgebaseAttachmentRequest.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestDataNonNegativeInt("kbarticleid", knowledgebaseAttachmentRequest.KnowledgebaseArticleId);
			parameters.AppendRequestDataNonEmptyString("filename", knowledgebaseAttachmentRequest.FileName);
			parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseAttachmentRequest.Contents);

			return parameters;
		}
コード例 #17
0
		private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseCommentRequest knowledgebaseCommentRequest, RequestTypes requestType)
		{
			knowledgebaseCommentRequest.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestDataNonNegativeInt("knowledgebasearticleid", knowledgebaseCommentRequest.KnowledgebaseArticleId);
			parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseCommentRequest.Contents);
			parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(knowledgebaseCommentRequest.CreatorType));
			
			if (knowledgebaseCommentRequest.CreatorId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("creatorid", knowledgebaseCommentRequest.CreatorId.Value);
			}
			else
			{
				parameters.AppendRequestDataNonEmptyString("fullname", knowledgebaseCommentRequest.FullName);
			}

			parameters.AppendRequestDataNonEmptyString("email", knowledgebaseCommentRequest.Email);

			if (knowledgebaseCommentRequest.ParentCommentId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("parentcommentid", knowledgebaseCommentRequest.ParentCommentId.Value);
			}

			return parameters;
		}
コード例 #18
0
		private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseArticleRequest knowledgebaseArticleRequest, RequestTypes requestType)
		{
			knowledgebaseArticleRequest.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestDataNonEmptyString("subject", knowledgebaseArticleRequest.Subject);
			parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseArticleRequest.Contents);

			if (requestType == RequestTypes.Create && knowledgebaseArticleRequest.CreatorId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("creatorid", knowledgebaseArticleRequest.CreatorId.Value);
			}

			if (knowledgebaseArticleRequest.ArticleStatus.HasValue)
			{
				parameters.AppendRequestData("articlestatus", EnumUtility.ToApiString(knowledgebaseArticleRequest.ArticleStatus.Value));
			}

			parameters.AppendRequestDataBool("isfeatured", knowledgebaseArticleRequest.IsFeatured);
			parameters.AppendRequestDataBool("allowcomments", knowledgebaseArticleRequest.AllowComments);
			parameters.AppendRequestDataArrayCommaSeparated("categoryid", knowledgebaseArticleRequest.CategoryIds);

			if (requestType == RequestTypes.Update && knowledgebaseArticleRequest.EditedStaffId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("editedstaffid", knowledgebaseArticleRequest.EditedStaffId.Value);
			}

			return parameters;
		}
コード例 #19
0
		private RequestBodyBuilder PopulateRequestParameters(NewsSubscriberRequest newsSubscriberRequest, RequestTypes requestTypes)
		{
			newsSubscriberRequest.EnsureValidData(requestTypes);

			var requestBodyBuilder = new RequestBodyBuilder();
			requestBodyBuilder.AppendRequestDataNonEmptyString("email", newsSubscriberRequest.Email);

			if (requestTypes == RequestTypes.Create)
			{
				requestBodyBuilder.AppendRequestDataBool("isvalidated", newsSubscriberRequest.IsValidated);
			}

			return requestBodyBuilder;
		}
コード例 #20
0
		public NewsItemComment CreateNewsItemComment(NewsItemCommentRequest newsItemCommentRequest)
		{
			newsItemCommentRequest.EnsureValidData(RequestTypes.Create);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestData("newsitemid", newsItemCommentRequest.NewsItemId);
			parameters.AppendRequestDataNonEmptyString("contents", newsItemCommentRequest.Contents);
			parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(newsItemCommentRequest.CreatorType));

			if (newsItemCommentRequest.CreatorId != null)
			{
				parameters.AppendRequestData("creatorid", newsItemCommentRequest.CreatorId);
			}
			else
			{
				parameters.AppendRequestDataNonEmptyString("fullname", newsItemCommentRequest.FullName);
			}

			parameters.AppendRequestDataNonEmptyString("email", newsItemCommentRequest.Email);
			parameters.AppendRequestData("parentcommentid", newsItemCommentRequest.ParentCommentId);

			var newsItemComments = Connector.ExecutePost<NewsItemCommentCollection>(NewsItemCommentBaseUrl, parameters.ToString());

			if (newsItemComments != null && newsItemComments.Count > 0)
			{
				return newsItemComments[0];
			}

			return null;
		}
コード例 #21
0
		private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseCategoryRequest knowledgebaseCategoryRequest, RequestTypes requestType)
		{
			knowledgebaseCategoryRequest.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestDataNonEmptyString("title", knowledgebaseCategoryRequest.Title);

			if (knowledgebaseCategoryRequest.CategoryType.HasValue)
			{
				parameters.AppendRequestData("categorytype",
				                             EnumUtility.ToApiString(knowledgebaseCategoryRequest.CategoryType.Value));
			}

			if (knowledgebaseCategoryRequest.ParentCategoryId.HasValue)
			{
				parameters.AppendRequestData("parentcategoryid", knowledgebaseCategoryRequest.ParentCategoryId.Value);
			}

			if (knowledgebaseCategoryRequest.DisplayOrder.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("displayorder", knowledgebaseCategoryRequest.DisplayOrder.Value);
			}

			if (knowledgebaseCategoryRequest.ArticleSortOrder.HasValue)
			{
				parameters.AppendRequestData("articlesortorder",
				                             EnumUtility.ToApiString(knowledgebaseCategoryRequest.ArticleSortOrder.Value));
			}

			parameters.AppendRequestDataBool("allowcomments", knowledgebaseCategoryRequest.AllowComments);
			parameters.AppendRequestDataBool("allowrating", knowledgebaseCategoryRequest.AllowRating);
			parameters.AppendRequestDataBool("ispublished", knowledgebaseCategoryRequest.IsPublished);
			parameters.AppendRequestDataBool("uservisibilitycustom", knowledgebaseCategoryRequest.UserVisibilityCustom);
			parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", knowledgebaseCategoryRequest.UserGroupIdList);
			parameters.AppendRequestDataBool("staffvisibilitycustom", knowledgebaseCategoryRequest.StaffVisibilityCustom);
			parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", knowledgebaseCategoryRequest.StaffGroupIdList);

			if (requestType == RequestTypes.Create && knowledgebaseCategoryRequest.StaffId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("staffid", knowledgebaseCategoryRequest.StaffId.Value);
			}

			return parameters;
		}
コード例 #22
0
		private static RequestBodyBuilder PopulateRequestParameters(NewsItemRequest newsItem, RequestTypes requestType)
		{
			newsItem.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestDataNonEmptyString("subject", newsItem.Subject);
			parameters.AppendRequestDataNonEmptyString("contents", newsItem.Contents);

			if (requestType == RequestTypes.Create)
			{
				parameters.AppendRequestDataNonNegativeInt("staffid", newsItem.StaffId);
			}
			else
			{
				parameters.AppendRequestDataNonNegativeInt("editedstaffid", newsItem.StaffId);
			}

			if (requestType == RequestTypes.Create && newsItem.NewsItemType.HasValue)
			{
				parameters.AppendRequestData("newstype", EnumUtility.ToApiString(newsItem.NewsItemType));
			}

			if (newsItem.NewsItemStatus.HasValue)
			{
				parameters.AppendRequestData("newsstatus", EnumUtility.ToApiString(newsItem.NewsItemStatus));
			}

			parameters.AppendRequestDataNonEmptyString("fromname", newsItem.FromName);
			parameters.AppendRequestDataNonEmptyString("email", newsItem.Email);
			parameters.AppendRequestDataNonEmptyString("customemailsubject", newsItem.CustomEmailSubject);
			parameters.AppendRequestDataBool("sendemail", newsItem.SendEmail);
			parameters.AppendRequestDataBool("allowcomments", newsItem.AllowComments);
			parameters.AppendRequestDataBool("uservisibilitycustom", newsItem.UserVisibilityCustom);
			parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", newsItem.UserGroupIdList);
			parameters.AppendRequestDataBool("staffvisibilitycustom", newsItem.StaffVisibilityCustom);
			parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", newsItem.StaffGroupIdList);
			parameters.AppendRequestData("expiry", newsItem.Expiry.DateTime.ToString("M/d/yyyy"));
			parameters.AppendRequestDataArrayCommaSeparated("newscategoryidlist", newsItem.Categories);
			
			return parameters;
		}