Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string _empID = loConfiguration.insertEmployee(txtFirstName.Text, txtLastName.Text, txtMiddleName.Text, txtInitials.Text, cboEmployeeType.SelectedValue.ToString());
                MessageBox.Show("New employee successfully saved!", "Save Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (_empID != null || _empID != "")
                {
                    //if the one who called this window was from the master list window click,
                    //refresh the masterlist at the back of this window
                    if (lSender== "")
                    {
                        EmployeeMasterList _parent = Application.OpenForms["EmployeeMasterList"] as EmployeeMasterList;

                        this.Hide();
                        _parent.GetType().GetMethod("refresh").Invoke(_parent, null);

                        ViewEmployee _view = new ViewEmployee();
                        _view.EmployeeId = _empID;
                        _view.ShowDialog(_parent);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occured upon saving new employee.Exception: " + ex.Message, "Save Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally { Close(); }
        }
Example #2
0
 public EmployeeMasterList()
 {
     InitializeComponent();
     loConfiguration = new Controller.Configuration();
     frmViewEmployee = new ViewEmployee();
 }