Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    int.TryParse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), out id);
                }
                else
                {
                    Response.Redirect("listGP7-admin.aspx");
                }
                BindData();
                BindDataBase();
            }

            if (HF1.Value != "")
            {
                p = HF1.Value;
            }

            if (p == null)
            {
                selectTab("1");
                if (CreateSelectPersonPageLoad(this, "addGP7-admin.aspx"))
                {
                    return;
                }
            }
        }
Beispiel #2
0
        protected void btnSave6_Click(object sender, EventArgs e)
        {
            PS_POSI_AND_SALARY PosiSalary = new PS_POSI_AND_SALARY();

            PosiSalary.UOC_ID          = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
            PosiSalary.START_DATE      = DateTime.Parse(tbStartDate14.Text);
            PosiSalary.PAS_NAME        = tbName14.Text;
            PosiSalary.NO_POSITION     = tbNoPosition14.Text;
            PosiSalary.POSITION_TYPE   = tbPosiType14.Text;
            PosiSalary.POSITION_DEGREE = tbPosiDegree14.Text;
            PosiSalary.SALARY          = Convert.ToInt32(tbSalary14.Text);
            PosiSalary.POSITION_SALARY = Convert.ToInt32(tbPosiSalary14.Text);
            PosiSalary.REF_DOC         = tbRefDoc14.Text;
            PosiSalary.INSERT_PS_POSI_AND_SALARY();

            PS_PERSON P0         = new PS_PERSON();
            int       salary     = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1");
            int       posisalary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT position_salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1");

            P0.SALARY          = salary.ToString();
            P0.POSITION_SALARY = posisalary.ToString();
            P0.UOC_ID          = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
            P0.UPDATE_CURRENT_SALARY_PERSON();

            ClearPositionAndSalary();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            BindData();
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public bool CreateSelectPersonPageLoad(Page page, string pageURL)
 {
     if (p == null)
     {
         p         = MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString());
         HF1.Value = p;
         return(true);
     }
     return(false);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["id"] != null)
         {
             int.TryParse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), out id);
             ReadSelectID();
         }
     }
 }
Beispiel #6
0
        protected void btnSave5_Click(object sender, EventArgs e)
        {
            PS_PUNISHMENT Punish = new PS_PUNISHMENT();

            Punish.UOC_ID      = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
            Punish.YEAR        = tbYear13.Text;
            Punish.PUNISH_NAME = tbPunishName13.Text;
            Punish.REF_DOC     = tbRefDoc13.Text;
            Punish.INSERT_PS_PUNISHMENT();

            ClearPunish();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            BindData();
        }
Beispiel #7
0
        protected void btnSave4_Click(object sender, EventArgs e)
        {
            PS_TRAINING Training = new PS_TRAINING();

            Training.UOC_ID        = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
            Training.TRAINING_NAME = tbCourse12.Text;
            Training.START_DATE    = DateTime.Parse(tbStartDate12.Text);
            Training.END_DATE      = DateTime.Parse(tbEndDate12.Text);
            Training.DEPARTMENT    = tbDepartment12.Text;
            Training.INSERT_PS_TRAINING();

            ClearTraining();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            BindData();
        }
Beispiel #8
0
        protected void btnSave3_Click(object sender, EventArgs e)
        {
            PS_PRO_LICENSE PLicense = new PS_PRO_LICENSE();

            PLicense.UOC_ID         = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
            PLicense.LICENSE_NAME   = tbLicenseName11.Text;
            PLicense.DEPARTMENT     = tbDepartment11.Text;
            PLicense.LICENSE_NUMBER = tbLicenseNumber11.Text;
            PLicense.START_DATE     = DateTime.Parse(tbStartDate11.Text);
            PLicense.INSERT_PS_PRO_LICENSE();

            ClearPLicense();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            BindData();
        }
