Пример #1
0
        private void ButtonUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //I have to add this here, because struct doesnt work with data binding
                newAdress.street = this.textBoxStreet.Text;

                if (Int32.TryParse(this.textBoxApart.Text, out toInt))
                {
                    newAdress.houseNumber = toInt;
                }
                else
                {
                    throw new Exception("מספר הבית אינו תקין");
                }

                newAdress.city = this.textBoxCity.Text;

                testerToUpdate._adressOfTester = newAdress;

                //Just if everithing is correct and legal, will implemet the update
                bl.updateDetailsTester(testerToUpdate);

                //This continue if there isnt ecemption
                this.Close();

                optionsToTester opTester = new optionsToTester();
                opTester.receiveTester(testerToUpdate);
                opTester.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void ButtonUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //I have to add this here, because struct doesnt work with data binding
                newAdress.street = this.textBoxStreet.Text;

                if (Int32.TryParse(this.textBoxApart.Text, out toInt))
                {
                    newAdress.houseNumber = toInt;
                }
                else
                {
                    throw new Exception("מספר הבית אינו תקין");
                }

                newAdress.city = this.textBoxCity.Text;

                currentTest._endAdress = newAdress;

                //Here we updating the reports manual
                testReport.keepDistance       = KeepDistancePanelPass.IsChecked.Value;
                testReport.parkingBrewers     = ParkingBrewersPanelPass.IsChecked.Value;
                testReport.lookingAtMirrors   = LookingAtMirrorsePanelPass.IsChecked.Value;
                testReport.winkersSignal      = WinkersSignalPanelPass.IsChecked.Value;
                testReport.pickUpTheHandbreak = PickUpTheHandbreakPanelPass.IsChecked.Value;
                testReport.lookAtTheSigns     = LookAtTheSignsPanelPass.IsChecked.Value;
                testReport.givingRightOfWay   = GivingRightOfWaPanelPass.IsChecked.Value;

                currentTest._reportsOfTest = testReport;

                //Here we updating the remark manual
                currentTest._remark = textBoxRemark.Text;

                bl.updateDetailsTest(currentTest);

                //If everithing worked right
                this.Close();

                if (currentTest._succeedOrFailed == true)
                {
                    MessageBox.Show(" תלמיד מספר " + currentTest.ID_Trainee + " עבר בהצלחה  ");
                }
                else
                {
                    MessageBox.Show(" תלמיד מספר " + currentTest.ID_Trainee + " נכשל בטסט ");
                }

                optionsToTester opTester = new optionsToTester();
                opTester.receiveTester(thisTester);
                opTester.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void ButtonToEnter_Click(object sender, RoutedEventArgs e)
        {
            bl = BL.factoryBL.getBL();

            currentTesters  = bl.testersList();
            currentTrainees = bl.traineesList();

            myTester  = new BE.Tester();
            myTrainee = new BE.Trainee();

            try
            {
                //To check the ID
                if (Int64.TryParse(this.textBoxID.Text, out toLong))
                {
                    ID = toLong;
                }
                else
                {
                    throw new Exception("ת.ז אינו תקין");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //To check the password;
            password = passwordBox.Password;

            foreach (Tester testerItem in currentTesters)
            {
                if (testerItem._ID == ID && testerItem._password == password)
                {
                    myTester = new BE.Tester(testerItem);
                    optionsToTester opTester = new optionsToTester();
                    opTester.receiveTester(myTester);
                    opTester.Show();

                    return;
                }
            }

            foreach (Trainee traineeItem in currentTrainees)
            {
                if (traineeItem._ID == ID && traineeItem._password == password)
                {
                    myTrainee = new BE.Trainee(traineeItem);
                    optionsToTrainee opTrainee = new optionsToTrainee();
                    opTrainee.receiveTrainee(myTrainee);
                    opTrainee.Show();

                    return;
                }
            }

            try
            {
                //If we arrive here throw that we didnt find
                throw new Exception("אחד או יותר מהפרטים אינם תקינים");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }