Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txt_name.Text != "" && txt_home_num.Text != "" && txt_moo.Text != "" && txt_soi.Text != "" && txt_rd.Text != "" && txt_subdis.Text != "" && txt_dis.Text != "" && combo_province.Text != "" && txt_mobile.Text != "" && txt_id_card.Text != "" && txt_user_issuer.Text != "" && txt_plate.Text != "" && combo_province1.Text != "" && txt_brand.Text != "" && txt_color.Text != "" && txt_cb.Text != "" && txt_amount.Text != "" && txt_type.Text != "")
     {
         if (button1.Text == "บันทึก")
         {
             button1.Text      = "ยืนยัน";
             groupBox1.Enabled = false;
             groupBox2.Enabled = false;
             button2.Visible   = true;
         }
         else
         {
             if (MessageBox.Show("ยืนยันข้อมุลถูกต้อง ใช่ หรือ ไม่", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
             {
                 GetEmpConfirmForm getEmp = new GetEmpConfirmForm();
                 getEmp.ShowDialog();
                 if (getEmp.checkValue)
                 {
                     string emp_id     = getEmp.emp_id;
                     string cpoint     = File.ReadAllText(script.file_cpoint).Split('|')[0];
                     string col        = "`memo_id_list_id`,`memo_name_cus`,`memo_home_no`,`memo_moo`,`memo_soi`,`memo_rd`,`memo_subdis`,`memo_dis`,`memo_province_add`,`memo_tel`,memo_mobile,`memo_id_card`,`memo_card_no`,`memo_card_issuer`,`memo_card_is_date`,`memo_card_ex_date`,`memo_cpoint_id`,`memo_date`,`memo_time`,`memo_cabinet`,`memo_type_id`,`memo_license_plate`,`memo_province_plate`,`memo_brand`,`memo_color`,`mome_note`,`memo_emp_id`,memo_amount,`memo_fine_amount`,`memo_drive_id`,memo_type";
                     string value      = "'5','" + txt_name.Text + "','" + txt_home_num.Text + "','" + txt_moo.Text + "','" + txt_soi.Text + "','" + txt_rd.Text + "','" + txt_subdis.Text + "','" + txt_dis.Text + "','" + combo_province.Text.Trim() + "','" + txt_tel.Text + "','" + txt_mobile.Text + "','" + txt_id_card.Text.Trim() + "','" + txt_card_num.Text.Trim() + "','" + txt_user_issuer.Text + "','" + card_is_date.Text + "','" + card_ex_date.Text + "','" + cpoint + "','" + date_memo.Text + "','" + time_memo.Text + "','" + txt_cb.Text + "','" + combo_type_car.Text + "','" + txt_plate.Text + "','" + combo_province1.Text.Trim() + "','" + txt_brand.Text + "','" + txt_color.Text + "','" + txt_note.Text.Trim() + "','" + emp_id + "','" + txt_amount.Text.Trim() + "','" + txt_fine_amount.Text.Trim() + "','" + txt_drive_id.Text.Trim() + "','" + txt_type.Text + "'";
                     string sql_insert = "INSERT INTO `tbl_memo` (" + col + ") VALUE (" + value + ")";
                     if (script.InsertUpdae_SQL(sql_insert))
                     {
                         MessageBox.Show("บันทึกข้อมูลสำเร็จ", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         script.GetReportTollNotPay(date_memo.Value, txt_id_card.Text.Trim(), txt_card_num.Text.Trim());
                         this.Close();
                     }
                     else
                     {
                         MessageBox.Show("Error : ผิดผลาด", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("ใส่ข้อมูลให้ครบถ้วน", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txt_id_card.Text != "" && txt_name.Text != "ไม่พบข้อมูล" && txt_bill.Text != "" && txt_bill_no.Text != "")
     {
         if (button1.Text == "บันทึก")
         {
             button1.Text      = "ยืนยัน";
             groupBox2.Enabled = false;
             groupBox1.Enabled = false;
             button2.Visible   = true;
         }
         else
         {
             if (MessageBox.Show("ยืนยันข้อมุลถูกต้อง ใช่ หรือ ไม่", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
             {
                 GetEmpConfirmForm getEmp = new GetEmpConfirmForm();
                 getEmp.ShowDialog();
                 if (getEmp.checkValue)
                 {
                     string emp_id = getEmp.emp_id;
                     string update = "UPDATE `tbl_memo` SET `memo_amount`='" + txt_total.Text.Trim() + "',`memo_status`='1',`memo_bill_book`='" + txt_bill.Text.Trim() + "',`memo_bill_no`='" + txt_bill_no.Text.Trim() + "',`memo_date_payment`='" + date_pay.Value.ToString("dd-MM-yyyy") + "',`memo_emp_id_payment`='" + emp_id + "' WHERE `memo_id` = '" + lb_memo_id.Text.Trim() + "' AND `memo_status` IS NULL";
                     if (script.InsertUpdae_SQL(update))
                     {
                         MessageBox.Show("บันทึกข้อมูลสำเร็จ", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         this.Close();
                     }
                     else
                     {
                         MessageBox.Show("Error : ผิดผลาด", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("ใส่ข้อมูลให้ครบถ้วน", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }