private void btn_newRequest_Click(object sender, RoutedEventArgs e)
 {
     cro = CommunicationController.getCemetries();
     if (cro.ok)
     {
         this.cBox_cemetries.ItemsSource = cro.cemetries;
         showPartial(this.newEntry);
     }
     else
     {
         MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
     }
 }
 private void btn_requests_Click(object sender, RoutedEventArgs e)
 {
     cro = CommunicationController.getTombRequests();
     if (cro.ok)
     {
         this.requestTbl.ItemsSource = cro.tombRequests;
         showPartial(this.myRequests);
     }
     else
     {
         MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
     }
 }
 private void btn_cemetry_grounds_Click(object sender, RoutedEventArgs e)
 {
     cro = CommunicationController.getCemetryGround(CommunicationController.getSelectedCemetry());
     if (cro.ok)
     {
         this.datagrid_CemetryGrounds.ItemsSource = cro.cemetryGrounds;
         showPartial(this.cemetryGrounds);
     }
     else
     {
         if (cro.message.Contains("no entries found"))
         {
             if (MessageBox.Show("Zurzeit exisitiert kein Friedhofsgelände.\nMöchten Sie einen erstellen?", "Cimitero© Info", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
             {
                 showPartial(this.newCemetryGround);
             }
         }
         else
         {
             MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
         }
     }
 }
        private void btn_myData_click(object sender, RoutedEventArgs e)
        {
            cro = CommunicationController.getCustomerData();
            if (cro.ok)
            {
                this.tbox_title.Text = cro.customer[0].title;
                this.tbox_nachname.Text = cro.customer[0].lastName;
                this.tbox_vorname.Text = cro.customer[0].firstName;
                this.tbox_other_firstname.Text = cro.customer[0].otherFirstNames;
                this.tbox_adresse.Text = cro.customer[0].address;
                this.tbox_telefonnummer.Text = cro.customer[0].telephoneNumber;
                if(cro.customer[0].gebDatum != null)
                {
                    this.tbox_geburtsdatum.SelectedDate = DateTime.Parse(cro.customer[0].gebDatum);
                }
                showPartial(this.myData);

            }
            else
            {
                MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
 private void bttn_TombDetail_Click(object sender, RoutedEventArgs e)
 {
     if(this.table_tombs.SelectedItem != null)
     {
         Tomb selectedTomb = (Tomb)table_tombs.SelectedItem;
         cro = CommunicationController.getBillsOfTomb(selectedTomb);
         if (cro.ok)
         {
             this.table_Bills1.ItemsSource = cro.invoices;
             cro = CommunicationController.getBodiesOfTomb(selectedTomb);
             if (cro.ok)
             {
                 this.table_bodies.ItemsSource = cro.bodies;
                 showPartial(this.tombDetail);
             }
             else
             {
                 MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
             }
         }
         else
         {
             MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
         }
     }
     else
     {
         MessageBox.Show("No Tomb selected", "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
     }
 }
 private void cBox_cemetryGround_DropDownClosed(object sender, EventArgs e)
 {
     if (cBox_cemetries.SelectedItem != null)
     {
         cro = CommunicationController.getTombs(((CemetryGround)cBox_CemetryGrounds.SelectedItem));
         if (cro.ok)
         {
             this.cBox_Tombs.ItemsSource = cro.tombs;
         }
         else
         {
             MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
         }
     }
 }
        private void bttn_saveData_Click(object sender, EventArgs e)
        {
            try
              {
                  cro = CommunicationController.saveOrUpdateCustomerData(new Customer(CommunicationController.getCurrentlyLoggedInUser().personId, tbox_title.Text, tbox_vorname.Text, tbox_other_firstname.Text, tbox_nachname.Text, tbox_adresse.Text, tbox_telefonnummer.Text, DateTime.ParseExact(tbox_geburtsdatum.ToString(), "dd.MM.yyyy HH:mm:ss",CultureInfo.InvariantCulture).ToString("yyyy-MM-dd"), null));
                  if (cro.ok)
                  {
                      btn_myData_click(this, null);
                  }

              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
              }
        }
        private void bttn_sendRequest_Click(object sender, RoutedEventArgs e)
        {
            if (this.cBox_cemetries.SelectedItem != null && this.cBox_CemetryGrounds.SelectedItem != null && this.cBox_Tombs.SelectedItem != null)
            {
                try
                {
                    cro = CommunicationController.addTombRequest(new TombRequest(-1, DateTime.ParseExact(DateTime.Now.ToString(), "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd"), this.tbox_requestText.Text, ((Tomb)this.cBox_Tombs.SelectedItem).tombId, CommunicationController.getCurrentlyLoggedInUser().personId));
                    if (cro.ok)
                    {
                        MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Information);
                    }

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                }
            }
            else
            {
                MessageBox.Show("No Tomb Selected!", "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
        private void bttn_save_owner_change_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Tomb tmptomb = (Tomb)this.datagrid_Tombs.SelectedItem;
                cro = CommunicationController.addOrUpdateTomb(new TombDto(tmptomb.tombId, tmptomb.tombNo, CommunicationController.getSelectedCemetryGround().cemetryGroundId, ((Customer)this.cbox_invoice_tombid1.SelectedItem).personId));
                if (cro.ok)
                {
                    bttn_Tombs_Click(this, null);
                }
                else
                {
                    MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
 private void bttn_myTombs_Click(object sender, RoutedEventArgs e)
 {
     cro = CommunicationController.getTombsOfCustomer();
     if (cro.ok)
     {
         this.table_tombs.ItemsSource = cro.tombs;
         showPartial(this.myTombs);
     }
     else
     {
         MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
     }
 }
 private void bttnShowCoords_Click(object sender, RoutedEventArgs e)
 {
     cro = CommunicationController.sendBoundaryCoordinates(CommunicationController.getSelectedCemetryGround(), this.points);
     if (cro.ok)
     {
         cro = CommunicationController.sendTrackCoordinates(CommunicationController.getSelectedCemetryGround(), this.points_street);
         if (cro.ok)
         {
             cro = CommunicationController.sendTombCoordinates(CommunicationController.getSelectedCemetryGround(), this.points_tomb);
             if (cro.ok)
             {
                 MessageBox.Show("Erfolgreich gespeichert" + cro.message);
             }
             else
             {
                 MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
             }
         }
         else
         {
             MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
         }
     }
     else
     {
         MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
     }
 }
        private void bttn_createCemetry_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cro = CommunicationController.addCemetry(new Cemetry(Convert.ToInt32(tbox_cemetry_id.Text), tbox_cemetry_name.Text, tbox_cemetry_address.Text, Double.Parse(tbox_longitude.Text), Double.Parse(tbox_latitude.Text)));
                if (cro.ok)
                {
                    tbox_cemetry_id.Text = "1-";
                    tbox_cemetry_name.Text = "";
                    tbox_cemetry_address.Text = "";
                    tbox_longitude.Text = "";
                    tbox_latitude.Text = "";
                    lbl_newCemetry.Content = "Neuen Friedhof erstellen";

                    btn_cemetry_Click(this, null);
                }
                else
                {
                    MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
 private void bttn_tomb_invoice_save_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Console.WriteLine("output:" + tb_invoicedate.ToString());
         string invoiceDate = null;
         string paymentdate = null;
         if (tb_invoicedate.ToString() != "")
         {
             invoiceDate = DateTime.ParseExact(tb_invoicedate.ToString(), "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd");
         }
         if (tb_paymentdate.ToString() != "")
         {
             paymentdate = DateTime.ParseExact(tb_paymentdate.ToString(), "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd");
         }
         cro = CommunicationController.saveOrUpdateInvoice(new Invoice(Convert.ToInt32(tb_newbill_invoiceid.Text),
                                                                     invoiceDate,
                                                                     paymentdate,
                                                                     tb_newbill_invoicenumber.Text,
                                                                     float.Parse(tb_newbill_invoiceamount.Text),
                                                                     tb_newbill_invoicecurrency.Text,
                                                                     ((Tomb)this.cbox_invoice_tombid.SelectedItem).tombId));
         if (cro.ok)
         {
             tb_invoicedate.SelectedDate = null;
             tb_paymentdate.SelectedDate = null;
             tb_newbill_invoiceid.Text = "-1";
             tb_newbill_invoicenumber.Text = "";
             tb_newbill_invoiceamount.Text = "";
             tb_newbill_invoicecurrency.Text = "";
             this.cbox_invoice_tombid.SelectedItem = null;
         }
         else
         {
             MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
     }
 }
        private void datagrid_Tombs_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (datagrid_Tombs.SelectedItem != null)
            {
                if (this.datagrid_Tombs.SelectedItem != null)
                {
                    Tomb selectedTomb = (Tomb)datagrid_Tombs.SelectedItem;
                    tmpselectedTomb = selectedTomb;
                    cro = CommunicationController.getBillsOfTomb(selectedTomb);
                    if (cro.ok)
                    {
                        this.table_Bills1.ItemsSource = cro.invoices;
                    }
                    else
                    {
                        MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                    }
                    cro = CommunicationController.getBodiesOfTomb(selectedTomb);
                    if (cro.ok)
                    {
                        this.table_bodies.ItemsSource = cro.bodies;

                    }
                    else
                    {
                        MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                    }
                    cro = CommunicationController.getCustomerOfTomb(selectedTomb);
                    if (cro.ok)
                    {
                        Customer tmpCustomer = cro.customer[0];
                        this.lbl_title.Content = tmpCustomer.title + " " + tmpCustomer.firstName + " " + tmpCustomer.lastName;
                        this.lbl_address.Content = tmpCustomer.address;
                        this.lbl_birthdate.Content = tmpCustomer.gebDatum;
                        this.lbl_telephone.Content = tmpCustomer.telephoneNumber;

                    }
                    else
                    {
                        MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                    }
                    showPartial(this.tombDetail);

                }
                else
                {
                    MessageBox.Show("No Tomb selected", "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                }
            }
        }
 private void bttn_Tombs_Click(object sender, RoutedEventArgs e)
 {
     cro = CommunicationController.getTombs(CommunicationController.getSelectedCemetryGround());
     if (cro.ok)
     {
         this.datagrid_Tombs.ItemsSource = cro.tombs;
         showPartial(this.tombs);
     }
     else
     {
         MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
     }
 }
 private void bttn_tombdetail_newbill_Click(object sender, RoutedEventArgs e)
 {
     cro = CommunicationController.getTombs(CommunicationController.getSelectedCemetryGround());
     if (cro.ok)
     {
         this.cbox_invoice_tombid.ItemsSource = cro.tombs;
         this.showPartial(this.tombInvoice);
     }
     else
     {
         MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
     }
 }
        private void bttn_tombdetail_changeowner_Click(object sender, RoutedEventArgs e)
        {
            cro = CommunicationController.getCustomers();
            if (cro.ok)
            {
                this.cbox_invoice_tombid1.ItemsSource = cro.customer;
                Tomb tmptomb = (Tomb)this.datagrid_Tombs.SelectedItem;
                cro = CommunicationController.getCustomerOfTomb(tmptomb);
                if (cro.ok)
                {
                    this.cbox_invoice_tombid1.SelectedItem = cro.customer[0];

                }
                this.showPartial(this.tomb_change_owner);

            }
            else
            {
                MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
        private void bttn_create_CemetryGround(object sender, RoutedEventArgs e)
        {
            try
            {
                cro = CommunicationController.addOrUpdateCemetryGround(new CemetryGround(Convert.ToInt32(this.tbox_cemetryGround_id.Text), this.tbox_cemetryGroundName.Text, this.tbox_cemetryGroundAddress.Text, CommunicationController.getSelectedCemetry().cemetryId));
                if (cro.ok)
                {
                    this.tbox_cemetryGroundAddress.Text = "";
                    this.tbox_cemetryGroundName.Text = "";
                    this.tbox_cemetryGround_id.Text = "-1";
                    lbl_newCemetryGround.Content = "Neues Friedhofsgelände erstellen";

                    btn_cemetry_grounds_Click(this, null);
                }
                else
                {
                    MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
        private void bttn_myBills_Click(object sender, RoutedEventArgs e)
        {
            List<Invoice> tmpInvoices = new List<Invoice>();
            cro = CommunicationController.getBills();
            if (cro.ok)
            {

                foreach (Tomb tomb in cro.tombs)
                {
                    foreach (Invoice i in tomb.invoices)
                    {
                        tmpInvoices.Add(new Invoice(i.invoiceId, i.invoiceDate, i.paymentDate, i.invoiceNumber, i.total, i.currency, tomb.tombId));
                    }
                }
                this.table_Bills.ItemsSource = tmpInvoices;
                showPartial(this.myBills);
            }
            else
            {
                MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
        private void bttn_AddBody_Click(object sender, RoutedEventArgs e)
        {
            cro = CommunicationController.getTombs(CommunicationController.getSelectedCemetryGround());
            if (cro.ok)
            {
                if(cro.tombs != null)
                {
                    this.cbox_new_body_tombnumber.ItemsSource = cro.tombs;
                    this.showPartial(this.newBody);
                }

            }
            else
            {

            }
        }
        private void bttn_create_Tomb(object sender, RoutedEventArgs e)
        {
            try
            {
                cro = CommunicationController.addOrUpdateTomb(new TombDto(Convert.ToInt32(this.tbox_tomb_id.Text), this.tbox_TombNumber.Text, CommunicationController.getSelectedCemetryGround().cemetryGroundId));
                if (cro.ok)
                {
                    this.tbox_tomb_id.Text = "-1";
                    this.tbox_TombNumber.Text = "";
                    lbl_newTomb.Content = "Neues Grab erstellen";

                    bttn_Tombs_Click(this, null);
                }
                else
                {
                    MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
        public CimiteroEditor(Tomb tombToShow)
        {
            InitializeComponent();
            this.tmpTomb = tombToShow;
            points = new List<Point>();
            points_street = new List<Point>();
            drawMode = "Bounding";

            cro = CommunicationController.getBoundaryCoordinates(CommunicationController.getSelectedCemetryGround());
            if (cro.ok)
            {

                for (int i = 0; i < cro.boundaryCoordinates.Count; i++)
                {
                    Line line = new Line();
                    line.Stroke = Brushes.Black;

                    if (i + 1 < cro.boundaryCoordinates.Count)
                    {
                        line.X1 = cro.boundaryCoordinates[i].x;
                        line.X2 = cro.boundaryCoordinates[i + 1].x;
                        line.Y1 = cro.boundaryCoordinates[i].y;
                        line.Y2 = cro.boundaryCoordinates[i + 1].y;
                    }
                    else
                    {
                        line.X1 = cro.boundaryCoordinates[i].x;
                        line.X2 = cro.boundaryCoordinates[0].x;
                        line.Y1 = cro.boundaryCoordinates[i].y;
                        line.Y2 = cro.boundaryCoordinates[0].y;
                    }
                    line.StrokeThickness = 10;
                    cimitero_canvas.Children.Add(line);
                    points.Add(new Point(cro.boundaryCoordinates[i].x, cro.boundaryCoordinates[i].y));

                }

                cro = CommunicationController.getTrackCoordinates(CommunicationController.getSelectedCemetryGround());
                if (cro.ok)
                {
                    for (int i = 0; i < cro.boundaryCoordinates.Count; i++)
                    {
                        Line line = new Line();
                        line.Stroke = Brushes.Green;

                        if (i + 1 < cro.boundaryCoordinates.Count)
                        {
                            line.X1 = cro.boundaryCoordinates[i].x;
                            line.X2 = cro.boundaryCoordinates[i + 1].x;
                            line.Y1 = cro.boundaryCoordinates[i].y;
                            line.Y2 = cro.boundaryCoordinates[i + 1].y;
                        }

                        line.StrokeThickness = 10;
                        cimitero_canvas.Children.Add(line);
                        points_street.Add(new Point(cro.boundaryCoordinates[i].x, cro.boundaryCoordinates[i].y));
                    }

                    cro = CommunicationController.getTombCoordinates(CommunicationController.getSelectedCemetryGround());
                    if (cro.ok)
                    {
                        for (int x = 0; x < cro.tombCoordinates.Count; x++)
                        {

                            System.Windows.Shapes.Rectangle rect;
                            rect = new System.Windows.Shapes.Rectangle();
                            rect.Stroke = new SolidColorBrush(Colors.Black);
                            if (tmpTomb != null)
                            {
                                if (cro.tombCoordinates[x].tombNo == tmpTomb.tombNo)
                                {
                                    rect.Fill = new SolidColorBrush(Colors.DarkGreen);
                                }
                                else
                                {
                                    rect.Fill = new SolidColorBrush(Colors.LavenderBlush);
                                }
                            }
                            else
                            {
                                rect.Fill = new SolidColorBrush(Colors.LavenderBlush);
                            }

                            if (cro.tombCoordinates[x].isSupersized)
                                rect.Width = 60;
                            else
                                rect.Width = 30;

                            rect.Height = 30;

                            Canvas.SetLeft(rect, cro.tombCoordinates[x].x);
                            Canvas.SetTop(rect, cro.tombCoordinates[x].y);
                            this.cimitero_canvas.Children.Add(rect);

                            TextBlock textBlock = new TextBlock();
                            textBlock.Text = cro.tombCoordinates[x].tombNo;
                            textBlock.Foreground = Brushes.Red;
                            Canvas.SetLeft(textBlock, cro.tombCoordinates[x].x);
                            Canvas.SetTop(textBlock, cro.tombCoordinates[x].y);
                            cimitero_canvas.Children.Add(textBlock);

                            this.points_tomb.Add(new TombCoords(cro.tombCoordinates[x].x, cro.tombCoordinates[x].y, cro.tombCoordinates[x].isSupersized, cro.tombCoordinates[x].tombNo));

                        }
                    }
                    else
                    {
                        MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                    }
                }
                else
                {
                    MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                }

            }
            else
            {
                MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }

            this.bttn_grab.Background = Brushes.White;
            this.bttn_bounding.Background = Brushes.Green;
            this.bttn_street.Background = Brushes.White;
        }
        private void bttn_createBody_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cro = CommunicationController.saveOrUpdateBody(new Body(Convert.ToInt32(tbox_bodyid.Text), tbox_new_body_title.Text,
                                                                            tbox_new_body_firstname.Text,
                                                                            tbox_new_body_otherfirstname.Text,
                                                                            tbox_new_body_lastname.Text,
                                                                            tbox_new_body_address.Text,
                                                                            tbox_new_body_phonenumber.Text,
                                                                            DateTime.ParseExact(tbox_new_body_birthdate.ToString(), "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd"),
                                                                            DateTime.ParseExact(tbox_new_body_dateofdeath.ToString(), "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd"),
                                                                            ((Tomb)this.cbox_new_body_tombnumber.SelectedItem).tombId));

                if (cro.ok)
                {
                    this.showPartial(this.bodies);
                    this.tbox_bodyid.Text = "";
                    this.tbox_new_body_title.Text = "";
                    this.tbox_new_body_firstname.Text = "";
                    this.tbox_new_body_otherfirstname.Text = "";
                    this.tbox_new_body_lastname.Text = "";
                    this.tbox_new_body_address.Text = "";
                    this.tbox_new_body_phonenumber.Text = "";
                    this.tbox_new_body_birthdate.SelectedDate = DateTime.Now.Date;
                    this.tbox_new_body_dateofdeath.SelectedDate = DateTime.Now.Date;
                }
                else
                {
                    MessageBox.Show(cro.message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Cimitero© Error ", MessageBoxButton.OK, MessageBoxImage.Hand);
            }

            this.showPartial(this.newBody);
        }