private void DownloadSurveyInfoButton_Click(object sender, RoutedEventArgs e) { SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest(); if (!string.IsNullOrEmpty(this.SurveyCriteria_SurveyId.Text.Trim())) { Request.Criteria.SurveyIdList.Add(this.SurveyCriteria_SurveyId.Text); } if ((bool)this.SurveyCriteria_CurrentlyOpenCheckBox.IsChecked) { Request.Criteria.ClosingDate = DateTime.Now; } if (this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex > -1) { Request.Criteria.SurveyType = int.Parse(((ListBoxItem)this.SurveyInfoCriteria_SurveyTypeListBox.Items[this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex]).Tag.ToString()); } SurveyInfoResponseTextBox.Document.Blocks.Clear(); try { Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request); SurveyInfoResponseTextBox.AppendText(string.Format("{0} - records. \n\n", Result.SurveyInfoList.Count)); foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in Result.SurveyInfoList) { SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); } } catch (FaultException <CustomFaultException> cfe) { SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n"); SurveyInfoResponseTextBox.AppendText(cfe.ToString()); } catch (FaultException fe) { SurveyInfoResponseTextBox.AppendText("FaultException:\n"); SurveyInfoResponseTextBox.AppendText(fe.ToString()); } catch (CommunicationException ce) { SurveyInfoResponseTextBox.AppendText("CommunicationException:\n"); SurveyInfoResponseTextBox.AppendText(ce.ToString()); } catch (TimeoutException te) { SurveyInfoResponseTextBox.AppendText("TimeoutException:\n"); SurveyInfoResponseTextBox.AppendText(te.ToString()); } catch (Exception ex) { SurveyInfoResponseTextBox.AppendText("Exception:\n"); SurveyInfoResponseTextBox.AppendText(ex.ToString()); } }
private void SubmitRequestButton_Click(object sender, RoutedEventArgs e) { ServiceResponseTextBox.Document.Blocks.Clear(); this.OpenURLButton.IsEnabled = false; // SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.PublishRequest Request = new Epi.Web.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; try { int ServiceVersion = ServiceClient.GetServiceVersion(); if (ServiceVersion == 1) { SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.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; } else if (ServiceVersion == 2) { SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2(); Epi.Web.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; } else if (ServiceVersion == 3) { SurveyManagerServiceV3.ManagerServiceV3Client client = ServiceClient.GetClientV3(); Epi.Web.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()); } }
public void GetOrganizationNames() { richTextBox1.AppendText("Simo is here"); Epi.Web.Common.Message.OrganizationRequest Request = new Epi.Web.Common.Message.OrganizationRequest(); richTextBox1.Document.Blocks.Clear(); try { if (!string.IsNullOrEmpty(passwordBox1.Password.ToString()) && IsGuid(passwordBox1.Password.ToString())) { int ServiceVersion = ServiceClient.GetServiceVersion(); if (ServiceVersion == 1) { Request.AdminSecurityKey = new Guid(passwordBox1.Password); SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.OrganizationResponse Result = client.GetOrganizationNames(Request); OnamelistBox1.Items.Clear(); if (Result.Message != null) { richTextBox1.AppendText(Result.Message.ToString()); } if (Result.OrganizationList != null) { for (int i = 0; i < Result.OrganizationList.Count; i++) { this.OnamelistBox1.Items.Add(Result.OrganizationList[i].Organization + "___" + Result.OrganizationList[i].OrganizationId); } this.OnamelistBox1.SelectedIndex = 0; } } else if (ServiceVersion == 2) { Request.AdminSecurityKey = new Guid(passwordBox1.Password); SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2(); Epi.Web.Common.Message.OrganizationResponse Result = client.GetOrganizationNames(Request); OnamelistBox1.Items.Clear(); if (Result.Message != null) { richTextBox1.AppendText(Result.Message.ToString()); } if (Result.OrganizationList != null) { for (int i = 0; i < Result.OrganizationList.Count; i++) { this.OnamelistBox1.Items.Add(Result.OrganizationList[i].Organization); } this.OnamelistBox1.SelectedIndex = 0; } } else if (ServiceVersion == 3) { Request.AdminSecurityKey = new Guid(passwordBox1.Password); SurveyManagerServiceV3.ManagerServiceV3Client client = ServiceClient.GetClientV3(); Epi.Web.Common.Message.OrganizationResponse Result = client.GetOrganizationNames(Request); OnamelistBox1.Items.Clear(); if (Result.Message != null) { richTextBox1.AppendText(Result.Message.ToString()); } if (Result.OrganizationList != null) { for (int i = 0; i < Result.OrganizationList.Count; i++) { this.OnamelistBox1.Items.Add(Result.OrganizationList[i].Organization); } this.OnamelistBox1.SelectedIndex = 0; } } else if (ServiceVersion == 4) { Request.AdminSecurityKey = new Guid(passwordBox1.Password); SurveyManagerServiceV4.ManagerServiceV4Client client = ServiceClient.GetClientV4(); Epi.Web.Common.Message.OrganizationResponse Result = client.GetOrganizationNames(Request); OnamelistBox1.Items.Clear(); if (Result.Message != null) { richTextBox1.AppendText(Result.Message.ToString()); } if (Result.OrganizationList != null) { for (int i = 0; i < Result.OrganizationList.Count; i++) { this.OnamelistBox1.Items.Add(Result.OrganizationList[i].Organization); } this.OnamelistBox1.SelectedIndex = 0; } if (this.OnamelistBox1.SelectedItem != null) { GetOrgUsers(); } } else { richTextBox1.AppendText("Error occurred while trying to get all organization names."); } } else { richTextBox1.AppendText("Admin key is required and Should be a Guid."); } } catch (Exception ex) { richTextBox1.AppendText("Error occurred while trying to get all organization names. "); } }
//Save_Click private void Save_Click(object sender, RoutedEventArgs e) { richTextBox1.Document.Blocks.Clear(); //SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.OrganizationRequest Request = new Epi.Web.Common.Message.OrganizationRequest(); richTextBox1.Foreground = Brushes.Red; richTextBox1.Document.Blocks.Clear(); try { if (!string.IsNullOrEmpty(passwordBox1.Password.ToString()) && IsGuid(passwordBox1.Password.ToString())) { int ServiceVersion = ServiceClient.GetServiceVersion(); if (ServiceVersion == 1) { SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); if (checkBox1.IsChecked == true) { Request.Organization.IsEnabled = true; } else { Request.Organization.IsEnabled = false; } Request.AdminSecurityKey = new Guid(passwordBox1.Password); Request.Organization.Organization = ONameEditTextBox1.Text; //Request.Organization.OrganizationKey = Cryptography.Encrypt(EditOtextBox1.Text); Request.Organization.OrganizationKey = EditOtextBox1.Text.ToString(); Epi.Web.Common.Message.OrganizationResponse Result = client.UpdateOrganizationInfo(Request); if (Result.Message.ToString().Contains("Successfully")) { richTextBox1.Foreground = Brushes.Green; GetOrganizationNames(); this.OnamelistBox1.SelectedItem = Request.Organization.Organization; } richTextBox1.AppendText(Result.Message.ToString()); } else if (ServiceVersion == 2) { SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2(); if (checkBox1.IsChecked == true) { Request.Organization.IsEnabled = true; } else { Request.Organization.IsEnabled = false; } Request.AdminSecurityKey = new Guid(passwordBox1.Password); Request.Organization.Organization = ONameEditTextBox1.Text; //Request.Organization.OrganizationKey = Cryptography.Encrypt(EditOtextBox1.Text); Request.Organization.OrganizationKey = EditOtextBox1.Text.ToString(); Epi.Web.Common.Message.OrganizationResponse Result = client.UpdateOrganizationInfo(Request); if (Result.Message.ToString().Contains("Successfully")) { richTextBox1.Foreground = Brushes.Green; GetOrganizationNames(); this.OnamelistBox1.SelectedItem = Request.Organization.Organization; } richTextBox1.AppendText(Result.Message.ToString()); } } else { richTextBox1.AppendText("Admin key is required and Should be a Guid."); } } catch (Exception ex) { richTextBox1.AppendText("Error occurred while updating organization info. Please try again. "); } }
private void Edit_Clik(object sender, RoutedEventArgs e) { //if (!string.IsNullOrEmpty(EditOtextBox1.Text)) //{ richTextBox1.Document.Blocks.Clear(); try { if (!string.IsNullOrEmpty(passwordBox1.Password.ToString()) && IsGuid(passwordBox1.Password.ToString())) { int ServiceVersion = ServiceClient.GetServiceVersion(); if (ServiceVersion == 1) { SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.OrganizationRequest Request = new Epi.Web.Common.Message.OrganizationRequest(); Request.AdminSecurityKey = new Guid(passwordBox1.Password); Request.Organization.OrganizationKey = EditOtextBox1.Text; Epi.Web.Common.Message.OrganizationResponse Result = client.GetOrganizationByKey(Request); if (Result.OrganizationList != null) { for (int i = 0; i < Result.OrganizationList.Count; i++) { this.ONameEditTextBox1.Text = Result.OrganizationList[i].Organization; this.checkBox1.IsChecked = Result.OrganizationList[i].IsEnabled; } } } else if (ServiceVersion == 2) { SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2(); Epi.Web.Common.Message.OrganizationRequest Request = new Epi.Web.Common.Message.OrganizationRequest(); Request.AdminSecurityKey = new Guid(passwordBox1.Password); Request.Organization.OrganizationKey = EditOtextBox1.Text; Epi.Web.Common.Message.OrganizationResponse Result = client.GetOrganizationByKey(Request); if (Result.OrganizationList != null) { for (int i = 0; i < Result.OrganizationList.Count; i++) { this.ONameEditTextBox1.Text = Result.OrganizationList[i].Organization; this.checkBox1.IsChecked = Result.OrganizationList[i].IsEnabled; } } } } else { richTextBox1.AppendText("Admin key is required and Should be a Guid."); } } catch (Exception ex) { richTextBox1.AppendText("Error occurred while trying to get organization Info. "); } //} //else { // richTextBox1.AppendText("Please select organization key."); //} }
private void AddOrganization_Click(object sender, RoutedEventArgs e) { richTextBox1.Document.Blocks.Clear(); Epi.Web.Common.Message.OrganizationRequest Request = new Epi.Web.Common.Message.OrganizationRequest(); richTextBox1.Foreground = Brushes.Red; try { if (!string.IsNullOrEmpty(passwordBox1.Password.ToString()) && IsGuid(passwordBox1.Password.ToString())) { if (!string.IsNullOrEmpty(OrganizationtextBox1.Text.ToString())) { if (!string.IsNullOrEmpty(GeneratedkeytextBox1.Text.ToString())) { Request.Organization.IsEnabled = true; Request.AdminSecurityKey = new Guid(passwordBox1.Password); Request.Organization.Organization = OrganizationtextBox1.Text; //Request.Organization.OrganizationKey = Cryptography.Encrypt(this.GeneratedkeytextBox1.Text); Request.Organization.OrganizationKey = this.GeneratedkeytextBox1.Text.ToString(); // Epi.Web.Common.Message.OrganizationResponse Result = client.SetOrganization(Request); var Organizationtext = OrganizationtextBox1.Text.ToString(); var Generatedkey = GeneratedkeytextBox1.Text.ToString(); richTextBox1.Document.Blocks.Clear(); OrganizationtextBox1.Clear(); GeneratedkeytextBox1.Clear(); int ServiceVersion = ServiceClient.GetServiceVersion(); if (ServiceVersion == 1) { SurveyManagerService.ManagerServiceClient Client = ServiceClient.GetClient(); Epi.Web.Common.Message.OrganizationResponse Result = Client.SetOrganization(Request); if (Result.Message.ToString().Contains("Successfully")) { Page_AddUser Page_AddUser = new Page_AddUser(new Guid(Generatedkey), new Guid(passwordBox1.Password), Organizationtext, "", false); this.NavigationService.Navigate(Page_AddUser); richTextBox1.Foreground = Brushes.Green; richTextBox1.AppendText(Result.Message.ToString()); } else { richTextBox1.Foreground = Brushes.Red; richTextBox1.AppendText(Result.Message.ToString()); } } else if (ServiceVersion == 2) { SurveyManagerServiceV2.ManagerServiceV2Client Client = ServiceClient.GetClientV2(); Epi.Web.Common.Message.OrganizationResponse Result = Client.SetOrganization(Request); if (Result.Message.ToString().Contains("Successfully")) { Page_AddUser Page_AddUser = new Page_AddUser(new Guid(Generatedkey), new Guid(passwordBox1.Password), Organizationtext, "", false); this.NavigationService.Navigate(Page_AddUser); richTextBox1.Foreground = Brushes.Green; richTextBox1.AppendText(Result.Message.ToString()); } else { richTextBox1.Foreground = Brushes.Red; richTextBox1.AppendText(Result.Message.ToString()); } } else if (ServiceVersion == 3) { SurveyManagerServiceV3.ManagerServiceV3Client Client = ServiceClient.GetClientV3(); Epi.Web.Common.Message.OrganizationResponse Result = Client.SetOrganization(Request); if (Result.Message.ToString().Contains("Successfully")) { Page_AddUser Page_AddUser = new Page_AddUser(new Guid(Generatedkey), new Guid(passwordBox1.Password), Organizationtext, "", false); this.NavigationService.Navigate(Page_AddUser); richTextBox1.Foreground = Brushes.Green; richTextBox1.AppendText(Result.Message.ToString()); } else { richTextBox1.Foreground = Brushes.Red; richTextBox1.AppendText(Result.Message.ToString()); } } else if (ServiceVersion == 4) { SurveyManagerServiceV4.ManagerServiceV4Client Client = ServiceClient.GetClientV4(); Epi.Web.Common.Message.OrganizationResponse Result = Client.SetOrganization(Request); if (Result.Message.ToString().Contains("Successfully")) { Page_AddUser Page_AddUser = new Page_AddUser(new Guid(Generatedkey), new Guid(passwordBox1.Password), Organizationtext, "", false); this.NavigationService.Navigate(Page_AddUser); richTextBox1.Foreground = Brushes.Green; richTextBox1.AppendText(Result.Message.ToString()); } else { richTextBox1.Foreground = Brushes.Red; richTextBox1.AppendText(Result.Message.ToString()); } } } else { richTextBox1.AppendText("Please generate organization key."); } } else { richTextBox1.AppendText("Organization Name is required."); } } else { richTextBox1.AppendText("Admin key is required and Should be a Guid."); } } catch (Exception ex) { richTextBox1.AppendText("Error occurred while trying to add new organization key. Please try again. "); } }
private void DownloadSurveyInfoButton_Click(object sender, RoutedEventArgs e) { SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest(); //Checking the Organization key guid is in correct format if (!IsGuid(passOrganizationKey.Password)) { MessageBox.Show("Organization key is not in correct format"); return; } //Assign the organization key Request.Criteria.OrganizationKey = new Guid(passOrganizationKey.Password); if (!string.IsNullOrEmpty(this.SurveyCriteria_SurveyId.Text.Trim())) { Request.Criteria.SurveyIdList.Add(this.SurveyCriteria_SurveyId.Text); } if ((bool)this.SurveyCriteria_CurrentlyOpenCheckBox.IsChecked) { Request.Criteria.ClosingDate = DateTime.Now; } if (this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex > -1) { Request.Criteria.SurveyType = int.Parse(((ListBoxItem)this.SurveyInfoCriteria_SurveyTypeListBox.Items[this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex]).Tag.ToString()); } SurveyInfoResponseTextBox.Document.Blocks.Clear(); int PageNumber = 0; int PageSize = 0; try { if (this.chkIsSizeRequestSurveyInfo.IsChecked == true) { Request.Criteria.ReturnSizeInfoOnly = true; Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request); if (!string.IsNullOrEmpty(Result.Message)) { SurveyInfoResponseTextBox.AppendText(string.Format(Result.Message)); } else { SurveyInfoResponseTextBox.AppendText(string.Format(" - Number of Pages: {0} \n\n", Result.NumberOfPages)); SurveyInfoResponseTextBox.AppendText(string.Format(" - Pages Size: {0} \n ", Result.PageSize)); } } else { // 2 Step process: // 1 - get sizing information. // 2 - Loop thru calls for query results // 1 - get sizing information Request.Criteria.ReturnSizeInfoOnly = true; Epi.Web.Common.Message.SurveyInfoResponse SizeResult = client.GetSurveyInfo(Request); if (!string.IsNullOrEmpty(SizeResult.Message)) { SurveyInfoResponseTextBox.AppendText(string.Format(SizeResult.Message)); } else { SurveyInfoResponseTextBox.AppendText(string.Format(" - Number of Pages: {0} \n\n", SizeResult.NumberOfPages)); SurveyInfoResponseTextBox.AppendText(string.Format(" - Pages Size: {0} \n", SizeResult.PageSize)); // 2 - loop thru calls for query results PageSize = SizeResult.PageSize; PageNumber = SizeResult.NumberOfPages; Request.Criteria.ReturnSizeInfoOnly = false; for (int i = 1; i <= PageNumber; i++) { Request.Criteria.PageNumber = i; Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request); foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in Result.SurveyInfoList) { SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); } } } } } catch (FaultException <CustomFaultException> cfe) { SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n"); SurveyInfoResponseTextBox.AppendText(cfe.ToString()); } catch (FaultException fe) { SurveyInfoResponseTextBox.AppendText("FaultException:\n"); SurveyInfoResponseTextBox.AppendText(fe.ToString()); } catch (CommunicationException ce) { SurveyInfoResponseTextBox.AppendText("CommunicationException:\n"); SurveyInfoResponseTextBox.AppendText(ce.ToString()); } catch (TimeoutException te) { SurveyInfoResponseTextBox.AppendText("TimeoutException:\n"); SurveyInfoResponseTextBox.AppendText(te.ToString()); } catch (Exception ex) { SurveyInfoResponseTextBox.AppendText("Exception:\n"); SurveyInfoResponseTextBox.AppendText(ex.ToString()); } }
private void DownloadSurveyAnswersButton_Click(object sender, RoutedEventArgs e) { SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.SurveyAnswerRequest Request = new Epi.Web.Common.Message.SurveyAnswerRequest(); foreach (string id in SurveyAnswerIdListBox.Items) { Request.Criteria.SurveyAnswerIdList.Add(id); } if (!string.IsNullOrEmpty(this.SurveyAnswerCriteria_SurveyIdTextBox.Text.Trim())) { Request.Criteria.SurveyId = this.SurveyAnswerCriteria_SurveyIdTextBox.Text; } if (!string.IsNullOrEmpty(this.passUserPublishKeySurveyResponse.Password.Trim()) && IsGuid(passUserPublishKeySurveyResponse.Password)) { Request.Criteria.UserPublishKey = new Guid(this.passUserPublishKeySurveyResponse.Password); } else { MessageBox.Show("Publish key is not in correct format"); return; } if (this.datePicker1.SelectedDate != null) { Request.Criteria.DateCompleted = (DateTime)this.datePicker1.SelectedDate; } if ((bool)this.OnlyCompletedCheckBox.IsChecked) { Request.Criteria.StatusId = 3; } //chkIsSizeRequestSurveyResponse //Checking the Organization key guid is in correct format if (!IsGuid(passOrganizationKey.Password)) { MessageBox.Show("Organization key is not in correct format"); return; } //Assign the organization key Request.Criteria.OrganizationKey = new Guid(passOrganizationKey.Password); SurveyAnswerResponseTextBox.Document.Blocks.Clear(); int PageNumber = 0; int PageSize = 0; try { if (this.chkIsSizeRequestSurveyResponse.IsChecked == true) { Request.Criteria.ReturnSizeInfoOnly = true; Epi.Web.Common.Message.SurveyAnswerResponse Result = client.GetSurveyAnswer(Request); if (!string.IsNullOrEmpty(Result.Message)) { SurveyAnswerResponseTextBox.AppendText(string.Format(Result.Message)); } else { SurveyAnswerResponseTextBox.AppendText(string.Format(" - Number of Pages: {0} \n\n", Result.NumberOfPages)); SurveyAnswerResponseTextBox.AppendText(string.Format(" - Pages Size: {0} ", Result.PageSize)); } } else { Request.Criteria.ReturnSizeInfoOnly = true; Epi.Web.Common.Message.SurveyAnswerResponse SizeResult = client.GetSurveyAnswer(Request); if (!string.IsNullOrEmpty(SizeResult.Message)) { SurveyAnswerResponseTextBox.AppendText(string.Format(SizeResult.Message)); } else { PageSize = SizeResult.PageSize; Request.Criteria.ReturnSizeInfoOnly = false; SurveyAnswerResponseTextBox.AppendText(string.Format(" - Number of Pages: {0} \n\n", SizeResult.NumberOfPages)); SurveyAnswerResponseTextBox.AppendText(string.Format(" - Pages Size: {0} \n", SizeResult.PageSize)); for (int i = 1; i <= SizeResult.NumberOfPages; i++) { Request.Criteria.PageNumber = i; Request.Criteria.PageSize = PageSize; Epi.Web.Common.Message.SurveyAnswerResponse Result = client.GetSurveyAnswer(Request); SurveyAnswerResponseTextBox.AppendText(string.Format(" -Number of available records: {0}\n\n", Result.SurveyResponseList.Count)); foreach (Epi.Web.Common.DTO.SurveyAnswerDTO SurveyAnswer in Result.SurveyResponseList) { SurveyAnswerResponseTextBox.AppendText(string.Format("{0} - {1} - {2} - {3}\n", SurveyAnswer.ResponseId, SurveyAnswer.Status, SurveyAnswer.DateUpdated, SurveyAnswer.XML)); } } } } } catch (FaultException <CustomFaultException> cfe) { SurveyAnswerResponseTextBox.AppendText("FaultException<CustomFaultException>:\n"); SurveyAnswerResponseTextBox.AppendText(cfe.ToString()); } catch (FaultException fe) { SurveyAnswerResponseTextBox.AppendText("FaultException:\n"); SurveyAnswerResponseTextBox.AppendText(fe.ToString()); } catch (CommunicationException ce) { SurveyAnswerResponseTextBox.AppendText("CommunicationException:\n"); SurveyAnswerResponseTextBox.AppendText(ce.ToString()); } catch (TimeoutException te) { SurveyAnswerResponseTextBox.AppendText("TimeoutException:\n"); SurveyAnswerResponseTextBox.AppendText(te.ToString()); } catch (Exception ex) { SurveyAnswerResponseTextBox.AppendText("Exception:\n"); SurveyAnswerResponseTextBox.AppendText(ex.ToString()); } }
private void DownloadSurveyAnswersButton_Click(object sender, RoutedEventArgs e) { SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.SurveyAnswerRequest Request = new Epi.Web.Common.Message.SurveyAnswerRequest(); foreach (string id in SurveyAnswerIdListBox.Items) { Request.Criteria.SurveyAnswerIdList.Add(id); } if (!string.IsNullOrEmpty(this.SurveyAnswerCriteria_SurveyIdTextBox.Text.Trim())) { Request.Criteria.SurveyId = this.SurveyAnswerCriteria_SurveyIdTextBox.Text; } if (!string.IsNullOrEmpty(this.UserPublishKeytextBox.Text.Trim())) { Request.Criteria.UserPublishKey = new Guid(this.UserPublishKeytextBox.Text); } if (this.datePicker1.SelectedDate != null) { Request.Criteria.DateCompleted = (DateTime)this.datePicker1.SelectedDate; } if ((bool)this.OnlyCompletedCheckBox.IsChecked) { Request.Criteria.StatusId = 1; } SurveyAnswerResponseTextBox.Document.Blocks.Clear(); try { Epi.Web.Common.Message.SurveyAnswerResponse Result = client.GetSurveyAnswer(Request); SurveyAnswerResponseTextBox.AppendText(string.Format("{0} - records.\n\n", Result.SurveyResponseList.Count)); foreach (Epi.Web.Common.DTO.SurveyAnswerDTO SurveyAnswer in Result.SurveyResponseList) { SurveyAnswerResponseTextBox.AppendText(string.Format("{0} - {1} - {2} - {3}\n", SurveyAnswer.ResponseId, SurveyAnswer.Status, SurveyAnswer.DateUpdated, SurveyAnswer.XML)); } } catch (FaultException <CustomFaultException> cfe) { SurveyAnswerResponseTextBox.AppendText("FaultException<CustomFaultException>:\n"); SurveyAnswerResponseTextBox.AppendText(cfe.ToString()); } catch (FaultException fe) { SurveyAnswerResponseTextBox.AppendText("FaultException:\n"); SurveyAnswerResponseTextBox.AppendText(fe.ToString()); } catch (CommunicationException ce) { SurveyAnswerResponseTextBox.AppendText("CommunicationException:\n"); SurveyAnswerResponseTextBox.AppendText(ce.ToString()); } catch (TimeoutException te) { SurveyAnswerResponseTextBox.AppendText("TimeoutException:\n"); SurveyAnswerResponseTextBox.AppendText(te.ToString()); } catch (Exception ex) { SurveyAnswerResponseTextBox.AppendText("Exception:\n"); SurveyAnswerResponseTextBox.AppendText(ex.ToString()); } }
private void DownloadSurveyInfoButton_Click(object sender, RoutedEventArgs e) { //if (ServiceVersion == "V1") // { // SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); // } //else if (ServiceVersion == "V2") // { // SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2(); // } Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest(); if (!string.IsNullOrEmpty(this.SurveyCriteria_SurveyId.Text.Trim())) { Request.Criteria.SurveyIdList.Add(this.SurveyCriteria_SurveyId.Text); } if ((bool)this.SurveyCriteria_CurrentlyOpenCheckBox.IsChecked) { Request.Criteria.ClosingDate = DateTime.Now; } if (this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex > -1) { Request.Criteria.SurveyType = int.Parse(((ListBoxItem)this.SurveyInfoCriteria_SurveyTypeListBox.Items[this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex]).Tag.ToString()); } if (!string.IsNullOrEmpty(this.OrgTextBox1.Text)) { Request.Criteria.OrganizationKey = new Guid(OrgTextBox1.Text); } else { } if (!string.IsNullOrEmpty(this.TextBoxPublish.Text)) { Request.Criteria.UserPublishKey = new Guid(this.TextBoxPublish.Text); } else { } SurveyInfoResponseTextBox.Document.Blocks.Clear(); SearchResultListBox.Items.Clear(); this.selectedIndex = -1; this.SurveyNameTextBox.Text = ""; this.DepartmentTextBox.Text = ""; this.SurveyNumberTextBox.Text = ""; this.OrganizationTextBox.Text = ""; this.datePicker1.SelectedDate = DateTime.Now; this.IsSingleResponseCheckBox.IsChecked = false; this.IsTestMode.IsChecked = false; this.IntroductionTextBox.Document.Blocks.Clear(); this.ExitTextTextBox.Document.Blocks.Clear(); this.TemplateXMLTextBox.Document.Blocks.Clear(); this.datePicker2.SelectedDate = DateTime.Now; try { int ServiceVersion = ServiceClient.GetServiceVersion(); if (ServiceVersion == 1) { SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request); SurveyInfoList = Result.SurveyInfoList; SearchResultListBox.Items.Clear(); SurveyInfoResponseTextBox.AppendText(string.Format("{0} - records. \n\n", Result.SurveyInfoList.Count)); foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in SurveyInfoList) { //SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); //System.Collections.Generic.KeyValuePair<string, string> kvp = new KeyValuePair<string, string>(SurveyInfo.SurveyId,string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); SearchResultListBox.Items.Add(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); } } else if (ServiceVersion == 2) { SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2(); Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request); SurveyInfoList = Result.SurveyInfoList; SearchResultListBox.Items.Clear(); SurveyInfoResponseTextBox.AppendText(string.Format("{0} - records. \n\n", Result.SurveyInfoList.Count)); foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in SurveyInfoList) { //SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); //System.Collections.Generic.KeyValuePair<string, string> kvp = new KeyValuePair<string, string>(SurveyInfo.SurveyId,string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); SearchResultListBox.Items.Add(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); } } else if (ServiceVersion == 3) { SurveyManagerServiceV3.ManagerServiceV3Client client = ServiceClient.GetClientV3(); Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request); SurveyInfoList = Result.SurveyInfoList; SearchResultListBox.Items.Clear(); SurveyInfoResponseTextBox.AppendText(string.Format("{0} - records. \n\n", Result.SurveyInfoList.Count)); foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in SurveyInfoList) { //SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); //System.Collections.Generic.KeyValuePair<string, string> kvp = new KeyValuePair<string, string>(SurveyInfo.SurveyId,string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); SearchResultListBox.Items.Add(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate)); } } } catch (FaultException <CustomFaultException> cfe) { SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n"); SurveyInfoResponseTextBox.AppendText(cfe.ToString()); } catch (FaultException fe) { SurveyInfoResponseTextBox.AppendText("FaultException:\n"); SurveyInfoResponseTextBox.AppendText(fe.ToString()); } catch (CommunicationException ce) { SurveyInfoResponseTextBox.AppendText("CommunicationException:\n"); SurveyInfoResponseTextBox.AppendText(ce.ToString()); } catch (TimeoutException te) { SurveyInfoResponseTextBox.AppendText("TimeoutException:\n"); SurveyInfoResponseTextBox.AppendText(te.ToString()); } catch (Exception ex) { SurveyInfoResponseTextBox.AppendText("Exception:\n"); SurveyInfoResponseTextBox.AppendText(ex.ToString()); } }
private void UpdateSurveyButton_Click(object sender, RoutedEventArgs e) { if (this.selectedIndex > -1) { SurveyInfoResponseTextBox.Document.Blocks.Clear(); Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest(); Request.Action = "Update"; if (this.datePicker1.SelectedDate == null) { TimeSpan t = new TimeSpan(10, 0, 0, 0); this.SurveyInfoList[this.selectedIndex].ClosingDate = DateTime.Now + t; } else { this.SurveyInfoList[this.selectedIndex].ClosingDate = (DateTime)this.datePicker1.SelectedDate; } this.SurveyInfoList[this.selectedIndex].DepartmentName = this.DepartmentTextBox.Text; this.SurveyInfoList[this.selectedIndex].IntroductionText = new TextRange(this.IntroductionTextBox.Document.ContentStart, this.IntroductionTextBox.Document.ContentEnd).Text; this.SurveyInfoList[this.selectedIndex].ExitText = new TextRange(this.ExitTextTextBox.Document.ContentStart, this.ExitTextTextBox.Document.ContentEnd).Text; if ((bool)this.IsSingleResponseCheckBox.IsChecked) { this.SurveyInfoList[this.selectedIndex].SurveyType = 1; } else { this.SurveyInfoList[this.selectedIndex].SurveyType = 2; } this.SurveyInfoList[this.selectedIndex].OrganizationName = this.OrganizationTextBox.Text; this.SurveyInfoList[this.selectedIndex].SurveyName = this.SurveyNameTextBox.Text; this.SurveyInfoList[this.selectedIndex].SurveyNumber = this.SurveyNumberTextBox.Text; if (this.IsTestMode.IsChecked == true) { this.SurveyInfoList[this.selectedIndex].IsDraftMode = true; } else { this.SurveyInfoList[this.selectedIndex].IsDraftMode = false; } this.SurveyInfoList[this.selectedIndex].XML = new TextRange(this.TemplateXMLTextBox.Document.ContentStart, this.TemplateXMLTextBox.Document.ContentEnd).Text; if (!string.IsNullOrEmpty(this.OrgTextBox1.Text)) { this.SurveyInfoList[this.selectedIndex].OrganizationKey = new Guid(OrgTextBox1.Text); } else { } if (!string.IsNullOrEmpty(this.TextBoxPublish.Text)) { this.SurveyInfoList[this.selectedIndex].UserPublishKey = new Guid(this.TextBoxPublish.Text); } else { } Request.SurveyInfoList.Add(this.SurveyInfoList[this.selectedIndex]); try { int ServiceVersion = ServiceClient.GetServiceVersion(); if (ServiceVersion == 1) { SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Common.Message.SurveyInfoResponse Result = client.SetSurveyInfo(Request); SurveyInfoResponseTextBox.AppendText(Result.Message); } else if (ServiceVersion == 2) { SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2(); Epi.Web.Common.Message.SurveyInfoResponse Result = client.SetSurveyInfo(Request); SurveyInfoResponseTextBox.AppendText(Result.Message); } else if (ServiceVersion == 3) { SurveyManagerServiceV3.ManagerServiceV3Client client = ServiceClient.GetClientV3(); Epi.Web.Common.Message.SurveyInfoResponse Result = client.SetSurveyInfo(Request); SurveyInfoResponseTextBox.AppendText(Result.Message); } } catch (FaultException <CustomFaultException> cfe) { SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n"); SurveyInfoResponseTextBox.AppendText(cfe.ToString()); } catch (FaultException fe) { SurveyInfoResponseTextBox.AppendText("FaultException:\n"); SurveyInfoResponseTextBox.AppendText(fe.ToString()); } catch (CommunicationException ce) { SurveyInfoResponseTextBox.AppendText("CommunicationException:\n"); SurveyInfoResponseTextBox.AppendText(ce.ToString()); } catch (TimeoutException te) { SurveyInfoResponseTextBox.AppendText("TimeoutException:\n"); SurveyInfoResponseTextBox.AppendText(te.ToString()); } catch (Exception ex) { SurveyInfoResponseTextBox.AppendText("Exception:\n"); SurveyInfoResponseTextBox.AppendText(ex.ToString()); } } }