示例#1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //lblDegree.Text = new TQF1().getTqf1Id();

        if (file_Attachment.HasFile)
        {
            FileName   = Path.GetFileName(file_Attachment.PostedFile.FileName);
            Extension  = Path.GetExtension(file_Attachment.PostedFile.FileName);
            FolderPath = ConfigurationManager.AppSettings["TQF1UploadFolder"];

            //หากต้องการเปลี่ยนชื่อไฟล์ที่ใช้ upload
            //string newName = new TQF1().getTqf1Id();
            //FileName = newName + Extension;

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

            if (Extension == ".pdf")
            {
                file_Attachment.SaveAs(FilePath);
            }
            else
            {
                Session["response"] = "add_TQF1: ไฟล์ upload ต้องเป็นไฟล์นามสกุล .pdf เท่านั้น";
                Response.Redirect("../err_response.aspx");
            }
        }

        TQF1   tqf1Data = new TQF1();
        string id       = new TQF.TQFUtility().getMaxID("NUMTQF1", "TQF1");

        tqf1Data.NumTQF1   = id;
        tqf1Data.Year      = txtACADEMIC_YEAR.Text;
        tqf1Data.LevelCode = ddlDegree.SelectedValue;
        tqf1Data.TQF1Major = txtMajor.Text;
        tqf1Data.FileName  = FileName;

        string resulte = new TQF1().insertTQF1(tqf1Data);

        if (resulte == "Success")
        {
            Response.Redirect("edit_TQF1.aspx?token=" + id);
        }
        else
        {
            Session["response"] = "add_TQF1: ไม่สามารถดำเนินการได้ในขณะนี้ (1)";
            Response.Redirect("../err_response.aspx");
        }
    }
示例#2
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง TQF2SEC4SUB1
    /// </summary>
    /// <param name="dataInsert">TQF2Sec4Sub1 Object</param>
    /// <returns>Success</returns>
    public string insertTQF2Sec4Sub1(TQF2Sec4Sub1 dataInsert)
    {
        string response = "";

        int    sleepTime  = 5000;
        string T2S4Sub1No = dataInsert.T2S4Sub1No;

        for (int i = 0; i < 10; i++)
        {
            if (getTQF2Sec4Sub1(T2S4Sub1No).T2S4Sub1No != null)
            {
                Thread.Sleep(sleepTime);
                T2S4Sub1No = new TQF.TQFUtility().getMaxID("T2S4SUB1NO", "TQF2SEC4SUB1");
                sleepTime += 5000;
            }
            else
            {
                dataInsert.T2S4Sub1No = T2S4Sub1No;
                break;
            }
        }

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

        string sql = "Insert into TQF2SEC4SUB1 (T2S4SUB1NO, CURRCODE, DOMAINTYPECODE, DETAILTYPE, DETAIL, YEARVERSION) values ('" + dataInsert.T2S4Sub1No + "','" + dataInsert.CurrCode + "','" + dataInsert.DomainTypeCode + "','" + dataInsert.DetailType + "','" + dataInsert.Detail + "','" + dataInsert.YearVersion + "')";

        oracleObj.InsertCommand = sql;

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

        return(response);
    }
示例#3
0
文件: TQF1.cs 项目: blkwarrior/myGIT
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง TQF1
    /// </summary>
    /// <param name="dataInsert"></param>
    /// <returns></returns>
    public string insertTQF1(TQF1 dataInsert)
    {
        string response = "";

        int    sleepTime = 5000;
        string NumTQF1   = dataInsert.NumTQF1;

        for (int i = 0; i < 10; i++)
        {
            if (getTQF1(NumTQF1).NumTQF1 != null)
            {
                Thread.Sleep(sleepTime);
                NumTQF1    = new TQF.TQFUtility().getMaxID("NUMTQF1", "TQF1");
                sleepTime += 5000;
            }
            else
            {
                dataInsert.NumTQF1 = NumTQF1;
                break;
            }
        }

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

        string sql = "Insert into TQF1 (NUMTQF1, YEAR, LEVELCODE, MAJORNAME, FILENAME) values ('" + dataInsert.NumTQF1 + "','" + dataInsert.Year + "','" + dataInsert.LevelCode + "','" + dataInsert.TQF1Major + "','" + dataInsert.FileName + "')";

        oracleObj.InsertCommand = sql;

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

        return(response);
    }
示例#4
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);
    }