Exemple #1
0
    private void ShowQuestionnaire(string masterId)
    {
        string                     js;
        QuestionnaireType          qt;
        QuestionnaireMasterManager qm = new QuestionnaireMasterManager();
        var master = qm.GetDataById(masterId);

        if (master != null)
        {
            hfMasterPK.Value = master.Id.ToString();
            hlChart.Attributes["onclick"] = Stool.GetSimpleModalInitFunction("QuestionnareChart.aspx?pk=" + master.Id.ToString());
            lblHeading.Text     = master.Heading;
            litChartResult.Text = master.Heading;
            lblDescription.Text = master.Description.Replace("/r/n", "<br/>");
            hfComment.Value     = master.Comment;

            //問卷類型
            qt = (QuestionnaireType)Enum.Parse(typeof(QuestionnaireType), master.Category);
            if (qt == QuestionnaireType.Process)
            {
                pnlList.Visible = false;
            }
            else
            {
                //清單(List)的顯示狀態和程序(process)是一樣
                // pnlList.Visible = pnlQues.Visible;
                pnlList.Visible = true;
                pnlQues.Visible = false;
            }
            hfQuestionnaireType.Value = qt.ToString();

            //是否到期
            if (DateTime.Now > master.EndDate)
            {
                pnlMain.Visible = false;
                //lblMessage.Visible = true;
                lblMessage.Style["display"] = "block;";
                hfShowChart.Value           = "Y";
            }

            //註冊javascript,建立問卷UI
            js  = string.Format(" quesUIObject.createContent('{5}','{0}','{1}', '{2}', '{3}', '{4}');", hfComment.ClientID, hfBeginShowChart.Value, hfChartResult.Value, hfShowChart.Value, hfQuestionnaireType.Value, master.Id);
            js += "function setCookie(){";
            if (master.OneTime)
            {
                var completed = "此問卷已填寫";
                js += " var value = $.cookie(quesUIObject.qStatus + \"_\" + quesUIObject.masterPK);";
                js += " if (value == \"complete\") {";
                js += "     $(\"div.visible\").hide();";
                js += string.Format("$(\"#{0}\").show().html('{1}');", lblMessage.ClientID, completed);
                js += "}";
            }
            js += "}";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "one", js, true);
        }
    }
Exemple #2
0
    protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        HyperLink hlUpdate;
        string    pk;
        string    url = this.ResolveUrl("~/DefinedForm/FormSetting.aspx");

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            hlUpdate = (HyperLink)e.Row.FindControl("hlUpdate");
            pk       = DataBinder.Eval(e.Row.DataItem, "PK").ToString();
            url     += "?p=" + pk;
            hlUpdate.Attributes["onclick"] = Stool.GetSimpleModalInitFunction(url);
        }
    }
Exemple #3
0
    protected void gvForm_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string    pk, url;
        HyperLink hlResult;

        url = this.ResolveUrl("FormResult.aspx");
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            hlResult = (HyperLink)e.Row.FindControl("hlResult");
            pk       = gvForm.DataKeys[e.Row.RowIndex].Value.ToString();
            url     += "?p=" + pk;
            hlResult.Attributes["onclick"] = Stool.GetSimpleModalInitFunction(url);
        }
    }
Exemple #4
0
    protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        int       id;
        string    url = this.ResolveUrl("~/Questionnaire/QuesSetting.aspx");
        HyperLink hlUpdate;

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            hlUpdate = (HyperLink)e.Row.FindControl("hlUpdate");
            id       = (int)DataBinder.Eval(e.Row.DataItem, "Id");

            url += "?p=" + id;
            hlUpdate.Attributes["onclick"] = Stool.GetSimpleModalInitFunction(url);
        }
    }