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 DownloadSurveyInfoButton_Click(object sender, RoutedEventArgs e) { EWEManagerService.EWEManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Enter.Common.Message.SurveyInfoRequest Request = new Epi.Web.Enter.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 { Epi.Web.Enter.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.Enter.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(); EWEManagerService.EWEManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Enter.Common.Message.SurveyInfoRequest Request = new Epi.Web.Enter.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 { Epi.Web.Enter.Common.Message.SurveyInfoResponse Result = client.SetSurveyInfo(Request); // SurveyInfoResponseTextBox.AppendText("Succefully updated survey:"); SurveyInfoResponseTextBox.AppendText(Result.Message); //SurveyInfoResponseTextBox.AppendText(Result.PublishInfo.IsPulished.ToString()); //SurveyInfoResponseTextBox.AppendText("\nURL: "); //SurveyInfoResponseTextBox.AppendText(Result.PublishInfo.URL); //SurveyInfoResponseTextBox.AppendText("\nStatus Text: "); //SurveyInfoResponseTextBox.AppendText(Result.PublishInfo.StatusText); } 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 DownloadSurveyInfoButton_Click(object sender, RoutedEventArgs e) { EWEManagerService.EWEManagerServiceClient client = ServiceClient.GetClient(); Epi.Web.Enter.Common.Message.SurveyInfoRequest Request = new Epi.Web.Enter.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.Enter.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.Enter.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.Enter.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request); foreach (Epi.Web.Enter.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()); } }