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);
             }
         }
     };
 }
        /// <summary>
        /// fills up the details from record-container to show in fields in case Quality managing
        /// </summary>
        /// <param name="prod">data-carrier QualityPart</param>
        private void fillUpQualityFieldsToModifyDeletUndelet(ProductQualityPart 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);

            indexProd     = prod.productQualId;
            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);
            }
        }
 private void setTheNewBtn1ProdEvents()
 {
     removeClickEvent((Button)btn1);
     btn1.Click += (e, a) => {
         if (mgrid.SelectedRows[0].Index != -1)
         {
             try
             {
                 if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiAct)
                 {
                     int indexFromGrid      = mgrid.SelectedRows[0].Index;
                     int recId              = (int)mgrid.Rows[indexFromGrid].Cells[0].Value;
                     ProductQualityPart row = productService.getPartContainerOfChosenProductions(recId);
                     row.productValidity  = true;
                     productsManageWindow = new FormServiceProductsWindow(row,
                                                                          ProductWindowPurpose.BRANDNEWSTRIPPING, productService, mainWindow);
                 }
                 if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripAct)     //normal show details of quantity
                 {
                     //create new ordering record is needed - case of ProdMode StripAct
                 }
             }
             catch (ErrorServiceProd k)
             {
                 errorHandle(k.Message);
             }
             catch (Exception k)
             {
                 errorHandle("Ismeretlen hiba történt (ContrMainProdBtn1) " + 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 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);
             }
         }
     };
 }
Пример #7
0
 /// <summary>
 /// modify a record in 'raktminoseg' table with ProductPartRow - index the definiton which
 /// </summary>
 /// <param name="modif">set of ProductPartElement with the new paramteres, index is remains!</param>
 public void modifyProdQualityRecord(ProductQualityPart modif, string userId)
 {
     try
     {
         parameters = new List <KeyValuePair <string, string> >();
         KeyValuePair <string, string> id     = new KeyValuePair <string, string>("@termekId", modif.productIndex.ToString());
         KeyValuePair <string, string> name   = new KeyValuePair <string, string>("@nev", modif.productName);
         KeyValuePair <string, string> subcon = new KeyValuePair <string, string>("@beszallito", modif.productSubcontr);
         KeyValuePair <string, string> descr  = new KeyValuePair <string, string>("@leiras", modif.productDescr);
         KeyValuePair <string, string> unit   = new KeyValuePair <string, string>("@menyegyseg", modif.productQantUnit);
         KeyValuePair <string, string> sheet  = new KeyValuePair <string, string>("@adatlap", modif.productSheet);
         KeyValuePair <string, string> dange  = new KeyValuePair <string, string>("@veszely", modif.productDanger.ToString());
         KeyValuePair <string, string> who    = new KeyValuePair <string, string>("@userId", userId);
         parameters.Add(id);
         parameters.Add(name);
         parameters.Add(subcon);
         parameters.Add(descr);
         parameters.Add(unit);
         parameters.Add(sheet);
         parameters.Add(dange);
         parameters.Add(who);
     }
     catch (Exception e)
     {
         throw new ErrorServiceUpdateRecord("Adatbátzis felé a kérés megalkotása sikertelen (ModProdQualModRec): " + e.Message);
     }
     mdi.openConnection();
     mdi.execPrepDMQueryWithKVPList(queryProductsModifyRowQuality, parameters, 8);
     mdi.closeConnection();
 }
 public FormServiceProductsWindow(ProductQualityPart prod, ProductWindowPurpose mode,
                                  ServiceProducts serviceOfProd, Form parentMain)
 {
     InitializeComponent();
     this.modeTheWindow       = mode;
     this.parentMainWindow    = parentMain;
     controllerProductsWindow = new ServiceProductsWinController(serviceOfProd, mode, this);
     controllerProductsWindow.sendTheQualityData(prod);
     parentMain.Hide();
     this.Show();
 }
Пример #9
0
 /// <summary>
 /// make change in raktminoseg - modify the spec. record
 /// ProdPartRow - the productIndex musn't change!
 /// </summary>
 /// <param name="row">record content, that is needed to change</param>
 public void setModifyRecProdQuality(ProductQualityPart row)
 {
     try
     {
         modelQualities = new ProductsModelQualityTable(dbci, parent);
         modelQualities.modifyProdQualityRecord(row, userId);
     }
     catch (ErrorServiceUpdateRecord e)
     {
         errorHandle(e.Message);
     }
 }
