/// <summary> /// Method that adds a Shipping to Shipping List /// </summary> /// <param name="id">int</param> private void AddShipping(int id) { IttLetterShipping shipping = new IttLetterShipping(); foreach (IttLetterShipping temp in Bizz.IttLetterShippingList) { if (temp.Id == id) { shipping = temp; break; } } ShippingList.Add(shipping); }
/// <summary> /// Method, that creates a IttLetterShipping /// </summary> /// <returns></returns> private void GetIttLetterShipping() { Shipping = new IttLetterShipping(Bizz.TempProject, @"PDF_Documents\", Bizz.MacAdresss); try { int id = Bizz.CreateInDbReturnInt(Shipping); Shipping.SetId(id); Shipping.PdfPath = ""; Bizz.UpdateInDb(Shipping); } catch (Exception ex) { MessageBox.Show("Databasen returnerede en fejl. Forsendelsen blev ikke opdateret.\n" + ex, "Opdater forsendelse", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// Method, that adds data to an ITT-letter receiver /// </summary> /// <param name="entity">IndexableLegalEntity</param> /// <returns>IttLetterReceiver</returns> private IttLetterReceiver FillIttLetterReceiver(IndexedLegalEntity entity) { GetIttLetterShipping(); IttLetterShipping shipping = Shipping; Project project = Shipping.Project; string companyId = entity.Id; string companyName = entity.Name; Contact contact = GetContact(entity.Id); string attention = contact.Name; Address address = GetAddress(entity.Address.Id); string street = address.Street; string place = address.Place; ZipTown zipTown = address.ZipTown; string zip = zipTown.ToString(); string email = contact.ContactInfo.Email; IttLetterReceiver result = new IttLetterReceiver(shipping, project, companyId, companyName, attention, street, zip, email, place); return(result); }
private void ButtonChoose_Click(object sender, RoutedEventArgs e) { result = false; bool receivers = false; if (ListBoxLegalEntities.SelectedItems.Count >= 1) { receivers = true; } switch (receivers) { case false: //Show Confirmation MessageBox.Show("Du har ikke valgt nogen modtagere. Der blev ikke føjet modtagere til modtagerlisten.", "Tilføj Modtager(e)", MessageBoxButton.OK, MessageBoxImage.Information); break; case true: AddReceivers(); break; } if (result) { //Show Confirmation MessageBox.Show("Modtager(e)n(ne) blev føjet til modtagerlisten.", "Tilføj Modtager(e)", MessageBoxButton.OK, MessageBoxImage.Information); //Reset Boxes ComboBoxCaseId.SelectedIndex = -1; //Update lists and fields Bizz.RefreshList("IttLetterReceivers"); Bizz.RefreshList("IttLetterShippingList"); Shipping = new IttLetterShipping(); } else { //Show error MessageBox.Show("Databasen returnerede en fejl. Modtager(e)n(ne) blev ikke føjet til modtagerlisten. Prøv igen.", "Tilføj Modtager(e)", MessageBoxButton.OK, MessageBoxImage.Information); } }