private void setTheNewBtn3ProdEvents()
 {
     removeClickEvent((Button)btn3);
     btn3.Click += (e, a) => {
         if (mgrid.SelectedRows[0].Index != -1)
         {
             try
             {
                 int indexFromGrid = mgrid.SelectedRows[0].Index;
                 int recIdentif    = (int)mgrid.Rows[indexFromGrid].Cells[0].Value;
                 if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiAct)     //modify the active qualRec
                 {
                     ProductQualityPart row = productService.getPartContainerOfChosenProductions(recIdentif);
                     productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.MODIFY, productService, mainWindow);
                 }
                 if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripAct)     //modify the active quantRec
                 {
                     ProductFullRow row = productService.getFullistContainerOfProduction(recIdentif);
                     productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.MODIFY, productService, mainWindow);
                 }
             }
             catch (ErrorServiceProd k)
             {
                 errorHandle(k.Message);
             }
             catch (Exception k)
             {
                 errorHandle("Ismeretlen hiba történt (ContrMainProdBtn3) " + k.Message);
             }
         }
     };
 }
 private void setTheNewBtn5ProdEvents()
 {
     removeClickEvent((Button)btn5);
     btn5.Click += (e, a) => {
         if (mgrid.SelectedRows[0].Index != -1)
         {
             try
             {
                 int indexFromGrid = mgrid.SelectedRows[0].Index;
                 int recIdentif    = (int)mgrid.Rows[indexFromGrid].Cells[0].Value;
                 if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripAct ||
                     actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripHis)
                 {
                     ProductFullRow row = productService.getFullistContainerOfProduction(recIdentif);
                     productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.DETAILS, productService, mainWindow);
                 }
                 else if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiAct ||
                          actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiHis)
                 {
                     ProductQualityPart row = productService.getPartContainerOfChosenProductions(recIdentif);
                     productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.DETAILS, productService, mainWindow);
                 }
             }
             catch (ErrorServiceProd w)
             {
                 errorHandle(w.Message);
             }
             catch (Exception w)
             {
                 errorHandle("Ismeretlen hiba történt (ContrMainGrid) " + w.Message);
             }
         }
     };
 }
        private void setTheNewBtn2ProdEvents()
        {
            removeClickEvent((Button)btn2);
            btn2.Click += (e, a) => {
                if (mgrid.SelectedRows[0].Index != -1)
                {
                    try
                    {
                        if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripAct)     //creates new (act) strippingRecord
                        {
                            int indexFromGrid = mgrid.SelectedRows[0].Index;
                            int stripId       = (int)mgrid.Rows[indexFromGrid].Cells[0].Value;

                            ProductFullRow row = productService.getFullistContainerOfProduction(stripId);
                            row.productValidity  = true;
                            productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.NEW, productService, mainWindow);
                        }
                        if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiAct)     //creates new (act) qualRecord
                        {
                            ProductQualityPart row = new ProductQualityPart();
                            row.productValidity  = true;
                            productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.NEW, productService, mainWindow);
                        }
                    }
                    catch (ErrorServiceProd k)
                    {
                        errorHandle(k.Message);
                    }
                    catch (Exception k)
                    {
                        errorHandle("Ismeretlen hiba történt (ContrMainProdBtn2) " + k.Message);
                    }
                }
            };
        }
 private void initializeProdGridViewEvent()
 {
     removeDoubleClickEvent(mgrid);
     mgrid.DoubleClick += (o, a) =>
     {
         if (mgrid.SelectedRows[0].Index != -1)
         {
             if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripAct ||
                 actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripHis)
             {
                 int index = mgrid.SelectedRows[0].Index;
                 List <ProductFullRow> allList = productService.getFullListOfProductions();
                 ProductFullRow        row     = allList[index];
                 productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.DETAILS, productService, mainWindow);
             }
             else if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiAct ||
                      actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiHis)
             {
                 int index = mgrid.SelectedRows[0].Index;
                 List <ProductQualityPart> partList = productService.getPartListOfProductions();
                 ProductQualityPart        row      = partList[index];
                 productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.DETAILS, productService, mainWindow);
             }
         }
     };
 }
 private int tryParseTemp;   //only for having a type-conversion probe
 /// <summary>
 /// constructor in case of production quantity is the matter
 /// </summary>
 /// <param name="prod">the list element of fullrecord</param>
 /// <param name="mode">mark of mode this section</param>
 /// <param name="serviceOfProd"></param>
 public FormServiceProductsWindow(ProductFullRow prod, ProductWindowPurpose mode,
                                  ServiceProducts serviceOfProd, Form parent)
 {
     InitializeComponent();
     this.modeTheWindow       = mode;
     this.parentMainWindow    = parent;
     controllerProductsWindow = new ServiceProductsWinController(serviceOfProd, mode, this);
     controllerProductsWindow.sendTheStrippingData(prod);
     parent.Hide();
     this.Show();
 }
        /// <summary>
        /// part of the NEW record creations in quantity
        /// </summary>
        private void fillUpNewProdQuantity(ProductFullRow prod)
        {
            txtbName.Text    = prod.productName;
            txtbSaftySh.Text = prod.productSheet;
            txtbQuantUn.Text = prod.productQantUnit;
            txtbDanger.Text  = prod.productDanger.ToString();
            txtbDescr.Text   = prod.productDescr;

            fillAndAdjustSubcontr(prod.productSubcontr);

            txtbPlace.Text     = "";
            txtbBarcode.Text   = "";
            txtbQuan.Text      = "";
            txtbStripping.Text = "";

            indexProd = prod.productIndex;
        }
 /// <summary>
 /// adjust the elements of this form - depending of the purpose mode of this in case Quantity managing
 /// </summary>
 /// <param name="prod">product in treat - FullRow -> need the quantity details</param>
 public void buildTheStarterStripping(ProductFullRow prod)
 {
     if (typeOfDataManaging == ProductWindowPurpose.NEW)
     {
         fillUpNewProdQuantity(prod);
         btnOk.Text    = "Bejegyzés";
         btnOk.Style   = MetroFramework.MetroColorStyle.Lime;
         lblMain.Text += " - Új kiszerelés";
         fieldsToQuantityNewModify();
     }
     else if (typeOfDataManaging == ProductWindowPurpose.MODIFY)
     {
         fillUpQuantityFields(prod);
         btnOk.Text    = "Módosítás";
         btnOk.Style   = MetroFramework.MetroColorStyle.Lime;
         lblMain.Text += " - Kiszerelés módosítása";
         fieldsToQuantityNewModify();
     }
     else if (typeOfDataManaging == ProductWindowPurpose.DELETE)
     {
         fillUpQuantityFields(prod);
         btnOk.Text    = "Tőrlés";
         btnOk.Style   = MetroFramework.MetroColorStyle.Red;
         lblMain.Text += " - Kiszerelés törlése";
         fieldsToQuantityDeletDetails();
     }
     else if (typeOfDataManaging == ProductWindowPurpose.UNDELETE)
     {
         fillUpQuantityFields(prod);
         btnOk.Text    = "Visszaállítás";
         btnOk.Style   = MetroFramework.MetroColorStyle.Purple;
         lblMain.Text += " - Kiszerelés visszaállítása";
         fieldsToQuantityDeletDetails();
     }
     else if (typeOfDataManaging == ProductWindowPurpose.DETAILS)
     {
         fillUpQuantityFields(prod);
         btnOk.Text    = "Adatlap";
         btnOk.Style   = MetroFramework.MetroColorStyle.Brown;
         lblMain.Text += " - Kiszerelés tulajdonságai";
         fieldsToQuantityDeletDetails();
     }
 }
        /// <summary>
        /// part of the product list collector - saves each row
        /// </summary>
        /// <param name="record">string[] of a record</param>
        /// <returns>datas in a single product-element</returns>
        private ProductFullRow fullRecordToListProdFullElem(string[] record)
        {
            ProductFullRow row = new ProductFullRow();

            row.productName         = record[0];
            row.productSubcontr     = record[1];
            row.productDescr        = record[2];
            row.productQantUnit     = record[3];
            row.productSheet        = record[4];
            row.productDanger       = Convert.ToInt32(record[5]);
            row.producQualId        = Convert.ToInt32(record[6]);
            row.strippId            = Convert.ToInt32(record[7]);
            row.productStripping    = Convert.ToInt32(record[8]);
            row.productQuantity     = Convert.ToInt32(record[9]);
            row.productBarcode      = record[10];
            row.productPlace        = record[11];
            row.productModifiedThen = record[12];
            row.productModifiedBy   = Convert.ToInt32(record[13]);
            row.productValidity     = record[14] == "1" ? true : false;

            return(row);
        }
        /// <summary>
        /// fills up the details from record-container to show in fields in case Quantity managing
        /// </summary>
        /// <param name="prod">data carrer FullRow</param>
        private void fillUpQuantityFields(ProductFullRow prod)
        {
            txtbName.Text    = prod.productName;
            txtbSaftySh.Text = prod.productSheet;
            txtbQuantUn.Text = prod.productQantUnit;
            txtbDanger.Text  = Convert.ToString(prod.productDanger);
            txtbDescr.Text   = prod.productDescr;

            fillAndAdjustSubcontr(prod.productSubcontr);

            txtbPlace.Text     = prod.productPlace;
            txtbBarcode.Text   = prod.productBarcode;
            txtbQuan.Text      = Convert.ToString(prod.productQuantity);
            txtbStripping.Text = Convert.ToString(prod.productStripping);

            indexProd     = prod.productIndex;
            oldStripping  = prod.productStripping.ToString();
            dataActOrHis  = prod.productValidity;
            sheetNameTemp = prod.productSheet;

            if (!dataActOrHis)
            {
                lblInfos.Text += "Töröve!\n";
            }
            if (prod.productModifiedThen != "0")
            {
                lblInfos.Text += "Utolsó módosítás: " + prod.productModifiedThen + "\n";
            }
            if (prod.productModifiedBy != 0)
            {
                lblInfos.Text += "Végrehajtotta: " + serviceProducts.getWhoModifiedTheRecord(prod.productModifiedBy);
            }

            if (typeOfDataManaging == ProductWindowPurpose.MODIFY)
            {
                oldStripping = prod.productStripping.ToString();
            }
        }
 private void setTheNewBtn3ProdEvents()
 {
     removeClickEvent((Button)btn3);
     btn3.Click += (e, a) => {
         if (mgrid.SelectedRows[0].Index != -1)
         {
             if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiAct)     //modify the active qualRec
             {
                 int index = mgrid.SelectedRows[0].Index;
                 List <ProductQualityPart> productsFullList = productService.getPartListOfProductions();
                 ProductQualityPart        row = productsFullList[index];
                 productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.MODIFY, productService, mainWindow);
             }
             if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripAct)     //modify the active quantRec
             {
                 int index = mgrid.SelectedRows[0].Index;
                 List <ProductFullRow> productsFullList = productService.getFullListOfProductions();
                 ProductFullRow        row = productsFullList[index];
                 productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.MODIFY, productService, mainWindow);
             }
         }
     };
 }
 private void setTheNewBtn2ProdEvents()
 {
     removeClickEvent((Button)btn2);
     btn2.Click += (e, a) => {
         if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripAct)     //creates new (act) strippingRecord
         {
             if (mgrid.SelectedRows[0].Index != -1)
             {
                 int index = mgrid.SelectedRows[0].Index;
                 List <ProductFullRow> productsFullList = productService.getFullListOfProductions();
                 ProductFullRow        row = productsFullList[index];
                 row.productValidity  = true;
                 productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.NEW, productService, mainWindow);
             }
         }
         if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiAct)     //creates new (act) qualRecord
         {
             ProductQualityPart row = new ProductQualityPart();
             row.productValidity  = true;
             productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.NEW, productService, mainWindow);
         }
     };
 }
 private void setTheNewBtn4ProdEvents()
 {
     removeClickEvent((Button)btn4);
     btn4.Click += (e, a) => {
         if (mgrid.SelectedRows[0].Index != -1)
         {
             if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiAct)     //delete activeQualRec
             {
                 int index = mgrid.SelectedRows[0].Index;
                 List <ProductQualityPart> productsFullList = productService.getPartListOfProductions();
                 ProductQualityPart        row = productsFullList[index];
                 productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.DELETE, productService, mainWindow);
             }
             else if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiHis)     //react passtiveQualRec
             {
                 int index = mgrid.SelectedRows[0].Index;
                 List <ProductQualityPart> productsFullList = productService.getPartListOfProductions();
                 ProductQualityPart        row = productsFullList[index];
                 productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.UNDELETE, productService, mainWindow);
             }
             else if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripAct)     //delete activeQuantRec
             {
                 int index = mgrid.SelectedRows[0].Index;
                 List <ProductFullRow> productsFullList = productService.getFullListOfProductions();
                 ProductFullRow        row = productsFullList[index];
                 productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.DELETE, productService, mainWindow);
             }
             else if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripHis)     //react passiveQuantRec
             {
                 int index = mgrid.SelectedRows[0].Index;
                 List <ProductFullRow> productsFullList = productService.getFullListOfProductions();
                 ProductFullRow        row = productsFullList[index];
                 productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.UNDELETE, productService, mainWindow);
             }
         }
     };
 }
 public void sendTheStrippingData(ProductFullRow prod)
 {
     typeOfInformationIsThreathing = true;
     buildTheStarterStripping(prod);
 }