Ejemplo n.º 1
0
        private void SubmitPerson_Click(object sender, RoutedEventArgs e)
        {
            if (Employee)
            {
                string[] data = new string[8];
                data[0] = PersonIDBox.GetLineText(0);
                data[1] = PersonNameBox.GetLineText(0);
                data[2] = PersonPhoneBox.GetLineText(0);
                data[3] = PersonAddressBox.GetLineText(0);
                data[4] = PersonSexBox.GetLineText(0);
                data[5] = PersonOther1Box.GetLineText(0);
                data[6] = PersonOther2Box.GetLineText(0);
                data[7] = PersonOther3Box.GetLineText(0);

                MC.ModifyEmployee(data);

                PersonIDBox.Clear();
                PersonNameBox.Clear();
                PersonPhoneBox.Clear();
                PersonAddressBox.Clear();
                PersonSexBox.Clear();
                PersonOther1Box.Clear();
                PersonOther2Box.Clear();
                PersonOther3Box.Clear();

                Employee = false;
                EmployeeCheck.IsChecked      = false;
                CustomerCheck.Visibility     = Visibility.Visible;
                PersonOther1Box.Visibility   = Visibility.Collapsed;
                PersonOther1Label.Visibility = Visibility.Collapsed;
                PersonOther2Box.Visibility   = Visibility.Collapsed;
                PersonOther2Label.Visibility = Visibility.Collapsed;
                PersonOther3Box.Visibility   = Visibility.Collapsed;
                PersonOther3Label.Visibility = Visibility.Collapsed;
            }
            else if (Customer)
            {
                string[] data = new string[6];
                data[0] = PersonIDBox.GetLineText(0);
                data[1] = PersonNameBox.GetLineText(0);
                data[2] = PersonPhoneBox.GetLineText(0);
                data[3] = PersonAddressBox.GetLineText(0);
                data[4] = PersonSexBox.GetLineText(0);
                data[5] = PersonOther1Box.GetLineText(0);

                MC.ModifyCustomer(data);

                PersonIDBox.Clear();
                PersonNameBox.Clear();
                PersonPhoneBox.Clear();
                PersonAddressBox.Clear();
                PersonSexBox.Clear();
                PersonOther1Box.Clear();

                Customer = false;
                CustomerCheck.IsChecked      = false;
                EmployeeCheck.Visibility     = Visibility.Visible;
                PersonOther1Box.Visibility   = Visibility.Collapsed;
                PersonOther1Label.Visibility = Visibility.Collapsed;
            }
        }
Ejemplo n.º 2
0
        private void SubmitPerson_Click(object sender, RoutedEventArgs e)
        {
            if (Employee)
            {
                string[] data = new string[8];
                data[0] = PersonIDBox.GetLineText(0);
                data[1] = PersonNameBox.GetLineText(0);
                data[2] = PersonPhoneBox.GetLineText(0);
                data[3] = PersonAddressBox.GetLineText(0);
                data[4] = PersonSexBox.GetLineText(0);
                data[5] = PersonOther1Box.GetLineText(0);
                data[6] = PersonOther2Box.GetLineText(0);
                data[7] = PersonOther3Box.GetLineText(0);

                try
                {
                    try
                    {
                        MC.ModifyEmployee(data);
                    }
                    catch (ArgumentException AE)
                    {
                        ErrorWindow Error = new ErrorWindow(AE.Message);
                        Error.Title = "Data Field Error";
                        Error.ShowDialog();
                    }
                }
                catch (OleDbException ex)
                {
                    ErrorWindow Error = new ErrorWindow(ex.Message);
                    Error.Title = "Data Field Error";
                    Error.ShowDialog();
                }

                PersonIDBox.Clear();
                PersonNameBox.Clear();
                PersonPhoneBox.Clear();
                PersonAddressBox.Clear();
                PersonSexBox.Clear();
                PersonOther1Box.Clear();
                PersonOther2Box.Clear();
                PersonOther3Box.Clear();

                Employee = false;
                EmployeeCheck.IsChecked      = false;
                CustomerCheck.Visibility     = Visibility.Visible;
                PersonOther1Box.Visibility   = Visibility.Collapsed;
                PersonOther1Label.Visibility = Visibility.Collapsed;
                PersonOther2Box.Visibility   = Visibility.Collapsed;
                PersonOther2Label.Visibility = Visibility.Collapsed;
                PersonOther3Box.Visibility   = Visibility.Collapsed;
                PersonOther3Label.Visibility = Visibility.Collapsed;
            }
            else if (Customer)
            {
                string[] data = new string[6];
                data[0] = PersonIDBox.GetLineText(0);
                data[1] = PersonNameBox.GetLineText(0);
                data[2] = PersonPhoneBox.GetLineText(0);
                data[3] = PersonAddressBox.GetLineText(0);
                data[4] = PersonSexBox.GetLineText(0);
                data[5] = PersonOther1Box.GetLineText(0);

                try
                {
                    try
                    {
                        MC.ModifyCustomer(data);
                    }
                    catch (ArgumentException AE)
                    {
                        ErrorWindow Error = new ErrorWindow(AE.Message);
                        Error.Title = "Data Field Error";
                        Error.ShowDialog();
                    }
                }
                catch (OleDbException ex)
                {
                    ErrorWindow Error = new ErrorWindow(ex.Message);
                    Error.Title = "Data Field Error";
                    Error.ShowDialog();
                }

                PersonIDBox.Clear();
                PersonNameBox.Clear();
                PersonPhoneBox.Clear();
                PersonAddressBox.Clear();
                PersonSexBox.Clear();
                PersonOther1Box.Clear();

                Customer = false;
                CustomerCheck.IsChecked      = false;
                EmployeeCheck.Visibility     = Visibility.Visible;
                PersonOther1Box.Visibility   = Visibility.Collapsed;
                PersonOther1Label.Visibility = Visibility.Collapsed;
            }
        }