コード例 #1
0
ファイル: Form1.cs プロジェクト: rudnickirobert/KWZP2019
        private void btnSales_Click(object sender, EventArgs e)
        {
            SalesDepartmentForm salesDepartmentForm = new SalesDepartmentForm(db, this);

            salesDepartmentForm.Show();
            this.Hide();
        }
コード例 #2
0
        private void acceptBtn_Click(object sender, EventArgs e)
        {
            SfOrderDetail newSfOrderDetail = new SfOrderDetail();

            newSfOrderDetail.IdSfOrder = idSfOrder;
            foreach (SemiFinished sf in db.SemiFinisheds.Where(sf => sf.SfCode.Contains(semiProductCodeCb.Text.ToString())))
            {
                newSfOrderDetail.IdSemiFinished = sf.IdSemiFinished;
            }
            newSfOrderDetail.Quantity = Convert.ToInt32(quantityTb.Text.Trim());
            db.SfOrderDetails.Add(newSfOrderDetail);
            db.SaveChanges();
            MessageBox.Show("Dodano szczegół zamówienia");
            this.Hide();
            salesForm.Show();
            this.Close();
        }
コード例 #3
0
        private void acceptBtn_Click(object sender, EventArgs e)
        {
            SemiFinishedOrder newSemiFinishedOrder = new SemiFinishedOrder();

            foreach (Supplier supplier in db.Suppliers.Where(s => s.SupplierName == typeCb.Text.ToString()))
            {
                newSemiFinishedOrder.IdSupplier = supplier.IdSupplier;
            }
            newSemiFinishedOrder.Cost           = Convert.ToInt32(costTb.Text.Trim());
            newSemiFinishedOrder.SfOrderDate    = orderDateDtp.Value;
            newSemiFinishedOrder.SfDeliveryDate = deliveryDateDtp.Value;
            db.SemiFinishedOrders.Add(newSemiFinishedOrder);
            db.SaveChanges();
            MessageBox.Show("Dodano zamówienie");
            this.Hide();
            salesForm.Show();
            this.Close();
        }
コード例 #4
0
        private void deleteOrderDetailBtn_Click(object sender, EventArgs e)
        {
            int    idDetailToRemove            = Convert.ToInt32(this.sfOrderDetailsDgv.CurrentRow.Cells["Nr_szczegółu"].Value);
            string messageDuringRemovingDetail = "Usunięto szczegół o numerze: " + Convert.ToString(idDetailToRemove);

            MessageBox.Show(messageDuringRemovingDetail, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            SfOrderDetail detailToRemove = db.SfOrderDetails.First(f => f.IdSfDetail == idDetailToRemove);

            db.SfOrderDetails.Remove(detailToRemove);
            db.SaveChanges();
            int id = Convert.ToInt32(this.sfOrdersDgv.CurrentRow.Cells["Nr_zamówienia"].Value);

            sfOrderDetailsDgv.DataSource = (from sfOrders in db.vSFOrderDetails
                                            where sfOrders.Nr_zamówienia == id
                                            select sfOrders).ToList();
            sfOrderDetailsDgv.Columns["Nr_zamówienia"].Visible = false;
            sfOrderDetailsLbl.Text = "Szczegół zamówienia nr: " + sfOrdersDgv.CurrentRow.Cells["Nr_zamówienia"].Value.ToString();
            salesForm.Show();
        }
コード例 #5
0
        private void addNewCustomerBtn_Click(object sender, EventArgs e)
        {
            //ŻĄDANIE WPROWADZENIA NAZWY FIRMY
            if (nameTb.Text.Trim() == "")
            {
                MessageBox.Show("Nazwa jest wymagana");
                return;
            }
            Customer newCustomer = new Customer();

            newCustomer.CustomerName = nameTb.Text.Trim();
            bool phoneTb2 = int.TryParse(phoneTb.Text, out int phoneTb21);

            if (phoneTb2)
            {
                newCustomer.PhoneNumber = Convert.ToString(phoneTb21);
            }
            else
            {
                MessageBox.Show("Niewłaściwy format numeru telefonu");
                return;
            }
            newCustomer.Email   = emailTb.Text.Trim();
            newCustomer.City    = cityTb.Text.Trim();
            newCustomer.ZipCode = zipCodeTb.Text.Trim();
            newCustomer.Street  = streetTb.Text.Trim();
            bool houseNumberTb2 = int.TryParse(houseNumberTb.Text.Trim(), out int houseNumberTb21);

            if (houseNumberTb2)
            {
                newCustomer.HouseNumber = Convert.ToString(houseNumberTb21);
            }
            else
            {
                MessageBox.Show("Niewłaściwy format numeru domu");
                return;
            }
            bool apartmentNumberTb2 = int.TryParse(apartmentNumberTb.Text.Trim(), out int apartmentNumberTb21);

            if (apartmentNumberTb2)
            {
                newCustomer.ApartmentNumber = Convert.ToString(apartmentNumberTb21);
            }
            else
            {
                MessageBox.Show("Niewłaściwy format numeru lokalu");
                return;
            }
            bool nipTb2 = long.TryParse(nipTb.Text.Trim(), out long nipTb21);

            if (nipTb2)
            {
                newCustomer.NIP = Convert.ToString(nipTb21);
            }
            else
            {
                MessageBox.Show("Niewłaściwy format NIP");
                return;
            }
            bool krsTb2 = long.TryParse(krsTb.Text.Trim(), out long krsTb21);

            if (krsTb2)
            {
                newCustomer.KRS = Convert.ToString(krsTb21);
            }
            else
            {
                MessageBox.Show("Niewłaściwy format KRS");
                return;
            }
            bool peselTb2 = long.TryParse(peselTb.Text.Trim(), out long peselTb21);

            if (peselTb2)
            {
                newCustomer.Pesel = Convert.ToString(peselTb21);
            }
            else
            {
                MessageBox.Show("Niewłaściwy format PESEL");
                return;
            }
            MessageBox.Show("Dodano nowego klienta");
            db.Customers.Add(newCustomer);
            db.SaveChanges();
            this.Hide();
            previousForm.Show();
            this.Close();
        }
コード例 #6
0
 private void returnBtn_Click(object sender, EventArgs e)
 {
     this.Hide();
     previousForm.Show();
     this.Close();
 }
コード例 #7
0
 private void backBtn_Click(object sender, EventArgs e)
 {
     this.Hide();
     salesForm.Show();
     this.Close();
 }