コード例 #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (cbEmployeeList.SelectedIndex == -1 || cbEducationLevel.SelectedIndex == -1)
     {
         MessageBox.Show("Wszystkie pola muszą być wypełnione");
     }
     else
     {
         Education newEducation = new Education();
         newEducation.IdEmployee       = cbEmployeeList.SelectedIndex + 1;
         newEducation.IdEducationLevel = cbEducationLevel.SelectedIndex + 1;
         newEducation.GraduationDate   = dtpGraduationDate.Value;
         db.Educations.Add(newEducation);
         db.SaveChanges();
         if (tbEducationSearch.Text.Trim() == "")
         {
             display();
         }
         else
         {
             tbEducationSearch_TextChanged(sender, e);
         }
         MessageBox.Show("Prawidłowo dodano pracownika");
         clear();
     }
 }
コード例 #2
0
ファイル: Absences.cs プロジェクト: rudnickirobert/KWZP2019
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Absence newAbsence = new Absence();

            if (cbEmployeeList.SelectedIndex == -1 || cbAbsenceType.SelectedIndex == -1)
            {
                MessageBox.Show("Wszystkie pola muszą być wypełnione");
            }
            else
            {
                if (dateTimePickerFirstDay.Value > dateTimePickerLastDay.Value)
                {
                    MessageBox.Show("Data końca nieobecności nie może być wcześniejsza niż data początku");
                }
                else
                {
                    newAbsence.IdEmployee     = cbEmployeeList.SelectedIndex + 1;
                    newAbsence.IdAbsenceType  = cbAbsenceType.SelectedIndex + 1;
                    newAbsence.StartOfAbsence = dateTimePickerFirstDay.Value;
                    newAbsence.EndOfAbsence   = dateTimePickerLastDay.Value;
                    db.Absences.Add(newAbsence);
                    db.SaveChanges();
                    if (tbSearchAbsence.Text.Trim() == "" || tbSearchName.Text.Trim() == "")
                    {
                        display();
                    }
                    else
                    {
                        tbSearchAbsence_TextChanged(sender, e);
                    }
                    clear();
                    MessageBox.Show("Nieobecność dodana prawidłowo");
                }
            }
        }