Beispiel #9
0
        protected void lbuDelete_Click(object sender, EventArgs e)
        {
            List <int>    pro_id   = new List <int>();
            List <string> img_file = new List <string>();

            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT PRO_ID, IMG_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));
                                img_file.Add(reader.GetString(1));
                            }
                        }
                    }
                }
            }

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

                string pathVS = Server.MapPath("Upload/Project/PDF/" + IMG_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;
            success.Visible    = false;
            delete.Visible     = true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                int.TryParse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), out id);
            }
            else
            {
                Response.Redirect("listrequest-admin.aspx");
            }

            if (!IsPostBack)
            {
                BindDDL();
                ReadSelectID();
            }
        }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    int.TryParse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), out id);
                    ReadSelectID();
                }
                else
                {
                    Response.Redirect("listproject-admin.aspx");
                }

                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 = '" + id + "'", con))
                    {
                        using (OracleDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                int    i     = 0;
                                string start = reader.GetDateTime(i).ToString("dd/MM/yyyy"); ++i;
                                string end   = reader.GetDateTime(i).ToString("dd/MM/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;
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #12
0
        protected void btnSave1_Click(object sender, EventArgs e)
        {
            PS_PERSON Pson = new PS_PERSON();

            Pson.UOC_ID       = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
            Pson.FATHER_NAME  = tbFatherName.Text;
            Pson.FATHER_LNAME = tbFatherLastName.Text;
            Pson.MOTHER_NAME  = tbMotherName.Text;
            Pson.MOTHER_LNAME = tbMotherLastName.Text;
            Pson.MOTHER_ONAME = tbMotherOldLastName.Text;
            Pson.COUPLE_NAME  = tbCoupleName.Text;
            Pson.COUPLE_LNAME = tbCoupleLastName.Text;
            Pson.COUPLE_ONAME = tbCoupleOldLastName.Text;
            Pson.UPDATE_GP7();

            ClearGP7();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            BindDataBase();
        }
Beispiel #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Notsuccess.Visible = true;
     success.Visible    = false;
     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 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (MultiView1.ActiveViewIndex == 0)
            {
                btnSelectView0.CssClass = "btn btn-info";
                btnSelectView1.CssClass = "btn btn-primary";
                btnSelectView2.CssClass = "btn btn-primary";
            }

            if (Request.QueryString["id"] != null)
            {
                int.TryParse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), out id);
                BindDDL();
                ReadSelectID();
            }
            else
            {
                Response.Redirect("listuser-admin.aspx");
            }
        }
Beispiel #15
0
        protected void modDeleteCommand5(Object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(GridViewPosiSalary.DataKeys[e.RowIndex].Value);
            PS_POSI_AND_SALARY PStudy = new PS_POSI_AND_SALARY();

            PStudy.PAS_ID = id;
            PStudy.DELETE_PS_POSI_AND_SALARY();

            PS_PERSON P0         = new PS_PERSON();
            int       salary     = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1");
            int       posisalary = DatabaseManager.ExecuteInt("SELECT * FROM (SELECT position_salary FROM PS_POSI_AND_SALARY ORDER BY START_DATE DESC) WHERE ROWNUM = 1");

            P0.SALARY          = salary.ToString();
            P0.POSITION_SALARY = posisalary.ToString();
            P0.UOC_ID          = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
            P0.UPDATE_CURRENT_SALARY_PERSON();

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true);

            GridViewPosiSalary.EditIndex = -1;
            BindData();
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Notsuccess.Visible = true;
            success.Visible    = false;
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    int.TryParse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), out id);
                    BindDDL();
                    ReadSelectID();
                }
                else
                {
                    Response.Redirect("listproject-admin.aspx");
                }

                string CheckIsNull = DatabaseManager.ExecuteString("SELECT COUNT(IMG_FILE) FROM TB_PROJECT WHERE PRO_ID = " + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "");
                if (CheckIsNull == "0")
                {
                    lbFile.Visible     = true;
                    FUdocument.Visible = true;
                    spFile.InnerText   = "*";
                    spFile.Attributes.Add("class", "ps-lb-red");
                    spFile.Attributes["style"] = "color:red;";
                    FUdocument.Attributes.Add("required", "true");
                }
                else
                {
                    lbFile.Visible     = false;
                    FUdocument.Visible = false;
                    spFile.InnerText   = "";
                    spFile.Attributes.Add("class", "");
                    spFile.Attributes["style"] = "";
                    FUdocument.Attributes.Add("required", "false");
                }
            }
            ReadFile();
        }
Beispiel #17
0
        void BindData()
        {
            PS_STUDY  PStudy = new PS_STUDY();
            DataTable dt1    = PStudy.SELECT_PS_STUDY("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", "");

            GridViewStudy.DataSource = dt1;
            GridViewStudy.DataBind();
            SetViewState(dt1);

            PS_PRO_LICENSE PLicense = new PS_PRO_LICENSE();
            DataTable      dt2      = PLicense.SELECT_PS_PRO_LICENSE("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", "");

            GridViewLicense.DataSource = dt2;
            GridViewLicense.DataBind();
            SetViewState(dt2);

            PS_TRAINING Training = new PS_TRAINING();
            DataTable   dt3      = Training.SELECT_PS_TRAINING("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", "");

            GridViewTraining.DataSource = dt3;
            GridViewTraining.DataBind();
            SetViewState(dt3);

            PS_PUNISHMENT Punishment = new PS_PUNISHMENT();
            DataTable     dt4        = Punishment.SELECT_PS_PUNISHMENT("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "");

            GridViewPunish.DataSource = dt4;
            GridViewPunish.DataBind();
            SetViewState(dt4);

            PS_POSI_AND_SALARY PosiSalary = new PS_POSI_AND_SALARY();
            DataTable          dt5        = PosiSalary.SELECT_PS_POSI_AND_SALARY("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", "", "", "", "", "");

            GridViewPosiSalary.DataSource = dt5;
            GridViewPosiSalary.DataBind();
            SetViewState(dt5);
        }
Beispiel #18
0
        protected void btnSave2_Click(object sender, EventArgs e)
        {
            if (tbStartDate10.Text != "" && tbEndDate10.Text != "")
            {
                DateTime dtEndDate10   = DateTime.Parse(tbEndDate10.Text);
                DateTime dtStartDate10 = DateTime.Parse(tbStartDate10.Text);
                int      totalDay      = (int)(dtEndDate10 - dtStartDate10).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.tbStartDate10);
                    return;
                }
                else
                {
                    notification.Attributes["class"] = "none";
                    notification.InnerHtml           = "";
                }
            }

            PS_STUDY PStudy = new PS_STUDY();

            PStudy.UOC_ID        = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
            PStudy.UNIV_NAME     = tbUnivName10.Text;
            PStudy.START_DATE    = DateTime.Parse(tbStartDate10.Text);
            PStudy.END_DATE      = DateTime.Parse(tbEndDate10.Text);
            PStudy.QUALIFICATION = tbCertificate10.Text;
            PStudy.INSERT_PS_STUDY();

            ClearStudy10();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            BindData();
        }
