public void aniadirDatos()
        {
            studentImpl            = new StudentImpl();
            stu                    = studentImpl.Get(id, idPerson);
            txtId.Text             = stu.PersonId.ToString();
            txtname.Text           = stu.Names;
            txtlastname.Text       = stu.LastName;
            txtlastname.Text       = stu.LastName;
            txtsecondlastname.Text = stu.SecondLastName;
            txtemail.Text          = stu.Email;
            txtPhone.Text          = stu.Phone;
            txtAddress.Text        = stu.Address;

            image = new BitmapImage();
            image.BeginInit();
            image.CacheOption = BitmapCacheOption.OnLoad;
            image.UriSource   = new Uri(DBImplementation.pathImages + stu.Photo + ".png");
            image.EndInit();
            imagesector.Source = image;


            pathImagePortada = DBImplementation.pathImages + stu.Photo + ".png";
            Location ubi = new Location(stu.Latitude, stu.Longitude);

            MyMap.Center   = ubi;
            ubicationPoint = ubi;
            Pushpin point = new Pushpin();

            point.Location = ubi;
            MyMap.Children.Clear();
            MyMap.Children.Add(point);
            idmodi = stu.TownId;
            llamarmuni(stu.TownId);
            txtrude.Text = stu.RudeNumber;
        }
        private void InsertNow_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                //names, lastName, secondLastName, address, phone, birthDate,gender,startDate,email
                if (txtname.Text != "" && txtlastname.Text != "" && txtAddress.Text != "" && txtPhone.Text != "" && txtBirth.Text != "" && txtGender.Text != "" && txtemail.Text != "" && txtrude.Text != "")
                {
                    string second;
                    if (txtsecondlastname.Text == null)
                    {
                        second = "";
                    }
                    else
                    {
                        second = txtsecondlastname.Text;
                    }

                    stu = new Student(txtname.Text, txtlastname.Text, txtsecondlastname.Text, txtAddress.Text, txtPhone.Text, txtBirth.SelectedDate.Value, txtGender.Text, txtemail.Text,
                                      ubicationPoint.Latitude, ubicationPoint.Longitude, byte.Parse(idTown.ToString()), pathImagePortada, txtrude.Text, idcourse);

                    studentImpl = new StudentImpl();
                    studentImpl.InsertTransaction(stu);


                    image = new BitmapImage();
                    image.BeginInit();
                    image.CacheOption = BitmapCacheOption.OnLoad;
                    image.UriSource   = new Uri(DBImplementation.pathImages + 0 + ".png");
                    image.EndInit();
                    imagesector.Source = image;



                    pathImagePortada = null;
                    MessageBox.Show("Student Inserted");
                }
                else
                {
                    MessageBox.Show("Don't leave data empty");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something happened \nCommunicate with the Suport department \[email protected]");
            }
        }
        private void InsertNow_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                MessageBox.Show(pathImagePortada);
                //string names, string lastName, string secondLastName, string address, string phone, string email, double latitude, double longitude, byte townId, string photo, string rudeNumber, int idCourse,string pathImage)
                stu         = new Student(stu.PersonId, txtname.Text, txtlastname.Text, txtsecondlastname.Text, txtAddress.Text, txtPhone.Text, txtemail.Text, ubicationPoint.Latitude, ubicationPoint.Longitude, idTown, DBImplementation.pathImages + stu.Photo + ".png", txtrude.Text, stu.IdCourse, pathImagePortada, stu.StudentId);
                studentImpl = new StudentImpl();
                studentImpl.UpdateTransaction(stu);

                MessageBox.Show("Teacher Modifed successfully!!!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }