示例#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
 /// <summary>
 /// Adding new Client to database
 /// </summary>
 /// <param name="name">Client name</param>
 /// <param name="address">Client address</param>
 /// <param name="nip">Client NIP</param>
 private void AddClientToDatabase(string name, string address, string city, string postcode, string nip)
 {
     var client = new Client(name, address, city, postcode, nip);
     DBManager.AddClient(client);
 }
示例#4
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!");
     }
         
 }
示例#5
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");
     }
    
 }
示例#6
0
 //Adding client to DB
 public static void AddClient(Client client)
 {
     using (var context = new FakturyContext())
     {
         context.Clients.Add(client);
         context.SaveChanges();
     }
 }