Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (tbName.Text == "")
            {
                MessageBox.Show("Введите наименование!");
                return;
            }

            DBWPName dbwp = new DBWPName();
            WPNameVO wp   = new WPNameVO();

            wp.WPName        = tbName.Text;
            wp.IDCat         = Convert.ToInt32(cbCategory.SelectedValue);
            wp.IDSubCat      = Convert.ToInt32(cbSubCategory.SelectedValue);
            wp.DecNum        = tbDecNum.Text;
            wp.COMPOSITION   = pfComposition.FullPath; //.bOpen.Tag.ToString();
            wp.DIMENDRAWING  = pfDimDrawing.FullPath;  //.bOpen.Tag.ToString();
            wp.PowerSupply   = tbPowerSupply.Text;
            wp.CONFIGURATION = tbConfiguration.Text;
            wp.Note          = tbNote.Text;
            wp.ID            = this.IDW;
            dbwp.EditWP(wp);
            MessageBox.Show("Наименование успешно изменено!");
            Close();
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)//save
        {
            WPNameVO wp = new WPNameVO();

            if (tbName.Text == "")
            {
                MessageBox.Show("Введите наименование!");
                return;
            }

            wp.WPType = WPTYPE.WPNAMELIST;
            //wp.ID = (int)r["ID"];
            wp.WPName        = tbName.Text;
            wp.IDCat         = Convert.ToInt32(cbCategory.SelectedValue);
            wp.IDSubCat      = (cbSubCategory.SelectedValue == null) ? new DBSubCategory().GetIDNotAwardedByIDCat(wp.IDCat)  : (int)cbSubCategory.SelectedValue;
            wp.DecNum        = tbDecNum.Text;
            wp.WIRINGDIAGRAM = (pfWIRINGDIAGRAM.FullPath == "<нет>") ? null : pfWIRINGDIAGRAM.FullPath;
            wp.TECHREQ       = (pfTECHREQ.FullPath == "<нет>") ? null : pfTECHREQ.FullPath;
            wp.COMPOSITION   = (pfComposition.FullPath == "<нет>") ? null : pfComposition.FullPath;
            wp.CONFIGURATION = (pfCONFIGURATION.FullPath == "<нет>") ? null : pfCONFIGURATION.FullPath;
            wp.DIMENDRAWING  = (pfDimDrawing.FullPath == "<нет>") ? null : pfDimDrawing.FullPath;;
            wp.SBORKA3D      = (pf3DSBORKA.FullPath == "<нет>") ? null : pf3DSBORKA.FullPath;
            wp.MECHPARTS     = (pfMECHPARTS.FullPath == "<нет>") ? null : pfMECHPARTS.FullPath;
            wp.ZHGUTS        = new DBZhgutList().GetPackageForVO(wp.ID);
            wp.CABLES        = new DBCableList().GetPackageForVO(wp.ID);
            wp.SHILDS        = (pfSHILDS.FullPath == "<нет>") ? null : pfSHILDS.FullPath;
            //wp.PLANKA                   = (pfPLANKA.FullPath == "<нет>") ? null : pfPLANKA.FullPath;
            //wp.SERIAL                   = (pfSERIAL.FullPath == "<нет>") ? null : pfSERIAL.FullPath;
            wp.PACKAGING             = (pfPACKAGING.FullPath == "<нет>") ? null : pfPACKAGING.FullPath;
            wp.PASSPORT              = (pfPASSPORT.FullPath == "<нет>") ? null : pfPASSPORT.FullPath;
            wp.MANUAL                = (pfMANUAL.FullPath == "<нет>") ? null : pfMANUAL.FullPath;
            wp.PACKINGLIST           = (pfPACKINGLIST.FullPath == "<нет>") ? null : pfPACKINGLIST.FullPath;
            wp.PowerSupply           = tbPowerSupply.Text;
            wp.Note                  = tbNote.Text;
            wp.COMPOSITIONREQ        = pfComposition.Required;
            wp.DIMENSIONALDRAWINGREQ = pfDimDrawing.Required;
            //wp.POWERSUPPLYREQ	        = pfpowe;
            wp.CONFIGURATIONREQ = pfCONFIGURATION.Required;
            wp.WIRINGDIAGRAMREQ = pfWIRINGDIAGRAM.Required;
            wp.TECHREQREQ       = pfTECHREQ.Required;
            wp.SBORKA3DREQ      = pf3DSBORKA.Required;
            wp.MECHPARTSREQ     = pfMECHPARTS.Required;
            wp.SHILDSREQ        = pfSHILDS.Required;
            //wp.PLANKAREQ	            = pfPLANKA.Required;
            //wp.SERIALREQ	            = pfSERIAL.Required;
            wp.PACKAGINGREQ   = pfPACKAGING.Required;
            wp.PASSPORTREQ    = pfPASSPORT.Required;
            wp.MANUALREQ      = pfMANUAL.Required;
            wp.PACKINGLISTREQ = pfPACKINGLIST.Required;
            //wp.SOFTWAREREQ	;
            wp.CABLELISTREQ = packCABLE.Required;
            wp.ZHGUTLISTREQ = packZHGUT.Required;
            //wp.RUNCARDLISTREQ	;
            //wp.CIRCUITBOARDLISTREQ;
            wp.LENGTH = tbLENGTH.Text;
            wp.WIDTH  = tbWIDTH.Text;
            wp.HEIGHT = tbHEIGHT.Text;
            wp.WEIGHT = tbWEIGHT.Text;


            DBWPName dbwp = new DBWPName();

            if (AccessMode == "EDIT")
            {
                wp.ID = EditWP.ID;
                if (UVO.Role == Roles.Admin)
                {
                    dbwp.EditWP(wp);
                }
                if (UVO.Role == Roles.Constructor)
                {
                    dbwp.EditWP_Constructor(wp);
                }
                if ((UVO.Role == Roles.Inzhener) ||
                    (UVO.Role == Roles.SimpleInzhener))
                {
                    dbwp.EditWP_Inzhener(wp);
                }
                if (UVO.Role == Roles.Tehnolog)
                {
                    dbwp.EditWP_Tehnolog(wp);
                }
                if (UVO.Role == Roles.Shemotehnik)
                {
                    dbwp.EditWP_Shemotehnik(wp);
                }
                if (UVO.Role == Roles.OTD)
                {
                    dbwp.EditWP_OTD(wp);
                }
                if (UVO.Role == Roles.OTK)
                {
                    dbwp.EditWP_OTK(wp);
                }
                if (UVO.Role == Roles.OTK)
                {
                    dbwp.EditWP_OTK(wp);
                }

                MessageBox.Show("Изделие успешно сохранено!");
            }
            if ((AccessMode == "NEW") || (AccessMode == "NEWCLONE"))
            {
                wp.COMPOSITIONREQ        = true;
                wp.DIMENSIONALDRAWINGREQ = true;
                wp.CONFIGURATIONREQ      = true;
                wp.WIRINGDIAGRAMREQ      = true;
                wp.TECHREQREQ            = true;
                wp.SBORKA3DREQ           = true;
                wp.MECHPARTSREQ          = true;
                wp.SHILDSREQ             = true;
                wp.PACKAGINGREQ          = true;
                wp.PASSPORTREQ           = true;
                wp.MANUALREQ             = true;
                wp.PACKINGLISTREQ        = true;
                wp.CABLELISTREQ          = true;
                wp.ZHGUTLISTREQ          = true;

                dbwp.AddNewWP(wp);
                MessageBox.Show("Изделие успешно добавлено!");
            }
            Close();
        }