Example #1
0
        /// <summary>
        /// The get panellist by survey notification job type.
        /// </summary>
        /// <param name="surveyId">
        /// The survey id.
        /// </param>
        /// <param name="type">
        /// The type.
        /// </param>
        /// <param name="sampleId">
        /// The sample id.
        /// </param>
        /// <returns>
        /// The <see cref="SampleRoot"/>.
        /// </returns>
        public SampleRoot GetPanellistByJobType(long surveyId, SurveyNotificationJobType type, long sampleId = 0)
        {
            if (surveyId < 1)
            {
                return(_result.ErrorToObject(new SampleRoot(), "Invalid parameter(s)"));
            }

            Task <Result> x = RequestHandler.SendRequestAsync(
                string.Empty,
                "api/UserSample/GetPanellistPageCustom?SurveyID=" + surveyId + "&ActivityId=" + (int)type + "&SampleID="
                + sampleId,
                HttpMethod.Get,
                RouteStyle.Rpc,
                null);

            x.Wait();

            return(x.Result.JsonToObject(new SampleRoot(), "Panellists"));
        }
        /// <summary>
        /// The update email notification content.
        /// </summary>
        /// <param name="notificationId">
        /// The notification id.
        /// </param>
        /// <param name="subType">
        /// The sub type.
        /// </param>
        /// <param name="subject">
        /// The subject.
        /// </param>
        /// <param name="emailContent">
        /// The email content.
        /// </param>
        /// <param name="emailtemplateId">
        /// The emailtemplate id.
        /// </param>
        /// <param name="emailServerId">
        /// The email server id.
        /// </param>
        /// <returns>
        /// The <see cref="NotificationRoot"/>.
        /// </returns>
        public NotificationRoot UpdateEmailNotificationContent(long notificationId, SurveyNotificationJobType subType,
                                                               string subject, string emailContent, long emailtemplateId = 0, int emailServerId = 0)
        {
            if (notificationId < 1 || string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(emailContent) || emailtemplateId < 0 || emailServerId < 0)
            {
                return(_result.ErrorToObject(new NotificationRoot(), "Invalid parameter(s)"));
            }

            var requestArg = JsonConvert.SerializeObject(
                new { Subject = subject, EmailContent = emailContent, SubType = subType, NotificationID = notificationId, Templateid = emailtemplateId, EmailServerID = emailServerId, });

            requestArg = JsonConvert.SerializeObject(new { Data = requestArg });

            Task <Result> x = RequestHandler.SendRequestAsync(
                string.Empty,
                "api/UserNotification/UpdateEmailNotifcation",
                HttpMethod.Post,
                RouteStyle.Rpc,
                requestArg);

            x.Wait();

            return(x.Result.JsonToObject(new NotificationRoot(), "Notifications"));
        }
        /// <summary>
        /// The update sms notification content.
        /// </summary>
        /// <param name="notificationId">
        /// The notification id.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="subType">
        /// The sub type.
        /// </param>
        /// <returns>
        /// The <see cref="NotificationRoot"/>.
        /// </returns>
        public NotificationRoot UpdateSmsNotificationContent(long notificationId, string message, SurveyNotificationJobType subType)
        {
            if (notificationId < 1 || string.IsNullOrEmpty(message))
            {
                return(_result.ErrorToObject(new NotificationRoot(), "Invalid parameter(s)"));
            }

            var requestArg = JsonConvert.SerializeObject(
                new { SmsContent = message, SubType = subType, NotificationID = notificationId });

            requestArg = JsonConvert.SerializeObject(new { Data = requestArg });

            Task <Result> x = RequestHandler.SendRequestAsync(
                string.Empty,
                "api/UserNotification/UpdateSmsNotifcation",
                HttpMethod.Post,
                RouteStyle.Rpc,
                requestArg);

            x.Wait();

            return(x.Result.JsonToObject(new NotificationRoot(), "Notifications"));
        }