protected void ddlScheduleID_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlScheduleID.SelectedIndex != 0)
     {
         CSchedule schedule = scheduleFactory.getById(Convert.ToInt32(ddlScheduleID.SelectedItem.Text));
         ddlUserName.Text    = userFactory.getById(schedule.user_id).name;
         ddlPatientName.Text = patientFactory.getById(schedule.patient_id).name;
         ddlAssessName.Text  = schedule.assess_name;
         tbDeadLine.Text     = schedule.deadLine.ToShortDateString();
     }
 }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["loginName"] != null)
        {
            user = userFactory.getByAccount(Session["loginName"].ToString());
        }


        int assess_id = 0;

        if (Request.QueryString["pid"] != null && Request.QueryString["aid"] != null && Request.QueryString["sid"] != null)
        {
            assess_id   = Convert.ToInt32(Request.QueryString["aid"]);
            patient_id  = Request.QueryString["pid"];
            schedule_id = Convert.ToInt32(Request.QueryString["sid"]);
        }


        myAssess           = assessFactory.getById(assess_id);
        isFinished         = scheduleFactory.getById(schedule_id).isFinished;
        lblAssessName.Text = myAssess.name;

        CGroup group = new CGroup();

        group.id = 0;

        int groupCount = 0;

        foreach (CItem item in myAssess.items)
        {
            if (item.group != null)
            {
                //item有group
                if (!item.group.id.Equals(group.id))
                {
                    //不同group
                    if (groupCount > 0)
                    {
                        if (isFinished)
                        {
                            Label lblGroupScore = new Label();
                            lblGroupScore.Text = "分數:" + groupScore.ToString();

                            PlaceHolder1.Controls.Add(new LiteralControl("<div class='panel-primary panel-footer'><span class='glyphicon glyphicon-ok' aria-hidden='true'></span>"));
                            PlaceHolder1.Controls.Add(lblGroupScore);
                            PlaceHolder1.Controls.Add(new LiteralControl("</div>"));
                        }
                        PlaceHolder1.Controls.Add(new LiteralControl("</div>"));
                    }

                    group.id = item.group.id;

                    Label lblGroupName = new Label();
                    lblGroupName.Text     = item.group.name;
                    lblGroupName.CssClass = "label";

                    PlaceHolder1.Controls.Add(new LiteralControl("<div class='panel panel-primary' style='font-size:X-large'><div class='panel-heading'>"));
                    PlaceHolder1.Controls.Add(lblGroupName);
                    PlaceHolder1.Controls.Add(new LiteralControl("</div>"));
                    groupCount++;
                    groupScore = 0;
                }
            }
            else
            {
                //item沒group
                groupCount = 0;
                if (groupCount > 0)
                {
                    PlaceHolder1.Controls.Add(new LiteralControl("</div>"));
                }
            }
            //加入項目
            addItem(item);
        }
        PlaceHolder1.Controls.Add(new LiteralControl("</div>"));

        Button btnSubmit = new Button();

        if (isFinished)
        {
            lbltotalScore.Visible = true;
            lbltotalScore.Text    = "總分:" + totalScore.ToString();

            btnSubmit.Text     = "上一頁";
            btnSubmit.Click   += btnBack_Click;
            btnSubmit.CssClass = "btn btn-large btn-block btn-danger";
        }
        else
        {
            btnSubmit.Text     = "送出";
            btnSubmit.Click   += btnSubmit_Click;
            btnSubmit.CssClass = "btn btn-large btn-block btn-success";
        }
        btnSubmit.Height    = 60;
        btnSubmit.Font.Size = 18;
        btnSubmit.ForeColor = Color.Black;

        PlaceHolder1.Controls.Add(btnSubmit);
    }