protected void lbuEdit_Click(object sender, EventArgs e)
        {
            string link    = MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString());
            string encrypt = MyCrypto.GetEncryptedQueryString(link);

            Response.Redirect("editproject.aspx?id=" + encrypt);
        }
        private void FuncGVHistory()
        {
            OracleConnection.ClearAllPools();
            SqlDataSource sds = DatabaseManager.CreateSQLDataSource("SELECT R_ID รหัสคำร้องแก้ไขข้อมูล, (SELECT PS_FIRSTNAME || ' ' || PS_LASTNAME FROM PS_PERSON WHERE PS_PERSON.PS_CITIZEN_ID = TB_REQUEST.CITIZEN_ID) ชื่อ, (SELECT (SELECT CAMPUS_NAME FROM TB_CAMPUS WHERE PS_PERSON.PS_CAMPUS_ID = TB_CAMPUS.CAMPUS_ID) FROM PS_PERSON WHERE PS_PERSON.PS_CITIZEN_ID = TB_REQUEST.CITIZEN_ID) วิทยาเขต, (SELECT (SELECT STAFFTYPE_NAME FROM TB_STAFFTYPE WHERE PS_PERSON.PS_STAFFTYPE_ID = TB_STAFFTYPE.STAFFTYPE_ID) FROM PS_PERSON WHERE PS_PERSON.PS_CITIZEN_ID = TB_REQUEST.CITIZEN_ID) ประเภทบุคลากร, DATE_START วันที่ข้อมูล, (SELECT R_STATUS_NAME FROM TB_REQUEST_STATUS WHERE TB_REQUEST_STATUS.R_STATUS_ID = TB_REQUEST.R_STATUS_ID) สถานะ, NVL(R_ALLOW,0) ผลการอนุมัติ, DATE_END วันที่อนุมัติ FROM TB_REQUEST WHERE R_STATUS_ID IN(2,3,4,5) ORDER BY R_ID DESC");

            gvHistory.DataSource = sds;
            gvHistory.DataBind();

            if (gvHistory.Rows.Count > 0)
            {
                lbHistory.Visible = false;
                TableHeaderCell headerCell = new TableHeaderCell();
                headerCell.Text = "ดูข้อมูล";
                gvHistory.HeaderRow.Cells.Add(headerCell);

                for (int i = 0; i < gvHistory.Rows.Count; ++i)
                {
                    string     ID   = gvHistory.Rows[i].Cells[0].Text;
                    TableCell  cell = new TableCell();
                    LinkButton btn  = new LinkButton();
                    btn.CssClass = "ps-button-img";
                    btn.Text     = "<img src='Image/Small/search.png'></img>";
                    btn.Click   += (e2, e3) => {
                        Response.Redirect("ViewRequestForm.aspx?id=" + MyCrypto.GetEncryptedQueryString(ID).ToString());
                    };
                    cell.Controls.Add(btn);
                    gvHistory.Rows[i].Cells.Add(cell);

                    if (Util.StringEqual(gvHistory.Rows[i].Cells[6].Text, new string[] { "0" }))
                    {
                        gvHistory.Rows[i].Cells[6].Text      = "-";
                        gvHistory.Rows[i].Cells[6].ForeColor = System.Drawing.Color.Black;
                    }
                    if (Util.StringEqual(gvHistory.Rows[i].Cells[6].Text, new string[] { "2" }))
                    {
                        gvHistory.Rows[i].Cells[6].Text      = "ไม่อนุมัติ";
                        gvHistory.Rows[i].Cells[6].ForeColor = System.Drawing.Color.Red;
                    }
                    if (Util.StringEqual(gvHistory.Rows[i].Cells[6].Text, new string[] { "1" }))
                    {
                        gvHistory.Rows[i].Cells[6].Text      = "อนุมัติ";
                        gvHistory.Rows[i].Cells[6].ForeColor = System.Drawing.Color.Green;
                    }
                }

                Util.NormalizeGridViewDate(gvHistory, 4);
                Util.NormalizeGridViewDate(gvHistory, 7);
            }
            else
            {
                lbHistory.Visible = true;
            }
        }