Beispiel #19
0
        private void ReadFile()
        {
            List <int>    pro_id   = new List <int>();
            List <string> img_file = new List <string>();

            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT PRO_ID, IMG_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));
                                img_file.Add(reader.GetString(1));
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < pro_id.Count; i++)
            {
                string path     = "Upload/Project/PDF/" + img_file[i];
                int    PRO_ID   = pro_id[i];
                string IMG_FILE = img_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);
            }
        }
        private void ReadSelectID()
        {
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                int uoc_id = DatabaseManager.ExecuteInt("SELECT UOC_ID FROM TB_REQUEST WHERE R_ID = '" + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "'");
                using (OracleCommand com = new OracleCommand("SELECT (SELECT UNIV_NAME_TH FROM REF_UNIV WHERE REF_UNIV.UNIV_ID = UOC_STAFF.UNIV_ID) UNIV_NAME," +
                                                             "(SELECT FULLNAME FROM REF_PREFIX_NAME WHERE UOC_STAFF.PREFIX_NAME = REF_PREFIX_NAME.PREFIX_NAME_ID) PREFIX_NAME," +
                                                             "STF_FNAME," +
                                                             "STF_LNAME" +
                                                             " FROM UOC_STAFF WHERE UOC_ID = '" + uoc_id + "'", con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            int i = 0;
                            lb4Univ.Text       = reader.GetValue(i).ToString(); ++i;
                            lb4PrefixName.Text = reader.GetValue(i).ToString(); ++i;
                            lb4Name.Text       = reader.GetValue(i).ToString(); ++i;
                            lb4LastName.Text   = reader.GetValue(i).ToString(); ++i;
                        }
                    }
                }

                using (OracleCommand com = new OracleCommand("SELECT UNIV_ID, PREFIX_NAME, STF_FNAME, STF_LNAME FROM TB_REQUEST WHERE R_ID = '" + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "'", con))
                {
                    using (OracleDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            int i = 0;

                            if (!reader.IsDBNull(0))
                            {
                                tr4_lb4Univ.Visible   = true;
                                ddlUniv.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                                ddlUniv.Visible       = true;
                            }
                            else
                            {
                                ++i;
                            }
                            if (!reader.IsDBNull(1))
                            {
                                tr4_lb4PrefixName.Visible   = true;
                                ddlPrefixName.SelectedValue = reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString(); ++i;
                                ddlPrefixName.Visible       = true;
                            }
                            else
                            {
                                ++i;
                            }
                            if (!reader.IsDBNull(2))
                            {
                                tr4_lb4Name.Visible = true;
                                lb4Name2.Text       = reader.GetValue(i).ToString(); ++i;
                            }
                            else
                            {
                                ++i;
                            }
                            if (!reader.IsDBNull(3))
                            {
                                tr4_lb4LastName.Visible = true;
                                lb4LastName2.Text       = reader.GetValue(i).ToString(); ++i;
                            }
                            else
                            {
                                ++i;
                            }
                        }
                    }
                }
            }
        }
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            int r_id = DatabaseManager.ExecuteInt("SELECT R_ID FROM TB_REQUEST WHERE R_ID = '" + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "'");
            int id   = 0;

            OracleConnection.ClearAllPools();
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("UPDATE TB_REQUEST SET STATUS_ID = :STATUS_ID, DATE_END = :DATE_END WHERE R_ID = '" + r_id + "'", con))
                {
                    com.Parameters.Add(new OracleParameter("STATUS_ID", "2"));
                    com.Parameters.Add(new OracleParameter("DATE_END", DateTime.Today));

                    id = com.ExecuteNonQuery();
                }
            }
            MultiView1.ActiveViewIndex = 2;
        }
