Beispiel #1
0
        private void AddCustomerSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[7];
            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);
            Data[5] = Data[0];
            Data[6] = TypeText.GetLineText(0);

            acc.createCustomer(Data).ShowDialog();

            this.Close();
        }
        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();
        }
        private void AddEmployeeSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[9];
            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);
            Data[5] = Data[0];
            Data[6] = SalaryText.GetLineText(0);
            Data[7] = StartDateText.GetLineText(0);
            Data[8] = ManagerText.GetLineText(0);

            aec.createEmployee(Data).ShowDialog();

            this.Close();
        }
        private void AddCustomerSubmit_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 Type = TypeText.GetLineText(0);

            MakePerson   P = new MakePerson(Data, cn);
            MakeCustomer E = new MakeCustomer(EID, Type, cn);

            try
            {
                P.CreatePerson();
            }
            catch (OleDbException ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            try
            {
                E.CreateCustomer();
            }
            catch (OleDbException ex)
            {
                try
                {
                    P.DeletePerson();
                }
                catch (OleDbException ex2) { }

                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            this.Close();
        }
Beispiel #5
0
        private void RemoveButton_Click(object sender, RoutedEventArgs e)
        {
            int    KeyNum = 0;
            string Num    = IDText.GetLineText(0);

            try
            {
                KeyNum = int.Parse(Num);
            }
            catch (Exception ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
            }

            if (Person)
            {
                D.DeletePart(KeyNum);
            }
            else if (Vehicle)
            {
                D.DeleteVehicle(KeyNum);
            }
            else if (Part)
            {
                D.DeletePart(KeyNum);
            }
            PersonCheck.IsChecked  = false;
            VehicleCheck.IsChecked = false;
            PartCheck.IsChecked    = false;
            Person  = false;
            Vehicle = false;
            Part    = false;
            PersonCheck.Visibility  = Visibility.Visible;
            VehicleCheck.Visibility = Visibility.Visible;
            PartCheck.Visibility    = Visibility.Visible;
            TextBoxLabel.Text       = "";
            IDText.Clear();
        }