Ejemplo n.º 1
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง SYSUSER2
    /// </summary>
    /// <param name="dataInsert">Sysuser2 Object</param>
    /// <returns>Success</returns>
    public string insertSysuser2(Sysuser2 dataInsert)
    {
        string response = "";

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Insert into SYSUSER2 (IDCODE, IDISSUEPLACE, IDDATEISSUE, IDISSUEEXPIRE, LICENSEID, LICENSEISSUEPLACE, LICENSDATEISSUE, LICENSEISSUEEXPIRE, TELEPHONE, BANKNAME, BANKBRANCH, BANKACCOUNTNAME, BANKACCOUNTNUMBER, RELIGION_CODE, LECTURER_TYPE) values ('" + dataInsert.IdCode + "','" + dataInsert.IdIssuePlace + "','" + dataInsert.IdDateIssue + "','" + dataInsert.IdIssueExpire + "','" + dataInsert.LicenseId + "','" + dataInsert.LicenseIssuePlace + "','" + dataInsert.LicensDateIssue + "','" + dataInsert.LicenseIssueExpire + "','" + dataInsert.Telephone + "','" + dataInsert.BankName + "','" + dataInsert.BankBranch + "','" + dataInsert.BankAccountName + "','" + dataInsert.BankAccountNumber + "','" + dataInsert.ReligionCode + "','" + dataInsert.Lecturer_Type + "' )";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "insertSysuser2: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// แก้ไขข้อมูลจากตาราง SYSUSER2
    /// </summary>
    /// <param name="updateData">Sysuser2 Object</param>
    /// <returns>Success</returns>
    public string updateSysuser2(Sysuser2 updateData)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Update SYSUSER2 Set IDISSUEPLACE = '" + updateData.IdIssuePlace + "', IDDATEISSUE = '" + updateData.IdDateIssue + "', IDISSUEEXPIRE = '" + updateData.IdIssueExpire + "', LICENSEID = '" + updateData.LicenseId + "', LICENSEISSUEPLACE = '" + updateData.LicenseIssuePlace + "', LICENSDATEISSUE = '" + updateData.LicensDateIssue + "', LICENSEISSUEEXPIRE = '" + updateData.LicenseIssueExpire + "', TELEPHONE = '" + updateData.Telephone + "', BANKNAME = '" + updateData.BankName + "', BANKBRANCH = '" + updateData.BankBranch + "', BANKACCOUNTNAME = '" + updateData.BankAccountName + "', BANKACCOUNTNUMBER = '" + updateData.BankAccountNumber + "', RELIGION_CODE = '" + updateData.ReligionCode + "', LECTURER_TYPE = '" + updateData.Lecturer_Type + "' Where IDCODE = '" + updateData.IdCode + "'";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "updateSysuser2: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง SYSUSER2
    /// </summary>
    /// <param name="IdCode">บัตรประจำตัวประชาชน</param>
    /// <returns>ข้อมูลจากตาราง SYSUSER2</returns>
    ///
    public Sysuser2 getSysuser2(string IdCode)
    {
        Sysuser2 data = new Sysuser2();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = "Select * From SYSUSER2 Where IDCODE='" + IdCode + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            data.IdCode             = rowData["IDCODE"].ToString();
            data.IdIssuePlace       = rowData["IDISSUEPLACE"].ToString();
            data.IdDateIssue        = rowData["IDDATEISSUE"].ToString();
            data.IdIssueExpire      = rowData["IDISSUEEXPIRE"].ToString();
            data.LicenseId          = rowData["LICENSEID"].ToString();
            data.LicenseIssuePlace  = rowData["LICENSEISSUEPLACE"].ToString();
            data.LicensDateIssue    = rowData["LICENSDATEISSUE"].ToString();
            data.LicenseIssueExpire = rowData["LICENSEISSUEEXPIRE"].ToString();
            data.Telephone          = rowData["TELEPHONE"].ToString();
            data.BankName           = rowData["BANKNAME"].ToString();
            data.BankBranch         = rowData["BANKBRANCH"].ToString();
            data.BankAccountName    = rowData["BANKACCOUNTNAME"].ToString();
            data.BankAccountNumber  = rowData["BANKACCOUNTNUMBER"].ToString();
            data.ReligionCode       = rowData["RELIGION_CODE"].ToString();
            data.Lecturer_Type      = rowData["LECTURER_TYPE"].ToString();
        }

        return(data);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง SYSUSER2
    /// </summary>
    /// <param name="sql">SQL Command</param>
    /// <returns>ข้อมูลจากตาราง SYSUSER2</returns>
    public List <Sysuser2> getSysuser2Manual(string sql)
    {
        List <Sysuser2> data = new List <Sysuser2>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = sql;

        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            Sysuser2 row = new Sysuser2();

            row.IdCode             = rowData["IDCODE"].ToString();
            row.IdIssuePlace       = rowData["IDISSUEPLACE"].ToString();
            row.IdDateIssue        = rowData["IDDATEISSUE"].ToString();
            row.IdIssueExpire      = rowData["IDISSUEEXPIRE"].ToString();
            row.LicenseId          = rowData["LICENSEID"].ToString();
            row.LicenseIssuePlace  = rowData["LICENSEISSUEPLACE"].ToString();
            row.LicensDateIssue    = rowData["LICENSDATEISSUE"].ToString();
            row.LicenseIssueExpire = rowData["LICENSEISSUEEXPIRE"].ToString();
            row.Telephone          = rowData["TELEPHONE"].ToString();
            row.BankName           = rowData["BANKNAME"].ToString();
            row.BankBranch         = rowData["BANKBRANCH"].ToString();
            row.BankAccountName    = rowData["BANKACCOUNTNAME"].ToString();
            row.BankAccountNumber  = rowData["BANKACCOUNTNUMBER"].ToString();
            row.ReligionCode       = rowData["RELIGION_CODE"].ToString();
            row.Lecturer_Type      = rowData["LECTURER_TYPE"].ToString();
            data.Add(row);
        }

        return(data);
    }
Ejemplo n.º 5
0
    public LecturerTableData checkHourRefWeekEndDay(List <LecturerTableData> alllecturer_data, TeachingTableData teaching_data)
    {
        LecturerTableData response = new LecturerTableData();

        if (teaching_data.Teaching_Day == "6" || teaching_data.Teaching_Day == "7")
        {
            foreach (LecturerTableData lec in alllecturer_data)
            {
                SysUser user = new SysUser();
                user = new SysUser().getSysUser(lec.Lecturer);

                Sysuser2 user2 = new Sysuser2();
                user2 = new Sysuser2().getSysuser2(lec.Lecturer);

                if (user2.Lecturer_Type != "03")     // อาจารย์พิเศษ
                {
                    float totalHourRef   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).HourReference;
                    float currentHourRef = getInTimeHourRef(teaching_data.AcademicYear, teaching_data.Semester, lec.Lecturer);

                    if (currentHourRef < totalHourRef)
                    {
                        response = lec;
                        break;
                    }
                }
            }
        }


        return(response);
    }
Ejemplo n.º 6
0
    public float checkEditLecturerCredit2(string academic_year, string semester, string lecturer_code, float new_credit, SubCreditData old_subcredit)
    {
        float response = -1;


        SysUser user = new SysUser();

        user = new SysUser().getSysUser(lecturer_code);

        Sysuser2 user2 = new Sysuser2();

        user2 = new Sysuser2().getSysuser2(lecturer_code);

        float totalCredit   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).TotalCredit;
        float currentCredit = getTotalCreditforEdit(academic_year, semester, lecturer_code, old_subcredit);

        float new_currentCredit = currentCredit + new_credit;

        if (new_currentCredit <= totalCredit)
        {
            response = -1;
        }
        else
        {
            response = totalCredit - currentCredit;
        }

        return(response);
    }
Ejemplo n.º 7
0
    public LecturerTableData checkLecturerCredit(List <LecturerTableData> alllecturer_data)
    {
        LecturerTableData response = new LecturerTableData();

        foreach (LecturerTableData lec in alllecturer_data)
        {
            SysUser user = new SysUser();
            user = new SysUser().getSysUser(lec.Lecturer);

            Sysuser2 user2 = new Sysuser2();
            user2 = new Sysuser2().getSysuser2(lec.Lecturer);

            float totalCredit   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).TotalCredit;
            float currentCredit = getTotalCredit(lec.AcademicYear, lec.Semester, lec.Lecturer);

            if (currentCredit >= totalCredit)
            {
                response = lec;
                break;
            }
        }



        return(response);
    }
