Пример #1
0
 protected void btnCheckEmp_Click(object sender, EventArgs e)
 {
     if (dBScript.checkIDCard(txtNewIDCard.Text.Trim()))
     {
         if (dBScript.checkDupicalIDCard(txtNewIDCard.Text.Trim()))
         {
             if (txtNationality.Text != "" && txtRace.Text != "" && txtReligion.Text != "" && txtBookBank.Text != "" && txtStatusRd.SelectedValue != "" && txtAff.SelectedValue != "")
             {
                 string emp_id = dBScript.createEmpId(txtOfferDate);
                 string text   = "emp_id, emp_profix_id, emp_name, emp_lname, emp_pos_id, emp_affi_id, emp_cpoint_id, emp_type_emp_id, emp_start_working, emp_birth_date, emp_origin, emp_nationality, emp_religion, emp_id_card, emp_status, emp_book_bank_no,emp_img_profile";
                 string value  = "'" + emp_id + "', '" + hdProfix.Value + "', '" + hdName.Value + "', '" + hdLname.Value + "', '" + hdPos.Value + "', '" + txtAff.SelectedValue + "', '" + hdCpoint.Value + "', '2', '" + txtOfferDate.Text + "', '" + txtBirdthDay.Text + "', '" + txtRace.Text + "', '" + txtNationality.Text + "', '" + txtReligion.Text + "', '" + txtNewIDCard.Text + "', '" + txtStatusRd.SelectedValue + "', '" + txtBookBank.Text + "',''";
                 string sql    = "INSERT INTO tbl_emp_profile (" + text + ") VALUES (" + value + ")";
                 if (dBScript.actionSql("UPDATE tbl_guest_list SET guest_list_idcard = '" + txtNewIDCard.Text.Trim() + "' WHERE guest_list_id = '" + hdGuest_list_id.Value + "'"))
                 {
                     if (dBScript.actionSql(sql))
                     {
                         string insert_history_text  = "history_status_id,history_date,history_note,history_emp_id";
                         string insert_history_value = "'1','00-00-0000','', '" + dBScript.getEmpData("id", emp_id) + "'";
                         string insert_history       = "INSERT INTO tbl_history (" + insert_history_text + ") VALUES (" + insert_history_value + ")";
                         dBScript.actionSql(insert_history);
                         ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('บันทึก ประวัติส่วนตัว สำเร็จ')", true);
                         BindData();
                     }
                     else
                     {
                         ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Error : บันทึก ประวัติส่วนตัว ล้มเหลว')", true);
                         BindData();
                     }
                 }
                 else
                 {
                     ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Error : ล้มเหลว')", true);
                 }
             }
             else
             {
                 ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('กรุณาใส่ข้อมูลให้ครบถ้วน')", true);
             }
         }
         else
         {
             ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('เลขบัตรประจำตัวประชาชน ซ้ำกับพนักงานที่ทำงานอยู่ในปัจจุบัน กรุณณาตรวจสอบ')", true);
         }
     }
     else
     {
         ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('เลขบัตรประจำตัวประชาชนไม่ถูกต้องกรุณณาตรวจสอบ')", true);
     }
 }