public ErrorWindow createEmployee(string[] d) { MakePerson P = new MakePerson(d, cn); MakeEmployee E = new MakeEmployee(d[5], d[6], d[7], d[8], cn); try { P.CreatePerson(); } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); return Error; } try { E.CreateEmployee(); } catch (OleDbException ex) { try { P.DeletePerson(); } catch (OleDbException ex2) { } ErrorWindow Error = new ErrorWindow(ex.Message); return Error; } return null; }
public ErrorWindow createEmployee(string[] d) { MakePerson P = new MakePerson(d, cn); MakeEmployee E = new MakeEmployee(d[5], d[6], d[7], d[8], cn); try { P.CreatePerson(); } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); return(Error); } try { E.CreateEmployee(); } catch (OleDbException ex) { try { P.DeletePerson(); } catch (OleDbException ex2) { } ErrorWindow Error = new ErrorWindow(ex.Message); return(Error); } return(null); }
private void AddEmployeeSubmit_Click(object sender, RoutedEventArgs e) { string[] Data = new string[5]; Data[0] = IDText.GetLineText(0); Data[1] = NameText.GetLineText(0); Data[2] = PhoneText.GetLineText(0); Data[3] = AddressText.GetLineText(0); Data[4] = SexText.GetLineText(0); string EID = Data[0]; string Salary = SalaryText.GetLineText(0); string StartDate = StartDateText.GetLineText(0); string ManagerID = ManagerText.GetLineText(0); MakePerson P = new MakePerson(Data, cn); MakeEmployee E = new MakeEmployee(EID, Salary, StartDate, ManagerID, cn); try { P.CreatePerson(); } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); return; } try { E.CreateEmployee(); } catch (OleDbException ex) { try { P.DeletePerson(); } catch (OleDbException ex2) { } ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); return; } this.Close(); }