protected void Page_Load(object sender, EventArgs e)
    {
        Dictionary <string, object> _loginResult = HCSUtil.GetInfoLogin("", "");
        int    _cookieError = int.Parse(_loginResult["CookieError"].ToString());
        int    _userError   = int.Parse(_loginResult["UserError"].ToString());;
        string _personId    = _loginResult["PersonId"].ToString();
        string _studentId   = _loginResult["StudentId"].ToString();

        try
        {
            if (_cookieError.Equals(0) && _userError.Equals(0))
            {
                Dictionary <string, object> _valueDataRecorded = HCSUtil.SetValueDataRecorded(HCSUtil.PAGE_DOWNLOADREGISTRATIONFORMSTUDENTRECORDS_MAIN, _personId);
                Dictionary <string, object> _dataRecorded      = (Dictionary <string, object>)_valueDataRecorded["DataRecorded" + HCSUtil.SUBJECT_SECTION_DOWNLOADREGISTRATIONFORMSTUDENTRECORDS];

                HCSUtil.HCSStaffDownloadRegistrationFormUtil.GetRegisForm(_dataRecorded);

                downloadformsuccess.Value     = "Y";
                downloadformcookieerror.Value = _cookieError.ToString();
                downloadformusererror.Value   = _userError.ToString();
            }
            else
            {
                downloadformsuccess.Value     = "N";
                downloadformcookieerror.Value = _cookieError.ToString();
                downloadformusererror.Value   = _userError.ToString();
            }
        }
        catch
        {
            downloadformsuccess.Value     = "N";
            downloadformcookieerror.Value = "0";
            downloadformusererror.Value   = "0";
        }
    }
    public static StringBuilder GetSection(Dictionary <string, object> _infoLogin, string _section, string _sectionAction, string _id)
    {
        StringBuilder _html    = new StringBuilder();
        StringBuilder _content = new StringBuilder();

        int _userError = int.Parse(_infoLogin["UserError"].ToString());

        switch (_section)
        {
        case "MAIN":
            Dictionary <string, object> _termServiceHCSConsentRegistrationResult = HCSUtil.GetTermServiceHCSConsentRegistration(_infoLogin["StudentId"].ToString());

            if (!String.IsNullOrEmpty(_termServiceHCSConsentRegistrationResult["TermServiceStatusHCSConsentRegistration"].ToString()))
            {
                _content.AppendFormat(
                    "<center>" +
                    "   <span class='f8'>นักศึกษาเคยแสดงความประสงค์ว่า</span><br />" +
                    "   <span class='f7 bold underline'>\"{0}\"</span><br />" +
                    "   <span class='f9'>ให้มหาวิทยาลัยมหิดลขึ้นทะเบียนสิทธิหลักประกันสุขภาพแห่งชาติ<br />กับโรงพยาบาลสังกัดมหาวิทยาลัยมหิดลไว้แล้ว</span>" +
                    "</center>" +
                    "<p class='br'></p>" +
                    "<div class='red'>" +
                    "   <span class='bold'>หมายเหตุ</span><br />กรณีที่นักศึกษามีข้อสงสัย หรือต้องการเปลี่ยนแปลงความประสงค์สามารถติดต่อสอบถามได้ที่ กองกิจการนักศึกษา โทร. 0 2849 4514 ในวันและเวลาราชการ หรือติดต่อได้ที่ Inbox ของ FB Fanpage : @MahidolHealth" +
                    "</div>", (_termServiceHCSConsentRegistrationResult["TermServiceStatusHCSConsentRegistration"].Equals("Y") ? "ยินยอม" : "ไม่ยินยอม")
                    );

                _html.AppendFormat("<div class='view usererror{0}' id='{1}-panel'>", _userError, HCSUtil.ID_SECTION_TERMSERVICEHCSCONSENTREGISTRATION_INFO.ToLower());
                _html.AppendLine("      <div class='panel panel-info'>");
                _html.AppendLine("          <div class='panel-body'>");
                _html.AppendFormat("            <div class='lang lang-th lang-en font-family-th regular {0}'>{1}</div>", "f10", _content);
                _html.AppendLine("          </div>");
                _html.AppendLine("      </div>");
                _html.AppendLine("  </div>");
            }

            if (_userError.Equals(0))
            {
                _html.AppendFormat("{0}", SectionMainUI.GetMain(_id, _termServiceHCSConsentRegistrationResult));
            }

            break;

        case "DIALOG":
            if (_sectionAction.Equals(HCSUtil.SUBJECT_SECTION_DOWNLOADREGISTRATIONFORMSELECTWELFARE))
            {
                _html = SectionDialogUI.SelectWelfareUI.GetMain();
            }

            break;
        }

        return(_html);
    }
        public static StringBuilder GetMain(string _id, Dictionary <string, object> _termService)
        {
            StringBuilder _html        = new StringBuilder();
            StringBuilder _contentTemp = new StringBuilder();
            Dictionary <string, Dictionary <string, object> > _contentFrmColumn = new Dictionary <string, Dictionary <string, object> >();

            Dictionary <string, object>[] _contentFrmColumnDetail = new Dictionary <string, object> [5];
            Dictionary <string, object>   _valueDataRecorded      = HCSUtil.SetValueDataRecorded(HCSUtil.PAGE_DOWNLOADREGISTRATIONFORMSTUDENTRECORDS_MAIN, _id);
            Dictionary <string, object>   _dataRecorded           = (Dictionary <string, object>)_valueDataRecorded["DataRecorded" + HCSUtil.SUBJECT_SECTION_DOWNLOADREGISTRATIONFORMSTUDENTRECORDS];
            string _fontTHSize = "f9";
            string _fontENSize = "f9";
            int    _i          = 0;

            _contentTemp.Clear();
            _contentTemp.AppendFormat("<div class='lang lang-th font-family-th blue regular {0}'>{1}</div>", _fontTHSize, _dataRecorded["StudentCode"]);
            _contentTemp.AppendFormat("<div class='lang lang-en font-family-en blue regular {0}'>{1}</div>", _fontENSize, _dataRecorded["StudentCode"]);

            _contentFrmColumnDetail[_i] = new Dictionary <string, object>();
            _contentFrmColumnDetail[_i].Add("ID", (_idSectionMain + "-studentid"));
            _contentFrmColumnDetail[_i].Add("HighLight", false);
            _contentFrmColumnDetail[_i].Add("TitleTH", "รหัสนักศึกษา");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleTH", _fontTHSize);
            _contentFrmColumnDetail[_i].Add("TitleEN", "Student ID");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleEN", _fontENSize);
            _contentFrmColumnDetail[_i].Add("DiscriptionTH", String.Empty);
            _contentFrmColumnDetail[_i].Add("DiscriptionEN", String.Empty);
            _contentFrmColumnDetail[_i].Add("InputContentPaddingDown", false);
            _contentFrmColumnDetail[_i].Add("InputContent", _contentTemp.ToString());
            _contentFrmColumnDetail[_i].Add("Require", false);
            _contentFrmColumnDetail[_i].Add("LastRow", false);
            _contentFrmColumn.Add("StudentID", _contentFrmColumnDetail[_i]);
            _i++;

            _contentTemp.Clear();
            _contentTemp.AppendFormat("<div class='lang lang-th font-family-th blue regular {0}'>{1}</div>", _fontTHSize, Util.GetFullName(_dataRecorded["TitleInitialsTH"].ToString(), _dataRecorded["TitleFullNameTH"].ToString(), _dataRecorded["FirstName"].ToString(), _dataRecorded["MiddleName"].ToString(), _dataRecorded["LastName"].ToString()));
            _contentTemp.AppendFormat("<div class='lang lang-en font-family-en blue regular {0}'>{1}</div>", _fontENSize, Util.GetFullName(_dataRecorded["TitleInitialsEN"].ToString(), _dataRecorded["TitleFullNameEN"].ToString(), _dataRecorded["FirstNameEN"].ToString(), _dataRecorded["MiddleNameEN"].ToString(), _dataRecorded["LastNameEN"].ToString()).ToUpper());

            _contentFrmColumnDetail[_i] = new Dictionary <string, object>();
            _contentFrmColumnDetail[_i].Add("ID", (_idSectionMain + "-studentname"));
            _contentFrmColumnDetail[_i].Add("HighLight", false);
            _contentFrmColumnDetail[_i].Add("TitleTH", "ชื่อ - นามสกุล");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleTH", _fontTHSize);
            _contentFrmColumnDetail[_i].Add("TitleEN", "Full Name");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleEN", _fontENSize);
            _contentFrmColumnDetail[_i].Add("DiscriptionTH", String.Empty);
            _contentFrmColumnDetail[_i].Add("DiscriptionEN", String.Empty);
            _contentFrmColumnDetail[_i].Add("InputContentPaddingDown", false);
            _contentFrmColumnDetail[_i].Add("InputContent", _contentTemp.ToString());
            _contentFrmColumnDetail[_i].Add("Require", false);
            _contentFrmColumnDetail[_i].Add("LastRow", false);
            _contentFrmColumn.Add("FullName", _contentFrmColumnDetail[_i]);
            _i++;

            _contentTemp.Clear();
            _contentTemp.AppendFormat("<div class='lang lang-th font-family-th blue regular {0}'>{1}</div>", _fontTHSize, _dataRecorded["FacultyNameTH"]);
            _contentTemp.AppendFormat("<div class='lang lang-en font-family-en blue regular {0}'>{1}</div>", _fontENSize, Util.UppercaseFirst(_dataRecorded["FacultyNameEN"].ToString()));

            _contentFrmColumnDetail[_i] = new Dictionary <string, object>();
            _contentFrmColumnDetail[_i].Add("ID", (_idSectionMain + "-faculty"));
            _contentFrmColumnDetail[_i].Add("HighLight", false);
            _contentFrmColumnDetail[_i].Add("TitleTH", "คณะ");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleTH", _fontTHSize);
            _contentFrmColumnDetail[_i].Add("TitleEN", "Faculty");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleEN", _fontENSize);
            _contentFrmColumnDetail[_i].Add("DiscriptionTH", String.Empty);
            _contentFrmColumnDetail[_i].Add("DiscriptionEN", String.Empty);
            _contentFrmColumnDetail[_i].Add("InputContentPaddingDown", false);
            _contentFrmColumnDetail[_i].Add("InputContent", _contentTemp.ToString());
            _contentFrmColumnDetail[_i].Add("Require", false);
            _contentFrmColumnDetail[_i].Add("LastRow", false);
            _contentFrmColumn.Add("Faculty", _contentFrmColumnDetail[_i]);
            _i++;

            _contentTemp.Clear();
            _contentTemp.AppendFormat("<div class='lang lang-th font-family-th blue regular {0}'>{1}</div>", _fontTHSize, _dataRecorded["ProgramNameTH"]);
            _contentTemp.AppendFormat("<div class='lang lang-en font-family-en blue regular {0}'>{1}</div>", _fontENSize, Util.UppercaseFirst(_dataRecorded["ProgramNameEN"].ToString()));

            _contentFrmColumnDetail[_i] = new Dictionary <string, object>();
            _contentFrmColumnDetail[_i].Add("ID", (_idSectionMain + "-program"));
            _contentFrmColumnDetail[_i].Add("HighLight", false);
            _contentFrmColumnDetail[_i].Add("TitleTH", "หลักสูตร");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleTH", _fontTHSize);
            _contentFrmColumnDetail[_i].Add("TitleEN", "Program");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleEN", _fontENSize);
            _contentFrmColumnDetail[_i].Add("DiscriptionTH", String.Empty);
            _contentFrmColumnDetail[_i].Add("DiscriptionEN", String.Empty);
            _contentFrmColumnDetail[_i].Add("InputContentPaddingDown", false);
            _contentFrmColumnDetail[_i].Add("InputContent", _contentTemp.ToString());
            _contentFrmColumnDetail[_i].Add("Require", false);
            _contentFrmColumnDetail[_i].Add("LastRow", false);
            _contentFrmColumn.Add("Program", _contentFrmColumnDetail[_i]);
            _i++;

            /*
             * _contentTemp.Clear();
             * _contentTemp.AppendFormat("<div class='lang lang-th font-family-th blue regular {0}'>{1}</div>", _fontTHSize, _dataRecorded["HospitalNameTH"]);
             * _contentTemp.AppendFormat("<div class='lang lang-en font-family-en blue regular {0}'>{1}</div>", _fontENSize, Util.UppercaseFirst(_dataRecorded["HospitalNameEN"].ToString()));
             *
             * _contentFrmColumnDetail[_i] = new Dictionary<string, object>();
             * _contentFrmColumnDetail[_i].Add("ID", (_idSectionMain + "-hospital"));
             * _contentFrmColumnDetail[_i].Add("HighLight", false);
             * _contentFrmColumnDetail[_i].Add("TitleTH", "หน่วยบริการสุขภาพ");
             * _contentFrmColumnDetail[_i].Add("FontSizeTitleTH", _fontTHSize);
             * _contentFrmColumnDetail[_i].Add("TitleEN", "Hospital");
             * _contentFrmColumnDetail[_i].Add("FontSizeTitleEN", _fontENSize);
             * _contentFrmColumnDetail[_i].Add("DiscriptionTH", String.Empty);
             * _contentFrmColumnDetail[_i].Add("DiscriptionEN", String.Empty);
             * _contentFrmColumnDetail[_i].Add("InputContentPaddingDown", false);
             * _contentFrmColumnDetail[_i].Add("InputContent", _contentTemp.ToString());
             * _contentFrmColumnDetail[_i].Add("Require", false);
             * _contentFrmColumnDetail[_i].Add("LastRow", false);
             * _contentFrmColumn.Add("Hospital", _contentFrmColumnDetail[_i]);
             */
            _contentTemp.Clear();
            _contentTemp.AppendFormat("<div class='lang lang-th font-family-th blue regular {0}'>{1}</div>", _fontTHSize, _termService["TermServiceHospitalNameTHHCSConsentRegistration"]);
            _contentTemp.AppendFormat("<div class='lang lang-en font-family-en blue regular {0}'>{1}</div>", _fontENSize, Util.UppercaseFirst(_termService["TermServiceHospitalNameENHCSConsentRegistration"].ToString()));

            _contentFrmColumnDetail[_i] = new Dictionary <string, object>();
            _contentFrmColumnDetail[_i].Add("ID", (_idSectionMain + "-hospital"));
            _contentFrmColumnDetail[_i].Add("HighLight", false);
            _contentFrmColumnDetail[_i].Add("TitleTH", "หน่วยบริการสุขภาพ");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleTH", _fontTHSize);
            _contentFrmColumnDetail[_i].Add("TitleEN", "Hospital");
            _contentFrmColumnDetail[_i].Add("FontSizeTitleEN", _fontENSize);
            _contentFrmColumnDetail[_i].Add("DiscriptionTH", String.Empty);
            _contentFrmColumnDetail[_i].Add("DiscriptionEN", String.Empty);
            _contentFrmColumnDetail[_i].Add("InputContentPaddingDown", false);
            _contentFrmColumnDetail[_i].Add("InputContent", _contentTemp.ToString());
            _contentFrmColumnDetail[_i].Add("Require", false);
            _contentFrmColumnDetail[_i].Add("LastRow", false);
            _contentFrmColumn.Add("Hospital", _contentFrmColumnDetail[_i]);

            _html.AppendLine(GetValueDataRecorded(_valueDataRecorded).ToString());

            _html.AppendFormat("<div class='view' id='{0}-panel'>", _idSectionMain);
            _html.AppendLine("      <div class='panel'>");
            _html.AppendLine("          <div class='panel-heading text-center'>");
            _html.AppendLine("              <div class='avatar profilepicture'>");
            _html.AppendLine("                  <div class='watermark'></div>");
            _html.AppendLine("                  <img />");
            _html.AppendLine("              </div>");
            _html.AppendLine("          </div>");
            _html.AppendLine("          <div class='panel-body'>");
            _html.AppendLine("              <div class='form'>");
            _html.AppendLine(HCSUI.GetFrmColumn(_contentFrmColumn["StudentID"]).ToString());
            _html.AppendLine(HCSUI.GetFrmColumn(_contentFrmColumn["FullName"]).ToString());
            _html.AppendLine(HCSUI.GetFrmColumn(_contentFrmColumn["Faculty"]).ToString());
            _html.AppendLine(HCSUI.GetFrmColumn(_contentFrmColumn["Program"]).ToString());

            if (_termService["TermServiceStatusHCSConsentRegistration"].Equals("Y"))
            {
                _html.AppendLine(HCSUI.GetFrmColumn(_contentFrmColumn["Hospital"]).ToString());
            }

            _html.AppendLine("              </div>");

            /*
             * _html.AppendLine("              <div class='btn-command text-center'>");
             * _html.AppendFormat("                <a class='btn btn-block btn-success' id='{0}-buttondownload'>", _idSectionMain);
             * _html.AppendFormat("                    <div class='lang lang-th font-family-th {0} regular'>ดาวน์โหลดแบบฟอร์มประกันสุขภาพ</div>", _fontTHSize);
             * _html.AppendFormat("                    <div class='lang lang-en font-family-en {0} regular'>Download Registration Form</div>", _fontENSize);
             * _html.AppendLine("                  </a>");
             * _html.AppendLine("              </div>");
             */
            _html.AppendLine("          </div>");
            _html.AppendLine("      </div>");
            _html.AppendLine("  </div>");

            return(_html);
        }
    public static StringBuilder GetSection(Dictionary <string, object> _infoLogin, string _section, string _sectionAction, string _id)
    {
        StringBuilder _html      = new StringBuilder();
        StringBuilder _content   = new StringBuilder();
        StringBuilder _contentTH = new StringBuilder();
        StringBuilder _contentEN = new StringBuilder();
        bool          _exist     = HCSUtil.ChkExistStudentTermServiceHCSConsentOOCA(_id);
        int           _userError = int.Parse(_infoLogin["UserError"].ToString());

        switch (_section)
        {
        case "MAIN":
            if (!_exist)
            {
                _html = SectionMainUI.GetMain(_id);
            }
            else
            {
                Dictionary <string, object> _termServiceHCSConsentOOCAResult = HCSUtil.GetTermServiceHCSConsentOOCA(_id);


                if (!String.IsNullOrEmpty(_termServiceHCSConsentOOCAResult["TermServiceStatusHCSConsentOOCA"].ToString()))
                {
                    _contentTH.AppendFormat(
                        "<center>" +
                        "   <span class='f8'>นักศึกษาเคยแสดงความประสงค์ว่า</span><br />" +
                        "   <span class='f7 bold underline'>\"{0}\"</span><br />" +
                        "   <span class='f9'>ให้ข้อมูลสำหรับการรับบริการปรึกษาออนไลน์สำหรับนักศึกษา มหาวิทยาลัยมหิดลไว้แล้ว</span>" +
                        "</center>" +
                        "<p class='br'></p>" +
                        "<div class='red'>" +
                        "   <span class='bold'>หมายเหตุ</span><br />กรณีต้องการแจ้งเปลี่ยนแปลงความประสงค์ หรือต้องการรายละเอียดเพิ่มเติมติดต่อสอบถามได้ที่ กองกิจการนักศึกษา โทร. 0 2849 4538 ในวันและเวลาราชการ หรือติดต่อได้ที่ Inbox ของ FB Fanpage : @MahidolFriends" +
                        "</div>", (_termServiceHCSConsentOOCAResult["TermServiceStatusHCSConsentOOCA"].Equals("Y") ? "ยินยอม" : "ไม่ยินยอม")
                        );

                    _contentEN.AppendFormat(
                        "<center>" +
                        "   <span class='f8'>You have already decided to</span><br />" +
                        "   <span class='f7 bold underline'>\"{0}\"</span><br />" +
                        "   <span class='f9'>provides information for receiving online counseling services<br />for Mahidol University’ students</span>" +
                        "</center>" +
                        "<p class='br'></p>" +
                        "<div class='red'>" +
                        "   <span class='bold'>Note</span><br />In case of changing your decision, please contact the Mahidol University Counseling Center ( MU Friends, Counseling Center ) Division of Student Affairs, tel. 0 2849 4538 or FB Fanpage: @mahidolfriends" +
                        "</div>", (_termServiceHCSConsentOOCAResult["TermServiceStatusHCSConsentOOCA"].Equals("Y") ? "Agree" : "Disagree")
                        );

                    _html.AppendFormat("<div class='view usererror{0}' id='{1}-panel'>", _userError, HCSUtil.ID_SECTION_TERMSERVICEHCSCONSENTOOCA_INFO.ToLower());
                    _html.AppendLine("      <div class='panel panel-info'>");
                    _html.AppendLine("          <div class='panel-body'>");
                    _html.AppendFormat("            <div class='lang lang-th font-family-th regular {0}'>{1}</div>", "f10", _contentTH);
                    _html.AppendFormat("            <div class='lang lang-en font-family-en regular {0}'>{1}</div>", "f10", _contentEN);
                    _html.AppendLine("          </div>");
                    _html.AppendLine("      </div>");
                    _html.AppendLine("  </div>");
                }
            }

            break;
        }

        return(_html);
    }