Пример #10
0
 /// <summary>
 /// make change in raktminoseg - create new record - some value is emty! productIndex as well
 /// name; subcontr; descr; unit;
 /// </summary>
 /// <param name="row">the spec datas to sotre in DB</param>
 public void setNewRecProdQuality(ProductQualityPart row)
 {
     try
     {
         modelQualities = new ProductsModelQualityTable(dbci, parentMain);
         modelQualities.createNewProdQualityRecord(row, userId);
     }
     catch (ErrorServiceNewRecord e)
     {
         throw new ErrorServiceProd(e.Message);
     }
 }
 /// <summary>
 /// adjust the elements of this form - depending of the purpose mode of this in case Quality managing
 /// </summary>
 /// <param name="prod">product in treat - QualityPart type</param>
 public void buildTheStarterQuality(ProductQualityPart prod)
 {
     if (typeOfDataManaging == ProductWindowPurpose.NEW)
     {
         fillUpNewProdQuality();
         btnOk.Text    = "Bejegyzés";
         btnOk.Style   = MetroFramework.MetroColorStyle.Purple;
         lblMain.Text += " - Új termék";
         fieldsToQualityNewModify();
     }
     else if (typeOfDataManaging == ProductWindowPurpose.MODIFY)
     {
         fillUpQualityFieldsToModifyDeletUndelet(prod);
         btnOk.Text    = "Módosítás";
         btnOk.Style   = MetroFramework.MetroColorStyle.Purple;
         lblMain.Text += " - Termék módosítása";
         fieldsToQualityNewModify();
     }
     else if (typeOfDataManaging == ProductWindowPurpose.DELETE)
     {
         fillUpQualityFieldsToModifyDeletUndelet(prod);
         btnOk.Text    = "Tőrlés";
         btnOk.Style   = MetroFramework.MetroColorStyle.Red;
         lblMain.Text += " - Termék törlése";
         fieldsToQualityDeletUndeletDetails();
     }
     else if (typeOfDataManaging == ProductWindowPurpose.UNDELETE)
     {
         fillUpQualityFieldsToModifyDeletUndelet(prod);
         btnOk.Text    = "Visszaállítás";
         btnOk.Style   = MetroFramework.MetroColorStyle.Purple;
         lblMain.Text += " - Termék visszaállítása";
         fieldsToQualityDeletUndeletDetails();
     }
     else if (typeOfDataManaging == ProductWindowPurpose.DETAILS)
     {
         fillUpQualityFieldsToModifyDeletUndelet(prod);
         btnOk.Visible = false;
         lblMain.Text += " - Termék részletei";
         fieldsToQualityDeletUndeletDetails();
     }
     else if (typeOfDataManaging == ProductWindowPurpose.BRANDNEWSTRIPPING)
     {
         fillUpQualityFieldsToModifyDeletUndelet(prod);
         btnOk.Text    = "Új kiszerelés";
         btnOk.Style   = MetroFramework.MetroColorStyle.Brown;
         lblMain.Text += " - Új kiszerelés létrehozása";
         fieldsToBrandNewStripping();
     }
 }
Пример #12
0
        /// <summary>
        /// collects the datas from fields of case quality managing
        /// </summary>
        public void collectAllDatasQuality()
        {
            tempOfCangesQuality                 = new ProductQualityPart();
            tempOfCangesQuality.productName     = txtbName.Text;
            tempOfCangesQuality.productSubcontr = cmbbSubcontr.SelectedItem.ToString();
            tempOfCangesQuality.productDescr    = txtbDescr.Text;
            tempOfCangesQuality.productDanger   = Convert.ToInt32(txtbDanger.Text);
            tempOfCangesQuality.productSheet    = txtbSaftySh.Text;
            tempOfCangesQuality.productQantUnit = txtbQuantUn.Text;

            if (typeOfDataManaging == ProductWindowPurpose.NEW)
            {
                tempOfCangesQuality.productIndex = 0;  //validity automaticly created true
            }
            else
            {
                tempOfCangesQuality.productIndex    = indexProd;
                tempOfCangesQuality.productValidity = true;     //in case reactivate
            }
        }
        /// <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 ProductQualityPart recordToListProdPartElem(string[] record)
        {
            ProductQualityPart row = new ProductQualityPart();

            row.productName     = record[0];                          //name
            row.productSubcontr = record[1];                          //subcontr
            row.productDescr    = record[2];                          //description
            row.productQantUnit = record[3];                          //quantity unit
            row.productSheet    = record[4];                          //datasheet
            row.productDanger   = Convert.ToInt32(record[5]);         //danger number
            row.productQualId   = Convert.ToInt32(record[6]);         //index of table (prim.key)

            row.productModifiedBy   = Convert.ToInt32(record[7]);     //user_id of profile
            row.productModifiedThen = record[8];                      //when changed the record
            row.productValidity     = record[9] == "1"? true : false; //is it activ or passive

            /*if (record[9] == "1")
             *  row.productValidity = true;
             * else
             *  row.productValidity = false;*/
            return(row);
        }
        private void setTheNewBtn1ProdEvents()
        {
            removeClickEvent((Button)btn1);
            btn1.Click += (e, a) => {
                if (mgrid.SelectedRows[0].Index != -1)
                {
                    if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANQualiAct)
                    {
                        int index = mgrid.SelectedRows[0].Index;
                        List <ProductQualityPart> productsPartList = productService.getPartListOfProductions();
                        ProductQualityPart        row = productsPartList[index];
                        row.productValidity  = true;
                        productsManageWindow = new FormServiceProductsWindow(row, ProductWindowPurpose.BRANDNEWSTRIPPING, productService, mainWindow);
                    }

                    if (actServiceForSubEvents == FormMainServiceMode.PRODUCTSMANStripAct)     //normal show details of quantity
                    {
                        //create new ordering record is needed - case of ProdMode StripAct
                    }
                }
            };
        }
 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 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 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 sendTheQualityData(ProductQualityPart prod)
 {
     typeOfInformationIsThreathing = false;
     buildTheStarterQuality(prod);
 }