コード例 #3
0
        // ==========================================

        private void buttonAddPart_Add_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dataPartsView.Rows)
            {
                if (Convert.ToString(row.Cells[0].Value) == tbName.Text)
                {
                    MessageBox.Show("Podana nazwa części już istnieje!\nUpewnij się, że nazwa została wpisana prawidłowo!",
                                    "Ostrzeżenie", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    tbName.BackColor = Color.Red;
                    return;
                }

                else if (Convert.ToString(row.Cells[3].Value) == tbCatalogNr.Text)
                {
                    MessageBox.Show("Podany numer katalogowy jest przypisany do istniejącej części!\nUpewnij się, że podany numer została wpisana prawidłowo!",
                                    "Ostrzeżenie", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    tbCatalogNr.BackColor = Color.Red;
                    return;
                }
            }

            if (tbName.Text == "" || cbPartType.Text == "" || tbProducer.Text == "" || tbCatalogNr.Text == "" ||
                tbAmount.Text == "" || cbUnit.Text == "")
            {
                MessageBox.Show("Nie można dodać nowej części!\nUzupełnij wszystkie pola!",
                                "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                DialogResult result = MessageBox.Show("Czy zatwierdzasz wprowadzoną część?", "Dodawanie części",
                                                      MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (result == DialogResult.Yes)
                {
                    Part part = new Part();
                    part.PartName          = tbName.Text.Trim();
                    part.IdPartType        = int.Parse(cbPartType.SelectedValue.ToString());
                    part.Producer          = tbProducer.Text.Trim();
                    part.CatalogPartNr     = int.Parse(tbCatalogNr.Text.ToString());
                    part.QuantityWarehouse = int.Parse(tbAmount.Text.ToString());
                    part.IdUnit            = int.Parse(cbUnit.SelectedValue.ToString());

                    db.Parts.Add(part);
                    db.SaveChanges();
                    ReloadData();

                    clear_AddPart();
                    MessageBox.Show("Dodano prawidłowo", "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #4
0
        private void ProductionProcess_Load(object sender, EventArgs e)
        {
            ///DODAŁEM TO
            List <PlannedProduction> missingProductionProcess = db.PlannedProductions.
                                                                Where(c => !db.ProductionProces.
                                                                      Select(b => b.IdPlan).
                                                                      Contains(c.IdPlan)).ToList();


            foreach (PlannedProduction plannedProduction in missingProductionProcess)
            {
                if (plannedProduction.Inproduction == true)
                {
                    ProductionProce productionProces = new ProductionProce();
                    productionProces.IdPlan    = plannedProduction.IdPlan;
                    productionProces.StartDate = plannedProduction.PlannedStartd;
                    productionProces.EndDate   = plannedProduction.PlannedEndd;
                    db.ProductionProces.Add(productionProces);
                }
                else
                {
                    continue;
                }
            }
            db.SaveChanges();

            ProductionProcessGridView.DataSource = db.ProductionProces.
                                                   Where(ProdProc => ProdProc.EndDate >= DateTime.Now).ToList();
        }
コード例 #5
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (textBoxTechnologyName.Text.Trim() != "")
            {
                technology.TechnologyName  = textBoxTechnologyName.Text;
                textBoxTechnologyName.Text = "";
            }

            if (textBoxTimePerMeter.Text.Trim() != "")
            {
                // TimePermeter nazywa się pole w tabeli Technology
                technology.TimePermeter  = int.Parse(textBoxTimePerMeter.Text);
                textBoxTimePerMeter.Text = "";
            }

            if (textBoxSpeedFactor.Text.Trim() != "")
            {
                technology.SpeedFactor  = int.Parse(textBoxSpeedFactor.Text);
                textBoxSpeedFactor.Text = "";
            }

            db.SaveChanges();
            productionTechnology.refreshDataGridView();
            productionTechnology.selectRow(technology.IdTechnology);
            productionTechnology.Show();
            this.Close();
        }
コード例 #6
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (tbAbsenceReason.Text.Trim() == "" || tbMultiplier.Text.Trim() == "")
     {
         MessageBox.Show("Pola musza być wypełnione");
     }
     else
     {
         bool numbersInTbMultipier = float.TryParse(tbMultiplier.Text.Trim(), out float number);
         if (numbersInTbMultipier == false)
         {
             MessageBox.Show("W polu współczynnik nieobecności mogą znajdować się tylko cyfry");
         }
         else
         {
             if (float.Parse(tbMultiplier.Text.Trim()) < 0 || float.Parse(tbMultiplier.Text.Trim()) > 1)
             {
                 MessageBox.Show("Współczynnik może przyjmować wartości od 0 do 1");
             }
             else
             {
                 AbsenceType newabsenceType = new AbsenceType();
                 newabsenceType.AbscenceReason = tbAbsenceReason.Text.Trim();
                 newabsenceType.Multiplier     = float.Parse(tbMultiplier.Text.Trim());
                 db.AbsenceTypes.Add(newabsenceType);
                 db.SaveChanges();
                 MessageBox.Show("Prawidłowo dodano typ nieobecności");
                 clear();
                 dgvAbsencesTypes.DataSource         = db.AbsenceTypes.ToList();
                 dgvAbsencesTypes.Columns[0].Visible = false;
             }
         }
     }
 }
コード例 #7
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);
            }
        }
コード例 #8
0
        private void deleteProduct()
        {
            Product produkt = db.Products.First(f => f.IdProduct == idSelected);

            db.Products.Remove(produkt);
            db.SaveChanges();
        }
コード例 #9
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            if (textBoxDescription.Text == "" || textBoxEmployeeId.Text == "" || dateTimePicker.Text == "" || newPatternImage == null)
            {
                MessageBox.Show("Nie można zatwierdzić wyników!\nUzupełnij wszystkie pola!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                FEMAnalysis fEMAnalysis = new FEMAnalysis();

                fEMAnalysis.AnalysisResults = textBoxDescription.Text;
                fEMAnalysis.IdEmployee      = int.Parse(textBoxEmployeeId.Text);
                fEMAnalysis.NewPattern      = newPatternImage;
                fEMAnalysis.AnalysisDate    = dateTimePicker.Value;

                db.FEMAnalysis.Add(fEMAnalysis);
                db.SaveChanges();

                textBoxDescription.Clear();
                textBoxEmployeeId.Clear();
                dateTimePicker.Value = DateTime.UtcNow;
                dateTimePicker.ResetText();
                picboxNewPattern.Image = picboxNewPattern.InitialImage;
            }
        }
コード例 #10
0
        private void MeasureGenereting()
        {
            int toProduce = db.vTechnicalProductDataPerProcesses.First(i => i.IdProcess == outControlForm.procesNumber).Quantity;

            MessageBox.Show("Uruchomiono pomiary, rozpoczeto od pomiaru " + txtbMeasureNumber.Text + " dla wybranego procesu wytwórczego.");
            while (succesfullMeasures < toProduce)
            {
                Random random = new Random();
                txtbSuccesful.Text     = succesfullMeasures.ToString();
                txtbMeasureNumber.Text = totalMeasures.ToString();
                OutputProductMeasurement outputProductMeasurement = new OutputProductMeasurement();
                outputProductMeasurement.IdProcess = outControlForm.procesNumber;
                double measuredLenght = Math.Round((random.NextDouble() * Int16.Parse(txtbLenghtNominal.Text) * 0.0203 * (db.OutControls.First(e => e.IdProcess == outControlForm.procesNumber).LenghtAcceptableDeviation)) + (Int16.Parse(txtbLenghtNominal.Text) * (100.01 - (db.OutControls.First(e => e.IdProcess == outControlForm.procesNumber).LenghtAcceptableDeviation)) / 100), 2);
                txtbLenghtMeasure.Text = measuredLenght.ToString();
                outputProductMeasurement.MeasuredLenght = measuredLenght;
                double measuredWidth = Math.Round((random.NextDouble() * Int16.Parse(txtbWidthNominal.Text) * 0.0203 * (db.OutControls.First(e => e.IdProcess == outControlForm.procesNumber).WidthAcceptableDeviation)) + (Int16.Parse(txtbWidthNominal.Text) * (100.01 - (db.OutControls.First(e => e.IdProcess == outControlForm.procesNumber).WidthAcceptableDeviation)) / 100), 2);
                outputProductMeasurement.MeasuredWidth = measuredWidth;
                outputProductMeasurement.IdMeasurement = db.OutputProductMeasurements.Max(e => e.IdMeasurement) + 1;
                txtbWidthMeasure.Text = measuredWidth.ToString();
                db.OutputProductMeasurements.Add(outputProductMeasurement);
                db.SaveChanges();
                totalMeasures++;
                dbContextRefreshingForChangesInViews();
                refreshMeasuresStatus();
                txtbLenghtMeasure.Refresh();
                txtbMeasureNumber.Refresh();
                txtbWidthMeasure.Refresh();
                txtbSuccesful.Refresh();
            }
            MessageBox.Show("Zakończono pomiary, wyprodukowano " + toProduce + " sztuk produktu zgodnych z wymaganiami oraz " + (Int16.Parse(txtbMeasureNumber.Text) - succesfullMeasures) + " sztuk nie spełniajacych wymagań. ");
            this.Close();
        }
コード例 #11
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (tbCompanyName.Text.Trim() == "" || tbNIP.Text.Trim() == "" || tbPhone.Text.Trim() == "" || tbKRS.Text.Trim() == "")
            {
                MessageBox.Show("Nazwa, NIP oraz telefon kontaktowy są wymagane!");
                return;
            }
            Contractor newContractor = new Contractor();

            newContractor.ContractorName  = tbCompanyName.Text.Trim();
            tbPhone.MaxLength             = 9;
            newContractor.Phone           = int.Parse(tbPhone.Text.Trim());
            newContractor.Email           = tbEmail.Text.Trim();
            newContractor.City            = tbCity.Text.Trim();
            newContractor.PostalCode      = tbPostalCode.Text.Trim();
            newContractor.Street          = tbStreet.Text.Trim();
            newContractor.HouseNumber     = tbHouseNumber.Text.Trim();
            newContractor.ApartmentNumber = tbLocalNumber.Text.Trim();
            tbNIP.MaxLength           = 10;
            newContractor.NIP         = long.Parse(tbNIP.Text.Trim());
            tbKRS.MaxLength           = 10;
            newContractor.KRS         = long.Parse(tbKRS.Text.Trim());
            newContractor.Description = tbDescription.Text.Trim();
            db.Contractors.Add(newContractor);
            db.SaveChanges();
        }
