예제 #1
0
 public PDFCreator(Invoice invoice)
 {
     this.invoice = invoice;
     this.client = invoice.Client;
     this.owner = invoice.Owner;
     this.products = invoice.products;
 }
예제 #2
0
 public Invoice(string date, string invoicenumber, Client client, Owner owner, List<Product> products)
 {
     this.Date = date;
     this.Client = client;
     this.Owner = owner;
     this.products = products;
     this.NumberOfInvoice = invoicenumber;
     this.ClientId = client.Id;
     this.OwnerId = owner.Id;
 }
예제 #3
0
 private void btnSaveInvoice_Click(object sender, EventArgs e)
 {
     if (CheckEmptyFields() && items.Count != 0)
     {
         try
         {
             Client client = new Client(txtClientName.Text, txtClientAddress.Text, txtClientCity.Text, txtClientPostCode.Text, txtClientNip.Text);
             Owner owner = new Owner(txtSellerName.Text, txtSellerAddress.Text, txtSellerCity.Text, txtSellerPostCode.Text, txtSellerNip.Text);
             invoice = new Invoice(dtpDate.Text, txtNumber.Text, client, owner, products);
             DBManager.SaveInvoice(invoice);
             MessageBox.Show("Zapisano fakturę w systemie");
         }
         catch (Exception err)
         {
             MessageBox.Show(err.ToString());
         }
     }
     else
     {
         MessageBox.Show("Wprowadź wszystkie dane!");
     }
         
 }
예제 #4
0
 private void btnCreatePDF_Click(object sender, EventArgs e)
 {
     if (CheckEmptyFields() && items.Count != 0)
     {
         try
         {
            
             Client client = new Client(txtClientName.Text, txtClientAddress.Text, txtClientCity.Text, txtClientPostCode.Text, txtClientNip.Text);
             Owner owner = new Owner(txtSellerName.Text, txtSellerAddress.Text, txtSellerCity.Text, txtSellerPostCode.Text, txtSellerNip.Text);
             invoice = new Invoice(dtpDate.Text, txtNumber.Text, client, owner, products);
             PDFCreator creator = new PDFCreator(invoice);
             creator.CreatePDF();
         }
         catch (Exception err)
         {
             MessageBox.Show(err.ToString());
         }
     }
     else
     {
         MessageBox.Show("Wprowadź wszystkie dane.", "Błąd");
     }
    
 }
예제 #5
0
 //Adding owner to DB
 public static void AddOwner(Owner owner)
 {
     using (var context = new FakturyContext())
     {
         context.Owners.Add(owner);
         context.SaveChanges();
     }
 }
예제 #6
0
 /// <summary>
 /// Adding new owner to database
 /// </summary>
 /// <param name="name">Owner name</param>
 /// <param name="address">Owner address</param>
 /// <param name="nip">Owner NIP</param>
 private void AddOwnerToDatabase(string name, string address, string city, string postcode, string nip)
 {
     var owner = new Owner(name, address, city, postcode, nip);
     DBManager.AddOwner(owner);
 }