Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTitle.Text == "")
            {
                MessageBox.Show("Employee title field is required.", clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int intResult = 0;
                clsEmployeeTitle employeetitle = new clsEmployeeTitle();
                employeetitle.Title = txtTitle.Text;
                intResult           = employeetitle.Add();

                if (intResult > 0)
                {
                    switch (_FormCaller)
                    {
                    case FormCallers.EmployeeDetails:
                        pfrmEmployeeDetails.BindEmployeeTitle();
                        break;
                    }
                }
                else
                {
                    MessageBox.Show("An error occured while adding a new record.", clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                Close();
            }
        }