Beispiel #22
0
        protected void btnUpdateProject_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                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           = "";
                    }
                }

                PersonnelSystem ps          = PersonnelSystem.GetPersonnelSystem(this);
                UOC_STAFF       loginPerson = ps.LoginPerson;
                PROJECT         p           = new PROJECT();
                p.Load(int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())));

                p.CATEGORY_ID        = Convert.ToInt32(ddlCategory.SelectedValue);
                p.PROJECT_NAME       = tbProjectName.Text;
                p.ADDRESS_PROJECT    = tbAddressProject.Text;
                p.START_DATE         = DateTime.Parse(tbStartDate.Text);
                p.END_DATE           = DateTime.Parse(tbEndDate.Text);
                p.EXPENSES           = Convert.ToInt32(tbExpenses.Text);
                p.FUNDING            = tbFunding.Text;
                p.CERTIFICATE        = tbCertificate.Text;
                p.SUMMARIZE_PROJECT  = tbSummarizeProject.Text;
                p.RESULT_TEACHING    = tbResultTeaching.Text;
                p.RESULT_ACADEMIC    = tbResultAcademic.Text;
                p.DIFFICULTY_PROJECT = tbDifficultyProject.Text;
                p.RESULT_PROJECT     = tbResultProject.Text;
                p.RESULT_RESEARCHING = tbResultResearching.Text;
                p.RESULT_OTHER       = tbResultOther.Text;
                p.COUNSEL            = tbCounsel.Text;
                p.COUNTRY_ID         = Convert.ToInt32(ddlCountry.SelectedValue);
                p.SUB_COUNTRY_ID     = Convert.ToInt32(ddlSubCountry.SelectedValue);
                if (FUdocument.HasFile)
                {
                    string   CountBase = DatabaseManager.ExecuteString("select count(*) from tb_project where pro_id = '" + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "'");
                    FileInfo fi        = new FileInfo(FUdocument.FileName);
                    string   imgFile   = "UID=" + p.UOC_ID + "&count=" + CountBase + fi.Extension;
                    FUdocument.SaveAs(Server.MapPath("Upload/Project/PDF/" + imgFile));
                    p.IMG_FILE = imgFile;
                }
                p.PRO_ID = int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
                p.UPDATE_PROJECT();

                Notsuccess.Visible = false;
                success.Visible    = true;
            }
        }
        public int UPDATE_REQUEST()
        {
            int r_id   = DatabaseManager.ExecuteInt("SELECT R_ID FROM TB_REQUEST WHERE R_ID = '" + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "'");
            int uoc_id = DatabaseManager.ExecuteInt("SELECT UOC_ID FROM TB_REQUEST WHERE R_ID = '" + int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "'");
            int id     = 0;

            OracleConnection.ClearAllPools();
            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("UPDATE TB_REQUEST SET STATUS_ID = :STATUS_ID, DATE_END = :DATE_END WHERE R_ID = '" + r_id + "'", con))
                {
                    com.Parameters.Add(new OracleParameter("STATUS_ID", "1"));
                    com.Parameters.Add(new OracleParameter("DATE_END", DateTime.Today));

                    id = com.ExecuteNonQuery();
                }
            }

            if (tr4_lb4Univ.Visible == true)
            {
                DatabaseManager.ExecuteNonQuery("UPDATE UOC_STAFF SET UNIV_ID = '" + ddlUniv.SelectedValue + "' WHERE UOC_ID = '" + uoc_id + "'");
            }
            if (tr4_lb4PrefixName.Visible == true)
            {
                DatabaseManager.ExecuteNonQuery("UPDATE UOC_STAFF SET PREFIX_NAME = '" + ddlPrefixName.SelectedValue + "' WHERE UOC_ID = '" + uoc_id + "'");
            }
            if (tr4_lb4Name.Visible == true)
            {
                DatabaseManager.ExecuteNonQuery("UPDATE UOC_STAFF SET STF_FNAME = '" + lb4Name2.Text + "' WHERE UOC_ID = '" + uoc_id + "'");
            }
            if (tr4_lb4LastName.Visible == true)
            {
                DatabaseManager.ExecuteNonQuery("UPDATE UOC_STAFF SET STF_LNAME = '" + lb4LastName2.Text + "' WHERE UOC_ID = '" + uoc_id + "'");
            }

            return(id);
        }
