Exemple #1
0
        protected void setSurvey(Int32 _surveyId)
        {
            this.clearMessage();

            SurveyDS.SurveyDSDataTable dt = BllProxySurvey.SelectSurvey(_surveyId);

            if (dt.Rows.Count > 0)
            {
                lblSurveyName.Text = dt[0].survey_name;
            }
            else
            {
                lblSurveyName.Text = "ERROR: " + surveyId.ToString();
            }
        }
Exemple #2
0
        //--------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------



        //protected void Page_PreRender(object sender, EventArgs e)
        //{
        //    this.Start();
        //}



        ///---------------------------------------------------------------------------------
        ///---------------------------------------------------------------------------------
        protected void dvControl_DataBound(object sender, EventArgs e)
        {
            DetailsView dv = (DetailsView)sender;


            //----------------------------------------------------------------------
            DropDownList ddlManagers = (DropDownList)dv.FindControl("ddlManagers");

            HiddenField hfUser = (HiddenField)dv.FindControl("hfUserId");

            if (hfUser.Value == "")
            {
                userId = 0;
            }
            else
            {
                userId = Convert.ToInt32(hfUser.Value);
            }



            //----------------------------------------------------------------------
            HiddenField hfFacilityGuid = (HiddenField)dv.FindControl("hfFacilityGuid");

            if (hfFacilityGuid.Value == "")
            {
                facilityGuid = new Guid();
            }
            else
            {
                facilityGuid = new Guid(Convert.ToString(hfFacilityGuid.Value));
            }

            this.Start();
            //----------------------------------------------------------------------



            if (ddlManagers != null)
            {
                ddlManagers.DataSource = BllProxyUser.GetUsersByRole(3, 1);    // 3:Managers
                ddlManagers.DataBind();

                ListItem item = new ListItem("select user", "0");
                ddlManagers.Items.Insert(0, item);

                ListItem currentItem = ddlManagers.Items.FindByValue(userId.ToString());
                if (currentItem != null)
                {
                    currentItem.Selected = true;
                }
                else
                {
                    ddlManagers.Items.FindByValue("0").Selected = true;
                }
            }


            //----------------------------------------------------------------------
            DropDownList ddlSurvey = (DropDownList)dv.FindControl("ddlSurvey");
            HiddenField  hfSurvey  = (HiddenField)dv.FindControl("hfSurveyId");

            if (hfSurvey.Value == "")
            {
                surveyId = 0;
            }
            else
            {
                surveyId = Convert.ToInt32(hfSurvey.Value);
            }

            if (ddlSurvey != null)
            {
                ddlSurvey.DataSource = BllProxySurvey.GetAllSurveys();    // 3:Managers
                ddlSurvey.DataBind();

                ListItem item = new ListItem("select survey", "0");
                ddlSurvey.Items.Insert(0, item);

                ListItem currentItem = ddlSurvey.Items.FindByValue(surveyId.ToString());
                if (currentItem != null)
                {
                    currentItem.Selected = true;
                }
                else
                {
                    ddlSurvey.Items.FindByValue("0").Selected = true;
                }
            }



            if (this.ReadOnly)
            {
                dv.Rows[6].Visible = false;
            }

            bool is_command_visible = false;

            if (this.AllowManagement)
            {
                Control    cntrl = dv.Rows[3].FindControl("lbManageGroups");
                LinkButton lb    = cntrl as LinkButton;
                if (lb != null)
                {
                    lb.Visible = true;
                }

                HiddenField hf_agent = dv.FindControl("hfAgentId") as HiddenField;

                is_command_visible = hf_agent != null && !string.IsNullOrEmpty(hf_agent.Value);
            }

            dv.Rows[dv.Rows.Count - 1].Visible = is_command_visible;
        }
Exemple #3
0
        protected void btnFinish_Click(object sender, EventArgs e)
        {
            Int32 surveyId = 0;

            FacilityDS.FacilityDSDataTable dtF = BllProxyFacility.SelectFacility(this.FacilityId);
            if (dtF.Rows.Count > 0)
            {
                surveyId = dtF[0].survey_id;
            }



            bool isComplete = false;

            foreach (Control c in rptSurveyQuestions.Items)
            {
                UcKioskSurveyQuestion surveyQuestion = (UcKioskSurveyQuestion)c.FindControl("SurveyQuestion");

                if (surveyQuestion != null)
                {
                    if (surveyQuestion.SurveyResponse != "")
                    {
                        isComplete = true;
                    }
                }
            }



            if (isComplete)
            {
                foreach (Control c in rptSurveyQuestions.Items)
                {
                    UcKioskSurveyQuestion surveyQuestion = (UcKioskSurveyQuestion)c.FindControl("SurveyQuestion");

                    if (surveyQuestion != null)
                    {
                        Int32  questionId = surveyQuestion.QuestionId;
                        Int32  typeId     = surveyQuestion.QuestionType;
                        string response   = surveyQuestion.SurveyResponse;


                        //if ((typeId == 2)||(typeId == 3))
                        if (response == "")
                        {
                            response = null;
                        }


                        if (response != "")
                        {
                            BllProxySurvey.InsertSurveyResponse(incidentId, surveyId, questionId, response);
                        }
                    }
                }
            }

            UcControlArgs args = new UcControlArgs();

            goNext(args);
        }