Beispiel #3
0
        protected void OnDeletePosition(object sender, EventArgs e)
        {
            RepeaterItem item      = (sender as LinkButton).Parent as RepeaterItem;
            string       ValuePHID = (item.FindControl("HFPH_ID") as HiddenField).Value;

            if (ValuePHID != "")
            {
                string CheckNull = DatabaseManager.ExecuteString("SELECT COUNT(*) FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'");

                OracleConnection.ClearAllPools();
                using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
                {
                    con.Open();

                    if (CheckNull == "1")
                    {
                        using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_POSITION_ID = :PS_POSITION_ID WHERE PS_CITIZEN_ID = :PS_CITIZEN_ID", con))
                        {
                            com.Parameters.Add(new OracleParameter("PS_POSITION_ID", DBNull.Value));
                            com.Parameters.Add(new OracleParameter("PS_CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.ExecuteNonQuery();
                        }
                        using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_FIRST_POSITION_ID = :PS_FIRST_POSITION_ID WHERE PS_CITIZEN_ID = :PS_CITIZEN_ID", con))
                        {
                            com.Parameters.Add(new OracleParameter("PS_FIRST_POSITION_ID", DBNull.Value));
                            com.Parameters.Add(new OracleParameter("PS_CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.ExecuteNonQuery();
                        }
                    }
                    else
                    {
                        using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_POSITION_ID = (select P_ID from ( select P_ID, rownum as rn from ( select P_ID from PS_POSITION_HISTORY where CITIZEN_ID = :CITIZEN_ID order by GET_DATE desc )) where rn=2) WHERE PS_CITIZEN_ID = :PS_CITIZEN_ID", con))
                        {
                            com.Parameters.Add(new OracleParameter("CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.Parameters.Add(new OracleParameter("PS_CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.ExecuteNonQuery();
                        }
                        //using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_FIRST_POSITION_ID = (select P_ID from ( select P_ID, rownum as rn from ( select P_ID from PS_POSITION_HISTORY where CITIZEN_ID = :CITIZEN_ID order by GET_DATE desc )) where rn=2) WHERE PS_CITIZEN_ID = :PS_CITIZEN_ID", con))
                        using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_FIRST_POSITION_ID = (SELECT P_ID FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = :CITIZEN_ID AND GET_DATE = (SELECT MIN(GET_DATE) FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = :CITIZEN_ID)) WHERE PS_CITIZEN_ID = :PS_CITIZEN_ID", con))
                        {
                            com.Parameters.Add(new OracleParameter("CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.Parameters.Add(new OracleParameter("PS_CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.ExecuteNonQuery();
                        }
                    }

                    DatabaseManager.ExecuteNonQuery("DELETE PS_POSITION_HISTORY WHERE PH_ID = '" + ValuePHID + "'");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true);
                    BindPosition();
                }
            }
        }
        protected void lbuDelete_Click(object sender, EventArgs e)
        {
            List <int>    pro_id   = new List <int>();
            List <string> pdf_file = new List <string>();

            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT PRO_ID, PDF_FILE FROM TB_PROJECT WHERE PRO_ID = " + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())), con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            if (!reader.IsDBNull(1))
                            {
                                pro_id.Add(reader.GetInt32(0));
                                pdf_file.Add(reader.GetString(1));
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < pro_id.Count; i++)
            {
                string path     = "Upload/Project/PDF/" + pdf_file[i];
                int    PRO_ID   = pro_id[i];
                string PDF_FILE = pdf_file[i];

                string pathVS = Server.MapPath("Upload/Project/PDF/" + PDF_FILE);
                if ((System.IO.File.Exists(pathVS)))
                {
                    System.IO.File.Delete(pathVS);
                }

                DatabaseManager.ExecuteNonQuery("DELETE TB_PROJECT WHERE PRO_ID = '" + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "'");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true);
            }

            string link = MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString());

            DatabaseManager.ExecuteNonQuery("DELETE TB_PROJECT WHERE PRO_ID = '" + link + "'");
            Notsuccess.Visible = false;
            delete.Visible     = true;
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Notsuccess.Visible = true;
     delete.Visible     = false;
     if (!IsPostBack)
     {
         if (Request.QueryString["id"] != null)
         {
             int.TryParse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), out id);
             ReadSelectID();
         }
         else
         {
             Response.Redirect("listproject.aspx");
         }
     }
     ReadFile();
 }
Beispiel #6
0
        protected void btnUpdateSalary_Click(object sender, EventArgs e)
        {
            string   ValueSalary         = tbSalary.Text;
            string   ValuePositionSalary = tbPositionSalary.Text;
            string   ValueResult1        = tbResult1.Text;
            string   ValuePercentSalary1 = tbPercentSalary1.Text;
            string   ValueResult2        = tbResult2.Text;
            string   ValuePercentSalary2 = tbPercentSalary2.Text;
            DateTime ValueDate           = Util.ToDateTimeOracle(tbInsertDateSalary.Text);

            if (Session["DefaultIdSalary"] == null)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาเลือกรายการที่จะแก้ไขก่อน')", true);
                return;
            }

            if (ValueSalary != "")
            {
                OracleConnection.ClearAllPools();
                using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
                {
                    con.Open();
                    using (OracleCommand com = new OracleCommand("UPDATE PS_SALARY SET CITIZEN_ID = :CITIZEN_ID, SALARY = :SALARY, POSITION_SALARY = :POSITION_SALARY, RESULT1 = :RESULT1 ,PERCENT_SALARY1 = :PERCENT_SALARY1 ,RESULT2 = :RESULT2 ,PERCENT_SALARY2 = :PERCENT_SALARY2, DO_DATE = :DO_DATE WHERE SALARY_ID = :SALARY_ID", con))
                    {
                        com.Parameters.Add(new OracleParameter("CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                        com.Parameters.Add(new OracleParameter("SALARY", ValueSalary));
                        com.Parameters.Add(new OracleParameter("POSITION_SALARY", ValuePositionSalary));
                        com.Parameters.Add(new OracleParameter("RESULT1", ValueResult1));
                        com.Parameters.Add(new OracleParameter("PERCENT_SALARY1", ValuePercentSalary1));
                        com.Parameters.Add(new OracleParameter("RESULT2", ValueResult2));
                        com.Parameters.Add(new OracleParameter("PERCENT_SALARY2", ValuePercentSalary2));
                        com.Parameters.Add(new OracleParameter("DO_DATE", ValueDate));
                        com.Parameters.Add(new OracleParameter("SALARY_ID", Session["DefaultIdSalary"].ToString()));
                        com.ExecuteNonQuery();
                    }
                }

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
                BindSalary();
                ClearSalary();
                Session.Remove("DefaultIdSalary");
            }
        }
Beispiel #7
0
        protected void btnInsertSalary_Click(object sender, EventArgs e)
        {
            OracleConnection.ClearAllPools();
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("INSERT INTO PS_SALARY (CITIZEN_ID,SALARY,POSITION_SALARY,RESULT1,PERCENT_SALARY1,RESULT2,PERCENT_SALARY2,DO_DATE) VALUES (:CITIZEN_ID,:SALARY,:POSITION_SALARY,:RESULT1,:PERCENT_SALARY1,:RESULT2,:PERCENT_SALARY2,:DO_DATE)", con))
                {
                    com.Parameters.Add(new OracleParameter("CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                    com.Parameters.Add(new OracleParameter("SALARY", tbSalary.Text));
                    com.Parameters.Add(new OracleParameter("POSITION_SALARY", tbPositionSalary.Text));
                    com.Parameters.Add(new OracleParameter("RESULT1", tbResult1.Text));
                    com.Parameters.Add(new OracleParameter("PERCENT_SALARY1", tbPercentSalary1.Text));
                    com.Parameters.Add(new OracleParameter("RESULT2", tbResult2.Text));
                    com.Parameters.Add(new OracleParameter("PERCENT_SALARY2", tbPercentSalary2.Text));
                    com.Parameters.Add(new OracleParameter("DO_DATE", Util.ToDateTimeOracle(tbInsertDateSalary.Text)));
                    com.ExecuteNonQuery();
                }
            }

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            BindSalary();
            ClearSalary();
        }
        protected void ReadRequest()
        {
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT R_ID, CITIZEN_ID, R_STATUS_ID, DATE_START, DATE_END, (SELECT TITLE_NAME_TH FROM TB_TITLENAME WHERE TB_TITLENAME.TITLE_ID = TB_REQUEST.TITLE_ID) TITLE_NAME, FIRSTNAME, LASTNAME, (SELECT GENDER_NAME FROM TB_GENDER WHERE TB_GENDER.GENDER_ID = TB_REQUEST.GENDER_ID) GENDER_NAME, TO_CHAR(ADD_MONTHS(BIRTHDAY_DATE,6516),'DD MON YYYY') BIRTHDAY_DATE, EMAIL, (SELECT NATION_NAME_EN FROM TB_NATION WHERE TB_NATION.NATION_ID = TB_REQUEST.NATION_ID) NATION_NAME, (SELECT CAMPUS_NAME FROM TB_CAMPUS WHERE TB_CAMPUS.CAMPUS_ID = TB_REQUEST.CAMPUS_ID) CAMPUS_NAME, (SELECT FACULTY_NAME FROM TB_FACULTY WHERE TB_FACULTY.FACULTY_ID = TB_REQUEST.FACULTY_ID) FACULTY_NAME, (SELECT DIVISION_NAME FROM TB_DIVISION WHERE TB_DIVISION.DIVISION_ID = TB_REQUEST.DIVISION_ID) DIVISION_NAME, (SELECT WORK_NAME FROM TB_WORK_DIVISION WHERE TB_WORK_DIVISION.WORK_ID = TB_REQUEST.WORK_DIVISION_ID) WORK_DIVISION_NAME, (SELECT STAFFTYPE_NAME FROM TB_STAFFTYPE WHERE TB_STAFFTYPE.STAFFTYPE_ID = TB_REQUEST.STAFFTYPE_ID) STAFFTYPE_NAME, (SELECT TIME_CONTACT_NAME FROM TB_TIME_CONTACT WHERE TB_TIME_CONTACT.TIME_CONTACT_ID = TB_REQUEST.TIME_CONTACT_ID) TIME_CONTACT_NAME, (SELECT BUDGET_NAME FROM TB_BUDGET WHERE TB_BUDGET.BUDGET_ID = TB_REQUEST.BUDGET_ID) BUDGET_NAME, (SELECT SUBSTAFFTYPE_NAME FROM TB_SUBSTAFFTYPE WHERE TB_SUBSTAFFTYPE.SUBSTAFFTYPE_ID = TB_REQUEST.SUBSTAFFTYPE_ID) SUBSTAFFTYPE_NAME, (SELECT ADMIN_POSITION_NAME FROM TB_ADMIN_POSITION WHERE TB_ADMIN_POSITION.ADMIN_POSITION_ID = TB_REQUEST.ADMIN_POS_ID) ADMIN_POSITION_NAME, (SELECT POSITION_WORK_NAME FROM TB_POSITION_WORK WHERE TB_POSITION_WORK.POSITION_WORK_ID = TB_REQUEST.WORK_POS_ID) WORK_POS_NAME, TO_CHAR(ADD_MONTHS(INWORK_DATE,6516),'DD MON YYYY') INWORK_DATE, TO_CHAR(ADD_MONTHS(DATE_START_THIS_U,6516),'DD MON YYYY') DATE_START_THIS_U, SPECIAL_NAME, (SELECT ISCED_NAME FROM TB_ISCED WHERE TB_ISCED.ISCED_ID = TB_REQUEST.TEACH_ISCED_ID) TEACH_ISCED_NAME, (SELECT LEV_NAME_TH FROM TB_LEV WHERE TB_LEV.LEV_ID = TB_REQUEST.GRAD_LEV_ID) GRAD_LEV_NAME, GRAD_CURR, (SELECT ISCED_NAME FROM TB_ISCED WHERE TB_ISCED.ISCED_ID = TB_REQUEST.GRAD_ISCED_ID) GRAD_ISCED_NAME, (SELECT PROGRAM_NAME FROM TB_PROGRAM WHERE TB_PROGRAM.PROGRAM_ID_NEW = TB_REQUEST.GRAD_PROG_ID) GRAD_PROG_NAME, GRAD_UNIV, (SELECT NATION_NAME_EN FROM TB_NATION WHERE TB_NATION.NATION_ID = TB_REQUEST.GRAD_COUNTRY_ID) GRAD_COUNTRY_NAME, (SELECT DEFORM_NAME FROM TB_DEFORM WHERE TB_DEFORM.DEFORM_ID = TB_REQUEST.DEFORM_ID) DEFORM_NAME, (SELECT RELIGION_NAME FROM TB_RELIGION WHERE TB_RELIGION.RELIGION_ID = TB_REQUEST.RELIGION_ID) RELIGION_NAME, COMMENT_INFO, (SELECT R_STATUS_NAME FROM TB_REQUEST_STATUS WHERE TB_REQUEST_STATUS.R_STATUS_ID = TB_REQUEST.R_STATUS_ID) FROM TB_REQUEST WHERE R_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "' ORDER BY R_ID DESC", con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        int i = 1;
                        while (reader.Read())
                        {
                            Table tb1 = new Table();
                            div1.Controls.Add(tb1);

                            {
                                TableHeaderRow row = new TableHeaderRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableHeaderCell cell = new TableHeaderCell();
                                cell.ColumnSpan = 2;
                                cell.Text       = "วันที่อนุมัติ " + reader.GetDateTime(4).ToLongDateString() + " / ";
                                if (reader.GetValue(2).ToString() == "2" || reader.GetValue(2).ToString() == "3")
                                {
                                    cell.Text += "<span style=\"color: rgb(34, 177, 76);\">อนุมัติ</span>";
                                }
                                else if (reader.GetValue(2).ToString() == "4" || reader.GetValue(2).ToString() == "5")
                                {
                                    cell.Text += "<span style=\"color: rgb(237, 28, 36);\">ไม่อนุมัติ</span>";
                                }
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(0))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "รหัสคำร้องแก้ไขข้อมูล";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(0).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(5))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "คำนำหน้า";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(5).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(6))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ชื่อ";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(6).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(7))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "นามสกุล";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(7).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(8))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "เพศ";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(8).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(9))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "วันเกิด";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(9).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(10))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "อีเมล";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(10).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(11))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "สัญชาติ";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(11).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(12))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "วิทยาเขต";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(12).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(13))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "สำนัก/สถาบัน/คณะ";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(13).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(14))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "กอง/สำนักงานเลขา/ภาควิชา";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(14).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(15))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "งาน/ฝ่าย";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(15).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(16))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ประเภทบุคลากร";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(16).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(17))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ระยะเวลาจ้าง";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(17).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(18))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ประเภทเงินจ้าง";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(18).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(19))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ประเภทบุคลากรย่อย";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(19).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(20))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ตำแหน่งทางบริหาร";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(20).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(21))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ตำแหน่งในสายงาน";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(21).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(22))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "วันที่เข้าทำงานครั้งแรก";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(22).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(23))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "วันที่เข้าทำงาน ณ สถานที่ปัจจุบัน";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(23).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(24))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "สาขางานที่เชี่ยวชาญ";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(24).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(25))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "กลุ่มสาขาวิชาที่สอน(ISCED)";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(25).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(26))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ระดับการศึกษาที่จบสูงสุด";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(26).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(27))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "หลักสูตรที่จบการศึกษาสูงสุด";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(27).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(28))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "กลุ่มสาขาวิชาที่จบสูงสุด(ISCED)";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(28).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(29))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "สาขาวิชาที่จบสูงสุด";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(29).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(30))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ชื่อสถาบันที่จบการศึกษาสูงสุด";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(30).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(31))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ประเทศที่จบการศึกษาสูงสุด";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(31).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(32))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ความพิการ";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(32).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(33))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "ศาสนา";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(33).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(34))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "<strong>ความเห็น</strong>";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(34).ToString();
                                row.Cells.Add(cell);
                            }

                            if (!reader.IsDBNull(35))
                            {
                                TableRow row = new TableRow();
                                tb1.Controls.Add(row);
                                tb1.Rows.Add(row);

                                TableCell cell = new TableCell();
                                cell.Text = "<strong>ผลการอนุมัติ</strong>";
                                row.Cells.Add(cell);

                                cell      = new TableCell();
                                cell.Text = reader.GetValue(35).ToString();
                                row.Cells.Add(cell);
                            }
                        }
                    }
                }
            }
        }
