Exemple #1
0
        private void Sold_Btn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Clothes cloth = (Clothes)clothDataGrid.SelectedItem;

                if (cloth.Sold == false)
                {
                    cloth.Sold = (bool)Sold_box.IsChecked;
                    _context.SaveChanges();
                    clothDataGrid.ItemsSource = _context.Clothes.ToList();
                }
            }
            catch (TargetException tEx)
            {
                MessageBox.Show("\nZaznacz Umowę\n\n" + tEx.Message);
            }
        }
Exemple #2
0
 private void Return_Btn_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Clothes cloth = (Clothes)clothDataGrid.SelectedItem; //agreementDataGrid.SelectedItem as Agreement;
         // Cloth updateCloth = _context.Clothes.FirstOrDefault(i => i.Id == cloth.Id);
         if (cloth.Sold == true)
         {
             cloth.Sold = (bool)Sold_box.IsChecked;
             _context.SaveChanges();
             clothDataGrid.ItemsSource = _context.Clothes.ToList();
         }
     }
     catch (TargetException tEx)
     {
         MessageBox.Show("\nZaznacz Umowę\n\n" + tEx.Message);
     }
 }
Exemple #3
0
        private void OnKeyDownHandler(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Return)
            {
                int temp = Convert.ToInt32(Scaner_txt.Text);
                // Cloth cloth = _context.Clothes.Where(i => i.Id == temp).FirstOrDefault();
                Clothes cloth = _context.Clothes.FirstOrDefault(i => i.Id == temp);
                if (cloth.Sold == false)
                {
                    cloth.Sold = true;
                }
                temp2         += cloth.Price;
                price_txt.Text = temp2.ToString();

                _context.SaveChanges();

                // MessageBox.Show("dziala");
            }
        }
Exemple #4
0
 private void deleteCloth_btn_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Clothes deleteCloth;
         Clothes cloth = clothDataGrid.SelectedItem as Clothes;
         deleteCloth = _context.Clothes.Find(cloth.Id);
         _context.Clothes.Attach(deleteCloth);
         _context.Clothes.Remove(deleteCloth);
         _context.SaveChanges();
         clothDataGrid.ItemsSource = _context.Clothes.ToList();
     }
     catch (NullReferenceException nEx)
     {
         MessageBox.Show("Zaznacz Element\n\n" + nEx.Message);
     }
     catch (Exception)
     {
         MessageBox.Show("Coś poszło nie tak");
     }
 }
Exemple #5
0
 private void Load_Btn_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Clothes cloth = clothDataGrid.SelectedItem as Clothes;
         Sold_box.IsChecked        = Convert.ToBoolean(cloth.Sold);
         clothDataGrid.ItemsSource = _context.Clothes.ToList();
     }
     catch (NullReferenceException nEx)
     {
         MessageBox.Show("Zaznacz Element\n\n" + nEx.Message);
     }
     catch (InvalidCastException iEx)
     {
         MessageBox.Show("Zaznacz Element z wartościami\n\n" + iEx.Message);
     }
     catch (Exception)
     {
         MessageBox.Show("Coś poszło nie tak");
     }
 }
Exemple #6
0
        private void editCloth_btn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Clothes cloth       = clothDataGrid.SelectedItem as Clothes;
                Clothes updateCloth = _context.Clothes.Where(i => i.Id == cloth.Id).FirstOrDefault();



                cloth.Price        = Int32.Parse(price_txt.Text);
                cloth.Agreement_Id = passId;
                cloth.Mark         = mark_txt.Text;
                cloth.Size         = size_txt.Text;
                cloth.Colour       = colour_txt.Text;
                cloth.Type         = type_txt.Text;
                cloth.Description  = description_txt.Text;
                cloth.Box          = box_txt.Text;


                _context.SaveChanges();
                clothDataGrid.ItemsSource = _context.Clothes.ToList();
            }
            catch (TargetException tEx)
            {
                MessageBox.Show("\nZaznacz Umowę\n\n" + tEx.Message);
            }
            catch (FormatException fEx)
            {
                MessageBox.Show(fEx.Message + "\nPodaj wszystkie dane lub\nSprawdź poprawność danych");
                //MessageBox.Show("Podaj wszystkie dane");
            }
            catch (Exception)
            {
                MessageBox.Show("Coś poszło nie tak");
            }
            finally
            {
                clothDataGrid.ItemsSource = _context.Clothes.ToList();
            }
        }
