protected override Entity OnAdd()
        {
            var newItem = new Dll.Employee.Employee();

            //App.MdiMainForm.OpenForm(frm, "Employee");
            ////f.Show(this);

            using (var frm = new frmEmployee_Add())
            {
                frm.ItemData = newItem;
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return(null);
                }
            }

            App.LogAction("Employee", "Created Employee : " + newItem.EmpNum);

            ItemDataCollection.Add(newItem);
            return(newItem);
        }
예제 #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                var empnum = 0;
                if (!int.TryParse(txtIdNum.Text, out empnum))
                {
                    MessageDialog.Show("Invalid Employee Number", "You have entered an Invalid Number");
                    txtIdNum.SelectAll();
                    return;
                }
                ;

                var empId = new EmployeeDataReader().GetIdOf(empnum);

                if (empId == 0)
                {
                    MessageDialog.Show("Invalid Employee Number", "You have entered an Invalid Number");
                    txtIdNum.SelectAll();
                    return;
                }

                EmployeeId = empId;


                ItemData = (new EmployeeDataReader()).GetItemOf(empId);


                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageDialog.ShowError(ex, this);
            }
        }