Beispiel #24
0
        public bool UPDATE_PERSON()
        {
            bool result = false;

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

                string query = "Update UOC_STAFF Set";
                query += " UNIV_ID = :UNIV_ID ,";
                query += " CITIZEN_ID = :CITIZEN_ID ,";
                query += " PREFIX_NAME = :PREFIX_NAME ,";
                query += " STF_FNAME = :STF_FNAME ,";
                query += " STF_LNAME = :STF_LNAME ,";
                query += " GENDER_ID = :GENDER_ID ,";
                query += " BIRTHDAY = :BIRTHDAY ,";
                query += " HOMEADD = :HOMEADD ,";
                query += " MOO = :MOO ,";
                query += " STREET = :STREET ,";
                query += " PROVINCE_ID = :PROVINCE_ID ,";
                query += " DISTRICT_ID = :DISTRICT_ID ,";
                query += " SUB_DISTRICT_ID = :SUB_DISTRICT_ID ,";
                query += " TELEPHONE = :TELEPHONE ,";
                query += " ZIPCODE = :ZIPCODE ,";
                query += " NATION_ID = :NATION_ID ,";
                query += " STAFFTYPE_ID = :STAFFTYPE_ID ,";
                query += " TIME_CONTACT_ID = :TIME_CONTACT_ID ,";
                query += " BUDGET_ID = :BUDGET_ID ,";
                query += " SUBSTAFFTYPE_ID = :SUBSTAFFTYPE_ID ,";
                query += " ADMIN_POSITION_ID = :ADMIN_POSITION_ID ,";
                query += " POSITION_ID = :POSITION_ID ,";
                query += " POSITION_WORK = :POSITION_WORK ,";
                query += " DEPARTMENT_ID = :DEPARTMENT_ID ,";
                query += " DATE_INWORK = :DATE_INWORK ,";
                query += " DATE_START_THIS_U = :DATE_START_THIS_U ,";
                query += " SPECIAL_NAME = :SPECIAL_NAME ,";
                query += " TEACH_ISCED_ID = :TEACH_ISCED_ID ,";
                query += " GRAD_LEV_ID = :GRAD_LEV_ID ,";
                query += " GRAD_CURR = :GRAD_CURR ,";
                query += " GRAD_ISCED_ID = :GRAD_ISCED_ID ,";
                query += " GRAD_PROG = :GRAD_PROG ,";
                query += " GRAD_UNIV = :GRAD_UNIV ,";
                query += " GRAD_COUNTRY_ID = :GRAD_COUNTRY_ID ,";
                query += " DEFORM_ID = :DEFORM_ID ,";
                query += " SIT_NO = :SIT_NO ,";
                query += " SALARY = :SALARY ,";
                query += " POSITION_SALARY = :POSITION_SALARY ,";
                query += " RELIGION_ID = :RELIGION_ID ,";
                query += " MOVEMENT_TYPE_ID = :MOVEMENT_TYPE_ID ,";
                query += " MOVEMENT_DATE = :MOVEMENT_DATE ,";
                query += " DECORATION = :DECORATION ,";
                query += " RESULT1 = :RESULT1 ,";
                query += " PERCENT_SALARY1 = :PERCENT_SALARY1 ,";
                query += " RESULT2 = :RESULT2 ,";
                query += " PERCENT_SALARY2 = :PERCENT_SALARY2 ";
                query += " where UOC_ID = :UOC_ID ";

                using (OracleCommand com = new OracleCommand(query, con))
                {
                    com.Parameters.Add(new OracleParameter("UNIV_ID", ddlUniv.SelectedValue));
                    com.Parameters.Add(new OracleParameter("CITIZEN_ID", lbCitizenID.Text));
                    com.Parameters.Add(new OracleParameter("PREFIX_NAME", ddlPrefixName.SelectedValue));
                    com.Parameters.Add(new OracleParameter("STF_FNAME", tbName.Text));
                    com.Parameters.Add(new OracleParameter("STF_LNAME", tbLastName.Text));
                    com.Parameters.Add(new OracleParameter("GENDER_ID", ddlGender.SelectedValue));
                    com.Parameters.Add(new OracleParameter("BIRTHDAY", DateTime.Parse(tbBirthday.Text)));
                    com.Parameters.Add(new OracleParameter("HOMEADD", tbHomeAdd.Text));
                    com.Parameters.Add(new OracleParameter("MOO", tbMoo.Text));
                    com.Parameters.Add(new OracleParameter("STREET", tbStreet.Text));
                    com.Parameters.Add(new OracleParameter("PROVINCE_ID", ddlProvince.SelectedValue));
                    com.Parameters.Add(new OracleParameter("DISTRICT_ID", ddlDistrict.SelectedValue));
                    com.Parameters.Add(new OracleParameter("SUB_DISTRICT_ID", ddlSubDistrict.SelectedValue));
                    com.Parameters.Add(new OracleParameter("TELEPHONE", tbTelephone.Text));
                    com.Parameters.Add(new OracleParameter("ZIPCODE", tbZipcode.Text));
                    com.Parameters.Add(new OracleParameter("NATION_ID", ddlNation.SelectedValue));
                    com.Parameters.Add(new OracleParameter("STAFFTYPE_ID", ddlStafftype.SelectedValue));
                    com.Parameters.Add(new OracleParameter("TIME_CONTACT_ID", ddlTimeContact.SelectedValue));
                    com.Parameters.Add(new OracleParameter("BUDGET_ID", ddlBudget.SelectedValue));
                    com.Parameters.Add(new OracleParameter("SUBSTAFFTYPE_ID", ddlSubStafftype.SelectedValue));
                    com.Parameters.Add(new OracleParameter("ADMIN_POSITION_ID", ddlAdminPosition.SelectedValue));
                    com.Parameters.Add(new OracleParameter("POSITION_ID", ddlPosition.SelectedValue));
                    com.Parameters.Add(new OracleParameter("POSITION_WORK", tbPositionWork.Text));
                    com.Parameters.Add(new OracleParameter("DEPARTMENT_ID", ddlDepartment.SelectedValue));
                    com.Parameters.Add(new OracleParameter("DATE_INWORK", DateTime.Parse(tbDateInwork.Text)));
                    com.Parameters.Add(new OracleParameter("DATE_START_THIS_U", DateTime.Parse(tbDateStartThisU.Text)));
                    com.Parameters.Add(new OracleParameter("SPECIAL_NAME", tbSpecialName.Text));
                    com.Parameters.Add(new OracleParameter("TEACH_ISCED_ID", ddlTeachISCED.SelectedValue));
                    com.Parameters.Add(new OracleParameter("GRAD_LEV_ID", ddlGradLev.SelectedValue));
                    com.Parameters.Add(new OracleParameter("GRAD_CURR", tbGradCURR.Text));
                    com.Parameters.Add(new OracleParameter("GRAD_ISCED_ID", ddlGradISCED.SelectedValue));
                    com.Parameters.Add(new OracleParameter("GRAD_PROG", ddlGradProg.SelectedValue));
                    com.Parameters.Add(new OracleParameter("GRAD_UNIV", tbGradUniv.Text));
                    com.Parameters.Add(new OracleParameter("GRAD_COUNTRY_ID", ddlGradCountry.SelectedValue));
                    com.Parameters.Add(new OracleParameter("DEFORM_ID", ddlDeform.SelectedValue));
                    com.Parameters.Add(new OracleParameter("SIT_NO", tbSitNo.Text));
                    com.Parameters.Add(new OracleParameter("SALARY", tbSalary.Text));
                    com.Parameters.Add(new OracleParameter("POSITION_SALARY", tbPositionSalary.Text));
                    com.Parameters.Add(new OracleParameter("RELIGION_ID", ddlReligion.SelectedValue));
                    com.Parameters.Add(new OracleParameter("MOVEMENT_TYPE_ID", ddlMovementType.SelectedValue));
                    if (tbMovementDate.Text == "")
                    {
                        com.Parameters.Add(new OracleParameter("MOVEMENT_DATE", DBNull.Value));
                    }
                    else
                    {
                        com.Parameters.Add(new OracleParameter("MOVEMENT_DATE", DateTime.Parse(tbMovementDate.Text)));
                    }
                    com.Parameters.Add(new OracleParameter("DECORATION", tbDecoration.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("UOC_ID", int.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()))));

                    if (com.ExecuteNonQuery() > 0)
                    {
                        result = true;
                    }
                }

                return(result);
            }
        }