Exemple #7
0
        private void Print_Btn_Click(object sender, RoutedEventArgs e)
        {
            Agreements agreement = (Agreements)agreementDataGrid.SelectedItem;
            // Agreement updateAgreement = _context.Agreements.Where(i => i.Id == agreement.Id).FirstOrDefault();
            Clothes cloth = new Clothes();

            try
            {
                Document  pdfDoc = new Document(PageSize.A4, 20, 20, 42, 35);
                PdfWriter pdfWri = PdfWriter.GetInstance(pdfDoc, new FileStream(agreement.Name + "_" + agreement.Surname + "_" + agreement.Id, FileMode.Create));
                pdfDoc.Open();

                iTextSharp.text.Paragraph p1 = new iTextSharp.text.Paragraph("Poznan dnia " + DateTime.Now.Date.ToShortDateString());
                p1.Alignment = Element.ALIGN_RIGHT;

                iTextSharp.text.Paragraph p2 = new iTextSharp.text.Paragraph("UMOWA KOMISU NR: " + agreement.Id);
                p2.Alignment = iTextSharp.text.Element.ALIGN_CENTER;

                iTextSharp.text.Paragraph p3 = new iTextSharp.text.Paragraph("Zawarta w dniu " + DateTime.Now.Date.ToShortDateString() +
                                                                             " pomiędzy SZAFARI z siedzibą w Poznaniu, przy ul.Ratajczaka 28, w imieniu którego działa ; Iga Staniul zwana w treści umowy 'Komisantem' a, " +
                                                                             agreement.Name + " " + agreement.Surname + " zwanym w treści umowy 'Komitentem', o następującej treści: ");

                iTextSharp.text.Paragraph p4 = new iTextSharp.text.Paragraph("§1.");
                p4.Alignment = iTextSharp.text.Element.ALIGN_CENTER;


                iTextSharp.text.Paragraph p5 = new iTextSharp.text.Paragraph("Komisant zobowiązuje się do sprzedaży komisowej we własnym imieniu otrzymanych od " +
                                                                             "Komitenta następujących rzeczy: (*wymienione na drugiej stronie)");


                iTextSharp.text.Paragraph p6 = new iTextSharp.text.Paragraph("§2.");
                p6.Alignment = iTextSharp.text.Element.ALIGN_CENTER;

                iTextSharp.text.Paragraph p7 = new iTextSharp.text.Paragraph("Komitent oświadcza, że przekazane rzeczy stanowią jego własność i nie są obciążone prawami osób trzecich.");

                iTextSharp.text.Paragraph p8 = new iTextSharp.text.Paragraph("§3.");
                p8.Alignment = iTextSharp.text.Element.ALIGN_CENTER;

                iTextSharp.text.Paragraph p9 = new iTextSharp.text.Paragraph("Komisant zobowiązany jest na własny koszt ubezpieczyć oddane do sprzedaży komisowej " +
                                                                             "rzeczy od ryzyka kradzieży z włamaniem, ognia i innych zdarzeń losowych, natomiast nie " +
                                                                             "ponosi odpowiedzialności za uszkodzenia powstałe podczas normalnej eksplatacji tzn " +
                                                                             "przymierzania przez klientów.");

                iTextSharp.text.Paragraph p10 = new iTextSharp.text.Paragraph("§4.");
                p10.Alignment = iTextSharp.text.Element.ALIGN_CENTER;

                iTextSharp.text.Paragraph p11 = new iTextSharp.text.Paragraph("Wysokość należnej Komitentowi kwoty za każdą rzeczy, ustalana jest indywidualnie" +
                                                                              " (*kwoty zapisane na drugiej stronie).Komisant narzuca swoją marże.");

                iTextSharp.text.Paragraph p12 = new iTextSharp.text.Paragraph("§5.");
                p12.Alignment = iTextSharp.text.Element.ALIGN_CENTER;

                iTextSharp.text.Paragraph p13 = new iTextSharp.text.Paragraph("W przypadku, gdy powierzone do sprzedania rzeczy określone wg umowy, pomimo dołożenia " +
                                                                              "przez Komisanta należytej staranności, nie zostaną sprzedane do dnia " + DateTime.Now.Date.AddDays(90).ToShortDateString() + ", Komitent " +
                                                                              "jest zobowiązany do odebrania rzeczy i gotówki w ciągu 1 miesiąca od daty zakończenia " +
                                                                              "umowy, w przeciwnym razie rzeczy zostają przekazane na rzecz Komisanta oraz dodatkowo naliczana jest codzinnie kara umowna o wyskości 5% wartości umowy");

                iTextSharp.text.Paragraph p14 = new iTextSharp.text.Paragraph("§6.");
                p14.Alignment = iTextSharp.text.Element.ALIGN_CENTER;

                iTextSharp.text.Paragraph p15 = new iTextSharp.text.Paragraph("Przyjmowanie oraz rozliczanie rzeczy wyłącznie w czwartki i piątki w godzinach między " +
                                                                              "12.00 a 18.00 lub po ówczesnym umówienie się poprzez www.facebook.com/szafarisklep.");

                iTextSharp.text.Paragraph p16 = new iTextSharp.text.Paragraph("§7.");
                p16.Alignment = iTextSharp.text.Element.ALIGN_CENTER;

                iTextSharp.text.Paragraph p17 = new iTextSharp.text.Paragraph("Ewentualne spory mogące wyniknąć na tle stosowania niniejszej umowy strony poddają " +
                                                                              "rozstrzygnięciu sądu właściwego dla siedziby Komisanta.");

                iTextSharp.text.Paragraph p18 = new iTextSharp.text.Paragraph("            " +
                                                                              "Komisant" +
                                                                              "                                                                                                                 " +
                                                                              "Komitient");
                p18.Alignment = iTextSharp.text.Element.ALIGN_LEFT;

                //  iTextSharp.text.Paragraph p19 = new iTextSharp.text.Paragraph("Komitient");
                //  p19.Alignment = iTextSharp.text.Element.ALIGN_RIGHT;


                pdfDoc.AddAuthor("Szafari");
                pdfDoc.AddCreator("Szafari");
                pdfDoc.AddSubject("Umowa Komisu");
                pdfDoc.AddTitle("Umowa komisu nr:" + agreement.Id);


                pdfDoc.Add(p1);
                pdfDoc.Add(p2);
                pdfDoc.Add(p3);
                pdfDoc.Add(p4);
                pdfDoc.Add(p5);
                pdfDoc.Add(p6);
                pdfDoc.Add(p7);
                pdfDoc.Add(p8);
                pdfDoc.Add(p9);
                pdfDoc.Add(p10);
                pdfDoc.Add(p11);
                pdfDoc.Add(p12);
                pdfDoc.Add(p13);
                pdfDoc.Add(p14);
                pdfDoc.Add(p15);
                pdfDoc.Add(p16);
                pdfDoc.Add(p17);
                pdfDoc.Add(p18);
                // pdfDoc.Add(p19);

                pdfDoc.Close();
            }
            catch (NullReferenceException nEx)
            {
                MessageBox.Show("Zaznacz Element\n\n" + nEx.Message);
            }
        }