Exemplo n.º 1
0
        private void add_Click(object sender, EventArgs e)
        {
            if (!validateForm())
            {
                return;
            }
            readData();
            int employeeID = conDB.addEmployee();

            Debug.WriteLine(employeeID);
            if (employeeID == 0)
            {
                MessageBox.Show("ชื่อพนักงาน \"" + nameTH.Text + "\" มีการเพิ่มเข้ามาแล้ว\nกรุณาตรวจสอบ");
                nameTH.Focus();
            }
            else
            {
                clearData();
                if (fRMMain.oldPage == "UCAddCustomerClem")
                {
                    fRMMain.addCustomerClem.employeeClem.Text = nameTH.Text;
                    fRMMain.addCustomerClem.employeeClem.Focus();
                }
                else if (fRMMain.oldPage == "UCAddEmployeeClem")
                {
                    fRMMain.addEmployeeClem.employeeClem.Text = nameTH.Text;
                    fRMMain.addEmployeeClem.employeeClem.Focus();
                }
                fRMMain.changPage();
            }
        }