Exemple #1
0
 /// <summary>
 /// Injectinting ISurveyInfoRepository through Constructor
 /// </summary>
 /// <param name="iSurveyInfoRepository"></param>
 public SurveyFacade(ISurveyInfoRepository iSurveyInfoRepository, ISurveyAnswerRepository iSurveyResponseRepository,
                     Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest, Epi.Web.Common.Message.SurveyAnswerRequest surveyResponseRequest,
                     Common.DTO.SurveyAnswerDTO surveyAnswerDTO,
                     SurveyResponseXML surveyResponseXML, UserAuthenticationRequest surveyAuthenticationRequest, Epi.Web.Common.DTO.PassCodeDTO PassCodeDTO, IOrganizationAccountRepository iOrgAccountRepository)
 {
     _iSurveyInfoRepository       = iSurveyInfoRepository;
     _iSurveyAnswerRepository     = iSurveyResponseRepository;
     _surveyInfoRequest           = surveyInfoRequest;
     _surveyAnswerRequest         = surveyResponseRequest;
     _surveyAnswerDTO             = surveyAnswerDTO;
     _surveyResponseXML           = surveyResponseXML;
     _surveyAuthenticationRequest = surveyAuthenticationRequest;
     _PassCodeDTO           = PassCodeDTO;
     _iOrgAccountRepository = iOrgAccountRepository;
 }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();
            Request.Action = "Update";

            this.currentSurveyInfoDTO.XML = this.template;
            Request.SurveyInfoList.Add(this.currentSurveyInfoDTO);

            try
            {
                Epi.Web.Common.Message.SurveyInfoResponse Result = new Epi.Web.Common.Message.SurveyInfoResponse();

                if (Result.Acknowledge == Web.Common.MessageBase.AcknowledgeType.Success)
                {
                    //txtStatusSummary.Text = SharedStrings.WEBFORM_SUCCESS;
                    lblOutput.Text = "Your Form has been republished: " + Result.Message;
                    ////string message = DateTime.Now + ": " + SharedStrings.WEBFORM_SUCCESS + ": " + Result.PublishInfo.URL;
                    //Logger.Log(message);
                    //message = DateTime.Now + ": Survey Key= " + txtSurveyKey.Text;
                    //Logger.Log(message);
                    //message = DateTime.Now + ": Data Key= " + txtDataKey.Text;
                    //Logger.Log(message);
                }
                else
                {
                    lblOutput.Text = "Your Form has NOT been republished: " + Result.Message;
                }

                //this.progressBar.Visible = false;
                //this.btnPublish.Enabled = true;

            }
            catch (Exception ex)
            {
                lblOutput.Text = lblOutput.Text + "An error occurred while trying to publish the survey.";
                lblOutput.Text = lblOutput.Text + ex.ToString();
                //btnDetails.Visible = true;
                //this.progressBar.Visible = false;
                this.Cursor = Cursors.Default;
            }
        }
Exemple #3
0
        public List <SurveyInfoBO> GetSurveyInfo(PreFilledAnswerRequest request)
        {
            List <string>       SurveyIdList   = new List <string>();
            string              SurveyId       = request.AnswerInfo.SurveyId.ToString();
            string              OrganizationId = request.AnswerInfo.OrganizationKey.ToString();
            Guid                UserPublishKey = request.AnswerInfo.UserPublishKey;
            List <SurveyInfoBO> SurveyBOList   = new List <SurveyInfoBO>();



            SurveyIdList.Add(SurveyId);

            Epi.Web.Common.Message.SurveyInfoRequest pRequest = new Epi.Web.Common.Message.SurveyInfoRequest();
            var criteria = pRequest.Criteria as Epi.Web.Common.Criteria.SurveyInfoCriteria;

            IDaoFactory    entityDaoFactory = new EF.EntityDaoFactory();
            ISurveyInfoDao surveyInfoDao    = entityDaoFactory.SurveyInfoDao;
            SurveyInfo     implementation   = new  SurveyInfo(surveyInfoDao);

            SurveyBOList = implementation.GetSurveyInfo(SurveyIdList, criteria.ClosingDate, OrganizationId, criteria.SurveyType, criteria.PageNumber, criteria.PageSize);//Default

            return(SurveyBOList);
        }
        private void WebPublishDialog_Load(object sender, EventArgs e)
        {
            if (!this.isRepublishableConfig || string.IsNullOrWhiteSpace(this.view.WebSurveyId))
            {
                TimeSpan t = new TimeSpan(10, 23, 59, 59);
                dtpSurveyClosingDate.Value = DateTime.Now.Date + t;
                this.txtSurveyName.SelectAll();
                txtSurveyName.Text = SharedStrings.WEBFORM_TITLE;
                txtSurveyName.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                txtSurveyNameMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                txtSurveyID.Text = SharedStrings.WEBFORM_SURVEYID;
                txtSurveyID.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                txtSurveyIDMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                txtSurveyIDMirror.Text = SharedStrings.WEBFORM_SURVEYID;
                txtOrganization.Text = SharedStrings.WEBFORM_ORGANIZATION;
                txtOrganization.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                txtOrganizationMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                txtOrganizationMirror.Text = SharedStrings.WEBFORM_ORGANIZATION;
                txtDepartment.Text = SharedStrings.WEBFORM_DEPARTMENT;
                txtDepartment.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                txtDepartmentMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                txtDepartmentMirror.Text = SharedStrings.WEBFORM_DEPARTMENT;
                txtIntroductionText.Text = SharedStrings.WEBFORM_INTRODUCTIONTEXT;
                txtIntroductionText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                txtExitText.Text = SharedStrings.WEBFORM_EXITTEXT;
                txtExitText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;

                if (!this.isRepublishableConfig)
                {
                    this.lblSurveyStartDate.Visible = false;
                    this.StartDateDatePicker.Visible = false;
                    this.StartTimecomboBox.Visible = false;
                    this.StartTimelabel.Visible = false;
                    this.OrganizationKeyLinkLabel.Visible = false;
                    this.OrganizationKeyValueLabel.Visible = false;
                    this.WebSurveyOptionsLinkLabel.Visible = false;
                    this.DividerLabel.Visible = false;
                    this.btnPublishForm.Enabled = true;

                    lblPublishModeStatus.Visible = false;
                    label1.Visible = false;
                    lblClosingDate.Left = 18;
                    dtpSurveyClosingDate.Left = 18;
                    // this.ClosingTimecomboBox.Left = 240;
                    // this.closingTimelabel.Left = 240;
                    //ClosingTimecomboBox.SelectedIndex = 0;
                    ClosingTimecomboBox.Visible = false;
                    closingTimelabel.Visible = false;
                }
                else
                {
                    this.txtDepartment.Visible = false;
                    this.lblDepartment.Visible = false;

                    this.txtOrganization.Left = 381;
                    this.txtOrganization.Size = new System.Drawing.Size(453, 23);
                    this.lblOrganization.Left = 300;

                    this.lblDepMirr.Visible = false;
                    this.txtDepartmentMirror.Visible = false;

                    this.txtOrganizationMirror.Left = 381;
                    this.txtOrganizationMirror.Size = new System.Drawing.Size(453, 23);
                    this.lblOrgMirr.Left = 300;
                    ClosingTimecomboBox.SelectedIndex = 0;
                    StartTimecomboBox.SelectedIndex = 0;

                }

            }
            else
            {
                SurveyManagerService.ManagerServiceClient client = Epi.Windows.MakeView.Utils.ServiceClient.GetClient();

                this.txtDepartment.Visible = false;
                this.lblDepartment.Visible = false;

                this.txtOrganization.Left = 381;
                this.txtOrganization.Size = new System.Drawing.Size(453, 23);
                this.lblOrganization.Left = 300;

                this.lblDepMirr.Visible = false;
                this.txtDepartmentMirror.Visible = false;

                this.txtOrganizationMirror.Left = 381;
                this.txtOrganizationMirror.Size = new System.Drawing.Size(453, 23);
                this.lblOrgMirr.Left = 300;

                ClosingTimecomboBox.SelectedIndex = 0;
                StartTimecomboBox.SelectedIndex = 0;

                // Epi.Windows.Dialogs.InputDialog inputDialog = new Windows.Dialogs.InputDialog("Enter organization key", "Organization Key", "", null, EpiInfo.Plugin.DataType.Text);
                //DialogResult result = inputDialog.ShowDialog();

                // if (result == System.Windows.Forms.DialogResult.OK)
                //{
                // this.OrganizationKey = inputDialog.OrganizationKey;
                this.txtOrganizationKey.Text = this.OrganizationKey;

                SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();
                Request.Criteria.SurveyIdList.Add(this.view.WebSurveyId);
                Request.Criteria.OrganizationKey = new Guid(this.OrganizationKey);
                SurveyInfoResponse response = client.GetSurveyInfo(Request);
                if (response.SurveyInfoList.Count > 0)
                {
                    currentSurveyInfoDTO = response.SurveyInfoList[0];
                    if (currentSurveyInfoDTO.IsDraftMode)
                    {
                        this.lblPublishModeStatus.Text = "DRAFT";
                    }
                    else
                    {
                        this.lblPublishModeStatus.Text = "FINAL";
                    }

                    dtpSurveyClosingDate.Value = currentSurveyInfoDTO.ClosingDate;

                    StartDateDatePicker.Value = currentSurveyInfoDTO.StartDate;
                    DateTime CloseTime = Convert.ToDateTime(currentSurveyInfoDTO.ClosingDate);
                    DateTime StartTime = Convert.ToDateTime(currentSurveyInfoDTO.StartDate);

                    ClosingTimecomboBox.SelectedItem = CloseTime.ToShortTimeString();
                    StartTimecomboBox.SelectedItem = StartTime.ToShortTimeString();

                    txtSurveyName.Text = currentSurveyInfoDTO.SurveyName;
                    //txtSurveyName.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                    //txtSurveyNameMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                    txtSurveyID.Text = currentSurveyInfoDTO.SurveyNumber;
                    //txtSurveyID.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                    //txtSurveyIDMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                    txtSurveyIDMirror.Text = currentSurveyInfoDTO.SurveyNumber;
                    txtOrganization.Text = currentSurveyInfoDTO.OrganizationName;
                    //txtOrganization.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                    //txtOrganizationMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                    txtOrganizationMirror.Text = currentSurveyInfoDTO.OrganizationName;
                    txtDepartment.Text = currentSurveyInfoDTO.DepartmentName;
                    //txtDepartment.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                    //txtDepartmentMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                    txtDepartmentMirror.Text = currentSurveyInfoDTO.DepartmentName;
                    txtIntroductionText.Text = currentSurveyInfoDTO.IntroductionText;
                    //txtIntroductionText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
                    txtExitText.Text = currentSurveyInfoDTO.ExitText;
                    //txtExitText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;

                    btnPublishForm.Enabled = true;
                }
                //}
            }
        }
        /// <summary>
        /// Initiates a single form publishing process
        /// </summary>
        private void DoRePublish()
        {
            if (this.UserPublishGuid == null)
            {
                this.UserPublishGuid = new Guid(this.txtPublisherKey.Text);
            }

            if(string.IsNullOrWhiteSpace(this.OrganizationKey))
            {
                this.OrganizationKey = this.txtOrganizationKey.Text;
            }

            this.QueryForExistingSurveyInfo();

            if (this.UserPublishGuid != null)
            {
                Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();
                Request.Action = "Update";

                this.currentSurveyInfoDTO.XML = template;

                Request.SurveyInfoList.Add(this.currentSurveyInfoDTO);
                try
                {
                    Epi.Web.Common.Message.SurveyInfoResponse Result = new Epi.Web.Common.Message.SurveyInfoResponse();

                    //txtStatusSummary.Text = SharedStrings.WEBFORM_SUCCESS;
                    //txtStatusSummary.Text = "Your Form has been republished: " + Result.Message;
                    ////string message = DateTime.Now + ": " + SharedStrings.WEBFORM_SUCCESS + ": " + Result.PublishInfo.URL;
                    //Logger.Log(message);
                    //message = DateTime.Now + ": Survey Key= " + txtSurveyKey.Text;
                    //Logger.Log(message);
                    //message = DateTime.Now + ": Data Key= " + txtDataKey.Text;
                    //Logger.Log(message);
                }
                catch (Exception ex)
                {
                    //txtStatusSummary.AppendText("An error occurred while trying to publish the survey.");
                    //txtStatus.AppendText(ex.ToString());
                    //btnDetails.Visible = true;
                    //this.progressBar.Visible = false;
                    //this.Cursor = Cursors.Default;
                }
            }
        }
 private void QueryForExistingSurveyInfo()
 {
     SurveyManagerService.ManagerServiceClient client = Epi.Windows.MakeView.Utils.ServiceClient.GetClient();
         SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();
         Request.Criteria.SurveyIdList.Add(this.view.WebSurveyId);
         Request.Criteria.OrganizationKey = new Guid(this.OrganizationKey);
         SurveyInfoResponse response = client.GetSurveyInfo(Request);
         if (response.SurveyInfoList.Count > 0)
         {
             this.currentSurveyInfoDTO = response.SurveyInfoList[0];
         }
 }