Beispiel #9
0
        private void ReadFile()
        {
            List <int>    pro_id   = new List <int>();
            List <string> pdf_file = new List <string>();

            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT PRO_ID, PDF_FILE FROM TB_PROJECT WHERE PRO_ID = " + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())), con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            if (!reader.IsDBNull(1))
                            {
                                pro_id.Add(reader.GetInt32(0));
                                pdf_file.Add(reader.GetString(1));
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < pro_id.Count; i++)
            {
                string path     = "Upload/Project/PDF/" + pdf_file[i];
                int    PRO_ID   = pro_id[i];
                string PDF_FILE = pdf_file[i];

                Panel p = new Panel();
                p.Style.Add("display", "inline-block");

                LinkButton lb = new LinkButton();
                lb.Attributes["href"] = path;
                lb.Text = "ดูไฟล์แนบ (รูปภาพ,เอกสาร ประกอบการอบรม)";
                p.Controls.Add(lb);

                LinkButton lbDelete = new LinkButton();
                lbDelete.CssClass = "ps-button";
                lbDelete.Text     = "<img src='Image/Small/delete.png' class='icon_left' />ลบ";
                lbDelete.Click   += (e1, e2) =>
                {
                    lbDelete.Attributes.Add("onclick", "javascript:if(!confirm('คุณต้องการที่จะลบใช่หรือไม่'))return false;");
                    FileInfo FileIn = new FileInfo(Server.MapPath("Upload/Project/PDF/" + PDF_FILE));
                    if (FileIn.Exists)
                    {
                        FileIn.Delete();
                    }
                    DatabaseManager.ExecuteNonQuery("UPDATE TB_PROJECT SET PDF_FILE = (null) WHERE PRO_ID = " + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                    Page.Response.Redirect(Page.Request.Url.ToString(), true);
                };

                p.Controls.Add(lbDelete);
                file_pdf.Controls.Add(p);
            }
        }
Beispiel #10
0
        protected void btnUpdateProject_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                OracleConnection.ClearAllPools();
                using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
                {
                    con.Open();
                    using (OracleCommand com = new OracleCommand("SELECT PRO_ID FROM TB_PROJECT WHERE START_DATE BETWEEN " + Util.DatabaseToDateSearch(tbStartDate.Text) + " AND " + Util.DatabaseToDateSearch(tbEndDate.Text) + " AND CITIZEN_ID = '" + loginPerson.PS_CITIZEN_ID + "'", con))
                    {
                        using (OracleDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                if (!reader.IsDBNull(0))
                                {
                                    Project ProjectData = new Project();
                                    ProjectData.Load(reader.GetInt32(0));
                                    ChangeNotification("danger", "ไม่สามารถเพิ่มข้อมูลได้ พบวันซ้อนทับกัน (รหัสโครงการ " + ProjectData.PRO_ID + ", " + ProjectData.START_DATE.Value.ToLongDateString() + " ถึง " + ProjectData.END_DATE.Value.ToLongDateString() + ")");
                                    return;
                                }
                            }
                        }
                    }
                }

                /*string[] validFileTypes = { "pdf" };
                 * string ext = System.IO.Path.GetExtension(FUdocument.PostedFile.FileName);
                 * bool isValidFile = false;
                 *
                 * for (int i = 0; i < validFileTypes.Length; i++)
                 * {
                 *  if (ext == "." + validFileTypes[i])
                 *  {
                 *      isValidFile = true;
                 *      break;
                 *  }
                 * }
                 * if (!isValidFile)
                 * {
                 *  ScriptManager.GetCurrent(this.Page).SetFocus(this.FUdocument);
                 *  ChangeNotification("danger", "กรุณาแนบไฟล์นามสกุล " + string.Join(",", validFileTypes) + " เท่านั้น");
                 *  return;
                 * }
                 *
                 * else if (FUdocument.PostedFile.ContentLength > 26214400)
                 * {
                 *  ScriptManager.GetCurrent(this.Page).SetFocus(this.FUdocument);
                 *  ChangeNotification("danger", "กรุณาแนบไฟล์ไม่เกิน 25 MB");
                 *  return;
                 * }
                 * else
                 * {
                 *  ChangeNotification("", "");
                 * }*/

                if (tbStartDate.Text != "" && tbEndDate.Text != "")
                {
                    DateTime dtEndDate   = DateTime.Parse(tbEndDate.Text);
                    DateTime dtStartDate = DateTime.Parse(tbStartDate.Text);
                    int      totalDay    = (int)(dtEndDate - dtStartDate).TotalDays + 1;

                    if (totalDay <= 0)
                    {
                        notification.Attributes["class"] = "alert alert_danger";
                        notification.InnerHtml           = "";
                        notification.InnerHtml          += "<div> <img src='Image/Small/red_alert.png' /> วันที่เริ่มโครงการ - วันที่สิ้นสุดโครงการ : วันที่ไม่ถูกต้อง !</div>";
                        ScriptManager.GetCurrent(this.Page).SetFocus(this.tbStartDate);
                        return;
                    }
                    else
                    {
                        notification.Attributes["class"] = "none";
                        notification.InnerHtml           = "";
                    }
                }

                if (Util.ToDateTimeOracle(tbStartDate.Text) > DateTime.Now)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('วันที่ไม่สามารถมากกว่าวันปัจจุบัน')", true);
                    return;
                }
                if (Util.ToDateTimeOracle(tbEndDate.Text) > DateTime.Now)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('วันที่ไม่สามารถมากกว่าวันปัจจุบัน')", true);
                    return;
                }

                using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
                {
                    PersonnelSystem ps          = PersonnelSystem.GetPersonnelSystem(this);
                    Person          loginPerson = ps.LoginPerson;

                    con.Open();

                    string query = "Update TB_PROJECT Set";
                    query += " CATEGORY_ID = :CATEGORY_ID ,";
                    query += " COUNTRY_ID = :COUNTRY_ID ,";
                    query += " SUB_COUNTRY_ID = :SUB_COUNTRY_ID ,";
                    query += " PROJECT_NAME = :PROJECT_NAME ,";
                    query += " ADDRESS_PROJECT = :ADDRESS_PROJECT ,";
                    query += " START_DATE = :START_DATE ,";
                    query += " END_DATE = :END_DATE ,";
                    query += " EXPENSES = :EXPENSES ,";
                    query += " FUNDING = :FUNDING ,";
                    query += " CERTIFICATE = :CERTIFICATE ,";
                    query += " SUMMARIZE_PROJECT = :SUMMARIZE_PROJECT ,";
                    query += " RESULT_TEACHING = :RESULT_TEACHING ,";
                    query += " RESULT_ACADEMIC = :RESULT_ACADEMIC ,";
                    query += " DIFFICULTY_PROJECT = :DIFFICULTY_PROJECT ,";
                    query += " RESULT_PROJECT = :RESULT_PROJECT ,";
                    query += " RESULT_RESEARCHING = :RESULT_RESEARCHING ,";
                    query += " RESULT_OTHER = :RESULT_OTHER ,";
                    query += " COUNSEL = :COUNSEL ,";
                    query += " PDF_FILE = :PDF_FILE ";
                    query += " where PRO_ID = :PRO_ID ";

                    using (OracleCommand com = new OracleCommand(query, con))
                    {
                        com.Parameters.Add(new OracleParameter("CATEGORY_ID", Convert.ToInt32(ddlCategory.SelectedValue)));
                        com.Parameters.Add(new OracleParameter("COUNTRY_ID", Convert.ToInt32(ddlCountry.SelectedValue)));
                        com.Parameters.Add(new OracleParameter("SUB_COUNTRY_ID", Convert.ToInt32(ddlSubCountry.SelectedValue)));
                        com.Parameters.Add(new OracleParameter("PROJECT_NAME", tbProjectName.Text));
                        com.Parameters.Add(new OracleParameter("ADDRESS_PROJECT", tbAddressProject.Text));
                        com.Parameters.Add(new OracleParameter("START_DATE", DateTime.Parse(tbStartDate.Text)));
                        com.Parameters.Add(new OracleParameter("END_DATE", DateTime.Parse(tbEndDate.Text)));
                        com.Parameters.Add(new OracleParameter("EXPENSES", Convert.ToInt32(tbExpenses.Text)));
                        com.Parameters.Add(new OracleParameter("FUNDING", tbFunding.Text));
                        com.Parameters.Add(new OracleParameter("CERTIFICATE", tbCertificate.Text));
                        com.Parameters.Add(new OracleParameter("SUMMARIZE_PROJECT", tbSummarizeProject.Text));
                        com.Parameters.Add(new OracleParameter("RESULT_TEACHING", tbResultTeaching.Text));
                        com.Parameters.Add(new OracleParameter("RESULT_ACADEMIC", tbResultAcademic.Text));
                        com.Parameters.Add(new OracleParameter("DIFFICULTY_PROJECT", tbDifficultyProject.Text));
                        com.Parameters.Add(new OracleParameter("RESULT_PROJECT", tbResultProject.Text));
                        com.Parameters.Add(new OracleParameter("RESULT_RESEARCHING", tbResultResearching.Text));
                        com.Parameters.Add(new OracleParameter("RESULT_OTHER", tbResultOther.Text));
                        com.Parameters.Add(new OracleParameter("COUNSEL", tbCounsel.Text));
                        if (FUdocument.HasFile)
                        {
                            string   CountBase = DatabaseManager.ExecuteString("SELECT COUNT(*) FROM TB_PROJECT WHERE CITIZEN_ID = '" + loginPerson.PS_CITIZEN_ID + "'");
                            FileInfo fi        = new FileInfo(FUdocument.FileName);
                            string   imgFile   = "CID=" + loginPerson.PS_CITIZEN_ID + "&count=" + CountBase + fi.Extension;
                            FUdocument.SaveAs(Server.MapPath("Upload/Project/PDF/" + imgFile));
                            com.Parameters.Add(new OracleParameter("PDF_FILE", imgFile));
                        }
                        else
                        {
                            com.Parameters.Add(new OracleParameter("PDF_FILE", DBNull.Value));
                        }
                        com.Parameters.Add(new OracleParameter("PRO_ID", int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()))));
                        com.ExecuteNonQuery();
                    }
                }

                ChangeNotification("", "");
                Notsuccess.Visible = false;
                success.Visible    = true;
            }
        }
Beispiel #11
0
 private void ReadSelectID()
 {
     using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
     {
         con.Open();
         using (OracleCommand com = new OracleCommand("SELECT COUNTRY_ID, SUB_COUNTRY_ID, CATEGORY_ID, PROJECT_NAME, ADDRESS_PROJECT, START_DATE, END_DATE, EXPENSES, FUNDING, CERTIFICATE, SUMMARIZE_PROJECT, RESULT_TEACHING, RESULT_ACADEMIC, DIFFICULTY_PROJECT, RESULT_PROJECT, RESULT_RESEARCHING, RESULT_OTHER, COUNSEL FROM TB_PROJECT WHERE PRO_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
         {
             using (OracleDataReader reader = com.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     int i = 0;
                     ddlCountry.SelectedValue    = reader.IsDBNull(i) ? "" : reader.GetInt32(i).ToString(); ++i;
                     ddlSubCountry.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetInt32(i).ToString(); ++i;
                     ddlCategory.SelectedValue   = reader.IsDBNull(i) ? "" : reader.GetInt32(i).ToString(); ++i;
                     tbProjectName.Text          = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbAddressProject.Text       = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbStartDate.Text            = reader.IsDBNull(i) ? "" : reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                     tbEndDate.Text           = reader.IsDBNull(i) ? "" : reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                     tbExpenses.Text          = reader.IsDBNull(i) ? "" : reader.GetInt32(i).ToString(); ++i;
                     tbFunding.Text           = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbCertificate.Text       = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbSummarizeProject.Text  = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbResultTeaching.Text    = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbResultAcademic.Text    = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbDifficultyProject.Text = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbResultProject.Text     = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbResultResearching.Text = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbResultOther.Text       = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbCounsel.Text           = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                 }
             }
         }
     }
 }
Beispiel #12
0
        public int UPDATE_PERSON()
        {
            int id = 0;

            OracleConnection.ClearAllPools();
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_TITLE_ID=:PS_TITLE_ID, PS_FIRSTNAME=:PS_FIRSTNAME, PS_LASTNAME=:PS_LASTNAME, PS_GENDER_ID=:PS_GENDER_ID, PS_BIRTHDAY_DATE=:PS_BIRTHDAY_DATE, PS_EMAIL=:PS_EMAIL, PS_HOMEADD=:PS_HOMEADD, PS_MOO=:PS_MOO, PS_STREET=:PS_STREET, PS_PROVINCE_ID=:PS_PROVINCE_ID, PS_AMPHUR_ID=:PS_AMPHUR_ID, PS_DISTRICT_ID=:PS_DISTRICT_ID, PS_ZIPCODE=:PS_ZIPCODE, PS_TELEPHONE=:PS_TELEPHONE, PS_NATION_ID=:PS_NATION_ID, PS_CAMPUS_ID=:PS_CAMPUS_ID, PS_FACULTY_ID=:PS_FACULTY_ID, PS_DIVISION_ID=:PS_DIVISION_ID, PS_WORK_DIVISION_ID=:PS_WORK_DIVISION_ID, PS_STAFFTYPE_ID=:PS_STAFFTYPE_ID, PS_TIME_CONTACT_ID=:PS_TIME_CONTACT_ID, PS_BUDGET_ID=:PS_BUDGET_ID, PS_SUBSTAFFTYPE_ID=:PS_SUBSTAFFTYPE_ID, PS_ADMIN_POS_ID=:PS_ADMIN_POS_ID, PS_WORK_POS_ID=:PS_WORK_POS_ID, PS_INWORK_DATE=:PS_INWORK_DATE, PS_DATE_START_THIS_U=:PS_DATE_START_THIS_U, PS_SPECIAL_NAME=:PS_SPECIAL_NAME, PS_TEACH_ISCED_ID=:PS_TEACH_ISCED_ID, PS_GRAD_LEV_ID=:PS_GRAD_LEV_ID, PS_GRAD_CURR=:PS_GRAD_CURR, PS_GRAD_ISCED_ID=:PS_GRAD_ISCED_ID, PS_GRAD_PROG_ID=:PS_GRAD_PROG_ID, PS_GRAD_UNIV=:PS_GRAD_UNIV, PS_GRAD_COUNTRY_ID=:PS_GRAD_COUNTRY_ID, PS_DEFORM_ID=:PS_DEFORM_ID, PS_SIT_NO=:PS_SIT_NO, PS_RELIGION_ID=:PS_RELIGION_ID, PS_MOVEMENT_TYPE_ID=:PS_MOVEMENT_TYPE_ID, PS_MOVEMENT_DATE=:PS_MOVEMENT_DATE WHERE PS_CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
                {
                    com.Parameters.Add(new OracleParameter("PS_TITLE_ID", ddlTitleID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_FIRSTNAME", tbFirstName.Text));
                    com.Parameters.Add(new OracleParameter("PS_LASTNAME", tbLastName.Text));
                    com.Parameters.Add(new OracleParameter("PS_GENDER_ID", ddlGenderID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_BIRTHDAY_DATE", Util.ToDateTimeOracle(tbBirthdayDate.Text)));
                    com.Parameters.Add(new OracleParameter("PS_EMAIL", tbEmail.Text));
                    com.Parameters.Add(new OracleParameter("PS_HOMEADD", tbHomeAdd.Text));
                    com.Parameters.Add(new OracleParameter("PS_MOO", tbMoo.Text));
                    com.Parameters.Add(new OracleParameter("PS_STREET", tbStreet.Text));

                    if (ddlProvinceID.SelectedIndex == 0)
                    {
                        com.Parameters.Add(new OracleParameter("PS_PROVINCE_ID", DBNull.Value));
                    }
                    else
                    {
                        com.Parameters.Add(new OracleParameter("PS_PROVINCE_ID", ddlProvinceID.SelectedValue));
                    }

                    if (ddlAmphurID.SelectedIndex == 0)
                    {
                        com.Parameters.Add(new OracleParameter("PS_AMPHUR_ID", DBNull.Value));
                    }
                    else
                    {
                        com.Parameters.Add(new OracleParameter("PS_AMPHUR_ID", ddlAmphurID.SelectedValue));
                    }

                    if (ddlDistrictID.SelectedIndex == 0)
                    {
                        com.Parameters.Add(new OracleParameter("PS_DISTRICT_ID", DBNull.Value));
                    }
                    else
                    {
                        com.Parameters.Add(new OracleParameter("PS_DISTRICT_ID", ddlDistrictID.SelectedValue));
                    }

                    com.Parameters.Add(new OracleParameter("PS_ZIPCODE", tbZipcode.Text));
                    com.Parameters.Add(new OracleParameter("PS_TELEPHONE", tbTelephone.Text));
                    com.Parameters.Add(new OracleParameter("PS_NATION_ID", ddlNationID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_CAMPUS_ID", ddlCampusID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_FACULTY_ID", ddlFacultyID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_DIVISION_ID", ddlDivisionID.SelectedValue));
                    if (ddlWorkDivisionID.SelectedIndex == 0)
                    {
                        com.Parameters.Add(new OracleParameter("PS_WORK_DIVISION_ID", DBNull.Value));
                    }
                    else
                    {
                        com.Parameters.Add(new OracleParameter("PS_WORK_DIVISION_ID", ddlWorkDivisionID.SelectedValue));
                    }
                    com.Parameters.Add(new OracleParameter("PS_STAFFTYPE_ID", ddlStafftypeID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_TIME_CONTACT_ID", ddlTimeContactID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_BUDGET_ID", ddlBudgetID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_SUBSTAFFTYPE_ID", ddlSubStafftypeID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_ADMIN_POS_ID", ddlAdminPosID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_WORK_POS_ID", ddlWorkPosID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_INWORK_DATE", Util.ToDateTimeOracle(tbDateInwork.Text)));
                    com.Parameters.Add(new OracleParameter("PS_DATE_START_THIS_U", Util.ToDateTimeOracle(tbDateStartThisU.Text)));
                    com.Parameters.Add(new OracleParameter("PS_SPECIAL_NAME", tbSpecialName.Text));

                    if (ddlTeachIscedID.SelectedIndex == 0)
                    {
                        com.Parameters.Add(new OracleParameter("PS_TEACH_ISCED_ID", DBNull.Value));
                    }
                    else
                    {
                        com.Parameters.Add(new OracleParameter("PS_TEACH_ISCED_ID", ddlTeachIscedID.SelectedValue));
                    }

                    com.Parameters.Add(new OracleParameter("PS_GRAD_LEV_ID", ddlGradLevID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_GRAD_CURR", tbGradCurr.Text));

                    if (ddlGradIscedID.SelectedIndex == 0)
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_ISCED_ID", DBNull.Value));
                    }
                    else
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_ISCED_ID", ddlGradIscedID.SelectedValue));
                    }
                    if (ddlGradProgID.SelectedIndex == 0)
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_PROG_ID", DBNull.Value));
                    }
                    else
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_PROG_ID", ddlGradProgID.SelectedValue));
                    }

                    com.Parameters.Add(new OracleParameter("PS_GRAD_UNIV", tbGradUniv.Text));
                    com.Parameters.Add(new OracleParameter("PS_GRAD_COUNTRY_ID", ddlGradCountryID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_DEFORM_ID", ddlDeformID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_SIT_NO", tbSitNo.Text));
                    com.Parameters.Add(new OracleParameter("PS_RELIGION_ID", ddlReligionID.SelectedValue));
                    com.Parameters.Add(new OracleParameter("PS_MOVEMENT_TYPE_ID", ddlMovementTypeID.SelectedValue));
                    if (tbMovementDate.Text == "")
                    {
                        com.Parameters.Add(new OracleParameter("PS_MOVEMENT_DATE", DBNull.Value));
                    }
                    else
                    {
                        com.Parameters.Add(new OracleParameter("PS_MOVEMENT_DATE", Util.ToDateTimeOracle(tbMovementDate.Text)));
                    }
                    id = com.ExecuteNonQuery();
                }
            }
            return(id);
        }
Beispiel #13
0
        protected void ReadID()
        {
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT PS_CITIZEN_ID,PS_TITLE_ID,PS_FIRSTNAME,PS_LASTNAME,PS_GENDER_ID,PS_BIRTHDAY_DATE,PS_EMAIL,PS_HOMEADD,PS_MOO,PS_STREET,PS_DISTRICT_ID,PS_AMPHUR_ID,PS_PROVINCE_ID,PS_ZIPCODE,PS_TELEPHONE,PS_NATION_ID,PS_CAMPUS_ID,PS_FACULTY_ID,PS_DIVISION_ID,PS_WORK_DIVISION_ID,PS_STAFFTYPE_ID,PS_TIME_CONTACT_ID,PS_BUDGET_ID,PS_SUBSTAFFTYPE_ID,PS_ADMIN_POS_ID,PS_WORK_POS_ID,PS_INWORK_DATE,PS_DATE_START_THIS_U,PS_SPECIAL_NAME,PS_TEACH_ISCED_ID,PS_GRAD_LEV_ID,PS_GRAD_CURR,PS_GRAD_ISCED_ID,PS_GRAD_PROG_ID,PS_GRAD_UNIV,PS_GRAD_COUNTRY_ID,PS_DEFORM_ID,PS_SIT_NO,PS_RELIGION_ID,PS_MOVEMENT_TYPE_ID,PS_MOVEMENT_DATE FROM PS_PERSON WHERE PS_CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            int i = 0;
                            tbCitizenID.Text          = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlTitleID.SelectedValue  = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbFirstName.Text          = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbLastName.Text           = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlGenderID.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbBirthdayDate.Text       = reader.IsDBNull(i) ? "" : reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                            tbEmail.Text   = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbHomeAdd.Text = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbMoo.Text     = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbStreet.Text  = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;

                            //--
                            ddlProvinceID.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlAmphurID.Items.Clear();
                            string s1 = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            DatabaseManager.BindDropDown(ddlAmphurID, "SELECT * FROM TB_AMPHUR WHERE PROVINCE_ID = '" + ddlProvinceID.SelectedValue + "'", "AMPHUR_TH", "AMPHUR_ID", "--กรุณาเลือก--");
                            ddlAmphurID.SelectedValue = s1;
                            //
                            ddlDistrictID.Items.Clear();
                            string s2 = reader.IsDBNull(i) ? "0" : reader.GetValue(i).ToString(); ++i;
                            DatabaseManager.BindDropDown(ddlDistrictID, "SELECT * FROM TB_DISTRICT WHERE AMPHUR_ID = '" + ddlAmphurID.SelectedValue + "'", "DISTRICT_TH", "DISTRICT_ID", "--กรุณาเลือก--");
                            ddlDistrictID.SelectedValue = s2;
                            //
                            tbZipcode.Text            = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbTelephone.Text          = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlNationID.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            //--

                            ddlCampusID.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;

                            ddlFacultyID.Items.Clear();
                            string z1 = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            DatabaseManager.BindDropDown(ddlFacultyID, "SELECT * FROM TB_FACULTY WHERE CAMPUS_ID = '" + ddlCampusID.SelectedValue + "'", "FACULTY_NAME", "FACULTY_ID", "--กรุณาเลือก--");
                            ddlFacultyID.SelectedValue = z1;
                            //
                            ddlDivisionID.Items.Clear();
                            string z2 = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            DatabaseManager.BindDropDown(ddlDivisionID, "SELECT * FROM TB_DIVISION WHERE FACULTY_ID = '" + ddlFacultyID.SelectedValue + "'", "DIVISION_NAME", "DIVISION_ID", "--กรุณาเลือก--");
                            ddlDivisionID.SelectedValue = z2;
                            //
                            ddlWorkDivisionID.Items.Clear();
                            string z3 = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            DatabaseManager.BindDropDown(ddlWorkDivisionID, "SELECT * FROM TB_WORK_DIVISION WHERE DIVISION_ID = '" + ddlDivisionID.SelectedValue + "'", "WORK_NAME", "WORK_ID", "--กรุณาเลือก--");
                            ddlWorkDivisionID.SelectedValue = z3;
                            //--

                            ddlStafftypeID.SelectedValue    = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlTimeContactID.SelectedValue  = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlBudgetID.SelectedValue       = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlSubStafftypeID.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlAdminPosID.SelectedValue     = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlWorkPosID.SelectedValue      = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbDateInwork.Text             = reader.IsDBNull(i) ? "" : reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                            tbDateStartThisU.Text         = reader.IsDBNull(i) ? "" : reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                            tbSpecialName.Text            = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlTeachIscedID.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlGradLevID.SelectedValue    = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbGradCurr.Text = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlGradIscedID.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlGradProgID.SelectedValue  = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbGradUniv.Text = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlGradCountryID.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlDeformID.SelectedValue      = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbSitNo.Text = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlReligionID.SelectedValue     = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            ddlMovementTypeID.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                            tbMovementDate.Text             = reader.IsDBNull(i) ? "" : reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                        }
                    }
                }
            }
        }
        protected void ReadID()
        {
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT TITLE_ID, FIRSTNAME, LASTNAME, GENDER_ID, BIRTHDAY_DATE, EMAIL, NATION_ID, CAMPUS_ID, FACULTY_ID, DIVISION_ID, WORK_DIVISION_ID, STAFFTYPE_ID, TIME_CONTACT_ID, BUDGET_ID, SUBSTAFFTYPE_ID, ADMIN_POS_ID, WORK_POS_ID, INWORK_DATE, DATE_START_THIS_U, SPECIAL_NAME, TEACH_ISCED_ID, GRAD_LEV_ID, GRAD_CURR, GRAD_ISCED_ID, GRAD_PROG_ID, GRAD_UNIV, GRAD_COUNTRY_ID, DEFORM_ID, RELIGION_ID, (SELECT TITLE_NAME_TH FROM TB_TITLENAME WHERE TB_TITLENAME.TITLE_ID = TB_REQUEST.TITLE_ID) TITLE_NAME, (SELECT GENDER_NAME FROM TB_GENDER WHERE TB_GENDER.GENDER_ID = TB_REQUEST.GENDER_ID) GENDER_NAME, (SELECT NATION_NAME_EN FROM TB_NATION WHERE TB_NATION.NATION_ID = TB_REQUEST.NATION_ID) NATION_NAME, (SELECT CAMPUS_NAME FROM TB_CAMPUS WHERE TB_CAMPUS.CAMPUS_ID = TB_REQUEST.CAMPUS_ID) CAMPUS_NAME, (SELECT FACULTY_NAME FROM TB_FACULTY WHERE TB_FACULTY.FACULTY_ID = TB_REQUEST.FACULTY_ID) FACULTY_NAME, (SELECT DIVISION_NAME FROM TB_DIVISION WHERE TB_DIVISION.DIVISION_ID = TB_REQUEST.DIVISION_ID) DIVISION_NAME, (SELECT WORK_NAME FROM TB_WORK_DIVISION WHERE TB_WORK_DIVISION.WORK_ID = TB_REQUEST.WORK_DIVISION_ID) WORK_DIVISION_NAME, (SELECT STAFFTYPE_NAME FROM TB_STAFFTYPE WHERE TB_STAFFTYPE.STAFFTYPE_ID = TB_REQUEST.STAFFTYPE_ID) STAFFTYPE_NAME, (SELECT TIME_CONTACT_NAME FROM TB_TIME_CONTACT WHERE TB_TIME_CONTACT.TIME_CONTACT_ID = TB_REQUEST.TIME_CONTACT_ID) TIME_CONTACT_NAME, (SELECT BUDGET_NAME FROM TB_BUDGET WHERE TB_BUDGET.BUDGET_ID = TB_REQUEST.BUDGET_ID) BUDGET_NAME, (SELECT SUBSTAFFTYPE_NAME FROM TB_SUBSTAFFTYPE WHERE TB_SUBSTAFFTYPE.SUBSTAFFTYPE_ID = TB_REQUEST.SUBSTAFFTYPE_ID) SUBSTAFFTYPE_NAME, (SELECT ADMIN_POSITION_NAME FROM TB_ADMIN_POSITION WHERE TB_ADMIN_POSITION.ADMIN_POSITION_ID = TB_REQUEST.ADMIN_POS_ID) ADMIN_POSITION_NAME, (SELECT POSITION_WORK_NAME FROM TB_POSITION_WORK WHERE TB_POSITION_WORK.POSITION_WORK_ID = TB_REQUEST.WORK_POS_ID) WORK_POS_NAME, (SELECT ISCED_NAME FROM TB_ISCED WHERE TB_ISCED.ISCED_ID = TB_REQUEST.TEACH_ISCED_ID) TEACH_ISCED_NAME, (SELECT LEV_NAME_TH FROM TB_LEV WHERE TB_LEV.LEV_ID = TB_REQUEST.GRAD_LEV_ID) GRAD_LEV_NAME, (SELECT ISCED_NAME FROM TB_ISCED WHERE TB_ISCED.ISCED_ID = TB_REQUEST.GRAD_ISCED_ID) GRAD_ISCED_NAME, (SELECT PROGRAM_NAME FROM TB_PROGRAM WHERE TB_PROGRAM.PROGRAM_ID_NEW = TB_REQUEST.GRAD_PROG_ID) GRAD_PROG_NAME, (SELECT NATION_NAME_EN FROM TB_NATION WHERE TB_NATION.NATION_ID = TB_REQUEST.GRAD_COUNTRY_ID) GRAD_COUNTRY_NAME, (SELECT DEFORM_NAME FROM TB_DEFORM WHERE TB_DEFORM.DEFORM_ID = TB_REQUEST.DEFORM_ID) DEFORM_NAME, (SELECT RELIGION_NAME FROM TB_RELIGION WHERE TB_RELIGION.RELIGION_ID = TB_REQUEST.RELIGION_ID) RELIGION_NAME FROM TB_REQUEST WHERE R_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            int i = 0;
                            if (reader.IsDBNull(i))
                            {
                                trTitleID.Visible = false;
                            }
                            else
                            {
                                ddlTitleID.SelectedValue = reader.GetValue(i).ToString(); ddlTitleID2.Text = reader.GetValue(29).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trFirstName.Visible = false;
                            }
                            else
                            {
                                tbFirstName.Text = reader.GetValue(i).ToString(); tbFirstName2.Text = reader.GetValue(i).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trLastName.Visible = false;
                            }
                            else
                            {
                                tbLastName.Text = reader.GetValue(i).ToString(); tbLastName2.Text = reader.GetValue(i).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trGenderID.Visible = false;
                            }
                            else
                            {
                                ddlGenderID.SelectedValue = reader.GetValue(i).ToString(); ddlGenderID2.Text = reader.GetValue(30).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trBirthdayDate.Visible = false;
                            }
                            else
                            {
                                tbBirthdayDate.Text = reader.GetDateTime(i).ToString("dd MMM yyyy"); tbBirthdayDate2.Text = reader.GetDateTime(i).ToString("dd MMM yyyy");
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trEmail.Visible = false;
                            }
                            else
                            {
                                tbEmail.Text = reader.GetValue(i).ToString(); tbEmail2.Text = reader.GetValue(i).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trNationID.Visible = false;
                            }
                            else
                            {
                                ddlNationID.SelectedValue = reader.GetValue(i).ToString(); ddlNationID2.Text = reader.GetValue(31).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trCampusID.Visible = false;
                            }
                            else
                            {
                                ddlCampusID.SelectedValue = reader.GetValue(i).ToString(); ddlCampusID2.Text = reader.GetValue(32).ToString();
                            }
                            ++i;

                            if (reader.IsDBNull(i))
                            {
                                trFacultyID.Visible = false;
                            }
                            else
                            {
                                ddlFacultyID.Items.Clear();
                                string z1 = reader.GetValue(i).ToString();
                                DatabaseManager.BindDropDown(ddlFacultyID, "SELECT * FROM TB_FACULTY WHERE CAMPUS_ID = '" + ddlCampusID.SelectedValue + "'", "FACULTY_NAME", "FACULTY_ID", "--กรุณาเลือก--");
                                ddlFacultyID.SelectedValue = z1;
                                ddlFacultyID2.Text         = reader.GetValue(33).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trDivisionID.Visible = false;
                            }
                            else
                            {
                                ddlDivisionID.Items.Clear();
                                string z2 = reader.GetValue(i).ToString();
                                DatabaseManager.BindDropDown(ddlDivisionID, "SELECT * FROM TB_DIVISION WHERE DIVISION_ID = '" + ddlDivisionID.SelectedValue + "'", "DIVISION_NAME", "DIVISION_ID", "--กรุณาเลือก--");
                                ddlDivisionID.SelectedValue = z2;
                                ddlDivisionID2.Text         = reader.GetValue(34).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trWorkDivisionID.Visible = false;
                            }
                            else
                            {
                                ddlWorkDivisionID.Items.Clear();
                                string z3 = reader.GetValue(i).ToString();
                                DatabaseManager.BindDropDown(ddlWorkDivisionID, "SELECT * FROM TB_WORK_DIVISION WHERE WORK_ID = '" + ddlWorkDivisionID.SelectedValue + "'", "WORK_NAME", "WORK_ID", "--กรุณาเลือก--");
                                ddlWorkDivisionID.SelectedValue = z3;
                                ddlWorkDivisionID2.Text         = reader.GetValue(35).ToString();
                            }
                            ++i;

                            if (reader.IsDBNull(i))
                            {
                                trStafftypeID.Visible = false;
                            }
                            else
                            {
                                ddlStafftypeID.SelectedValue = reader.GetValue(i).ToString(); ddlStafftypeID2.Text = reader.GetValue(36).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trTimeContactID.Visible = false;
                            }
                            else
                            {
                                ddlTimeContactID.SelectedValue = reader.GetValue(i).ToString(); ddlTimeContactID2.Text = reader.GetValue(37).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trBudgetID.Visible = false;
                            }
                            else
                            {
                                ddlBudgetID.SelectedValue = reader.GetValue(i).ToString(); ddlBudgetID2.Text = reader.GetValue(38).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trSubStafftypeID.Visible = false;
                            }
                            else
                            {
                                ddlSubStafftypeID.SelectedValue = reader.GetValue(i).ToString(); ddlSubStafftypeID2.Text = reader.GetValue(39).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trAdminPosID.Visible = false;
                            }
                            else
                            {
                                ddlAdminPosID.SelectedValue = reader.GetValue(i).ToString(); ddlAdminPosID2.Text = reader.GetValue(40).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trWorkPosID.Visible = false;
                            }
                            else
                            {
                                ddlWorkPosID.SelectedValue = reader.GetValue(i).ToString(); ddlWorkPosID2.Text = reader.GetValue(41).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trDateInwork.Visible = false;
                            }
                            else
                            {
                                tbDateInwork.Text = reader.GetDateTime(i).ToString("dd MMM yyyy"); tbDateInwork2.Text = reader.GetDateTime(i).ToString("dd MMM yyyy");
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trDateStartThisU.Visible = false;
                            }
                            else
                            {
                                tbDateStartThisU.Text = reader.GetDateTime(i).ToString("dd MMM yyyy"); tbDateStartThisU2.Text = reader.GetDateTime(i).ToString("dd MMM yyyy");
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trSpecialName.Visible = false;
                            }
                            else
                            {
                                tbSpecialName.Text = reader.GetValue(i).ToString(); tbSpecialName2.Text = reader.GetValue(i).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trTeachIscedID.Visible = false;
                            }
                            else
                            {
                                ddlTeachIscedID.SelectedValue = reader.GetValue(i).ToString(); ddlTeachIscedID2.Text = reader.GetValue(42).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trGradLevID.Visible = false;
                            }
                            else
                            {
                                ddlGradLevID.SelectedValue = reader.GetValue(i).ToString(); ddlGradLevID2.Text = reader.GetValue(43).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trGradCurr.Visible = false;
                            }
                            else
                            {
                                tbGradCurr.Text = reader.GetValue(i).ToString(); tbGradCurr2.Text = reader.GetValue(i).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trGradIscedID.Visible = false;
                            }
                            else
                            {
                                ddlGradIscedID.SelectedValue = reader.GetValue(i).ToString(); ddlGradIscedID2.Text = reader.GetValue(44).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trGradProgID.Visible = false;
                            }
                            else
                            {
                                ddlGradProgID.SelectedValue = reader.GetValue(i).ToString(); ddlGradProgID2.Text = reader.GetValue(45).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trGradUniv.Visible = false;
                            }
                            else
                            {
                                tbGradUniv.Text = reader.GetValue(i).ToString(); tbGradUniv2.Text = reader.GetValue(i).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trGradCountryID.Visible = false;
                            }
                            else
                            {
                                ddlGradCountryID.SelectedValue = reader.GetValue(i).ToString(); ddlGradCountryID2.Text = reader.GetValue(46).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trDeformID.Visible = false;
                            }
                            else
                            {
                                ddlDeformID.SelectedValue = reader.GetValue(i).ToString(); ddlDeformID2.Text = reader.GetValue(47).ToString();
                            }
                            ++i;
                            if (reader.IsDBNull(i))
                            {
                                trReligionID.Visible = false;
                            }
                            else
                            {
                                ddlReligionID.SelectedValue = reader.GetValue(i).ToString(); ddlReligionID2.Text = reader.GetValue(48).ToString();
                            }
                            ++i;
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] == null)
            {
                Response.Redirect("ListRequest.aspx");
                return;
            }

            PersonnelSystem ps = PersonnelSystem.GetPersonnelSystem(this);

            loginPerson = ps.LoginPerson;
            Citizen_id  = DatabaseManager.ExecuteString("SELECT CITIZEN_ID FROM TB_REQUEST WHERE R_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'");
            Person QueryString = DatabaseManager.GetPerson(Citizen_id);

            if (loginPerson.PERSON_ROLE_ID != "2")
            {
                Server.Transfer("NoPermission.aspx");
            }

            if (!IsPostBack)
            {
                BindDDL();
                ReadID();
                ReadRequest();
            }

            lbTitleID.Text        = Util.IsBlank(QueryString.PS_TITLE_NAME) ? "-" : QueryString.PS_TITLE_NAME;
            lbFirstName.Text      = Util.IsBlank(QueryString.PS_FIRSTNAME) ? "-" : QueryString.PS_FIRSTNAME;
            lbLastName.Text       = Util.IsBlank(QueryString.PS_LASTNAME) ? "-" : QueryString.PS_LASTNAME;
            lbGenderID.Text       = Util.IsBlank(QueryString.PS_GENDER_NAME) ? "-" : QueryString.PS_GENDER_NAME;
            lbBirthdayDate.Text   = Util.IsBlank(QueryString.PS_BIRTHDAY_DATE.ToString()) ? "-" : QueryString.PS_BIRTHDAY_DATE.Value.ToLongDateString();
            lbEmail.Text          = Util.IsBlank(QueryString.PS_EMAIL) ? "-" : QueryString.PS_EMAIL;
            lbNationID.Text       = Util.IsBlank(QueryString.PS_NATION_NAME) ? "-" : QueryString.PS_NATION_NAME;
            lbCampusID.Text       = Util.IsBlank(QueryString.PS_CAMPUS_NAME) ? "-" : QueryString.PS_CAMPUS_NAME;
            lbFacultyID.Text      = Util.IsBlank(QueryString.PS_FACULTY_NAME) ? "-" : QueryString.PS_FACULTY_NAME;
            lbDivisionID.Text     = Util.IsBlank(QueryString.PS_DIVISION_NAME) ? "-" : QueryString.PS_DIVISION_NAME;
            lbWorkDivisionID.Text = Util.IsBlank(QueryString.PS_WORK_DIVISION_NAME) ? "-" : QueryString.PS_WORK_DIVISION_NAME;
            lbStafftypeID.Text    = Util.IsBlank(QueryString.PS_STAFFTYPE_NAME) ? "-" : QueryString.PS_STAFFTYPE_NAME;
            lbTimeContactID.Text  = Util.IsBlank(QueryString.PS_TIME_CONTACT_NAME) ? "-" : QueryString.PS_TIME_CONTACT_NAME;
            lbBudgetID.Text       = Util.IsBlank(QueryString.PS_BUDGET_NAME) ? "-" : QueryString.PS_BUDGET_NAME;
            lbSubStafftypeID.Text = Util.IsBlank(QueryString.PS_SUBSTAFFTYPE_NAME) ? "-" : QueryString.PS_SUBSTAFFTYPE_NAME;
            lbAdminPosID.Text     = Util.IsBlank(QueryString.PS_ADMIN_POS_NAME) ? "-" : QueryString.PS_ADMIN_POS_NAME;
            lbWorkPosID.Text      = Util.IsBlank(QueryString.PS_WORK_POS_NAME) ? "-" : QueryString.PS_WORK_POS_NAME;
            lbDateInwork.Text     = Util.IsBlank(QueryString.PS_INWORK_DATE.ToString()) ? "-" : QueryString.PS_INWORK_DATE.Value.ToLongDateString();
            lbDateStartThisU.Text = Util.IsBlank(QueryString.PS_DATE_START_THIS_U.ToString()) ? "-" : QueryString.PS_DATE_START_THIS_U.Value.ToLongDateString();
            lbSpecialName.Text    = Util.IsBlank(QueryString.PS_SPECIAL_NAME) ? "-" : QueryString.PS_SPECIAL_NAME;
            lbTeachIscedID.Text   = Util.IsBlank(QueryString.PS_TEACH_ISCED_NAME) ? "-" : QueryString.PS_TEACH_ISCED_NAME;
            lbGradLevID.Text      = Util.IsBlank(QueryString.PS_GRAD_LEV_NAME) ? "-" : QueryString.PS_GRAD_LEV_NAME;
            lbGradCurr.Text       = Util.IsBlank(QueryString.PS_GRAD_CURR) ? "-" : QueryString.PS_GRAD_CURR;
            lbGradIscedID.Text    = Util.IsBlank(QueryString.PS_GRAD_ISCED_NAME) ? "-" : QueryString.PS_GRAD_ISCED_NAME;
            lbGradProgID.Text     = Util.IsBlank(QueryString.PS_GRAD_PROG_NAME) ? "-" : QueryString.PS_GRAD_PROG_NAME;
            lbGradUniv.Text       = Util.IsBlank(QueryString.PS_GRAD_UNIV) ? "-" : QueryString.PS_GRAD_UNIV;
            lbGradCountryID.Text  = Util.IsBlank(QueryString.PS_GRAD_COUNTRY_NAME) ? "-" : QueryString.PS_GRAD_COUNTRY_NAME;
            lbDeformID.Text       = Util.IsBlank(QueryString.PS_DEFORM_NAME) ? "-" : QueryString.PS_DEFORM_NAME;
            lbReligionID.Text     = Util.IsBlank(QueryString.PS_RELIGION_NAME) ? "-" : QueryString.PS_RELIGION_NAME;
        }
