public static StringBuilder GetMain(Dictionary <string, object> _infoLogin, DataRow[] _dr) { StringBuilder _str = new StringBuilder(); string _username = _infoLogin["Username"].ToString(); string _userlevel = _infoLogin["Userlevel"].ToString(); string _systemGroup = _infoLogin["SystemGroup"].ToString(); string _personId = String.Empty; string _studentCode = String.Empty; string _fullNameTH = String.Empty; string _fullNameEN = String.Empty; string _scholarshipsId = String.Empty; string _scholarshipsNameTH = String.Empty; string _scholarshipsNameEN = String.Empty; string _responsibleAgency = String.Empty; string _scholarshipsYear = String.Empty; string _semester = String.Empty; string _tuition = String.Empty; string _remark = String.Empty; string _fontColor = String.Empty; string[] _msgTH = new string[5]; string[] _msgEN = new string[5]; int _error = 0; int _row = 0; int _i = 0; int _j = 0; int _indexArray = 0; int _recordCount = (_dr.GetLength(0) - 1); _str.AppendFormat("<div class='paddingTop10'>"); _str.AppendLine(" <div class='ui horizontal segments table-title'>"); _str.AppendLine(" <div class='ui segment left floated grey inverted'>"); _str.AppendFormat(" <div class='mini ui grey inverted button btnoption {0} button-overflow'>", (_recordCount.Equals(0) ? "disabled" : "")); _str.AppendLine(" <i class='save icon font-th regular white'></i>"); _str.AppendLine(" <span class='lang lang-th f10 font-th regular white'>บันทึก</span>"); _str.AppendFormat(" <div class='lang lang-th f11 font-th regular white'><a class='btnregister-option' href='javascript:void(0)' alt='{0}'>ทั้งหมด</a> | <a class='btnregister-option' href='javascript:void(0)' alt='{1}'>เฉพาะที่เลือก</a></div>", SCHUtil._selectOption[0].ToLower(), SCHUtil._selectOption[1].ToLower()); _str.AppendLine(" <span class='lang lang-en f10 font-en regular white'>Save</span>"); _str.AppendFormat(" <div class='lang lang-en f11 font-en regular white'><a class='btnregister-option' href='javascript:void(0)' alt='{0}'>All</a> | <a class='btnregister-option' href='javascript:void(0)' alt='{1}'>Selected</a></div>", SCHUtil._selectOption[0].ToLower(), SCHUtil._selectOption[1].ToLower()); _str.AppendLine(" </div>"); _str.AppendLine(" </div>"); _str.AppendLine(" <div class='ui segment right floated right aligned grey inverted recordcount'>"); _str.AppendFormat(" <span class='lang lang-th f10 font-th regular white'>พบ <span class='recordcountprimary-search'>{0}</span></span>", _recordCount); _str.AppendFormat(" <span class='lang lang-en f10 font-en regular white'>Found <span class='recordcountprimary-search'>{0}</span></span>", _recordCount); _str.AppendLine(" </div>"); _str.AppendLine(" </div>"); _str.AppendLine(" <table class='ui table unstackable'>"); _str.AppendLine(" <thead>"); _str.AppendLine(" <tr class='center aligned'>"); _str.AppendLine(" <th class='col1'>"); _str.AppendLine(" <span class='lang lang-th f9 font-th regular black'>ที่</span>"); _str.AppendLine(" <span class='lang lang-en f9 font-en regular black'>No.</span>"); _str.AppendLine(" </th>"); _str.AppendLine(" <th class='col2'>"); _str.AppendLine(" <input type ='checkbox' class='select-root checkbox ui' tabindex='0' />"); _str.AppendLine(" </th>"); _str.AppendLine(" <th class='col3'>"); _str.AppendLine(" <span class='lang lang-th f9 font-th regular black'>รหัสนักศึกษา</span>"); _str.AppendLine(" <span class='lang lang-en f9 font-en regular black'>Student ID</span>"); _str.AppendLine(" </th>"); _str.AppendLine(" <th class='col4'>"); _str.AppendLine(" <span class='lang lang-th f9 font-th regular black'>ชื่อ - สกุล</span>"); _str.AppendLine(" <span class='lang lang-en f9 font-en regular black'>Full Name</span>"); _str.AppendLine(" </th>"); _str.AppendLine(" <th class='col5'>"); _str.AppendLine(" <span class='lang lang-th f9 font-th regular black'>ทุน</span>"); _str.AppendLine(" <span class='lang lang-en f9 font-en regular black'>Scholarship</span>"); _str.AppendLine(" </th>"); _str.AppendLine(" <th class='col6'>"); _str.AppendLine(" <span class='lang lang-th f9 font-th regular black'>สมัครรับทุน<br />เมื่อ</span>"); _str.AppendLine(" <span class='lang lang-en f9 font-en regular black'>Regerter<br />When</span>"); _str.AppendLine(" </th>"); _str.AppendLine(" <th class='col7'>"); _str.AppendLine(" <span class='lang lang-th f9 font-th regular black'>จำนวนเงิน<br />( บาท )</span>"); _str.AppendLine(" <span class='lang lang-en f9 font-en regular black'>Amount<br />( bath )</span>"); _str.AppendLine(" </th>"); _str.AppendLine(" </tr>"); _str.AppendLine(" </thead>"); _str.AppendLine(" <tbody>"); if (_recordCount > 0) { foreach (DataRow _dr1 in _dr) { if (_row > 0) { _personId = String.Empty; _studentCode = _dr1[3].ToString(); _fullNameTH = String.Empty; _fullNameEN = String.Empty; _scholarshipsNameTH = _dr1[4].ToString(); _scholarshipsNameEN = _scholarshipsNameTH; _responsibleAgency = _dr1[6].ToString(); _scholarshipsYear = _dr1[1].ToString(); _semester = _dr1[2].ToString(); _tuition = _dr1[5].ToString(); _remark = _dr1[7].ToString(); _i = 0; DataSet _ds2 = SCHDB.GetSCHStudent(_username, _userlevel, _systemGroup, _studentCode); _error = (_ds2.Tables[0].Rows.Count > 0 ? 0 : 1); if (_error.Equals(0)) { DataRow _dr2 = _ds2.Tables[0].Rows[0]; _personId = _dr2["id"].ToString(); _studentCode = _dr2["studentCode"].ToString(); _fullNameTH = SCHUtil.GetFullName(_dr2["titlePrefixInitialsTH"].ToString(), _dr2["titlePrefixFullNameTH"].ToString(), _dr2["firstName"].ToString(), _dr2["middleName"].ToString(), _dr2["lastName"].ToString()); _fullNameEN = SCHUtil.GetFullName(_dr2["titlePrefixInitialsEN"].ToString(), _dr2["titlePrefixFullNameEN"].ToString(), _dr2["firstNameEN"].ToString(), _dr2["middleNameEN"].ToString(), _dr2["lastNameEN"].ToString()).ToUpper(); } else { _msgTH[_i] = "ไม่พบนักศึกษา"; _msgEN[_i] = "Student not found."; _i++; } _ds2.Dispose(); DataSet _ds3 = SCHDB.GetScholarships("", _scholarshipsNameTH); _error = (_ds3.Tables[0].Rows.Count > 0 ? 0 : 1); if (_error.Equals(0)) { DataRow _dr3 = _ds3.Tables[0].Rows[0]; _scholarshipsId = _dr3["id"].ToString(); _scholarshipsNameTH = _dr3["scholarshipsNameTH"].ToString(); _scholarshipsNameEN = (!String.IsNullOrEmpty(_dr3["scholarshipsNameEN"].ToString()) ? _dr3["scholarshipsNameEN"].ToString() : (!String.IsNullOrEmpty(_scholarshipsNameTH) ? _scholarshipsNameTH : "")); if (String.IsNullOrEmpty(_responsibleAgency)) { _msgTH[_i] = "ไม่พบหน่วยงานที่รับผิดชอบ"; _msgEN[_i] = "Responsible Agency not found."; _i++; } } else { _msgTH[_i] = "ไม่พบทุน"; _msgEN[_i] = "Scholarship not found."; _i++; } _ds3.Dispose(); _indexArray = SCHUtil.FindIndexArray2D(1, SCHUtil._semester, _semester); _error = (_indexArray > 0 ? 0 : 1); if (_error.Equals(0)) { _semester = SCHUtil._semester[_indexArray - 1, 0]; } else { _msgTH[_i] = "ไม่พบภาคเรียน"; _msgEN[_i] = "Semester not found."; _i++; } try { _error = (!_tuition.Equals("0") ? 0 : 1); if (_error.Equals(0)) { _tuition = double.Parse(_tuition).ToString("#,##0.00"); } else { _msgTH[_i] = "จำนวนเงินต้องมากกว่า 0"; _msgEN[_i] = "Amount must be greater than 0."; _i++; } } catch { _msgTH[_i] = "รูปแบบจำนวนเงินไม่ถูกต้อง"; _msgEN[_i] = "Invalid number format."; _i++; } _fontColor = (_i.Equals(0) ? "black" : "red"); _str.AppendFormat(" <tr class='center aligned' id='{0}-id-{1}'>", _idContent, (_personId + _scholarshipsYear + _semester + _scholarshipsId)); _str.AppendLine(" <td class='tooltip col1' data-content='' data-contentth='ที่' data-contenten='No.'>"); _str.AppendFormat(" <span class='lang lang-th f10 font-th regular {0}'>{1}</span>", _fontColor, _row.ToString("#,##0")); _str.AppendFormat(" <span class='lang lang-en f10 font-en regular {0}'>{1}</span>", _fontColor, _row.ToString("#,##0")); _str.AppendLine(" </td>"); _str.AppendLine(" <td class='col2 checkbox'>"); if (_i.Equals(0)) { _str.AppendLine(" <input type='checkbox' name='select-child' class='select-child checkbox checker' data-options='{\"studentId\":\"" + _studentCode + "\",\"personId\":\"" + _personId + "\",\"scholarshipsYear\":\"" + _scholarshipsYear + "\",\"semester\":\"" + _semester + "\",\"scholarshipsId\":\"" + _scholarshipsId + "\",\"responsibleAgency\":\"" + _responsibleAgency + "\",\"tuition\":\"" + _tuition.Replace(",", "") + "\",\"remark\":\"" + _remark + "\"}' value='" + _personId + ":" + _scholarshipsYear + ":" + _semester + ":" + _scholarshipsId + ":" + _responsibleAgency + ":" + _tuition.Replace(",", "") + ":" + _remark + "' />"); } _str.AppendLine(" </td>"); _str.AppendLine(" <td class='tooltip col3' data-content='' data-contentth='รหัสนักศึกษา' data-contenten='Student ID'>"); if (_i.Equals(0)) { _str.AppendLine(" <div class='ui green button btnstudentcv' data-options='{\"personId\":\"" + _personId + "\",\"scholarshipsYear\":\"" + _scholarshipsYear + "\",\"semester\":\"" + _semester + "\",\"scholarshipsId\":\"" + _scholarshipsId + "\"}'>"); _str.AppendFormat(" <span class='lang lang-th f10 font-th regular white'>{0}</span>", _studentCode); _str.AppendFormat(" <span class='lang lang-en f10 font-en regular white'>{0}</span>", _studentCode); _str.AppendLine(" </div>"); } else { _str.AppendFormat(" <span class='lang lang-th f10 font-th regular red'>{0}</span>", _studentCode); _str.AppendFormat(" <span class='lang lang-en f10 font-en regular red'>{0}</span>", _studentCode); } _str.AppendLine(" </td>"); _str.AppendLine(" <td class='tooltip col4 left aligned' data-content='' data-contentth='ชื่อ - สกุล' data-contenten='Full Name'>"); _str.AppendFormat(" <span class='lang lang-th f10 font-th regular {0}'>{1}</span>", _fontColor, _fullNameTH); _str.AppendFormat(" <span class='lang lang-en f10 font-en regular {0}'>{1}</span>", _fontColor, _fullNameEN); _str.AppendLine(" </td>"); _str.AppendLine(" <td class='tooltip col5 left aligned' data-content='' data-contentth='ทุน' data-contenten='Scholarship'>"); _str.AppendFormat(" <span class='lang lang-th f10 font-th regular {0} black'>{1}</span><span class='lang lang-th f10 font-th regular {2}'>{3}</span>", _fontColor, _scholarshipsNameTH, (_i.Equals(0) ? "muted" : "red"), (!String.IsNullOrEmpty(_responsibleAgency) ? (" - " + _responsibleAgency) : "")); _str.AppendFormat(" <span class='lang lang-en f10 font-en regular {0} black'>{1}</span><span class='lang lang-en f10 font-en regular {2}'>{3}</span>", _fontColor, _scholarshipsNameEN, (_i.Equals(0) ? "muted" : "red"), (!String.IsNullOrEmpty(_responsibleAgency) ? (" - " + _responsibleAgency) : "")); _str.AppendLine(" </td>"); _str.AppendLine(" <td class='tooltip col6' data-content='' data-contentth='ปี / ภาคเรียนที่สมัครรับทุน' data-contenten='Scholarship on Year / Semester'>"); _str.AppendFormat(" <span class='lang lang-th f10 font-th regular {0}'>{1} / {2}</span>", _fontColor, _scholarshipsYear, _semester); _str.AppendFormat(" <span class='lang lang-en f10 font-en regular {0}'>{1} / {2}</span>", _fontColor, _scholarshipsYear, _semester); _str.AppendLine(" </td>"); _str.AppendLine(" <td class='tooltip col7 right aligned' data-content='' data-contentth='จำนวนเงิน' data-contenten='Amount'>"); _str.AppendFormat(" <span class='lang lang-th f10 font-th regular {0}'>{1}</span>", _fontColor, _tuition); _str.AppendFormat(" <span class='lang lang-en f10 font-en regular {0}'>{1}</span>", _fontColor, _tuition); _str.AppendLine(" </td>"); _str.AppendLine(" <td class='tooltip col8 hide'>"); _str.AppendFormat(" <span>{0}</span>", _remark.Replace("\n", "<br />")); _str.AppendLine(" </td>"); _str.AppendLine(" </tr>"); if (_i > 0) { _str.AppendLine("<tr>"); _str.AppendLine(" <td class='info-list' colspan='7'>"); _str.AppendLine(" <ul>"); for (_j = 0; _j < _i; _j++) { _str.AppendFormat(" <li class='lang lang-th f10 font-th regular white'>{0}</li>", _msgTH[_j]); _str.AppendFormat(" <li class='lang lang-en f10 font-en regular white'>{0}</li>", _msgEN[_j]); } _str.AppendLine(" </ul>"); _str.AppendLine(" </td>"); _str.AppendLine("</tr>"); } else { _str.AppendFormat(" <tr class='center aligned hide ui {0}' id='{1}-studentcv-{2}{3}{4}{5}'>", SCHUtil.SUBJECT_STUDENTCV.ToLower(), _idContent, _personId, _scholarshipsYear, _semester, _scholarshipsId); _str.AppendFormat(" <td class='preloading' colspan='8' id='{0}-id-{1}{2}{3}{4}'></td>", StudentCVUI._idContent, _personId, _scholarshipsYear, _semester, _scholarshipsId); _str.AppendLine(" </tr>"); } } _row++; } } _str.AppendLine(" </tbody>"); _str.AppendLine(" </table>"); _str.AppendLine(" <div class='ui horizontal segments table-title'>"); _str.AppendLine(" <div class='ui segment left floated grey inverted'>"); _str.AppendFormat(" <div class='mini ui grey inverted button btnoption {0} button-overflow'>", (_recordCount.Equals(0) ? "disabled" : "")); _str.AppendLine(" <i class='save icon font-th regular white'></i>"); _str.AppendLine(" <span class='lang lang-th f10 font-th regular white'>บันทึก</span>"); _str.AppendFormat(" <div class='lang lang-th f11 font-th regular white'><a class='btnregister-option' href='javascript:void(0)' alt='{0}'>ทั้งหมด</a> | <a class='btnregister-option' href='javascript:void(0)' alt='{1}'>เฉพาะที่เลือก</a></div>", SCHUtil._selectOption[0].ToLower(), SCHUtil._selectOption[1].ToLower()); _str.AppendLine(" <span class='lang lang-en f10 font-en regular white'>Save</span>"); _str.AppendFormat(" <div class='lang lang-en f11 font-en regular white'><a class='btnregister-option' href='javascript:void(0)' alt='{0}'>All</a> | <a class='btnregister-option' href='javascript:void(0)' alt='{1}'>Selected</a></div>", SCHUtil._selectOption[0].ToLower(), SCHUtil._selectOption[1].ToLower()); _str.AppendLine(" </div>"); _str.AppendLine(" </div>"); _str.AppendLine(" <div class='ui segment right floated right aligned grey inverted recordcount'>"); _str.AppendFormat(" <span class='lang lang-th f10 font-th regular white'>พบ <span class='recordcountprimary-search'>{0}</span></span>", _recordCount); _str.AppendFormat(" <span class='lang lang-en f10 font-en regular white'>Found <span class='recordcountprimary-search'>{0}</span></span>", _recordCount); _str.AppendLine(" </div>"); _str.AppendLine(" </div>"); _str.AppendLine(" </div>"); return(_str); }