Beispiel #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    int.TryParse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), out id);
                    lb1.Text = id.ToString();
                }
                else
                {
                    Response.Redirect("listGP7-admin.aspx");
                }
            }

            OracleConnection  objConn   = new OracleConnection();
            OracleCommand     objCmd    = new OracleCommand();
            OracleDataAdapter dtAdapter = new OracleDataAdapter();

            string strConnString = null;

            DataSet       dsMain     = new DataSet();
            DataTable     dtMain     = null;
            StringBuilder strSQLMain = new StringBuilder();

            //strConnString = "DATA SOURCE=ORCL_RMUTTO;PASSWORD=Zxcvbnm;PERSIST SECURITY INFO=True;USER ID=Personnel";
            strConnString = "DATA SOURCE=ORCL;PASSWORD=Zxcvbnm;PERSIST SECURITY INFO=True;USER ID=Personnel";
            strSQLMain.Append("SELECT CITIZEN_ID,");
            strSQLMain.Append("(SELECT FULLNAME FROM REF_PREFIX_NAME WHERE UOC_STAFF.PREFIX_NAME = REF_PREFIX_NAME.PREFIX_NAME_ID) PREFIX_NAME,");
            strSQLMain.Append("STF_FNAME,");
            strSQLMain.Append("STF_LNAME,");
            strSQLMain.Append("BIRTHDAY,");
            strSQLMain.Append("DATE_INWORK,");
            strSQLMain.Append("(SELECT STAFFTYPE_NAME FROM REF_STAFFTYPE WHERE REF_STAFFTYPE.STAFFTYPE_ID = UOC_STAFF.STAFFTYPE_ID) STAFFTYPE_ID,");
            strSQLMain.Append("FATHER_NAME || '  ' || FATHER_LNAME FATHER_NAME,");
            strSQLMain.Append("MOTHER_NAME || '  ' || MOTHER_LNAME MOTHER_NAME,");
            strSQLMain.Append("MOTHER_ONAME,");
            strSQLMain.Append("COUPLE_NAME || '  ' || COUPLE_LNAME COUPLE_NAME,");
            strSQLMain.Append("COUPLE_ONAME");
            strSQLMain.Append(" FROM UOC_STAFF WHERE UOC_ID = " + Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "");
            objConn.ConnectionString = strConnString;
            var _with1 = objCmd;

            _with1.Connection       = objConn;
            _with1.CommandText      = strSQLMain.ToString();
            _with1.CommandType      = CommandType.Text;
            dtAdapter.SelectCommand = objCmd;
            dtAdapter.Fill(dsMain, "myDataGP7");
            dtMain = dsMain.Tables[0];

            DataSet       dsStudy     = new DataSet();
            DataTable     dtStudy     = null;
            StringBuilder strSQLStudy = new StringBuilder();

            strSQLStudy.Append("SELECT UNIV_NAME,");
            strSQLStudy.Append("TO_CHAR(START_DATE,'MON YYYY','NLS_CALENDAR=''THAI BUDDHA''NLS_DATE_LANGUAGE=THAI') START_DATE,");
            strSQLStudy.Append("TO_CHAR(END_DATE,'MON YYYY','NLS_CALENDAR=''THAI BUDDHA''NLS_DATE_LANGUAGE=THAI') END_DATE,");
            strSQLStudy.Append("QUALIFICATION");
            strSQLStudy.Append(" FROM PS_STUDY WHERE UOC_ID = " + Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "");
            strSQLStudy.Append(" ORDER BY STUDY_ID ASC");
            objConn.ConnectionString = strConnString;
            var _with2 = objCmd;

            _with2.Connection       = objConn;
            _with2.CommandText      = strSQLStudy.ToString();
            _with2.CommandType      = CommandType.Text;
            dtAdapter.SelectCommand = objCmd;
            dtAdapter.Fill(dsStudy, "myDataStudy");
            dtStudy = dsStudy.Tables[0];

            DataSet       dsProLicense     = new DataSet();
            DataTable     dtProLicense     = null;
            StringBuilder strSQLProLicense = new StringBuilder();

            strSQLProLicense.Append("SELECT LICENSE_NAME,");
            strSQLProLicense.Append("DEPARTMENT,");
            strSQLProLicense.Append("LICENSE_NUMBER,");
            strSQLProLicense.Append("TO_CHAR(START_DATE,'DD/MM/YYYY','NLS_CALENDAR=''THAI BUDDHA''NLS_DATE_LANGUAGE=THAI') START_DATE");
            strSQLProLicense.Append(" FROM PS_PRO_LICENSE WHERE UOC_ID = " + Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "");
            strSQLProLicense.Append(" ORDER BY PRO_ID ASC");
            objConn.ConnectionString = strConnString;
            var _with3 = objCmd;

            _with3.Connection       = objConn;
            _with3.CommandText      = strSQLProLicense.ToString();
            _with3.CommandType      = CommandType.Text;
            dtAdapter.SelectCommand = objCmd;
            dtAdapter.Fill(dsProLicense, "myDataProLicense");
            dtProLicense = dsProLicense.Tables[0];

            DataSet       dsTraining     = new DataSet();
            DataTable     dtTraining     = null;
            StringBuilder strSQLTraining = new StringBuilder();

            strSQLTraining.Append("SELECT TRAINING_NAME,");
            strSQLTraining.Append("TO_CHAR(START_DATE,'DD/MM/YYYY','NLS_CALENDAR=''THAI BUDDHA''NLS_DATE_LANGUAGE=THAI') START_DATE,");
            strSQLTraining.Append("TO_CHAR(END_DATE,'DD/MM/YYYY','NLS_CALENDAR=''THAI BUDDHA''NLS_DATE_LANGUAGE=THAI') END_DATE,");
            strSQLTraining.Append("DEPARTMENT");
            strSQLTraining.Append(" FROM PS_TRAINING WHERE UOC_ID = " + Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "");
            strSQLTraining.Append(" ORDER BY TRAINING_ID ASC");
            objConn.ConnectionString = strConnString;
            var _with4 = objCmd;

            _with4.Connection       = objConn;
            _with4.CommandText      = strSQLTraining.ToString();
            _with4.CommandType      = CommandType.Text;
            dtAdapter.SelectCommand = objCmd;
            dtAdapter.Fill(dsTraining, "myDataTraining");
            dtTraining = dsTraining.Tables[0];

            DataSet       dsPunish     = new DataSet();
            DataTable     dtPunish     = null;
            StringBuilder strSQLPunish = new StringBuilder();

            strSQLPunish.Append("SELECT YEAR,");
            strSQLPunish.Append("PUNISH_NAME,");
            strSQLPunish.Append("REF_DOC");
            strSQLPunish.Append(" FROM PS_PUNISHMENT WHERE UOC_ID = " + Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "");
            strSQLPunish.Append(" ORDER BY PUNISH_ID ASC");
            objConn.ConnectionString = strConnString;
            var _with5 = objCmd;

            _with5.Connection       = objConn;
            _with5.CommandText      = strSQLPunish.ToString();
            _with5.CommandType      = CommandType.Text;
            dtAdapter.SelectCommand = objCmd;
            dtAdapter.Fill(dsPunish, "myDataPunish");
            dtPunish = dsPunish.Tables[0];


            DataSet       dsPositionAndSalary     = new DataSet();
            DataTable     dtPositionAndSalary     = null;
            StringBuilder strSQLPositionAndSalary = new StringBuilder();

            strSQLPositionAndSalary.Append("SELECT TO_CHAR(START_DATE,'DD/MM/YYYY','NLS_CALENDAR=''THAI BUDDHA''NLS_DATE_LANGUAGE=THAI') START_DATE,");
            strSQLPositionAndSalary.Append("PAS_NAME,");
            strSQLPositionAndSalary.Append("NO_POSITION,");
            strSQLPositionAndSalary.Append("POSITION_TYPE,");
            strSQLPositionAndSalary.Append("POSITION_DEGREE,");
            strSQLPositionAndSalary.Append("SALARY,");
            strSQLPositionAndSalary.Append("POSITION_SALARY,");
            strSQLPositionAndSalary.Append("REF_DOC");
            strSQLPositionAndSalary.Append(" FROM PS_POSI_AND_SALARY WHERE UOC_ID = " + Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString())) + "");
            strSQLPositionAndSalary.Append(" ORDER BY PAS_ID ASC");
            objConn.ConnectionString = strConnString;
            var _with6 = objCmd;

            _with6.Connection       = objConn;
            _with6.CommandText      = strSQLPositionAndSalary.ToString();
            _with6.CommandType      = CommandType.Text;
            dtAdapter.SelectCommand = objCmd;
            dtAdapter.Fill(dsPositionAndSalary, "myDataPositionAndSalary");
            dtPositionAndSalary = dsPositionAndSalary.Tables[0];


            dtAdapter = null;
            objConn.Close();
            objConn = null;

            ReportDocument rpt = new ReportDocument();

            rpt.Load(Server.MapPath("~/Report/CR/personGP7.rpt"));

            rpt.SetDataSource(dtMain);
            rpt.Subreports["psStudy"].Database.Tables[0].SetDataSource(dtStudy);
            rpt.Subreports["psProLicense"].Database.Tables[0].SetDataSource(dtProLicense);
            rpt.Subreports["dsTraining"].Database.Tables[0].SetDataSource(dtTraining);
            rpt.Subreports["psPunish"].Database.Tables[0].SetDataSource(dtPunish);
            rpt.Subreports["psPositionAndSalary"].Database.Tables[0].SetDataSource(dtPositionAndSalary);

            CrystalReportViewer1.ReportSource = rpt;
        }
