示例#1
0
        // ==================================================
        private void BtnDone_Click(object sender, EventArgs e)
        {
            if (doResultsApproved)
            {
                SfOrderDetail idSfDetail = db.SfOrderDetails
                                           .Where(check =>
                                                  check.IdSfOrder == selectedOrderId &&
                                                  check.IdSemiFinished == selectedSfId).First();


                EntranceControl entranceControl = new EntranceControl();

                entranceControl.IdSfDetail          = idSfDetail.IdSfDetail;
                entranceControl.IdEmployee          = this.idControler;
                entranceControl.ControlDate         = datePickerSelectedControlsDate.Value;
                entranceControl.Comments            = txtboxComment.Text;
                entranceControl.Quantity            = int.Parse(txtBoxQuantity.Text);
                entranceControl.RealThickness       = Math.Floor(decimal.Parse(txtboxThickness.Text) * 100) / 100;
                entranceControl.RealWidth           = Math.Floor(decimal.Parse(txtboxWidth.Text) * 100) / 100;
                entranceControl.RealWeight          = Math.Floor(decimal.Parse(txtboxMass.Text) * 100) / 100;
                entranceControl.RealColor           = txtBoxColor.Text;
                entranceControl.ChemicalComposition = checkBoxComposition.Checked;
                entranceControl.ControlStatus       = this.wholeControlStatus;

                db.EntranceControls.Add(entranceControl);
                db.SaveChanges();
                MessageBox.Show("Kontrola dodana do bazy.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Proszę zatwierdzić wyniki!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#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 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();
        }
示例#4
0
        // ==================================================
        private void CheckControl()
        {
            if (lblOrderIdShow.Text == "")
            {
                MessageBox.Show("Wybierz zamówienie i półfabrykat!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                SemiFinished semiFinished = db.SemiFinisheds.FirstOrDefault(sf => sf.IdSemiFinished == selectedSfId);

                bool flagThickness = false;
                bool flagWidth     = false;
                bool flagMass      = false;
                bool flagColor     = false;
                bool flagQuantity  = false;

                if (txtboxThickness.Text.Trim() != "")
                {
                    if (decimal.TryParse(txtboxThickness.Text, out decimal thickness))
                    {
                        if ((decimal)(semiFinished.Thickness * 0.95) < thickness &&
                            thickness < (decimal)(semiFinished.Thickness * 1.05))
                        {
                            picBoxThicknessStatus.Image = Properties.Resources.ok_48px;
                            flagThickness = true;
                        }
                        else
                        {
                            picBoxThicknessStatus.Image = Properties.Resources.cancel_48px;
                        }
                    }
                    else
                    {
                        txtboxThickness.Text = "WPISZ LICZBĘ!";
                    }
                }

                if (txtboxWidth.Text.Trim() != "")
                {
                    if (decimal.TryParse(txtboxWidth.Text, out decimal width))
                    {
                        if ((decimal)(semiFinished.Width * 0.95) < width &&
                            width < (decimal)(semiFinished.Width * 1.05))
                        {
                            picBoxWidhtStatus.Image = Properties.Resources.ok_48px;
                            flagWidth = true;
                        }
                        else
                        {
                            picBoxWidhtStatus.Image = Properties.Resources.cancel_48px;
                        }
                    }
                    else
                    {
                        txtboxWidth.Text = "WPISZ LICZBĘ!";
                    }
                }

                if (txtboxMass.Text.Trim() != "")
                {
                    if (decimal.TryParse(txtboxMass.Text, out decimal mass))
                    {
                        if ((decimal)(semiFinished.SfWeight * 0.95) < mass &&
                            mass < (decimal)(semiFinished.SfWeight * 1.05))
                        {
                            picBoxMassStatus.Image = Properties.Resources.ok_48px;
                            flagMass = true;
                        }
                        else
                        {
                            picBoxMassStatus.Image = Properties.Resources.cancel_48px;
                        }
                    }
                    else
                    {
                        txtboxMass.Text = "WPISZ LICZBĘ!";
                    }
                }

                if (txtBoxColor.Text.Trim() != "")
                {
                    if (semiFinished.Color == txtBoxColor.Text)
                    {
                        picBoxColorStatus.Image = Properties.Resources.ok_48px;
                        flagColor = true;
                    }
                    else
                    {
                        picBoxColorStatus.Image = Properties.Resources.cancel_48px;
                    }
                }

                if (txtBoxQuantity.Text.Trim() != "")
                {
                    SfOrderDetail quantitySfOrder = db.SfOrderDetails
                                                    .Where(check =>
                                                           check.IdSfOrder == selectedOrderId &&
                                                           check.IdSemiFinished == selectedSfId)
                                                    .FirstOrDefault();

                    if (int.TryParse(txtBoxQuantity.Text, out int quantity))
                    {
                        if (quantitySfOrder.Quantity == quantity)
                        {
                            picBoxQuantityStatus.Image = Properties.Resources.ok_48px;
                            flagQuantity = true;
                        }
                        else
                        {
                            picBoxQuantityStatus.Image = Properties.Resources.cancel_48px;
                        }
                    }
                    else
                    {
                        txtBoxQuantity.Text = "LICZBA CAŁKOWITA!";
                    }
                }

                if (flagThickness && flagWidth && flagMass && flagColor && flagQuantity && checkBoxComposition.Checked)
                {
                    picBoxControlStatus.Image = Properties.Resources.good_quality_80px;
                    this.wholeControlStatus   = true;
                }
                else
                {
                    picBoxControlStatus.Image = Properties.Resources.poor_quality_80px;
                    this.wholeControlStatus   = false;
                }
            }
        }