Beispiel #16
0
        protected void btnUpdatePosition_Click(object sender, EventArgs e)
        {
            string ValueID   = ddlInsertIdPosition.SelectedValue;
            string ValueDate = Util.ToDateTimeOracle(tbInsertDatePosition.Text).ToString();

            if (Session["DefaultIdPosition"] == null)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาเลือกรายการที่จะแก้ไขก่อน')", true);
                return;
            }
            if (Util.ToDateTimeOracle(tbInsertDatePosition.Text) > DateTime.Now)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('วันที่ไม่สามารถมากกว่าวันปัจจุบัน')", true);
                return;
            }

            bool ok = false;

            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT * FROM (SELECT GET_DATE FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "' ORDER BY GET_DATE DESC) WHERE ROWNUM = 1", con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            DateTime getDate = reader.GetDateTime(0).AddDays(-1);
                            if (Util.ToDateTimeOracle(tbInsertDatePosition.Text) > getDate)
                            {
                                ok = false;
                            }
                            else
                            {
                                ok = true;
                            }
                        }
                    }
                }
            }

            if (ok)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('วันที่ไม่ถูกต้อง')", true);
            }
            else
            {
                if (ValueID != "" && ValueDate != "")
                {
                    OracleConnection.ClearAllPools();
                    using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
                    {
                        con.Open();

                        using (OracleCommand com = new OracleCommand("UPDATE PS_POSITION_HISTORY SET P_ID = :P_ID, GET_DATE = :GET_DATE WHERE PH_ID = :PH_ID", con))
                        {
                            com.Parameters.Add(new OracleParameter("P_ID", ValueID));
                            com.Parameters.Add(new OracleParameter("GET_DATE", Util.ToDateTimeOracle(tbInsertDatePosition.Text)));
                            com.Parameters.Add(new OracleParameter("PH_ID", Session["DefaultIdPosition"].ToString()));
                            com.ExecuteNonQuery();
                        }
                        using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_POSITION_ID = :PS_POSITION_ID WHERE PS_CITIZEN_ID = :PS_CITIZEN_ID", con))
                        {
                            com.Parameters.Add(new OracleParameter("PS_POSITION_ID", ddlInsertIdPosition.SelectedValue));
                            com.Parameters.Add(new OracleParameter("PS_CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.ExecuteNonQuery();
                        }
                        //----------
                        using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_FIRST_POSITION_ID = (SELECT P_ID FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = :CITIZEN_ID AND GET_DATE = (SELECT MIN(GET_DATE) FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = :CITIZEN_ID)) WHERE PS_CITIZEN_ID = :CITIZEN_ID", con))
                        {
                            com.Parameters.Add(new OracleParameter("CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.ExecuteNonQuery();
                        }
                    }

                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
                    BindPosition();
                    ClearPosition();
                    Session.Remove("DefaultIdPosition");
                }
            }
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PersonnelSystem ps = PersonnelSystem.GetPersonnelSystem(this);

            loginPerson = ps.LoginPerson;
            Citizen_id  = DatabaseManager.ExecuteString("SELECT PS_CITIZEN_ID FROM PS_PERSON WHERE PS_CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'");
            QueryString = DatabaseManager.GetPerson(Citizen_id);

            if (loginPerson.PERSON_ROLE_ID != "2")
            {
                Server.Transfer("NoPermission.aspx");
            }

            if (Request.QueryString["id"] == null)
            {
                Response.Redirect("ListPerson-ADMIN.aspx");
            }

            if (!IsPostBack)
            {
                if (QueryString.PS_STAFFTYPE_ID == "1" || QueryString.PS_STAFFTYPE_ID == "5")
                {
                    BindPosition();
                }
            }
        }
 private void ReadSelectID()
 {
     using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
     {
         con.Open();
         using (OracleCommand com = new OracleCommand("SELECT (SELECT (SELECT TITLE_NAME_TH FROM TB_TITLENAME WHERE PS_PERSON.PS_TITLE_ID = TB_TITLENAME.TITLE_ID) || ' ' || PS_FIRSTNAME || ' ' || PS_LASTNAME FROM PS_PERSON WHERE PS_PERSON.PS_CITIZEN_ID = TB_PROJECT.CITIZEN_ID) NAME, (SELECT (SELECT POSITION_WORK_NAME FROM TB_POSITION_WORK WHERE TB_POSITION_WORK.POSITION_WORK_ID = PS_PERSON.PS_WORK_POS_ID) FROM PS_PERSON WHERE PS_PERSON.PS_CITIZEN_ID = TB_PROJECT.CITIZEN_ID) POSITION_NAME, (SELECT (SELECT ADMIN_POSITION_NAME FROM TB_ADMIN_POSITION WHERE TB_ADMIN_POSITION.ADMIN_POSITION_ID = PS_PERSON.PS_ADMIN_POS_ID) FROM PS_PERSON WHERE PS_PERSON.PS_CITIZEN_ID = TB_PROJECT.CITIZEN_ID) DEGREE_NAME, (SELECT (SELECT CAMPUS_NAME FROM TB_CAMPUS WHERE TB_CAMPUS.CAMPUS_ID = PS_PERSON.PS_CAMPUS_ID) || ' ' || (SELECT FACULTY_NAME FROM TB_FACULTY WHERE TB_FACULTY.FACULTY_ID = PS_PERSON.PS_FACULTY_ID) || ' ' || (SELECT DIVISION_NAME FROM TB_DIVISION WHERE TB_DIVISION.DIVISION_ID = PS_PERSON.PS_DIVISION_ID) || ' ' || (SELECT WORK_NAME FROM TB_WORK_DIVISION WHERE TB_WORK_DIVISION.WORK_ID = PS_PERSON.PS_WORK_DIVISION_ID) FROM PS_PERSON WHERE PS_PERSON.PS_CITIZEN_ID = TB_PROJECT.CITIZEN_ID) DEPARTMENT_NAME, PROJECT_NAME, ADDRESS_PROJECT, START_DATE, END_DATE, EXPENSES, FUNDING, CERTIFICATE, SUMMARIZE_PROJECT, RESULT_TEACHING, RESULT_ACADEMIC, DIFFICULTY_PROJECT, RESULT_PROJECT, RESULT_RESEARCHING, RESULT_OTHER, COUNSEL FROM TB_PROJECT WHERE PRO_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
         {
             using (OracleDataReader reader = com.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     int i = 0;
                     lbName.Text              = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbPosition.Text          = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbDegree.Text            = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbDepartment.Text        = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbNameProject.Text       = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbAddressProject.Text    = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbDateStart.Text         = reader.IsDBNull(i) ? "" : reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                     lbDateEnd.Text           = reader.IsDBNull(i) ? "" : reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                     lbExpense.Text           = reader.IsDBNull(i) ? "0" : reader.GetInt32(i).ToString("#,###"); ++i;
                     lbFunding.Text           = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbCertificate.Text       = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbSummaryProject.Text    = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbResultTeaching.Text    = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbResultAcademic.Text    = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbDifficultyProject.Text = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbResultProject.Text     = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbResultResearching.Text = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbResultOther.Text       = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     lbCounsel.Text           = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                 }
             }
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] == null)
            {
                Response.Redirect("listproject-admin.aspx");
            }

            if (!IsPostBack)
            {
                ReadSelectID();

                using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
                {
                    con.Open();
                    using (OracleCommand com = new OracleCommand("SELECT START_DATE,END_DATE FROM TB_PROJECT WHERE PRO_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
                    {
                        using (OracleDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                int    i     = 0;
                                string start = reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                                string end   = reader.GetDateTime(i).ToString("dd MMM yyyy"); ++i;
                                if (!reader.IsDBNull(0) && !reader.IsDBNull(1))
                                {
                                    DateTime df  = DateTime.Parse(start);
                                    DateTime dt  = DateTime.Parse(end);
                                    int      day = (int)(dt - df).TotalDays + 1;

                                    int year  = (day / 365);
                                    int month = (day % 365) / 30;
                                    day = (day % 365) % 30;

                                    lbcalYear.Text  = "" + year;
                                    lbcalMonth.Text = "" + month;
                                    lbcalDay.Text   = "" + day;
                                }
                            }
                        }
                    }
                }
            }
        }
 protected void lbuAllow_Click(object sender, EventArgs e)
 {
     if (rbAllow.Checked)
     {
         UPDATE_PERSON();
         DataShow.Visible = false;
         Accept.Visible   = true;
         //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('บันทึกข้อมูลเรียบร้อย')", true);
     }
     else if (rbNotAllow.Checked)
     {
         OracleConnection.ClearAllPools();
         using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
         {
             con.Open();
             using (OracleCommand com = new OracleCommand("UPDATE TB_REQUEST SET DATE_END=:DATE_END, R_STATUS_ID=:R_STATUS_ID, COMMENT_INFO=:COMMENT_INFO, R_ALLOW=:R_ALLOW WHERE R_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
             {
                 com.Parameters.Add(new OracleParameter("DATE_END", DateTime.Today));
                 com.Parameters.Add(new OracleParameter("R_STATUS_ID", "4"));
                 com.Parameters.Add(new OracleParameter("COMMENT_INFO", tbComment.Text));
                 com.Parameters.Add(new OracleParameter("R_ALLOW", "2"));
                 com.ExecuteNonQuery();
             }
         }
         DataShow.Visible = false;
         NoAccept.Visible = true;
     }
 }
 protected void ReadRequest()
 {
     using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
     {
         con.Open();
         using (OracleCommand com = new OracleCommand("SELECT DATE_START FROM TB_REQUEST WHERE R_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
         {
             using (OracleDataReader reader = com.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     lbDateReq.Text = reader.GetDateTime(0).ToLongDateString();
                 }
             }
         }
     }
 }
Beispiel #22
0
        protected void btnInsertPosition_Click(object sender, EventArgs e)
        {
            string oldID = DatabaseManager.ExecuteString("SELECT P_ID FROM PS_POSITION_HISTORY WHERE P_ID ='" + ddlInsertIdPosition.SelectedValue + "' AND CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'");

            if (ddlInsertIdPosition.SelectedValue == oldID)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('มีชื่อระดับตำแหน่ง " + ddlInsertIdPosition.SelectedItem.ToString() + " อยู่แล้วไม่สามารถเพิ่มได้')", true);
                return;
            }

            if (Util.ToDateTimeOracle(tbInsertDatePosition.Text) > DateTime.Now)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('วันที่ไม่สามารถมากกว่าวันปัจจุบัน')", true);
                return;
            }

            bool ok = false;

            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                //int salary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT GET_DATE FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "' ORDER BY GET_DATE DESC) WHERE ROWNUM = 1");
                using (OracleCommand com = new OracleCommand("SELECT * FROM (SELECT GET_DATE FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "' ORDER BY GET_DATE DESC) WHERE ROWNUM = 1", con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            DateTime getDate = reader.GetDateTime(0);
                            if (Util.ToDateTimeOracle(tbInsertDatePosition.Text) > getDate)
                            {
                                ok = false;
                            }
                            else
                            {
                                ok = true;
                            }
                        }
                    }
                }
            }

            if (ok)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('วันที่ไม่ถูกต้อง')", true);
            }
            else
            {
                OracleConnection.ClearAllPools();
                using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
                {
                    con.Open();
                    string CheckFrist = DatabaseManager.ExecuteString("SELECT COUNT(*) FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'");

                    using (OracleCommand com = new OracleCommand("INSERT INTO PS_POSITION_HISTORY (CITIZEN_ID,P_ID,GET_DATE) VALUES (:CITIZEN_ID,:P_ID,:GET_DATE)", con))
                    {
                        com.Parameters.Add(new OracleParameter("CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                        com.Parameters.Add(new OracleParameter("P_ID", ddlInsertIdPosition.SelectedValue));
                        com.Parameters.Add(new OracleParameter("GET_DATE", Util.ToDateTimeOracle(tbInsertDatePosition.Text)));
                        com.ExecuteNonQuery();
                    }

                    if (CheckFrist == "0")
                    {
                        using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_POSITION_ID = :PS_POSITION_ID, PS_FIRST_POSITION_ID = :PS_FIRST_POSITION_ID WHERE PS_CITIZEN_ID = :PS_CITIZEN_ID", con))
                        {
                            com.Parameters.Add(new OracleParameter("PS_CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.Parameters.Add(new OracleParameter("PS_POSITION_ID", ddlInsertIdPosition.SelectedValue));
                            com.Parameters.Add(new OracleParameter("PS_FIRST_POSITION_ID", ddlInsertIdPosition.SelectedValue));
                            com.ExecuteNonQuery();
                        }
                    }
                    else
                    {
                        using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_POSITION_ID = :PS_POSITION_ID WHERE PS_CITIZEN_ID = :PS_CITIZEN_ID", con))
                        {
                            com.Parameters.Add(new OracleParameter("PS_CITIZEN_ID", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));
                            com.Parameters.Add(new OracleParameter("PS_POSITION_ID", ddlInsertIdPosition.SelectedValue));
                            com.ExecuteNonQuery();
                        }
                    }
                }

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
                BindPosition();
                ClearPosition();
            }
        }
Beispiel #23
0
        //
        protected void BindSalary()
        {
            OracleConnection  con = new OracleConnection(DatabaseManager.CONNECTION_STRING);
            OracleDataAdapter sda = new OracleDataAdapter("SELECT SALARY_ID, SALARY, POSITION_SALARY, RESULT1, PERCENT_SALARY1, RESULT2, PERCENT_SALARY2, DO_DATE FROM PS_SALARY WHERE CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "' ORDER BY DO_DATE ASC", con);
            DataTable         dt  = new DataTable();

            sda.Fill(dt);
            myRepeaterSalary.DataSource = dt;
            myRepeaterSalary.DataBind();
        }
        public int UPDATE_PERSON()
        {
            int id = 0;

            OracleConnection.ClearAllPools();
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                if (trTitleID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_TITLE_ID=:PS_TITLE_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_TITLE_ID", ddlTitleID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trFirstName.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_FIRSTNAME=:PS_FIRSTNAME WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_FIRSTNAME", tbFirstName.Text));
                        com.ExecuteNonQuery();
                    }
                }
                if (trLastName.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_LASTNAME=:PS_LASTNAME WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_LASTNAME", tbLastName.Text));
                        com.ExecuteNonQuery();
                    }
                }
                if (trGenderID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_GENDER_ID=:PS_GENDER_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_GENDER_ID", ddlGenderID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trBirthdayDate.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_BIRTHDAY_DATE=:PS_BIRTHDAY_DATE WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_BIRTHDAY_DATE", Util.ToDateTimeOracle(tbBirthdayDate.Text)));
                        com.ExecuteNonQuery();
                    }
                }
                if (trEmail.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_EMAIL=:PS_EMAIL WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_EMAIL", tbEmail.Text));
                        com.ExecuteNonQuery();
                    }
                }
                if (trNationID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_NATION_ID=:PS_NATION_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_NATION_ID", ddlNationID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trCampusID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_CAMPUS_ID=:PS_CAMPUS_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_CAMPUS_ID", ddlCampusID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trFacultyID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_FACULTY_ID=:PS_FACULTY_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_FACULTY_ID", ddlFacultyID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trDivisionID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_DIVISION_ID=:PS_DIVISION_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_DIVISION_ID", ddlDivisionID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trWorkDivisionID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_WORK_DIVISION_ID=:PS_WORK_DIVISION_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_WORK_DIVISION_ID", ddlWorkDivisionID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trStafftypeID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_STAFFTYPE_ID=:PS_STAFFTYPE_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_STAFFTYPE_ID", ddlStafftypeID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trTimeContactID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_TIME_CONTACT_ID=:PS_TIME_CONTACT_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_TIME_CONTACT_ID", ddlTimeContactID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trBudgetID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_BUDGET_ID=:PS_BUDGET_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_BUDGET_ID", ddlBudgetID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trSubStafftypeID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_SUBSTAFFTYPE_ID=:PS_SUBSTAFFTYPE_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_SUBSTAFFTYPE_ID", ddlSubStafftypeID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trAdminPosID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_ADMIN_POS_ID=:PS_ADMIN_POS_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_ADMIN_POS_ID", ddlAdminPosID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trWorkPosID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_WORK_POS_ID=:PS_WORK_POS_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_WORK_POS_ID", ddlWorkPosID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trDateInwork.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_INWORK_DATE=:PS_INWORK_DATE WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_INWORK_DATE", Util.ToDateTimeOracle(tbDateInwork.Text)));
                        com.ExecuteNonQuery();
                    }
                }
                if (trDateStartThisU.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_DATE_START_THIS_U=:PS_DATE_START_THIS_U WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_DATE_START_THIS_U", Util.ToDateTimeOracle(tbDateStartThisU.Text)));
                        com.ExecuteNonQuery();
                    }
                }
                if (trSpecialName.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_SPECIAL_NAME=:PS_SPECIAL_NAME WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_SPECIAL_NAME", tbSpecialName.Text));
                        com.ExecuteNonQuery();
                    }
                }
                if (trTeachIscedID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_TEACH_ISCED_ID=:PS_TEACH_ISCED_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_TEACH_ISCED_ID", ddlTeachIscedID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trGradLevID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_GRAD_LEV_ID=:PS_GRAD_LEV_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_LEV_ID", ddlGradLevID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trGradCurr.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_GRAD_CURR=:PS_GRAD_CURR WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_CURR", tbGradCurr.Text));
                        com.ExecuteNonQuery();
                    }
                }
                if (trGradIscedID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_GRAD_ISCED_ID=:PS_GRAD_ISCED_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_ISCED_ID", ddlGradIscedID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trGradProgID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_GRAD_PROG_ID=:PS_GRAD_PROG_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_PROG_ID", ddlGradProgID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trGradUniv.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_GRAD_UNIV=:PS_GRAD_UNIV WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_UNIV", tbGradUniv.Text));
                        com.ExecuteNonQuery();
                    }
                }
                if (trGradCountryID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_GRAD_COUNTRY_ID=:PS_GRAD_COUNTRY_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_GRAD_COUNTRY_ID", ddlGradCountryID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trDeformID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_DEFORM_ID=:PS_DEFORM_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_DEFORM_ID", ddlDeformID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }
                if (trReligionID.Visible == true)
                {
                    using (OracleCommand com = new OracleCommand("UPDATE PS_PERSON SET PS_RELIGION_ID=:PS_RELIGION_ID WHERE PS_CITIZEN_ID = '" + Citizen_id + "'", con))
                    {
                        com.Parameters.Add(new OracleParameter("PS_RELIGION_ID", ddlReligionID.SelectedValue));
                        com.ExecuteNonQuery();
                    }
                }

                /*/*/
                using (OracleCommand com = new OracleCommand("UPDATE TB_REQUEST SET DATE_END=:DATE_END, R_STATUS_ID=:R_STATUS_ID, COMMENT_INFO=:COMMENT_INFO, R_ALLOW=:R_ALLOW WHERE R_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
                {
                    com.Parameters.Add(new OracleParameter("DATE_END", DateTime.Today));
                    com.Parameters.Add(new OracleParameter("R_STATUS_ID", "2"));
                    com.Parameters.Add(new OracleParameter("COMMENT_INFO", tbComment.Text));
                    com.Parameters.Add(new OracleParameter("R_ALLOW", "1"));
                    id = com.ExecuteNonQuery();
                }
            }
            return(id);
        }