Ejemplo n.º 8
0
    public LecturerTableData checkHourRefNormalDay(List <LecturerTableData> alllecturer_data, TeachingTableData teaching_data)
    {
        LecturerTableData response = new LecturerTableData();

        if (teaching_data.Teaching_Day == "1" || teaching_data.Teaching_Day == "2" || teaching_data.Teaching_Day == "3" || teaching_data.Teaching_Day == "4" || teaching_data.Teaching_Day == "5")
        {
            int start_time = (int)Convert.ToDouble(teaching_data.Teaching_Start_Time.Replace(':', '.'));

            if (start_time >= 16)
            {
                foreach (LecturerTableData lec in alllecturer_data)
                {
                    SysUser user = new SysUser();
                    user = new SysUser().getSysUser(lec.Lecturer);

                    Sysuser2 user2 = new Sysuser2();
                    user2 = new Sysuser2().getSysuser2(lec.Lecturer);

                    if (user2.Lecturer_Type != "03")    // อาจารย์พิเศษ
                    {
                        float totalHourRef   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).HourReference;
                        float currentHourRef = getInTimeHourRef(teaching_data.AcademicYear, teaching_data.Semester, lec.Lecturer);

                        if (currentHourRef < totalHourRef)
                        {
                            response = lec;
                            break;
                        }
                    }
                }
            }
        }


        return(response);
    }
    private void createCreditTable2()
    {
        CourseData course_data = new Course().getCourse(available_data.Course_Code);

        tblSubCredit.Rows.Clear();

        // แบ่งโหลด
        string[] ar5 = { "ชื่ออาจารย์", "ภาระงานสอน ชั่วโมง/หน่วยกิต", "ชั่วโมงสอนอ้างอิง", "หน่วยกิตรวม", "แบ่งหน่วยกิต" };

        Table tb5 = new Table();

        tb5.Attributes.Add("class", "table table-bordered table-striped");
        tb5.Attributes.Add("id", "dt_basic5");
        TableHeaderRow tRowHead5 = new TableHeaderRow();

        tRowHead5.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar5.Length; cellCtr++)
        {
            // Create a new cell and add it to the row.
            TableHeaderCell cellHead5 = new TableHeaderCell();
            cellHead5.Text = ar5[cellCtr - 1];
            cellHead5.Attributes.Add("class", "text-align-center");
            tRowHead5.Cells.Add(cellHead5);
        }

        tb5.Rows.Add(tRowHead5);

        int i = 0;

        List <LecturerTableData> new_lecturertable = new List <LecturerTableData>();

        //List<LecturerTableData> tmp = new List<LecturerTableData>();
        new_lecturertable = lecturertable.OrderBy(o => o.Lecturer).ToList();

        //string lec_code = "";
        //foreach (LecturerTableData lect_data in tmp)
        //    {
        //    if (lect_data.Lecturer != lec_code)
        //        {
        //        new_lecturertable.Add(lect_data);
        //        }

        //    lec_code = lect_data.Lecturer;
        //    }



        foreach (LecturerTableData lect_data in new_lecturertable)
        {
            subcreditData = (List <SubCreditData>)Session["subCredit"];

            SysUser user1 = new SysUser();
            user1 = new SysUser().getSysUser(lect_data.Lecturer);
            Sysuser2 user2 = new Sysuser2();
            user2 = new Sysuser2().getSysuser2(lect_data.Lecturer);

            TableRow tRowBody5 = new TableRow();
            tRowBody5.TableSection = TableRowSection.TableBody;

            TableCell cellLecName = new TableCell();
            cellLecName.Text = lecturerObj.getLecturer(lect_data.Lecturer).First_ThaiName + " " + lecturerObj.getLecturer(lect_data.Lecturer).Family_ThaiName;
            tRowBody5.Cells.Add(cellLecName);

            WorkLoadConfigData workload = new WorkLoadConfigData();
            workload = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user1.Position);

            TableCell cellLoad = new TableCell();
            cellLoad.Text = workload.HourReference.ToString() + " / " + workload.TotalCredit.ToString();
            cellLoad.Attributes.Add("class", "text-align-center");
            tRowBody5.Cells.Add(cellLoad);

            TableCell cellHourRef = new TableCell();
            cellHourRef.Text = new WorkLoadCalculate().getHourRef(lect_data.AcademicYear, lect_data.Semester, lect_data.Lecturer).ToString();
            cellHourRef.Attributes.Add("class", "text-align-center");
            tRowBody5.Cells.Add(cellHourRef);

            TableCell cellTotalCredit = new TableCell();
            cellTotalCredit.Text = new WorkLoadCalculate().getTotalCredit(lect_data.AcademicYear, lect_data.Semester, lect_data.Lecturer).ToString();
            cellTotalCredit.Attributes.Add("class", "text-align-center");
            tRowBody5.Cells.Add(cellTotalCredit);


            int credit = course_data.Credit;

            if (lect_data.Course_Type == "1")
            {
                if (course_data.Practice != 0)
                {
                    credit = course_data.Theory;
                }
                else
                {
                    credit = course_data.Credit;
                }
            }
            else if (lect_data.Course_Type == "2")
            {
                if (course_data.Theory != 0)
                {
                    credit = course_data.Practice / 2;
                }
                else
                {
                    credit = course_data.Credit;
                }
            }


            TableCell cellSubCredit = new TableCell();
            txtSubCredit                 = new TextBox[new_lecturertable.Count];
            txtSubCredit[i]              = new TextBox();
            txtSubCredit[i].ID           = lect_data.Lecturer + lect_data.Teaching_Day + lect_data.Teaching_Start_Time.Replace(":", "").Replace(".", "") + lect_data.Teaching_End_Time.Replace(":", "").Replace(".", "");
            txtSubCredit[i].MaxLength    = 5;
            txtSubCredit[i].Width        = 50;
            txtSubCredit[i].AutoPostBack = true;

            txtSubCredit[i].Text = subcreditData[i].ToString();
            txtSubCredit[i].Attributes.Add("class", "text-align-center");
            txtSubCredit[i].TextChanged += new EventHandler(txtChanged);


            cellSubCredit.Attributes.Add("class", "text-align-center");
            cellSubCredit.Controls.Add(txtSubCredit[i]);
            tRowBody5.Cells.Add(cellSubCredit);

            tb5.Rows.Add(tRowBody5);

            i++;
        }

        TableRow  row5  = new TableRow();
        TableCell cell5 = new TableCell();

        cell5.Controls.Add(tb5);
        row5.Cells.Add(cell5);
        tblSubCredit.Rows.Add(row5);
    }