コード例 #12
0
        private void ProductionProcess_Load(object sender, EventArgs e)
        {
            dTPickerProductionActualFilterUpper.Value = DateTime.Today;
            dTPickerProductionActualFilterLower.Value = DateTime.Today.AddDays(-30);

            List <PlannedProduction> plansAddedToProduction = db.PlannedProductions.
                                                              Where(plannedProductionPlan => !db.ProductionProcesses.
                                                                    Select(productionProcessPlan => productionProcessPlan.IdPlan).
                                                                    Contains(plannedProductionPlan.IdPlan) && plannedProductionPlan.Inproduction.Value).ToList();

            foreach (PlannedProduction plannedProduction in plansAddedToProduction)
            {
                ProductionProcess newProductionProces = new ProductionProcess();
                newProductionProces.IdPlan    = plannedProduction.IdPlan;
                newProductionProces.StartDate = plannedProduction.PlannedStartd;
                newProductionProces.EndDate   = plannedProduction.PlannedEndd;
                db.ProductionProcesses.Add(newProductionProces);
            }

            List <PlannedProduction> plansToUpdate = db.PlannedProductions.
                                                     Where(plannedProductionPlanToUpdate => db.ProductionProcesses.
                                                           Select(productionProcessPlanToUpdate => productionProcessPlanToUpdate.IdPlan).
                                                           Contains(plannedProductionPlanToUpdate.IdPlan) && plannedProductionPlanToUpdate.Inproduction.Value).ToList();

            foreach (PlannedProduction plannedProductionToUpdate in plansToUpdate)
            {
                ProductionProcess updateProcess = db.ProductionProcesses.Find(plannedProductionToUpdate.IdPlan);
                updateProcess.StartDate = plannedProductionToUpdate.PlannedStartd;
                updateProcess.EndDate   = plannedProductionToUpdate.PlannedEndd;
            }
            db.SaveChanges();
            ProductionProcessGridView.DataSource = db.vProductionProcessFullDatas.
                                                   Where(ProdProc => ProdProc.EndDate >= DateTime.Now).ToList();
        }