Beispiel #25
0
        //
        protected void BindPosition()
        {
            OracleConnection  con = new OracleConnection(DatabaseManager.CONNECTION_STRING);
            OracleDataAdapter sda = new OracleDataAdapter("SELECT PH_ID,P_ID,(SELECT P_NAME FROM TB_POSITION WHERE TB_POSITION.P_ID = PS_POSITION_HISTORY.P_ID)P_NAME, GET_DATE FROM PS_POSITION_HISTORY WHERE CITIZEN_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "' ORDER BY GET_DATE ASC", con);
            DataTable         dt  = new DataTable();

            sda.Fill(dt);
            myRepeaterPosition.DataSource = dt;
            myRepeaterPosition.DataBind();
            if (QueryString.PS_STAFFTYPE_ID == "1")
            {
                DatabaseManager.BindDropDown(ddlInsertIdPosition, "SELECT * FROM TB_POSITION WHERE P_STAFFTYPE_ID = 1 ORDER BY ABS(P_ID) ASC", "P_NAME", "P_ID", "--กรุณาเลือก--");
            }
            else if (QueryString.PS_STAFFTYPE_ID == "5")
            {
                DatabaseManager.BindDropDown(ddlInsertIdPosition, "SELECT * FROM TB_POSITION WHERE P_STAFFTYPE_ID = 5 ORDER BY ABS(P_ID) ASC", "P_NAME", "P_ID", "--กรุณาเลือก--");
            }
        }
        private void ReadFile()
        {
            List <int>    pro_id   = new List <int>();
            List <string> pdf_file = new List <string>();

            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT PRO_ID, PDF_FILE FROM TB_PROJECT WHERE PRO_ID = " + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())), con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            if (!reader.IsDBNull(1))
                            {
                                pro_id.Add(reader.GetInt32(0));
                                pdf_file.Add(reader.GetString(1));
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < pro_id.Count; i++)
            {
                string path     = "Upload/Project/PDF/" + pdf_file[i];
                int    PRO_ID   = pro_id[i];
                string PDF_FILE = pdf_file[i];

                Panel p = new Panel();
                p.Style.Add("display", "inline-block");

                LinkButton lb = new LinkButton();
                lb.Attributes["href"] = path;
                lb.Text = "ดูไฟล์แนบ (รูปภาพ,เอกสาร ประกอบการอบรม)";
                p.Controls.Add(lb);

                file_pdf.Controls.Add(p);
            }
        }