Ejemplo n.º 10
0
    private void printLecturerForm(string lectuere_id, HttpResponse Response)
    {
        SysUser  sysUserData  = new SysUser().getSysUser(code);
        Sysuser2 sysuserData2 = new Sysuser2().getSysuser2(code);

        string prefix               = new Prefix().getPrefix(sysUserData.TitleNameCode).Prefix_Thai;
        string thai_name            = sysUserData.ThName;
        string thai_surname         = sysUserData.ThSurName;
        string academic_position    = new AcademicPosition().getAcademicPosition(sysUserData.AcademicPositionCode).AcademicPositionThName;
        string nationality          = new Country().getCountry(sysUserData.Nationality).Country_ThaiName;
        string ethnicity            = new Country().getCountry(sysUserData.Ethnicity).Country_ThaiName;
        string religion             = new Religion().getReligion(sysuserData2.ReligionCode).Religion_ThaiName;
        string birth_day            = new TQF.TQFUtility().getThaiBirthDay(sysUserData.BirthDay);
        string nation_id            = sysUserData.IdCode;
        string issue_by             = sysuserData2.IdIssuePlace;
        string issue_date           = new TQF.TQFUtility().getThaiBirthDay(sysuserData2.IdDateIssue);
        string expire_date          = new TQF.TQFUtility().getThaiBirthDay(sysuserData2.IdIssueExpire);
        string license_id           = "";
        string license_issue_by     = "";
        string license_issue_date   = "";
        string license_expire_date  = "";
        string home_address         = sysUserData.HomeNumber;
        string home_moo             = sysUserData.HomeMoo;
        string home_vilage_building = sysUserData.HomeBuilding + " " + sysUserData.HomeVillage;
        string home_soi             = sysUserData.HomeSoi;
        string home_road            = sysUserData.HomeRoad;
        string home_tumbol          = new SubDistrict().getSUBDistrict(sysUserData.HomeTumbol).SubDistrict_ThaiName;
        string home_amphur          = new District().getDistrict(sysUserData.HomeAmphur).District_ThaiName;
        string home_provice         = new Province().getProvince(sysUserData.HomeProvince).Province_ThaiName;
        string home_phone           = sysuserData2.Telephone;
        string home_mobile          = sysUserData.MobileNumber;
        string work_address         = sysUserData.OfficeNumber + " " + sysUserData.OfficeName + sysUserData.OfficeMoo + " " + sysUserData.OfficeVillage + " " + sysUserData.OfficeBuilding + " " + sysUserData.OfficeSoi + " " + sysUserData.OfficeRoad + " " + new SubDistrict().getSUBDistrict(sysUserData.OfficeTumbol).SubDistrict_ThaiName + " " + new District().getDistrict(sysUserData.OfficeAmphur).District_ThaiName + " " + new TQF.Province().getProvince(sysUserData.OfficeProvince).ProvinceThai;
        string email = sysUserData.Email;

        List <QualificationDetail> qualificationDetail = new List <QualificationDetail>();
        string sql = "Select * From QUALIFICATIONDETAIL Where LECTIDENTITY='" + code + "' Order by YEAR";

        qualificationDetail = new QualificationDetail().getQualificationDetailManual(sql);

        List <LecturerSholarship> lecturerSholarship = new List <LecturerSholarship>();
        string sql2 = "Select * From LECTURERSHOLARSHIP Where LECTIDENTITY='" + code + "' Order by SCHOLARYEAR";

        lecturerSholarship = new LecturerSholarship().getLecturerSholarshipManual(sql2);


        if (sysuserData2.LicenseId.Length > 0)
        {
            license_id          = sysuserData2.LicenseId;
            license_issue_by    = sysuserData2.LicenseIssuePlace;
            license_issue_date  = new TQF.TQFUtility().getThaiBirthDay(sysuserData2.LicensDateIssue);
            license_expire_date = new TQF.TQFUtility().getThaiBirthDay(sysuserData2.LicenseIssueExpire);
        }


        pdfReport    objPdf       = new pdfReport();
        Document     doc          = new Document(PageSize.A4, 0, 0, 30, 0);
        MemoryStream memoryStream = new MemoryStream();
        PdfWriter    writer       = PdfWriter.GetInstance(doc, memoryStream);

        doc.Open();

        // =============== Page 1 ==========

        PdfPTable tableH = new PdfPTable(3);

        tableH.DefaultCell.Border = 0;
        tableH.DefaultCell.HorizontalAlignment = 1;
        float[] widthsHead = new float[] { 1f, 5f, 1f };
        tableH.SetWidths(widthsHead);

        iTextSharp.text.Image logo = iTextSharp.text.Image.GetInstance(System.Web.HttpContext.Current.Server.MapPath("../img/logo_lecturer_form.png"));
        logo.ScaleAbsolute(80f, 90f);
        PdfPCell cell_logo = new PdfPCell(logo);

        cell_logo.Border = 0;
        cell_logo.HorizontalAlignment = Element.ALIGN_LEFT;
        cell_logo.VerticalAlignment   = 1;
        cell_logo.Rowspan             = 3;

        iTextSharp.text.Image picturer = iTextSharp.text.Image.GetInstance(System.Web.HttpContext.Current.Server.MapPath("../img/pic-1inch.png"));
        picturer.ScaleAbsolute(80f, 90f);
        PdfPCell cell_picturer = new PdfPCell(picturer);

        cell_picturer.Border = 0;
        cell_picturer.HorizontalAlignment = Element.ALIGN_RIGHT;
        cell_picturer.VerticalAlignment   = 1;
        cell_picturer.Rowspan             = 3;

        tableH.AddCell(new PdfPCell(cell_logo));
        tableH.AddCell(new Phrase("แบบฟอร์มข้อมูลอาจารย์พิเศษ", objPdf.bold_font));
        tableH.AddCell(new PdfPCell(cell_picturer));

        tableH.AddCell(new Phrase("คณะสถาปัตยกรรมและการออกแบบ", objPdf.bold_font));
        tableH.AddCell(new Phrase("มหาวิทยาลัยเทคโนโลยีพระจอมเกล้าพระนครเหนือ", objPdf.bold_font));

        doc.Add(tableH);

        PdfPTable tableBlank = new PdfPTable(1);

        tableBlank.DefaultCell.Border = 0;
        tableBlank.AddCell(new Phrase(".", objPdf.white_font));
        doc.Add(tableBlank);

        PdfPTable tableProfile = new PdfPTable(2);

        tableProfile.DefaultCell.Border = 0;
        tableProfile.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        float[] widthsProfile = new float[] { 0.3f, 6.7f };
        tableProfile.SetWidths(widthsProfile);

        tableProfile.AddCell(new Phrase("1.", objPdf.small_font));
        tableProfile.AddCell(new Phrase("ชื่อ  " + prefix + thai_name + "          นามสกุล  " + thai_surname, objPdf.small_font));

        tableProfile.AddCell(new Phrase(".", objPdf.white_font));
        tableProfile.AddCell(new Phrase("ตำแหน่งทางวิชาการ  " + academic_position, objPdf.small_font));

        tableProfile.AddCell(new Phrase(".", objPdf.white_font));
        PdfPTable tb1 = new PdfPTable(3);

        tb1.DefaultCell.Border = 0;
        tb1.SetWidths(new float[] { 1, 1, 1 });
        tb1.AddCell(new Phrase("สัญชาติ  " + nationality, objPdf.small_font));
        tb1.AddCell(new Phrase("เชื้อชาติ  " + ethnicity, objPdf.small_font));
        tb1.AddCell(new Phrase("ศาสนา  " + religion, objPdf.small_font));
        tableProfile.AddCell(tb1);
        // tableProfile.AddCell(new Phrase("สัญชาติ  " + nationality + "          เชื้อชาติ  " + ethnicity + "          ศาสนา  " + religion, objPdf.small_font));

        tableProfile.AddCell(new Phrase("2.", objPdf.small_font));
        tableProfile.AddCell(new Phrase("เกิดวันที่  " + birth_day, objPdf.small_font));

        tableProfile.AddCell(new Phrase("3.", objPdf.small_font));
        tableProfile.AddCell(new Phrase("บัตรประจำตัวประชาชนเลขที่  " + nation_id, objPdf.small_font));

        tableProfile.AddCell(new Phrase(".", objPdf.white_font));
        PdfPTable tb2 = new PdfPTable(3);

        tb2.DefaultCell.Border = 0;
        tb2.SetWidths(new float[] { 1, 1, 1 });
        tb2.AddCell(new Phrase("ออกโดย  " + issue_by, objPdf.small_font));
        tb2.AddCell(new Phrase("วันที่ออกบัตร  " + issue_date, objPdf.small_font));
        tb2.AddCell(new Phrase("วันที่หมดอายุ  " + expire_date, objPdf.small_font));
        tableProfile.AddCell(tb2);
        //tableProfile.AddCell(new Phrase("ออกโดย  " + issue_by + "          วันที่ออกบัตร  " + issue_date + "          วันที่หมดอายุ  " + expire_date, objPdf.small_font));

        tableProfile.AddCell(new Phrase("4.", objPdf.small_font));
        tableProfile.AddCell(new Phrase("ใบอนุญาตประกอบวิชาชีพเลขที่ (ถ้ามี)  " + license_id, objPdf.small_font));

        tableProfile.AddCell(new Phrase(".", objPdf.white_font));
        PdfPTable tb3 = new PdfPTable(3);

        tb3.DefaultCell.Border = 0;
        tb3.SetWidths(new float[] { 1, 1, 1 });
        tb3.AddCell(new Phrase("ออกโดย  " + license_issue_by, objPdf.small_font));
        tb3.AddCell(new Phrase("วันที่ออกบัตร  " + license_issue_date, objPdf.small_font));
        tb3.AddCell(new Phrase("วันที่หมดอายุ  " + license_expire_date, objPdf.small_font));
        tableProfile.AddCell(tb3);
        //tableProfile.AddCell(new Phrase("ออกโดย  " + license_issue_by + "          วันที่ออกบัตร  " + license_issue_date + "          วันที่หมดอายุ  " + license_expire_date, objPdf.small_font));

        tableProfile.AddCell(new Phrase("5.", objPdf.small_font));
        tableProfile.AddCell(new Phrase("ที่อยู่ปัจจุบันบ้านเลขที่  " + home_address + "   หมู่ที่/หมู่บ้าน  " + home_moo + "   " + home_vilage_building + "   ซอย  " + home_soi, objPdf.small_font));

        tableProfile.AddCell(new Phrase(".", objPdf.white_font));
        PdfPTable tb4 = new PdfPTable(3);

        tb4.DefaultCell.Border = 0;
        tb4.SetWidths(new float[] { 1, 1, 1 });
        tb4.AddCell(new Phrase("ถนน  " + home_road, objPdf.small_font));
        tb4.AddCell(new Phrase("ตำบล/แขวง  " + home_tumbol, objPdf.small_font));
        tb4.AddCell(new Phrase("อำเภอ/เขต  " + home_amphur, objPdf.small_font));
        tableProfile.AddCell(tb4);
        //tableProfile.AddCell(new Phrase("ถนน  " + home_road + "          ตำบล/แขวง  " + home_tumbol + "          อำเภอ/เขต  " + home_amphur, objPdf.small_font));

        tableProfile.AddCell(new Phrase(".", objPdf.white_font));
        PdfPTable tb5 = new PdfPTable(3);

        tb5.DefaultCell.Border = 0;
        tb5.SetWidths(new float[] { 1, 1, 1 });
        tb5.AddCell(new Phrase("จังหวัด  " + home_provice, objPdf.small_font));
        tb5.AddCell(new Phrase("เบอร์โทรศัพท์  " + home_phone, objPdf.small_font));
        tb5.AddCell(new Phrase("มือถือ  " + home_mobile, objPdf.small_font));
        tableProfile.AddCell(tb5);
        //tableProfile.AddCell(new Phrase("จังหวัด  " + home_provice + "          เบอร์โทรศัพท์  " + home_phone + "          มือถือ  " + home_mobile, objPdf.small_font));

        tableProfile.AddCell(new Phrase(".", objPdf.white_font));
        tableProfile.AddCell(new Phrase("สถานที่ทำงาน  " + work_address, objPdf.small_font));

        tableProfile.AddCell(new Phrase("6.", objPdf.small_font));
        tableProfile.AddCell(new Phrase("E-mail address  " + email, objPdf.small_font));

        doc.Add(tableProfile);

        doc.Add(tableBlank);

        PdfPTable tablePreHis = new PdfPTable(2);

        tablePreHis.DefaultCell.Border = 0;
        tablePreHis.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreHis.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreHis = new float[] { 0.3f, 6.7f };
        tablePreHis.SetWidths(widthsPreHis);

        tablePreHis.AddCell(new Phrase("7.", objPdf.small_font));
        tablePreHis.AddCell(new Phrase("ประวัติการศึกษา (ระดับมัธยมศึกษาตอนปลาย ถึง อุดมศึกษา)", objPdf.small_font));
        doc.Add(tablePreHis);

        PdfPTable tableHis = new PdfPTable(5);

        tableHis.DefaultCell.Border = Rectangle.BOX;
        tableHis.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
        tableHis.DefaultCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
        tableHis.DefaultCell.PaddingBottom       = 5;
        float[] widthHis = new float[] { 1f, 2.2f, 1.3f, 2f, 0.5f };
        tableHis.SetWidths(widthHis);

        tableHis.AddCell(new Phrase("ปี พ.ศ.", objPdf.small_bold_font));
        tableHis.AddCell(new Phrase("ชื่อสถาบันที่ศึกษา", objPdf.small_bold_font));
        tableHis.AddCell(new Phrase("จังหวัด/ประเทศ", objPdf.small_bold_font));
        tableHis.AddCell(new Phrase("ชื่อประกาศนียบัตร/ปริญญา", objPdf.small_bold_font));
        tableHis.AddCell(new Phrase("G.P.A.", objPdf.small_bold_font));

        foreach (QualificationDetail item in qualificationDetail)
        {
            string province = "";
            if (item.Province_Code == "00")
            {
                province = item.Province_Other + Environment.NewLine + new Country().getCountry(item.Country_Code).Country_ThaiName;
            }
            else
            {
                province = new Province().getProvince(item.Province_Code).Province_ThaiName + Environment.NewLine + new Country().getCountry(item.Country_Code).Country_ThaiName;
            }

            tableHis.AddCell(new Phrase(item.Year, objPdf.small_font));
            tableHis.AddCell(new PdfPCell(new Phrase(item.Academy, objPdf.small_font))
            {
                HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE, PaddingBottom = 5
            });
            tableHis.AddCell(new Phrase(province, objPdf.small_font));
            tableHis.AddCell(new Phrase(item.QualificationDegree + Environment.NewLine + item.Division, objPdf.small_font));
            tableHis.AddCell(new Phrase(item.gpa, objPdf.small_font));
        }

        doc.Add(tableHis);

        doc.Add(tableBlank);

        PdfPTable tablePreScholar = new PdfPTable(2);

        tablePreScholar.DefaultCell.Border = 0;
        tablePreScholar.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreScholar.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreScholar = new float[] { 0.3f, 6.7f };
        tablePreScholar.SetWidths(widthsPreScholar);

        tablePreScholar.AddCell(new Phrase("8.", objPdf.small_font));
        tablePreScholar.AddCell(new Phrase("เคยได้รับทุนการศึกษา", objPdf.small_font));
        doc.Add(tablePreScholar);

        PdfPTable tableScholar = new PdfPTable(3);

        tableScholar.DefaultCell.Border = Rectangle.BOX;
        tableScholar.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
        tableScholar.DefaultCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
        tableScholar.DefaultCell.PaddingBottom       = 5;
        float[] widthScholar = new float[] { 1f, 3.5f, 2.5f };
        tableScholar.SetWidths(widthScholar);

        tableScholar.AddCell(new Phrase("ปี พ.ศ.", objPdf.small_bold_font));
        tableScholar.AddCell(new Phrase("ชื่อทุน", objPdf.small_bold_font));
        tableScholar.AddCell(new Phrase("วัตถุประสงค์/กิจกรรม", objPdf.small_bold_font));

        int row_sch = 3 - lecturerSholarship.Count;

        foreach (LecturerSholarship item in lecturerSholarship)
        {
            tableScholar.AddCell(new Phrase(item.ScholarYear, objPdf.small_font));
            tableScholar.AddCell(new PdfPCell(new Phrase(item.ScholarName, objPdf.small_font))
            {
                HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE, PaddingBottom = 5
            });
            tableScholar.AddCell(new PdfPCell(new Phrase(item.ScholarPurpose, objPdf.small_font))
            {
                HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE, PaddingBottom = 5
            });
        }

        for (int i = 0; i < row_sch; i++)
        {
            tableScholar.AddCell(new Phrase(" ", objPdf.small_font));
            tableScholar.AddCell(new Phrase(" ", objPdf.small_font));
            tableScholar.AddCell(new Phrase(" ", objPdf.small_font));
        }

        doc.Add(tableScholar);

        // =============== Page 2 ==========
        doc.NewPage();

        PdfPTable tablePreWork = new PdfPTable(2);

        tablePreWork.DefaultCell.Border = 0;
        tablePreWork.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreWork.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreWork = new float[] { 0.3f, 6.7f };
        tablePreWork.SetWidths(widthsPreWork);

        tablePreWork.AddCell(new Phrase("9.", objPdf.small_font));
        tablePreWork.AddCell(new Phrase("ประสบการณ์ทำงาน", objPdf.small_font));
        doc.Add(tablePreWork);

        PdfPTable tablePreWork1 = new PdfPTable(2);

        tablePreWork1.DefaultCell.Border = 0;
        tablePreWork1.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreWork1.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreWork1 = new float[] { 0.7f, 6.3f };
        tablePreWork1.SetWidths(widthsPreWork1);
        tablePreWork1.AddCell(new PdfPCell(new Phrase("9.1", objPdf.small_font))
        {
            HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
        });
        tablePreWork1.AddCell(new Phrase("ประสบการณ์ในการทำงานหรือการสอน", objPdf.small_font));
        doc.Add(tablePreWork1);

        PdfPTable tableWork = new PdfPTable(4);

        tableWork.DefaultCell.Border = Rectangle.BOX;
        tableWork.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
        tableWork.DefaultCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
        tableWork.DefaultCell.PaddingBottom       = 5;
        float[] widthWork = new float[] { 2.5f, 1.5f, 1.5f, 1.5f };
        tableWork.SetWidths(widthWork);

        tableWork.AddCell(new Phrase("บริษัท/ชื่อวิชาที่สอน", objPdf.small_bold_font));
        tableWork.AddCell(new Phrase("ลักษณะงาน (อ.ประจำ/อ.พิเศษ)", objPdf.small_bold_font));
        tableWork.AddCell(new Phrase("ปีที่เริ่ม - สิ้นสุด", objPdf.small_bold_font));
        tableWork.AddCell(new Phrase("สาเหตุที่ออก", objPdf.small_bold_font));

        List <LecturerExprience> exprience_data = new List <LecturerExprience>();
        string exprience_sql = "Select * From LECTUREREXPRIENCE Where LECTIDENTITY='" + code + "' Order by BEGINYEAR";

        exprience_data = new LecturerExprience().getLecturerExprienceManual(exprience_sql);
        int row_work = 3 - exprience_data.Count;

        foreach (LecturerExprience item in exprience_data)
        {
            tableWork.AddCell(new PdfPCell(new Phrase(item.SubjectName, objPdf.small_font))
            {
                HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE, PaddingBottom = 5
            });
            tableWork.AddCell(new PdfPCell(new Phrase(item.LecturerType, objPdf.small_font))
            {
                HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE, PaddingBottom = 5
            });
            tableWork.AddCell(new Phrase(item.BeginYear + " - " + item.EndYear, objPdf.small_font));
            tableWork.AddCell(new PdfPCell(new Phrase(item.QuitIssue, objPdf.small_font))
            {
                HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE, PaddingBottom = 5
            });
        }

        for (int i = 0; i < row_work; i++)
        {
            tableWork.AddCell(new Phrase(" ", objPdf.small_font));
            tableWork.AddCell(new Phrase(" ", objPdf.small_font));
            tableWork.AddCell(new Phrase(" ", objPdf.small_font));
            tableWork.AddCell(new Phrase(" ", objPdf.small_font));
        }

        doc.Add(tableWork);

        doc.Add(tableBlank);

        PdfPTable tablePreResearch = new PdfPTable(2);

        tablePreResearch.DefaultCell.Border = 0;
        tablePreResearch.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreResearch.DefaultCell.PaddingBottom       = 5;
        float[] widthsResearch = new float[] { 0.7f, 6.3f };
        tablePreResearch.SetWidths(widthsResearch);
        tablePreResearch.AddCell(new PdfPCell(new Phrase("9.2", objPdf.small_font))
        {
            HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
        });
        tablePreResearch.AddCell(new Phrase("ประสบการณ์ในการวิจัย/บทความวิชาการ/งานสร้างสรรค์", objPdf.small_font));
        doc.Add(tablePreResearch);

        PdfPTable tableResearch = new PdfPTable(4);

        tableResearch.DefaultCell.Border = Rectangle.BOX;
        tableResearch.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
        tableResearch.DefaultCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
        tableResearch.DefaultCell.PaddingBottom       = 5;
        float[] widthResearch = new float[] { 1f, 3f, 1.5f, 1.5f };
        tableResearch.SetWidths(widthResearch);

        tableResearch.AddCell(new Phrase("ปี พ.ศ.", objPdf.small_bold_font));
        tableResearch.AddCell(new Phrase("ชื่อผลงาน", objPdf.small_bold_font));
        tableResearch.AddCell(new Phrase("ประเภท", objPdf.small_bold_font));
        tableResearch.AddCell(new Phrase("ตีพิมพ์ในวารสาร", objPdf.small_bold_font));

        List <LecturerPublication> research_data = new List <LecturerPublication>();
        string research_sql = "Select * From LECTURERPUBLICATION Where LECTIDENTITY='" + code + "' Order by PUBLISHEDYEAR";

        research_data = new LecturerPublication().getLecturerPublicationManual(research_sql);

        int row_research = 3 - research_data.Count;

        foreach (LecturerPublication item in research_data)
        {
            tableResearch.AddCell(new Phrase(item.PublishedYear, objPdf.small_font));
            tableResearch.AddCell(new PdfPCell(new Phrase(item.PublicationName, objPdf.small_font))
            {
                HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE, PaddingBottom = 5
            });
            tableResearch.AddCell(new Phrase(item.PublicationType, objPdf.small_font));
            tableResearch.AddCell(new Phrase(item.Ppoceeding, objPdf.small_font));
        }

        for (int i = 0; i < row_research; i++)
        {
            tableResearch.AddCell(new Phrase(" ", objPdf.small_font));
            tableResearch.AddCell(new Phrase(" ", objPdf.small_font));
            tableResearch.AddCell(new Phrase(" ", objPdf.small_font));
            tableResearch.AddCell(new Phrase(" ", objPdf.small_font));
        }

        doc.Add(tableResearch);

        doc.Add(tableBlank);

        PdfPTable tablePreBook = new PdfPTable(2);

        tablePreBook.DefaultCell.Border = 0;
        tablePreBook.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreBook.DefaultCell.PaddingBottom       = 5;
        float[] widthsBook = new float[] { 0.7f, 6.3f };
        tablePreBook.SetWidths(widthsBook);
        tablePreBook.AddCell(new PdfPCell(new Phrase("9.3", objPdf.small_font))
        {
            HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
        });
        tablePreBook.AddCell(new Phrase("เอกสารตำรา/หนังสือ", objPdf.small_font));
        doc.Add(tablePreBook);

        PdfPTable tableBook = new PdfPTable(3);

        tableBook.DefaultCell.Border = Rectangle.BOX;
        tableBook.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
        tableBook.DefaultCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
        tableBook.DefaultCell.PaddingBottom       = 5;
        float[] widthBook = new float[] { 4f, 1.5f, 1.5f };
        tableBook.SetWidths(widthBook);

        tableBook.AddCell(new Phrase("ชื่อตำรา/หนังสือ", objPdf.small_bold_font));
        tableBook.AddCell(new Phrase("ปีที่ตีพิมพ์", objPdf.small_bold_font));
        tableBook.AddCell(new Phrase("สำนักพิมพ์", objPdf.small_bold_font));

        List <LecturerBook> book_data = new List <LecturerBook>();

        string sql_book = "Select * From LECTURERBOOK Where LECTIDENTITY='" + code + "' Order by PUBLISHEDYEAR";

        book_data = new LecturerBook().getLecturerBookManual(sql_book);

        int row_book = 3 - book_data.Count;

        foreach (LecturerBook item in book_data)
        {
            tableBook.AddCell(new PdfPCell(new Phrase(item.BookName, objPdf.small_font))
            {
                HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE, PaddingBottom = 5
            });
            tableBook.AddCell(new Phrase(item.PublishedYear, objPdf.small_font));
            tableBook.AddCell(new Phrase(item.Publisher, objPdf.small_font));
        }

        for (int i = 0; i < row_book; i++)
        {
            tableBook.AddCell(new Phrase(" ", objPdf.small_font));
            tableBook.AddCell(new Phrase(" ", objPdf.small_font));
            tableBook.AddCell(new Phrase(" ", objPdf.small_font));
        }

        doc.Add(tableBook);

        // =============== Page 3 ==========
        doc.NewPage();

        string bank_account_name = sysuserData2.BankAccountName;
        string bank_branch       = sysuserData2.BankBranch;
        string bank_account_num  = sysuserData2.BankAccountNumber;

        PdfPTable tablePreBankAcc = new PdfPTable(2);

        tablePreBankAcc.DefaultCell.Border = 0;
        tablePreBankAcc.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreBankAcc.DefaultCell.PaddingBottom       = 5;
        float[] widthsBankAcc = new float[] { 0.3f, 6.7f };
        tablePreBankAcc.SetWidths(widthsBankAcc);

        tablePreBankAcc.AddCell(new Phrase("10.", objPdf.small_font));
        tablePreBankAcc.AddCell(new Phrase("ข้าพเจ้ายินดีที่จะปฏิบัติตามแนวทางที่คณะสถาปัตยากรรมและการออกแบบกำหนดไว้ดังต่อไปนี้", objPdf.small_font));
        doc.Add(tablePreBankAcc);

        PdfPTable tablePreBankAcc1 = new PdfPTable(2);

        tablePreBankAcc1.DefaultCell.Border = 0;
        tablePreBankAcc1.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreBankAcc1.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreBankAcc1 = new float[] { 0.7f, 6.3f };
        tablePreBankAcc1.SetWidths(widthsPreBankAcc1);
        tablePreBankAcc1.AddCell(new PdfPCell(new Phrase("10.1)", objPdf.small_font))
        {
            HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
        });

        Phrase acc1 = new Phrase();

        acc1.Add(new Phrase("เปิดบัญชีธนาคารกรุงเทพ จำกัด (มหาชน) เพื่อรับค่าสอนโดยโอนเงินเข้า ชื่อบัญชี  ", objPdf.small_font));
        acc1.Add(new Phrase(bank_account_name, objPdf.small_bold_font));

        tablePreBankAcc1.AddCell(acc1);
        doc.Add(tablePreBankAcc1);

        PdfPTable tablePreBankAcc2 = new PdfPTable(2);

        tablePreBankAcc2.DefaultCell.Border = 0;
        tablePreBankAcc2.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreBankAcc2.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreBankAcc2 = new float[] { 1f, 1f };
        tablePreBankAcc2.SetWidths(widthsPreBankAcc2);

        Phrase acc2 = new Phrase();

        acc2.Add(new Phrase("สาขา  ", objPdf.small_font));
        acc2.Add(new Phrase(bank_branch, objPdf.small_bold_font));
        tablePreBankAcc2.AddCell(acc2);

        Phrase acc3 = new Phrase();

        acc3.Add(new Phrase("เลขที่บัญชี  ", objPdf.small_font));
        acc3.Add(new Phrase(bank_account_num, objPdf.small_bold_font));
        tablePreBankAcc2.AddCell(acc3);

        doc.Add(tablePreBankAcc2);

        PdfPTable tablePreBankAcc3 = new PdfPTable(2);

        tablePreBankAcc3.DefaultCell.Border = 0;
        tablePreBankAcc3.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreBankAcc3.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreBankAcc3 = new float[] { 0.7f, 6.3f };
        tablePreBankAcc3.SetWidths(widthsPreBankAcc3);
        tablePreBankAcc3.AddCell(new PdfPCell(new Phrase("10.2)", objPdf.small_font))
        {
            HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
        });

        tablePreBankAcc3.AddCell(new Phrase("จัดส่ง มคอ.3 และ มคอ.5 ตามวันและเวลาที่งานวิชาการกำหนด เพื่อเป็นไปตามกฎเกณฑ์มาตราฐานการประกัน", objPdf.small_font));

        doc.Add(tablePreBankAcc3);

        PdfPTable tablePreBankAcc3_1 = new PdfPTable(1);

        tablePreBankAcc3_1.DefaultCell.Border = 0;
        tablePreBankAcc3_1.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreBankAcc3_1.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreBankAcc3_1 = new float[] { 1f };
        tablePreBankAcc3_1.SetWidths(widthsPreBankAcc3_1);

        tablePreBankAcc3_1.AddCell(new Phrase("คุณภาพการศึกษาภายใน ตามที่สำนักงานคณะกรรมการการอุดมศึกษากำหนด", objPdf.small_font));

        doc.Add(tablePreBankAcc3_1);

        PdfPTable tablePreBankAcc4 = new PdfPTable(2);

        tablePreBankAcc4.DefaultCell.Border = 0;
        tablePreBankAcc4.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreBankAcc4.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreBankAcc4 = new float[] { 0.7f, 6.3f };
        tablePreBankAcc4.SetWidths(widthsPreBankAcc4);
        tablePreBankAcc4.AddCell(new PdfPCell(new Phrase("10.3)", objPdf.small_font))
        {
            HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
        });

        tablePreBankAcc4.AddCell(new Phrase("จัดส่งคะแนนสอบกลางภาคและปลายภาคได้ตามวันและเวลาที่งานวิชาการกำหนด", objPdf.small_font));

        doc.Add(tablePreBankAcc4);

        PdfPTable tablePreBankAcc5 = new PdfPTable(2);

        tablePreBankAcc5.DefaultCell.Border = 0;
        tablePreBankAcc5.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreBankAcc5.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreBankAcc5 = new float[] { 0.7f, 6.3f };
        tablePreBankAcc5.SetWidths(widthsPreBankAcc5);
        tablePreBankAcc5.AddCell(new PdfPCell(new Phrase("10.4)", objPdf.small_font))
        {
            HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
        });

        tablePreBankAcc5.AddCell(new Phrase("ร่วมเป็นคณะกรรมการคุมสอบในรายวิชาทฤษฎีและประลองทั้งกลางภาคและปลายภาค ในกรณีวิชาที่รับผิดชอบ", objPdf.small_font));

        doc.Add(tablePreBankAcc5);

        PdfPTable tablePreBankAcc5_1 = new PdfPTable(1);

        tablePreBankAcc5_1.DefaultCell.Border = 0;
        tablePreBankAcc5_1.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreBankAcc5_1.DefaultCell.PaddingBottom       = 5;
        float[] widthsPreBankAcc5_1 = new float[] { 1f };
        tablePreBankAcc5_1.SetWidths(widthsPreBankAcc5_1);

        tablePreBankAcc5_1.AddCell(new Phrase("มีการสอบ โดยงานวิชาการจะจัดให้คุมสอบตามวันเวลาที่ดำเนินการสอน ทั้งนี้สัปดาห์ที่สอบจะไม่มีการเรียนการสอน", objPdf.small_font));

        doc.Add(tablePreBankAcc5_1);

        doc.Add(tableBlank);

        PdfPTable tablePreAttach = new PdfPTable(2);

        tablePreAttach.DefaultCell.Border = 0;
        tablePreAttach.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tablePreAttach.DefaultCell.PaddingBottom       = 5;
        float[] widthsAttach = new float[] { 0.3f, 6.7f };
        tablePreAttach.SetWidths(widthsAttach);

        var  uncheck_box = new Chunk("o", objPdf.wingding_font16);
        char ch          = (char)254;
        var  check_box   = new Chunk(ch, objPdf.wingding_font16);

        tablePreAttach.AddCell(new Phrase("11.", objPdf.small_font));
        tablePreAttach.AddCell(new Phrase("ข้าพเจ้าได้แนบหลักฐาน/เอกสารที่เกี่ยวข้องดังรายการต่อไปนี้", objPdf.small_font));
        doc.Add(tablePreAttach);

        PdfPTable tableAttach1 = new PdfPTable(2);

        tableAttach1.DefaultCell.Border = 0;
        tableAttach1.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
        tableAttach1.DefaultCell.PaddingBottom       = 5;
        float[] widthsAttach1 = new float[] { 0.7f, 6.3f };
        tableAttach1.SetWidths(widthsAttach1);

        LecturerEvidence attach = new LecturerEvidence().getLecturerEvidence(sysUserData.IdCode);

        if (attach.Evidence1 == "Y")
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(check_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        else
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(uncheck_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        tableAttach1.AddCell(new Phrase("สำเนาใบปริญญาบัตร 1 ฉบับ (ของทุกระดับที่สำเร็จการศึกษา)", objPdf.small_font));

        if (attach.Evidence2 == "Y")
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(check_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        else
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(uncheck_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        tableAttach1.AddCell(new Phrase("สำเนา Transcript 1 ฉบับ (ของทุกระดับที่สำเร็จการศึกษา)", objPdf.small_font));

        if (attach.Evidence3 == "Y")
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(check_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        else
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(uncheck_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        tableAttach1.AddCell(new Phrase("รูปถ่ายหน้าตรง 1 นิ้ว ไม่สวมหมวก ไม่ใส่แว่นตาดำ ถ่ายมาแล้วไม่เกิน 1 ปี (ติดที่แบบฟอร์ม)", objPdf.small_font));

        if (attach.Evidence4 == "Y")
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(check_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        else
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(uncheck_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        tableAttach1.AddCell(new Phrase("สำเนาบัตรประจำตัวประชาชน หรือสำเนาบัตรประจำตัวข้าราชการ/พนักงานมหาวิทยาลัย 1 ฉบับ", objPdf.small_font));

        if (attach.Evidence5 == "Y")
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(check_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        else
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(uncheck_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        tableAttach1.AddCell(new Phrase("สำเนาทะเบียนบ้าน 1 ฉบับ", objPdf.small_font));

        if (attach.Evidence6 == "Y")
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(check_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        else
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(uncheck_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        tableAttach1.AddCell(new Phrase("สำเนาสมุดบัญชี (เฉพาะหน้าแรก) ธนาคารกรุงเทพ 1 ฉบับ", objPdf.small_font));

        if (attach.Evidence7 == "Y")
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(check_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        else
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(uncheck_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        tableAttach1.AddCell(new Phrase("สำเนาใบประกอบวิชาชีพ 1 ฉบับ (ถ้ามี)", objPdf.small_font));

        if (attach.Evidence8 == "Y")
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(check_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        else
        {
            tableAttach1.AddCell(new PdfPCell(new Phrase(uncheck_box))
            {
                HorizontalAlignment = Element.ALIGN_RIGHT, Border = 0, PaddingBottom = 5
            });
        }
        tableAttach1.AddCell(new Phrase("อื่น ๆ  (กรณีมีเอกสารเพิ่มเติมจากที่กล่าวมา โปรดระบุ)...........................................................................................", objPdf.small_font));

        doc.Add(tableAttach1);

        doc.Add(tableBlank);

        PdfPTable tableSign = new PdfPTable(1);

        tableSign.DefaultCell.Border = 0;
        tableSign.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
        tableSign.DefaultCell.PaddingBottom       = 5;
        float[] widthsSign = new float[] { 1f };
        tableSign.SetWidths(widthsSign);

        tableSign.AddCell(new Phrase("ขอรับรองว่าข้อความดังกล่าวข้างต้นเป็นความจริงทุกประการ", objPdf.small_font));

        tableSign.AddCell(new Phrase(".", objPdf.white_font));
        tableSign.AddCell(new Phrase(".", objPdf.white_font));

        tableSign.AddCell(new Phrase("ลงชื่อผู้สมัคร...........................................................................", objPdf.small_font));
        tableSign.AddCell(new Phrase("(.........................................................................)", objPdf.small_font));
        tableSign.AddCell(new Phrase("วันที่....................../........................./.........................", objPdf.small_font));

        doc.Add(tableSign);
        // =================================

        writer.CloseStream = false;
        doc.Close();
        memoryStream.Position = 0;

        string pdfFile = "";

        pdfFile = lectuere_id + "_" + DateTime.Now.ToString().Replace(" ", "_") + ".pdf";
        objPdf.ExportPDF(Response, memoryStream, pdfFile);
    }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department) || autro_obj.CheckGroupUser(login_data, group_var.lecturer))
            {
                // ======== Process ===========



                code = Request.QueryString["token"];

                SysUser  sysUserData  = new SysUser().getSysUser(code);
                Sysuser2 sysuserData2 = new Sysuser2().getSysuser2(code);

                //ข้อมูลทั่วไป
                lblNATIONAL_ID.Text = sysUserData.IdCode;
                //lblPASSPORT_ID.Text = sysUserData.PassportCode;
                lblTITLE_THAINAME.Text  = new Prefix().getPrefix(sysUserData.TitleNameCode).Prefix_Thai;
                lblTITLE_ENGNAME.Text   = new Prefix().getPrefix(sysUserData.TitleNameCode).Prefix_Eng;
                lblFIRST_THAINAME.Text  = sysUserData.ThName;
                lblFAMILY_THAINAME.Text = sysUserData.ThSurName;
                lblFIRST_ENGNAME.Text   = sysUserData.EnName;
                lblFAMILY_ENGNAME.Text  = sysUserData.EnSurName;
                lblSHORT_NAME.Text      = sysUserData.ShortName;
                if (sysUserData.GradLecturer == "0")
                {
                    lblGRAD_LECTURER.Text = "ไม่เป็นอาจารย์ระดับบัณฑิตศึกษา";
                }
                if (sysUserData.GradLecturer == "1")
                {
                    lblGRAD_LECTURER.Text = "เป็นอาจารย์ระดับบัณฑิตศึกษา";
                }
                if (sysUserData.Sex == "M")
                {
                    lblGENDER.Text = "ชาย";
                }
                if (sysUserData.Sex == "F")
                {
                    lblGENDER.Text = "หญิง";
                }
                lblACADEMIC_POSITION.Text = new AcademicPosition().getAcademicPosition(sysUserData.AcademicPositionCode).AcademicPositionThName;
                lblPOSITION.Text          = new BoardPos().getBoardPos(sysUserData.Position).Position_Thai;
                lblLECTURER_CAT.Text      = new LecturerType().getLecturerType(sysUserData.UserTypeCode).LecturerTypeName;
                lblLECTURER_Type.Text     = new LecturerType().getLecturerType2(sysuserData2.Lecturer_Type).LecturerTypeName;
                lblLEC_FACULTY.Text       = new Faculty().getFaculty(sysUserData.FacultyCode).Faculty_Thai;
                lblLEC_DEPARTMENT.Text    = new Department().getDepartment(sysUserData.DepartmentCode).Department_Thai;
                lblLEC_MAJOR.Text         = new TQF.Division().getDivision(sysUserData.DivisionCode).DivisionThName;
                lblAFFILIATION.Text       = sysUserData.Affiliation;

                bool authorized = false;

                if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                {
                    authorized = true;
                }
                else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                {
                    List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                    foreach (string dep in department_authorized)
                    {
                        if (dep == sysUserData.DepartmentCode)
                        {
                            authorized = true;
                            break;
                        }
                    }
                }
                else if (autro_obj.CheckGroupUser(login_data, group_var.lecturer))
                {
                    if (code == login_data.Nation_ID)
                    {
                        authorized = true;
                    }
                }

                if (authorized == true)
                {
                    //ข้อมูลส่วนตัว
                    if (sysUserData.BirthDay == "")
                    {
                        lblDATE_OF_BIRTH.Text = "";
                    }
                    else
                    {
                        lblDATE_OF_BIRTH.Text = new TQF.TQFUtility().getThaiBirthDay(sysUserData.BirthDay);
                    }
                    lblPROVINCE_BIRTH_TH.Text    = new TQF.Province().getProvince(sysUserData.BirthProvince).ProvinceThai;
                    lblPROVINCE_BIRTH_OTHER.Text = sysUserData.BirthPlace;
                    lblCOUNTRY.Text     = new Country().getCountry(sysUserData.Country).Country_ThaiName;
                    lblNATIONALITY.Text = new Country().getCountry(sysUserData.Nationality).Country_ThaiName;
                    lblETHNICITY.Text   = new Country().getCountry(sysUserData.Ethnicity).Country_ThaiName;
                    //lblRELIGION.Text = sysUserData.
                    //lblBLOOD.Text = sysUserData
                    lblHEIGHT.Text        = sysUserData.Height.ToString();
                    lblWEIGHT.Text        = sysUserData.Weight.ToString();
                    lblMARITAL.Text       = new Marital().getMarital(sysUserData.Marital).Marital_Thai;
                    lblOCCUPATION.Text    = new Occupation().getOccupation(sysUserData.Occupation).Occupation_Thai;
                    lblMOBILE_NUMBER.Text = sysUserData.MobileNumber;
                    lblEMAIL.Text         = sysUserData.Email;
                    lblTALENT.Text        = sysUserData.Talent;

                    //ข้อมูลที่อยู่
                    lblADDRESS.Text  = sysUserData.HomeNumber;
                    lblBUILDING.Text = sysUserData.HomeBuilding;
                    lblVILLAGE.Text  = sysUserData.HomeVillage;
                    lblMOO.Text      = sysUserData.HomeMoo;
                    lblSOI.Text      = sysUserData.HomeSoi;
                    lblROAD.Text     = sysUserData.HomeRoad;
                    lblTUMBOL.Text   = new SubDistrict().getSUBDistrict(sysUserData.HomeTumbol).SubDistrict_ThaiName;
                    lblAMPHUR.Text   = new District().getDistrict(sysUserData.HomeAmphur).District_ThaiName;
                    lblPROVINCE.Text = new TQF.Province().getProvince(sysUserData.HomeProvince).ProvinceThai;
                    lblPOSTCODE.Text = sysUserData.HomePostCode;

                    //ธนาคาร
                    lblBankName.Text          = new BankCode().getBankCode(sysuserData2.BankName).Bank_ThaiName;
                    lblBankBranch.Text        = sysuserData2.BankBranch;
                    lblBankAccountName.Text   = sysuserData2.BankAccountName;
                    lblBankAccountNumber.Text = sysuserData2.BankAccountNumber;
                }


                //ข้อมูลสถานที่ทำงาน
                lblOFFICE_NAME.Text     = sysUserData.OfficeName;
                lblOFFICE_ADDRESS.Text  = sysUserData.OfficeNumber;
                lblOFFICE_BUILDING.Text = sysUserData.OfficeBuilding;
                lblOFFICE_VILLAGE.Text  = sysUserData.OfficeVillage;
                lblOFFICE_MOO.Text      = sysUserData.OfficeMoo;
                lblOFFICE_SOI.Text      = sysUserData.OfficeSoi;
                lblOFFICE_ROAD.Text     = sysUserData.OfficeRoad;
                lblOFFICE_TUMBOL.Text   = new SubDistrict().getSUBDistrict(sysUserData.OfficeTumbol).SubDistrict_ThaiName;
                lblOFFICE_AMPHUR.Text   = new District().getDistrict(sysUserData.OfficeAmphur).District_ThaiName;
                lblOFFICE_PROVINCE.Text = new TQF.Province().getProvince(sysUserData.OfficeProvince).ProvinceThai;
                lblOFFICE_POSTCODE.Text = sysUserData.OfficePostCode;
                //=============================

                //คณะสถาปัตย์
                lblIdIssuePlace.Text       = sysuserData2.IdIssuePlace;
                lblIdDateIssue.Text        = sysuserData2.IdDateIssue;
                lblIdIssueExpire.Text      = sysuserData2.IdIssueExpire;
                lblLicenseId.Text          = sysuserData2.LicenseId;
                lblLicenseIssuePlace.Text  = sysuserData2.LicenseIssuePlace;
                lblLicensDateIssue.Text    = sysuserData2.LicensDateIssue;
                lblLicenseIssueExpire.Text = sysuserData2.LicenseIssueExpire;
                lblTelephone.Text          = sysuserData2.Telephone;
                //lblBankName.Text = new BankCode().getBankCode(sysuserData2.BankName).Bank_ThaiName;
                //lblBankBranch.Text = sysuserData2.BankBranch;
                //lblBankAccountName.Text = sysuserData2.BankAccountName;
                //lblBankAccountNumber.Text = sysuserData2.BankAccountNumber;
                lblRELIGION.Text = new Religion().getReligion(sysuserData2.ReligionCode).Religion_ThaiName;

                //ข้อมูลการศึกษา
                tblEducationHead();

                //ประวัติการรับทุน
                tblScholarshipHead();

                //ประสบการณ์ทำงาน
                tblExperienceHead();

                //ผลงานวิจัย/วิชาการ
                tblProceedingHead();

                //ตำรา
                tblBookHead();
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_department) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.lecturer))
            {
                /*=============================*/
                if (!Page.IsPostBack)
                {
                    config_data           = new SystemConfig().getConfig();
                    txtACADEMIC_YEAR.Text = config_data.AcademicYear;
                    academic_year         = config_data.AcademicYear;
                    ddlSEMESTER.Items.FindByValue(config_data.Semester).Selected = true;
                }
                academic_year = txtACADEMIC_YEAR.Text;

                // Head Table
                string[] ar  = { "ลำดับ", "ชื่ออาจารย์", "ตำแหน่ง", "ชั่วโมงสอนอ้างอิง", "หน่วยกิตรวม", "ภาระงานสอน ชั่วโมง/หน่วยกิต", "รายละเอียด" };
                Table    tb1 = new Table();
                tb1.Attributes.Add("class", "table table-bordered table-striped table-hover");
                tb1.Attributes.Add("id", "dt_basic");
                TableHeaderRow tRowHead = new TableHeaderRow();
                tRowHead.TableSection = TableRowSection.TableHeader;

                for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                {
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar[cellCtr - 1];
                    cellHead.Attributes.Add("class", "text-center");
                    tRowHead.Cells.Add(cellHead);
                }
                tb1.Rows.Add(tRowHead);


                List <SysUser> lecturerALL = new List <SysUser>();

                if (autro_obj.CheckGroupUser(login_data, group_var.lecturer))
                {
                    SysUser lecturer = new SysUser().getSysUser(login_data.Nation_ID);
                    lecturerALL.Add(lecturer);
                }
                else
                {
                    lecturerALL = new SysUser().getSysUser();
                }



                int num = 1;
                foreach (SysUser lec in lecturerALL)
                {
                    TableRow tRowBody = new TableRow();
                    tRowBody.TableSection = TableRowSection.TableBody;

                    TableCell cellNum = new TableCell();
                    cellNum.Attributes.Add("class", "text-center");
                    cellNum.Text = num.ToString();
                    tRowBody.Cells.Add(cellNum);

                    TableCell cellName = new TableCell();
                    cellName.Text = new AcademicPosition().getAcademicPosition(lec.AcademicPositionCode).AcademicPositionThName + " " + lec.ThName + " " + lec.ThSurName;
                    tRowBody.Cells.Add(cellName);

                    TableCell cellPosition = new TableCell();
                    cellPosition.Attributes.Add("class", "text-center");
                    cellPosition.Text = new BoardPos().getBoardPos(lec.Position).Position_Thai;
                    tRowBody.Cells.Add(cellPosition);

                    TableCell cellHourRef = new TableCell();
                    cellHourRef.Attributes.Add("class", "text-center");
                    cellHourRef.Text = new WorkLoadCalculate().getHourRef(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lec.IdCode).ToString();
                    tRowBody.Cells.Add(cellHourRef);

                    TableCell cellTotalCredit = new TableCell();
                    cellTotalCredit.Attributes.Add("class", "text-center");
                    cellTotalCredit.Text = new WorkLoadCalculate().getTotalCredit(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lec.IdCode).ToString();
                    tRowBody.Cells.Add(cellTotalCredit);

                    Sysuser2 user2 = new Sysuser2();
                    user2 = new Sysuser2().getSysuser2(lec.IdCode);
                    WorkLoadConfigData workload = new WorkLoadConfigData();
                    workload = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, lec.Position);

                    TableCell cellLoad = new TableCell();
                    cellLoad.Attributes.Add("class", "text-center");
                    cellLoad.Text = workload.HourReference.ToString() + " / " + workload.TotalCredit.ToString();
                    tRowBody.Cells.Add(cellLoad);

                    TableCell cellDetail = new TableCell();
                    cellDetail.Attributes.Add("class", "text-center");

                    if (autro_obj.CheckGroupUser(login_data, group_var.lecturer))
                    {
                        if (login_data.Nation_ID == lec.IdCode)
                        {
                            string    urlDetail = "detail_WorkLoad.aspx?lecturer=" + lec.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;
                            HyperLink hypDetail = new HyperLink();
                            hypDetail.Text        = "<h4><i class='fa fa-search'></i></h4>";
                            hypDetail.NavigateUrl = urlDetail;
                            hypDetail.ToolTip     = "Detail";
                            hypDetail.Target      = "_Blank";
                            cellDetail.Controls.Add(hypDetail);
                        }
                        else
                        {
                            string    urlDetail = "#";
                            HyperLink hypDetail = new HyperLink();
                            hypDetail.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                            hypDetail.NavigateUrl = urlDetail;
                            hypDetail.ToolTip     = "Detail";
                            hypDetail.Target      = "_Blank";
                            cellDetail.Controls.Add(hypDetail);
                        }
                    }
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    {
                        string    urlDetail = "detail_WorkLoad.aspx?lecturer=" + lec.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;
                        HyperLink hypDetail = new HyperLink();
                        hypDetail.Text        = "<h4><i class='fa fa-search'></i></h4>";
                        hypDetail.NavigateUrl = urlDetail;
                        hypDetail.ToolTip     = "Detail";
                        hypDetail.Target      = "_Blank";
                        cellDetail.Controls.Add(hypDetail);
                    }
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        bool          authorized            = false;
                        List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                        foreach (string dep in department_authorized)
                        {
                            if (dep == lec.DepartmentCode)
                            {
                                authorized = true;
                                break;
                            }
                        }

                        if (authorized == true)
                        {
                            string    urlDetail = "detail_WorkLoad.aspx?lecturer=" + lec.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;
                            HyperLink hypDetail = new HyperLink();
                            hypDetail.Text        = "<h4><i class='fa fa-search'></i></h4>";
                            hypDetail.NavigateUrl = urlDetail;
                            hypDetail.ToolTip     = "Detail";
                            hypDetail.Target      = "_Blank";
                            cellDetail.Controls.Add(hypDetail);
                        }
                        else
                        {
                            string    urlDetail = "#";
                            HyperLink hypDetail = new HyperLink();
                            hypDetail.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                            hypDetail.NavigateUrl = urlDetail;
                            hypDetail.ToolTip     = "Detail";
                            hypDetail.Target      = "_Blank";
                            cellDetail.Controls.Add(hypDetail);
                        }
                    }


                    tRowBody.Cells.Add(cellDetail);

                    tb1.Rows.Add(tRowBody);

                    num++;
                }

                TableRow  row  = new TableRow();
                TableCell cell = new TableCell();
                cell.Controls.Add(tb1);
                row.Cells.Add(cell);
                tblWorkLoad.Rows.Add(row);
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 13
0
    public LecturerTableData checkHourRefNormalDay2(List <LecturerTableData> alllecturer_data, TeachingTableData teaching_data, SubCreditData subcredit)
    {
        LecturerTableData response = new LecturerTableData();

        if (teaching_data.Teaching_Day == "1" || teaching_data.Teaching_Day == "2" || teaching_data.Teaching_Day == "3" || teaching_data.Teaching_Day == "4" || teaching_data.Teaching_Day == "5")
        {
            CourseData    course_data = new CourseData();
            HourReferData hour_data   = new HourReferData();

            int start_time = (int)Convert.ToDouble(teaching_data.Teaching_Start_Time.Replace(':', '.'));

            if (start_time >= 16)
            {
                foreach (LecturerTableData lec in alllecturer_data)
                {
                    float hour_ref = 0;

                    SysUser user = new SysUser();
                    user = new SysUser().getSysUser(lec.Lecturer);

                    Sysuser2 user2 = new Sysuser2();
                    user2 = new Sysuser2().getSysuser2(lec.Lecturer);

                    if (user2.Lecturer_Type != "03") // อาจารย์พิเศษ
                    {
                        course_data = new Course().getCourse(teaching_data.Course_Code);

                        if (course_data.Course_DegreeLevel == "01")// ปวช.
                        {
                            hour_data = new HourRefer().getHourRefer("U", teaching_data.Course_Type);
                            hour_ref  = hour_data.HourRefer * subcredit.SubCredit;
                        }
                        else if (course_data.Course_DegreeLevel == "02") //ป.ตรี
                        {
                            hour_data = new HourRefer().getHourRefer("B", teaching_data.Course_Type);
                            hour_ref  = hour_data.HourRefer * subcredit.SubCredit;
                        }
                        else
                        {     // บัณฑิต
                            hour_data = new HourRefer().getHourRefer("M", teaching_data.Course_Type);
                            hour_ref  = hour_data.HourRefer * subcredit.SubCredit;
                        }

                        float totalHourRef   = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user.Position).HourReference;
                        float currentHourRef = getHourRef(teaching_data.AcademicYear, teaching_data.Semester, lec.Lecturer);

                        currentHourRef -= hour_ref;

                        if (currentHourRef < totalHourRef)
                        {
                            response = lec;
                            break;
                        }
                    }
                }
            }
        }


        return(response);
    }
Ejemplo n.º 14
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        SysUser dataSysUser = new SysUser();

        dataSysUser.IdCode         = txtNATIONAL_ID.Text;
        dataSysUser.FacultyCode    = ddlFACULTY.SelectedValue;
        dataSysUser.TitleNameCode  = ddlTITLE_THAINAME.SelectedValue;
        dataSysUser.DepartmentCode = ddlDEPARTMENT.SelectedValue;
        dataSysUser.UserTypeCode   = ddlLECTURER_CAT.SelectedValue;
        dataSysUser.ThName         = txtTHNAME.Text;
        dataSysUser.EnName         = txtENNAME.Text;
        dataSysUser.ThSurName      = txtTHSURNAME.Text;
        dataSysUser.EnSurName      = txtENSURNAME.Text;
        dataSysUser.UserName       = "";
        dataSysUser.Password       = "";
        dataSysUser.Position       = ddlLectuerePosition.SelectedValue;
        dataSysUser.Address        = "";
        dataSysUser.Tel            = "";
        dataSysUser.Email          = txtEmail.Text;
        dataSysUser.OpenStatus     = "";
        dataSysUser.PassportCode   = txtPASSPORT_ID.Text;

        if (rBtnGENDER1.Checked == true)
        {
            dataSysUser.Sex = "M";
        }
        if (rBtnGENDER2.Checked == true)
        {
            dataSysUser.Sex = "F";
        }

        dataSysUser.AcademicPositionCode = ddlACADEMIC_POSITION.SelectedValue;
        dataSysUser.DivisionCode         = ddlDIVISION.SelectedValue;
        dataSysUser.BirthDay             = txtBirthday.Text;
        dataSysUser.BirthProvince        = ddlBirthProvince.SelectedValue;
        dataSysUser.BirthPlace           = txtBirthPlace.Text;
        dataSysUser.Country     = ddlCountry.SelectedValue;
        dataSysUser.Nationality = ddlNationality.SelectedValue;
        dataSysUser.Ethnicity   = ddlEthnicity.SelectedValue;
        if (txtHeight.Text == "")
        {
            dataSysUser.Height = 0.0f;
        }
        else
        {
            dataSysUser.Height = float.Parse(txtHeight.Text);
        }
        if (txtWeight.Text == "")
        {
            dataSysUser.Weight = 0.0f;
        }
        else
        {
            dataSysUser.Weight = float.Parse(txtWeight.Text);
        }
        dataSysUser.Marital        = ddlMarital.SelectedValue;
        dataSysUser.Occupation     = ddlOccupation.SelectedValue;
        dataSysUser.MobileNumber   = txtMobileNumber.Text;
        dataSysUser.Talent         = txtTalent.Text;
        dataSysUser.HomeNumber     = txtHomeNumber.Text;
        dataSysUser.HomeBuilding   = txtHomeBuilding.Text;
        dataSysUser.HomeVillage    = txtHomeVillage.Text;
        dataSysUser.HomeMoo        = txtHomeMoo.Text;
        dataSysUser.HomeSoi        = txtHomeSoi.Text;
        dataSysUser.HomeRoad       = txtHomeRoad.Text;
        dataSysUser.HomeTumbol     = ddlHomeTumbol.SelectedValue;
        dataSysUser.HomeAmphur     = ddlHomeAmphur.SelectedValue;
        dataSysUser.HomeProvince   = ddlHomeProvince.SelectedValue;
        dataSysUser.HomePostCode   = txtHomePostcode.Text;
        dataSysUser.OfficeName     = txtOfficeName.Text;
        dataSysUser.OfficeNumber   = txtOfficeNumber.Text;
        dataSysUser.OfficeBuilding = txtOfficeBuilding.Text;
        dataSysUser.OfficeVillage  = txtOfficeVillage.Text;
        dataSysUser.OfficeMoo      = txtOfficeMoo.Text;
        dataSysUser.OfficeSoi      = txtOfficeSoi.Text;
        dataSysUser.OfficeRoad     = txtOfficeRoad.Text;
        dataSysUser.OfficeTumbol   = ddlOfficeTumbol.SelectedValue;
        dataSysUser.OfficeAmphur   = ddlOfficeAmphur.SelectedValue;
        dataSysUser.OfficeProvince = ddlOfficeProvince.SelectedValue;
        dataSysUser.OfficePostCode = txtOfficePostcode.Text;
        dataSysUser.Affiliation    = txtAFFILIATION.Text;
        dataSysUser.GradLecturer   = ddlGRAD_LECTURER.SelectedValue;
        dataSysUser.ShortName      = txtSHORT_NAME.Text;

        ///
        Sysuser2 dataSysUser2 = new Sysuser2();

        dataSysUser2.IdCode             = txtNATIONAL_ID.Text;
        dataSysUser2.IdIssuePlace       = txtIdIsuePlace.Text;
        dataSysUser2.IdDateIssue        = txtDate_of_issue.Text;
        dataSysUser2.IdIssueExpire      = txtDate_of_expire.Text;
        dataSysUser2.LicenseId          = txtProfession.Text;
        dataSysUser2.LicenseIssuePlace  = txtProfessionIssuePlace.Text;
        dataSysUser2.LicensDateIssue    = txtDate_of_issue2.Text;
        dataSysUser2.LicenseIssueExpire = txtDate_of_expire2.Text;
        dataSysUser2.Telephone          = txtTelephone.Text;
        dataSysUser2.BankName           = ddlBank.SelectedValue;
        dataSysUser2.BankBranch         = txtBankBranch.Text;
        dataSysUser2.BankAccountName    = txtBankAccountName.Text;
        dataSysUser2.BankAccountNumber  = txtBankAccountNumber.Text;
        dataSysUser2.ReligionCode       = ddlReligion.SelectedValue;
        dataSysUser2.Lecturer_Type      = ddlLectuereType.SelectedValue;
        ///

        ///
        LecturerEvidence evidence = new LecturerEvidence();

        evidence.LectIdentity = txtNATIONAL_ID.Text;
        if (chkEvidence1.Checked)
        {
            evidence.Evidence1 = "Y";
        }
        else
        {
            evidence.Evidence1 = "N";
        }
        if (chkEvidence2.Checked)
        {
            evidence.Evidence2 = "Y";
        }
        else
        {
            evidence.Evidence2 = "N";
        }
        if (chkEvidence3.Checked)
        {
            evidence.Evidence3 = "Y";
        }
        else
        {
            evidence.Evidence3 = "N";
        }
        if (chkEvidence4.Checked)
        {
            evidence.Evidence4 = "Y";
        }
        else
        {
            evidence.Evidence4 = "N";
        }
        if (chkEvidence5.Checked)
        {
            evidence.Evidence5 = "Y";
        }
        else
        {
            evidence.Evidence5 = "N";
        }
        if (chkEvidence6.Checked)
        {
            evidence.Evidence6 = "Y";
        }
        else
        {
            evidence.Evidence6 = "N";
        }
        if (chkEvidence7.Checked)
        {
            evidence.Evidence7 = "Y";
        }
        else
        {
            evidence.Evidence7 = "N";
        }
        if (chkEvidence8.Checked)
        {
            evidence.Evidence8 = "Y";
        }
        else
        {
            evidence.Evidence8 = "N";
        }

        if (file_Attachment.HasFile)
        {
            string FileName;
            string Extension;
            string FolderPath;

            FileName   = Path.GetFileName(file_Attachment.PostedFile.FileName);
            Extension  = Path.GetExtension(file_Attachment.PostedFile.FileName);
            FolderPath = ConfigurationManager.AppSettings["LecturerEvidenceUploadFolder"];

            string newName = DateTime.Now.ToString("yyyyMMddHHmmss");
            FileName = newName + Extension;

            string FilePath = Server.MapPath(FolderPath + FileName);

            if (Extension == ".rar" || Extension == ".zip")
            {
                try
                {
                    file_Attachment.SaveAs(FilePath);
                    evidence.AttatchName = FileName;
                }
                catch
                {
                    Session["response"] = "ไฟล์ upload ขนาดต้องไม่เกิน 2 MB";
                    Response.Redirect("../err_response.aspx");
                }
            }
            else
            {
                Session["response"] = "ไฟล์ upload ต้องเป็นไฟล์นามสกุล .rar หรือ .zip เท่านั้น";
                Response.Redirect("../err_response.aspx");
            }
        }
        else
        {
            evidence.AttatchName = "";
        }

        new LecturerEvidence().insertLecturerEvidence(evidence);
        ///

        string insertSysUser  = new SysUser().insertSysUser(dataSysUser);
        string insertSysUser2 = new Sysuser2().insertSysuser2(dataSysUser2);

        if (insertSysUser == "Success" && insertSysUser2 == "Success")
        {
            //สร้าง session ไว้ใช้กับหน้า add_Qualification_Data, delete_Qualification, edit_Qualification
            Session["IdCode"] = dataSysUser.IdCode;
            Response.Redirect("add_Qualification_Data.aspx?token=" + dataSysUser.IdCode);
        }
        else
        {
            try
            {
                new LecturerExprience().deleteLecturerExprience(txtNATIONAL_ID.Text);
                new LecturerSholarship().deleteLecturerSholarship(txtNATIONAL_ID.Text);
                new LecturerPublication().deleteLecturerPublication(txtNATIONAL_ID.Text);
                new LecturerBook().deleteLecturerBook(txtNATIONAL_ID.Text);
                new LecturerEvidence().deleteLecturerEvidence(txtNATIONAL_ID.Text);
                new SysUser().deleteSysUser(txtNATIONAL_ID.Text);
                new Sysuser2().deleteSysuser2(txtNATIONAL_ID.Text);
            }
            catch {
                Session["response"] = "ข้อมูลผิดพลาด ไม่สามารถทำงานได้ในขณะนี้";
                Response.Redirect("../err_response.aspx");
            }

            //divError.Visible = true;
        }
    }
Ejemplo n.º 15
0
    protected void btnSEARCH_Click(object sender, EventArgs e)
    {
        SysUser lecturerALL = new SysUser();

        lecturerALL = new SysUser().getSysUser(txtLecturerID.Text);

        int num = 1;

        if (lecturerALL.IdCode != null)
        {
            divShow.Visible = true;
        }
        else
        {
            divShow.Visible = false;
        }


        // Head Table
        string[] ar  = { "ลำดับ", "ชื่ออาจารย์", "ตำแหน่ง", "ชั่วโมงสอนอ้างอิง", "หน่วยกิตรวม", "ภาระงานสอน ชั่วโมง/หน่วยกิต", "เพิ่ม", "แก้ไข", "ลบ" };
        Table    tb1 = new Table();

        tb1.Attributes.Add("class", "table table-bordered table-striped table-hover");
        tb1.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;

        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            TableHeaderCell cellHead = new TableHeaderCell();
            cellHead.Text = ar[cellCtr - 1];
            cellHead.Attributes.Add("class", "text-center");
            tRowHead.Cells.Add(cellHead);
        }
        tb1.Rows.Add(tRowHead);



        TableRow tRowBody = new TableRow();

        tRowBody.TableSection = TableRowSection.TableBody;

        TableCell cellNum = new TableCell();

        cellNum.Attributes.Add("class", "text-center");
        cellNum.Text = num.ToString();
        tRowBody.Cells.Add(cellNum);

        TableCell cellName = new TableCell();

        cellName.Text = new AcademicPosition().getAcademicPosition(lecturerALL.AcademicPositionCode).AcademicPositionThName + " " + lecturerALL.ThName + " " + lecturerALL.ThSurName;
        tRowBody.Cells.Add(cellName);

        TableCell cellPosition = new TableCell();

        cellPosition.Attributes.Add("class", "text-center");
        cellPosition.Text = new BoardPos().getBoardPos(lecturerALL.Position).Position_Thai;
        tRowBody.Cells.Add(cellPosition);

        TableCell cellHourRef = new TableCell();

        cellHourRef.Attributes.Add("class", "text-center");
        cellHourRef.Text = new WorkLoadCalculate().getHourRef(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).ToString();
        tRowBody.Cells.Add(cellHourRef);

        TableCell cellTotalCredit = new TableCell();

        cellTotalCredit.Attributes.Add("class", "text-center");
        cellTotalCredit.Text = new WorkLoadCalculate().getTotalCredit(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).ToString();
        tRowBody.Cells.Add(cellTotalCredit);

        Sysuser2 user2 = new Sysuser2();

        user2 = new Sysuser2().getSysuser2(lecturerALL.IdCode);
        WorkLoadConfigData workload = new WorkLoadConfigData();

        workload = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, lecturerALL.Position);

        TableCell cellLoad = new TableCell();

        cellLoad.Attributes.Add("class", "text-center");
        cellLoad.Text = workload.HourReference.ToString() + " / " + workload.TotalCredit.ToString();
        tRowBody.Cells.Add(cellLoad);

        string    urlAdd = "AddWorkLoad.aspx?lecturer=" + lecturerALL.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;
        HyperLink hypAdd = new HyperLink();

        hypAdd.Text = "<h4><i class='fa fa-book'></i></h4>";
        hypAdd.Attributes.Add("data-target", "#modal001");
        hypAdd.Attributes.Add("data-toggle", "modal");
        hypAdd.NavigateUrl = urlAdd;
        hypAdd.ToolTip     = "Add";
        hypAdd.Target      = "_Blank";

        TableCell cellAdd = new TableCell();

        cellAdd.Width = 100;
        cellAdd.Attributes.Add("class", "text-center");
        cellAdd.Controls.Add(hypAdd);
        tRowBody.Cells.Add(cellAdd);

        float add_ref    = new AddWorkLoad().getAddWorkLoad(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).HourRefer;
        float add_credit = new AddWorkLoad().getAddWorkLoad(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).HourRefer;

        string    urlUpdate = "#";
        string    urlDelete = "#";
        HyperLink hypUpdate = new HyperLink();
        HyperLink hypDelete = new HyperLink();

        if (add_credit + add_ref == 0)
        {
            hypUpdate.Text = "<h4><i class='fa fa-ban'></i></h4>";
            hypUpdate.Attributes.Add("data-target", "#modal001");
            hypUpdate.ToolTip = "Update";
            hypUpdate.Target  = "_Blank";

            hypDelete.Text    = "<h4><i class='fa fa-ban'></i></h4>";
            hypDelete.ToolTip = "Delete";
            hypDelete.Target  = "_Blank";
        }
        else
        {
            urlUpdate = "EditWorkLoad.aspx?lecturer=" + lecturerALL.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;

            urlDelete = "delAddWorkLoad.aspx?lecturer=" + lecturerALL.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue;

            hypUpdate.Text = "<h4><i class='fa fa-edit'></i></h4>";
            hypUpdate.Attributes.Add("data-target", "#modal001");
            hypUpdate.Attributes.Add("data-toggle", "modal");
            hypUpdate.NavigateUrl = urlUpdate;
            hypUpdate.ToolTip     = "Update";
            hypUpdate.Target      = "_Blank";

            hypDelete.Text = "<h4><i class='fa fa-trash-o'></i></h4>";
            hypDelete.Attributes.Add("data-target", "#modal001");
            hypDelete.Attributes.Add("data-toggle", "modal");
            hypDelete.NavigateUrl = urlDelete;
            hypDelete.ToolTip     = "Delete";
            hypDelete.Target      = "_Blank";
        }



        TableCell cellUpdate = new TableCell();

        cellUpdate.Width = 100;
        cellUpdate.Attributes.Add("class", "text-center");
        cellUpdate.Controls.Add(hypUpdate);
        tRowBody.Cells.Add(cellUpdate);

        TableCell cellDelete = new TableCell();

        cellDelete.Width = 100;
        cellDelete.Attributes.Add("class", "text-center");
        cellDelete.Controls.Add(hypDelete);
        tRowBody.Cells.Add(cellDelete);

        tb1.Rows.Add(tRowBody);

        num++;

        TableRow  row  = new TableRow();
        TableCell cell = new TableCell();

        cell.Controls.Add(tb1);
        row.Cells.Add(cell);
        tblWorkLoad.Rows.Add(row);
    }