Beispiel #26
0
        private void ReadFile()
        {
            List <int>    pro_id   = new List <int>();
            List <string> img_file = new List <string>();

            using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
            {
                con.Open();
                using (OracleCommand com = new OracleCommand("SELECT PRO_ID, IMG_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));
                                img_file.Add(reader.GetString(1));
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < pro_id.Count; i++)
            {
                string path     = "Upload/Project/PDF/" + img_file[i];
                int    PRO_ID   = pro_id[i];
                string IMG_FILE = img_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/" + IMG_FILE));
                    if (FileIn.Exists)
                    {
                        FileIn.Delete();
                    }
                    DatabaseManager.ExecuteNonQuery("UPDATE TB_PROJECT SET IMG_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 #27
0
 protected void BindDataBase()
 {
     using (OracleConnection con = new OracleConnection(DatabaseManager.CONNECTION_STRING))
     {
         con.Open();
         using (OracleCommand com = new OracleCommand("SELECT FATHER_NAME, FATHER_LNAME, MOTHER_NAME, MOTHER_LNAME, MOTHER_ONAME, COUPLE_NAME, COUPLE_LNAME, COUPLE_ONAME FROM UOC_STAFF WHERE UOC_ID = '" + MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()) + "'", con))
         {
             using (OracleDataReader reader = com.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     int i = 0;
                     tbFatherName.Text        = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbFatherLastName.Text    = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbMotherName.Text        = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbMotherLastName.Text    = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbMotherOldLastName.Text = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbCoupleName.Text        = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbCoupleLastName.Text    = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                     tbCoupleOldLastName.Text = reader.IsDBNull(i) ? "" : reader.GetString(i); ++i;
                 }
             }
         }
     }
 }