コード例 #13
0
ファイル: OSHControl.cs プロジェクト: rudnickirobert/KWZP2019
        private void btnDone_Click(object sender, EventArgs e)
        {
            if (textBoxDescription.Text == "" || domainUpDownEmployee.Text == "" || txtBoxControlingCompany.Text == "" || txtBoxControlerId.Text == "")
            {
                MessageBox.Show("Nie można zatwierdzić wyników!\nUzupełnij wszystkie pola!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                SafetyControl safetyControl = new SafetyControl();

                safetyControl.IdSafetyEmployee         = txtBoxControlerId.Text;
                safetyControl.CompanyName              = txtBoxControlingCompany.Text;
                safetyControl.IdInspectedEmployee      = selectedEmployee;
                safetyControl.SaftyControlDate         = dateTimeOSHControl.Value;
                safetyControl.SafetyControlDescription = textBoxDescription.Text;

                db.SafetyControls.Add(safetyControl);
                db.SaveChanges();

                txtBoxControlerId.Text       = "";
                txtBoxControlingCompany.Text = "";
                textBoxDescription.Text      = "";
                lblEmployeeFullName.Text     = "------------------------";
                domainUpDownEmployee.Text    = "1";
            }
        }
コード例 #14
0
        // ==========================================

        private void btnRequestPart_Delete_Click(object sender, EventArgs e)
        {
            try
            {
                if (selectedRow)
                {
                    DataGridViewRow row = dataPartRequestView.Rows[numberRow];

                    if (int.Parse(row.Cells[4].Value.ToString()) != 0)
                    {
                        MessageBox.Show("Nie można usunąć zrealizowanego zapotrzebowania", "Błąd",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    if (MessageBox.Show("Czy na pewno chcesz usunąć tę pozycję?", "Usuwanie części",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        int selectedID = int.Parse(row.Cells[0].Value.ToString());

                        PartRequest partrequest = new PartRequest();
                        partrequest = db.PartRequests.Where(request => request.IdPartRequest == selectedID).First();

                        db.PartRequests.Remove(partrequest);

                        db.SaveChanges();
                        ReloadData();

                        MessageBox.Show("Usunięto prawidłowo", "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                else
                {
                    MessageBox.Show("Proszę wybrać zapotrzebowanie do usunięcia!", "Ostrzeżenie",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            catch (Exception)
            {
                MessageBox.Show("Wybrane zapotrzebowanie jest w trakcie realizacji i nie może zostać usunięte!", "Błąd",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                selectedRow = false;
            }
        }
コード例 #15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (textBoxSpeedFactor.Text == "" || textBoxTechnologyName.Text == "" || textBoxTimePerMeter.Text == "")
            {
                MessageBox.Show("Proszę uzupełnić wszystkie pola!!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Technology technology = new Technology();
                technology.TechnologyName = textBoxTechnologyName.Text;

                bool ifTimePerMeter = int.TryParse(textBoxTimePerMeter.Text, out int timePerMeter);
                if (ifTimePerMeter)
                {
                    // TimePermeter nazywa się pole w tabeli Technology
                    if (timePerMeter > 0)
                    {
                        technology.TimePermeter = timePerMeter;
                    }
                    else
                    {
                        textBoxTimePerMeter.Text = "Wpisz liczbę > 0";
                    }
                }
                else
                {
                    textBoxTimePerMeter.Text = "Wpisz liczbę całkowitą";
                }

                bool ifSpeedFactor = int.TryParse(textBoxSpeedFactor.Text, out int speedFactor);
                if (ifSpeedFactor)
                {
                    if (speedFactor > 0)
                    {
                        technology.SpeedFactor = speedFactor;
                    }
                    else
                    {
                        textBoxSpeedFactor.Text = "Wpisz liczbę > 0";
                    }
                }
                else
                {
                    textBoxSpeedFactor.Text = "Wpisz liczbę całkowitą";
                }

                if (technology.TimePermeter > 0 && technology.SpeedFactor > 0)
                {
                    db.Technologies.Add(technology);
                    db.SaveChanges();
                    productionTechnology.refreshDataGridView();
                    productionTechnology.selectRow(technology.IdTechnology);
                    productionTechnology.Show();
                    this.Close();
                }
            }
        }
コード例 #16
0
        //===========================================================

        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (technology != null)
            {
                db.Technologies.Remove(technology);
                db.SaveChanges();
                refreshDataGridView();
            }
        }
コード例 #17
0
        private void btEditConfirm_Click(object sender, EventArgs e)
        {
            product.IdSemiFinished = Convert.ToInt32(cBEditSemiFinished.SelectedValue);
            product.IdTechnology   = Convert.ToInt32(cBEditTechnology.SelectedValue);
            product.ProductCode    = Convert.ToString(tBProductCode.Text);
            db.SaveChanges();

            MessageBox.Show("Edytowano!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #18
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (tbTrainingName.Text.Trim() == "" || tbTrainingPrice.Text.Trim() == "" || cbEmployeeList.SelectedIndex == -1)
     {
         MessageBox.Show("Pola nazwa, cena oraz pracownik muszą być wypełnione");
     }
     else
     {
         bool numbersInTbPrice = int.TryParse(tbTrainingPrice.Text.Trim(), out int number);
         if (numbersInTbPrice == false)
         {
             MessageBox.Show("W polu cena muszą znajdować się wyłącznie cyfry");
         }
         else
         {
             if (dtpTrainingStartDate.Value > dtpTrainingEndDate.Value)
             {
                 MessageBox.Show("Data końca szkolenia nie może być wcześniej niż data początku szkolenia");
             }
             else
             {
                 Training newTraining = new Training();
                 newTraining.TrainingName      = tbTrainingName.Text.Trim();
                 newTraining.TrainingStartDate = dtpTrainingStartDate.Value;
                 newTraining.TrainingEndDate   = dtpTrainingEndDate.Value;
                 newTraining.IdEmployee        = cbEmployeeList.SelectedIndex + 1;
                 newTraining.TrainingPrice     = int.Parse(tbTrainingPrice.Text.Trim());
                 db.Trainings.Add(newTraining);
                 db.SaveChanges();
                 clear();
                 if (tbSearchTraining.Text.Trim() == "" || tbSearchTrainingName.Text.Trim() == "")
                 {
                     display();
                 }
                 else
                 {
                     tbSearchTrainingName_TextChanged(sender, e);
                 }
                 MessageBox.Show("Poprawnie dodano szkolenie");
             }
         }
     }
 }
コード例 #19
0
        private void acceptBtn_Click(object sender, EventArgs e)
        {
            OrderCustomer newOrderCustomer = new OrderCustomer();

            //IdCustomer
            foreach (Customer cust in db.Customers)
            {
                if (cust.CustomerName == customerName)
                {
                    newOrderCustomer.IdCustomer = cust.IdCustomer;
                }
            }
            //IdEmployee
            if (employeeCb.SelectedIndex == -1)
            {
                MessageBox.Show("Nie wybrano pracownika");
                employeeCb.BackColor = Color.Red;
                return;
            }
            else
            {
                foreach (Employee emp in db.Employees)
                {
                    if ((emp.EmployeeName + " " + emp.EmployeeSurname).ToString() == employeeCb.Text.ToString())
                    {
                        newOrderCustomer.IdEmployee = emp.IdEmployee;
                    }
                }
            }
            //OrderDate
            if (orderDtp.Value.ToShortDateString() == DateTime.Today.ToShortDateString())
            {
                MessageBox.Show("Wybrano dzisiejszą datę");
                orderDtp.CalendarTitleForeColor = Color.Red;
                return;
            }
            else
            {
                newOrderCustomer.OrderDate = orderDtp.Value;
            }
            if (isMarkupCorrect)
            {
                newOrderCustomer.Markup = double.Parse(markupTb.Text.Trim());
                newOrderCustomer.Cost   = 0;
                db.OrderCustomers.Add(newOrderCustomer);
                db.SaveChanges();
                this.Hide();
                MessageBox.Show("Dodaj szczegół zamówienia");
                AddNewOrderDetailForm newOrderDetail = new AddNewOrderDetailForm(db, newOrderCustomer.IdOrderCustomer, salesForm);
                newOrderDetail.ShowDialog();
                this.Close();
                return;
            }
            MessageBox.Show("Coś poszło nie tak");
        }
コード例 #20
0
        private void button_save_Click(object sender, EventArgs e)
        {
            Failure failure = new Failure();

            failure.IdProces      = Convert.ToInt32(cBidproces.SelectedValue);
            failure.FailureDate   = dateTimePicker_Failure.Value;
            failure.Specification = tBdescription.Text;
            db.Failures.Add(failure);
            db.SaveChanges();
            MessageBox.Show("Dodano awarie!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #21
0
        private void btAddConfirm_Click(object sender, EventArgs e)
        {
            Product product = new Product();

            product.IdSemiFinished = Convert.ToInt32(cBSemiFinished.SelectedValue);
            product.ProductCode    = tBProductCode.Text;
            product.IdTechnology   = Convert.ToInt32(cBTechnology.SelectedValue);
            product.InputDate      = dTPAddTime.Value;
            db.Products.Add(product);
            db.SaveChanges();
            MessageBox.Show("Dodano nowy produkt!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #22
0
 private void btnReturn_Click(object sender, EventArgs e)
 {
     if (editPlan() & flagEditPlan)
     {
         Close();
     }
     else
     {
         if (viewProcessEmpl.RowCount == 0)
         {
             db.PlannedProductions.Remove(newPlan);
             db.SaveChanges();
             Close();
         }
         else if (viewProcessEmpl.DataSource == null)
         {
             Close();
         }
         else
         {
             if (flagExitPermission)
             {
                 MessageBox.Show("Usuń wszystkich pracowników jeśli nie chcesz zapisać tego planu", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             else
             {
                 Close();
             }
         }
     }
 }
コード例 #23
0
        private void btnAddNewInvoice_Click(object sender, EventArgs e)
        {
            Invoice newInvoiceValue = new Invoice();
            int     indexInvoice    = cbInvoiceType.SelectedIndex;
            int     indexContractor = cbContractors.SelectedIndex;

            newInvoiceValue.IdInvoiceType = indexInvoice + 1;
            newInvoiceValue.IdContractor  = indexContractor + 1;
            newInvoiceValue.Sum           = decimal.Parse(tbInvoiceValue.Text.Trim());
            newInvoiceValue.Date          = DateTime.Parse(dtpDateAdded.Value.ToString("yyyy-MM-dd"));
            db.Invoices.Add(newInvoiceValue);
            db.SaveChanges();
        }
コード例 #24
0
 private void btnSMeasures_Click(object sender, EventArgs e)
 {
     if (txtbAcceptableLenghtDeviation.Text == "" || txtbAcceptableWidthDeviation.Text == "")
     {
         MessageBox.Show("Proszę wypełnić oba pola określające wielkość dopuszczalnych odchyłek.");
     }
     else
     {
         if (txtbAcceptableLenghtDeviation.Text.Contains(".") || txtbAcceptableWidthDeviation.Text.Contains("."))
         {
             MessageBox.Show("Separatorem wartości dziesiętnej używanym w programie jest przecinek, zamieniono wykryte kropki na przecinki");
             txtbAcceptableLenghtDeviation.Text = txtbAcceptableLenghtDeviation.Text.Replace(".", ",");
             txtbAcceptableWidthDeviation.Text  = txtbAcceptableWidthDeviation.Text.Replace(".", ",");
         }
         if (processStatus[procesNumber].Equals(OutControlStatus.Oczekuje_na_kontrolę.ToString()))
         {
             OutControl outControl = new OutControl();
             outControl.IdEmployee = Int16.Parse(cbControlerId.SelectedValue.ToString());
             outControl.IdProcess  = procesNumber;
             outControl.LenghtAcceptableDeviation = Double.Parse(txtbAcceptableLenghtDeviation.Text);
             outControl.WidthAcceptableDeviation  = Double.Parse(txtbAcceptableWidthDeviation.Text);
             outControl.StartControlDate          = DateTime.Now;
             outControl.EndControlDate            = null;
             db.OutControls.Add(outControl);
             db.SaveChanges();
             using (OutMeasures outControlForm = new OutMeasures(db, startForm, qualityControlForm, this))
             {
                 this.Hide();
                 outControlForm.ShowDialog();
                 db.OutControls.First(i => i.IdProcess == procesNumber).EndControlDate = DateTime.Now;
                 db.SaveChanges();
                 db = new RoofingCompanyEntities();
                 refreshingData(procesNumber);
                 this.Show();
             }
         }
     }
 }
コード例 #25
0
        //Accept
        private void detailAcceptBtn_Click(object sender, EventArgs e)
        {
            OrderDetail newOrderDetail = new OrderDetail();

            if (productCb.SelectedIndex == -1)
            {
                MessageBox.Show("Wybierz Produkt");
                productCb.BackColor = Color.Red;
                return;
            }
            else
            {
                foreach (Product prod in db.Products)
                {
                    if (prod.ProductCode.ToString() == productCb.Text.ToString())
                    {
                        newOrderDetail.IdProduct = prod.IdProduct;
                    }
                }
            }
            if (int.TryParse(quantityTb.Text.Trim(), out int isQuantityInteger))
            {
                if (int.Parse(quantityTb.Text.Trim()) < 1)
                {
                    MessageBox.Show("Wprowadź poprawną wartość");
                    quantityTb.BackColor = Color.Red;
                    return;
                }
                else
                {
                    newOrderDetail.Quantity = int.Parse(quantityTb.Text.Trim());
                }
            }
            else
            {
                MessageBox.Show("Wprowadź poprawną wartość");
                quantityTb.BackColor = Color.Red;
                return;
            }
            newOrderDetail.IdOrderCustomer = orderNumber;
            db.OrderDetails.Add(newOrderDetail);
            db.SaveChanges();
            this.Hide();
            MessageBox.Show("Dodano szczegół zamówienia");
            CustomerForm customerForm = new CustomerForm(db, salesForm);

            customerForm.ShowDialog();
            this.Close();
        }
コード例 #26
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            PlannedProduction newPlan = new PlannedProduction();

            newPlan.IdDetail = Convert.ToInt32(this.viewOrderDetail.CurrentRow.Cells[0].Value);
            ///ZMIENIŁEM TO
            newPlan.IdMachine = Convert.ToInt32(cBoxMachine.SelectedValue);
            ///
            newPlan.PlannedStartd = dateTimeStart.Value;
            newPlan.PlannedEndd   = dateTimeEnd.Value;
            newPlan.Inproduction  = Convert.ToBoolean(cBoxIntoProduction.CheckState);
            db.PlannedProductions.Add(newPlan);
            db.SaveChanges();
            MessageBox.Show("Dodano nowy plan!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #27
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();
        }
コード例 #28
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();
        }
コード例 #29
0
        private void btnAcceptChanges_Click(object sender, EventArgs e)
        {
            if (tbBonus.Text.Trim() == "")
            {
                MessageBox.Show("Wartość premii jest wymagana!");
                return;
            }
            dgvSalariesData.CurrentRow.Cells[1].Value = Convert.ToDecimal(tbBonus.Text);
            dgvSalariesData.CurrentRow.Cells[0].Value = Convert.ToDecimal(dgvSalariesData.CurrentRow.Cells[1].Value) + Convert.ToDecimal(dgvSalariesData.CurrentRow.Cells[18].Value);
            Payment newPayment = new Payment();

            newPayment.Bonus      = int.Parse(tbBonus.Text.Trim());
            newPayment.IdEmployee = Convert.ToInt16(dgvSalariesData.CurrentRow.Cells[2].Value);
            newPayment.Date       = Convert.ToDateTime(tbCurrentDate.Text);
            newPayment.Sum        = Convert.ToDecimal(dgvSalariesData.CurrentRow.Cells[0].Value);
            db.Payments.Add(newPayment);
            db.SaveChanges();
        }
コード例 #30
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            MedicalExamination examinationToRemove = new MedicalExamination();

            examinationToRemove.IdMedicalExamination = int.Parse(dgvExamination.SelectedRows[0].Cells[8].Value.ToString());
            db.MedicalExaminations.Attach(examinationToRemove);
            db.MedicalExaminations.Remove(examinationToRemove);
            db.SaveChanges();
            if (tbSearchEmployeeExamination.Text.Trim() == "" || tbSearchEmployeeExaminationName.Text.Trim() == "")
            {
                display();
            }
            else
            {
                tbSearchEmployeeExamination_TextChanged(sender, e);
            }
            MessageBox.Show("Rekord został usunięty");
        }