public Epi.Web.Enter.Common.Message.PublishResponse RePublishSurvey(Epi.Web.Enter.Common.Message.PublishRequest pRequestMessage)
 {
     return(base.Channel.RePublishSurvey(pRequestMessage));
 }
Ejemplo n.º 2
0
        private void SubmitRequestButton_Click(object sender, RoutedEventArgs e)
        {
            ServiceResponseTextBox.Document.Blocks.Clear();
            this.OpenURLButton.IsEnabled = false;

            EWEManagerService.EWEManagerServiceClient client = ServiceClient.GetClient();

            Epi.Web.Enter.Common.Message.PublishRequest Request = new Epi.Web.Enter.Common.Message.PublishRequest();
            if (this.datePicker1.SelectedDate == null)
            {
                TimeSpan t = new TimeSpan(10, 0, 0, 0);
                Request.SurveyInfo.ClosingDate = DateTime.Now + t;
            }
            else
            {
                Request.SurveyInfo.ClosingDate = (DateTime)this.datePicker1.SelectedDate;
            }

            Request.SurveyInfo.DepartmentName   = this.DepartmentTextBox.Text;
            Request.SurveyInfo.IntroductionText = new TextRange(this.IntroductionTextBox.Document.ContentStart, this.IntroductionTextBox.Document.ContentEnd).Text;
            Request.SurveyInfo.ExitText         = new TextRange(this.ExitTextTextBox.Document.ContentStart, this.ExitTextTextBox.Document.ContentEnd).Text;
            if ((bool)this.IsSingleResponseCheckBox.IsChecked)
            {
                Request.SurveyInfo.SurveyType = 1;
            }
            else
            {
                Request.SurveyInfo.SurveyType = 2;
            }

            Request.SurveyInfo.OrganizationName = this.OrganizationTextBox.Text;
            Request.SurveyInfo.SurveyName       = this.SurveyNameTextBox.Text;
            Request.SurveyInfo.SurveyNumber     = this.SurveyNumberTextBox.Text;
            Request.SurveyInfo.XML = new TextRange(this.TemplateXMLTextBox.Document.ContentStart, this.TemplateXMLTextBox.Document.ContentEnd).Text;

            //Checking the publish key guid is in correct format
            if (!IsGuid(txtPublishKey.Text))
            {
                MessageBox.Show("Publish key is not in correct format");
                return;
            }

            Request.SurveyInfo.UserPublishKey = new Guid(txtPublishKey.Text);
            //get the Organization key and assign it to SurveyInfoDTO object under PublishRequest
            string strOrganizationKey = passOrganizationKey.Password.ToString();

            if (!IsGuid(strOrganizationKey))
            {
                MessageBox.Show("Organization key is not in correct format");
                return;
            }
            Guid gOrganizationkey = new Guid(strOrganizationKey);

            Request.SurveyInfo.OrganizationKey = gOrganizationkey;
            Request.SurveyInfo.OwnerId         = 2;//HardCode
            try
            {
                Epi.Web.Enter.Common.Message.PublishResponse Result = client.PublishSurvey(Request);

                passOrganizationKey.Password = string.Empty;
                URL = Result.PublishInfo.URL;
                ServiceResponseTextBox.AppendText("is published: ");
                ServiceResponseTextBox.AppendText(Result.PublishInfo.IsPulished.ToString());
                ServiceResponseTextBox.AppendText("\nURL: ");
                ServiceResponseTextBox.AppendText(Result.PublishInfo.URL);
                ServiceResponseTextBox.AppendText("\nStatus Text: ");
                ServiceResponseTextBox.AppendText(Result.PublishInfo.StatusText);
                ServiceResponseTextBox.AppendText("\n User Publish Key: ");
                ServiceResponseTextBox.AppendText(UserPublishKey.ToString());
                this.OpenURLButton.IsEnabled = Result.PublishInfo.IsPulished;
            }
            catch (FaultException <CustomFaultException> cfe)
            {
                ServiceResponseTextBox.AppendText("FaultException<CustomFaultException>:\n");
                ServiceResponseTextBox.AppendText(cfe.ToString());
            }
            catch (FaultException fe)
            {
                ServiceResponseTextBox.AppendText("FaultException:\n");
                ServiceResponseTextBox.AppendText(fe.ToString());
            }
            catch (CommunicationException ce)
            {
                ServiceResponseTextBox.AppendText("CommunicationException:\n");
                ServiceResponseTextBox.AppendText(ce.ToString());
            }
            catch (TimeoutException te)
            {
                ServiceResponseTextBox.AppendText("TimeoutException:\n");
                ServiceResponseTextBox.AppendText(te.ToString());
            }
            catch (Exception ex)
            {
                ServiceResponseTextBox.AppendText("Exception:\n");
                ServiceResponseTextBox.AppendText(ex.ToString());
            }
        }