Exemple #1
0
        public NewZHGUT(ZhgutVO wp, string accessmode_, IRole uvo)
        {
            InitializeComponent();

            this.AccessMode = accessmode_;
            this.UVO        = uvo;
            RequireVisible  = true;//((UVO.Role == Roles.Inzhener) || (UVO.Role == Roles.Admin)) ? true : false;
            RequireEnabled  = false;
            if (AccessMode == "NEW")
            {
                InitNEW();
                this.Text = "Создание нового изделия";
            }
            if (AccessMode == "NEWCLONE")
            {
                InitNEWCLONE(wp);
                this.Text = "Создание нового изделия на основе существующего";
            }
            if (AccessMode == "EDIT")
            {
                InitEDIT(wp);
                this.Text = "Редактирование изделия";
            }
            if (AccessMode == "VIEWONLY")
            {
                InitVIEWONLY(wp);
                this.Text       = "Просмотр сведений об изделии";
                button2.Visible = false;
            }
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)//save
        {
            ZhgutVO wp = new ZhgutVO();

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

            wp.WPType    = WPTYPE.ZHGUTLIST;
            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.ZHGUTPATH = (pfDimDrawing.FullPath == "<нет>") ? null : pfDimDrawing.FullPath;;
            wp.NOTE      = tbNote.Text;

            DBZhgutList dbc = new DBZhgutList();

            if (AccessMode == "EDIT")
            {
                wp.ID = EditWP.ID;
                dbc.EditZhgut(wp);

                MessageBox.Show("Жгут успешно сохранён!");
            }
            if ((AccessMode == "NEW") || (AccessMode == "NEWCLONE"))
            {
                dbc.AddNewZhgut(wp);
                MessageBox.Show("Жгут успешно добавлен!");
            }
            Close();
        }
Exemple #3
0
        private void bEdit_Click(object sender, EventArgs e)//редактировать
        {
            PreviousState ps = new PreviousState(dgWP);

            if (cbPRODUCTTYPE.SelectedIndex == 0)
            {
                NewWPN ew = new NewWPN(WPNameVO.WPNameVOByID(Convert.ToInt32(dgWP.SelectedRows[0].Cells["ID"].Value)), "EDIT", UVO);
                ew.ShowDialog();
            }
            if (cbPRODUCTTYPE.SelectedIndex == 1)
            {
                NewZHGUT ew = new NewZHGUT(ZhgutVO.GetZhgutVOByID(Convert.ToInt32(dgWP.SelectedRows[0].Cells["ID"].Value)), "EDIT", UVO);
                ew.ShowDialog();
            }
            if (cbPRODUCTTYPE.SelectedIndex == 2)
            {
                NewCABLE ew = new NewCABLE(CableVO.GetCableVOByID(Convert.ToInt32(dgWP.SelectedRows[0].Cells["ID"].Value)), "EDIT", UVO);
                ew.ShowDialog();
            }
            int idsub = (cbSubCat.SelectedValue != null) ? (int)cbSubCat.SelectedValue : 0;

            cbCAT_SelectedIndexChanged(sender, e);
            cbSubCat.SelectedValue = idsub;
            ps.Restore();
        }
Exemple #4
0
        private void InitEDIT(ZhgutVO wp)
        {
            EditWP      = wp;
            tbName.Text = wp.WPName;
            cbCategory.SelectedValue    = wp.IDCat;
            cbSubCategory.SelectedValue = wp.IDSubCat;
            tbDecNum.Text = wp.DecNum;
            tbNote.Text   = wp.NOTE;

            pfDimDrawing.Init(wp.ZHGUTPATH, true, true, false, RequireEnabled, Roles.Constructor, "EDIT", UVO, "ZHGUTPATH", null, wp);


            //AllocateRoles();
        }
Exemple #5
0
 private void InitVIEWONLY(ZhgutVO wp)
 {
     ViewWP                      = wp;
     RequireVisible              = true;
     tbName.Text                 = wp.WPName;
     tbName.Enabled              = false;
     cbCategory.SelectedValue    = wp.IDCat;
     cbCategory.Enabled          = false;
     cbSubCategory.SelectedValue = wp.IDSubCat;
     cbSubCategory.Enabled       = false;
     tbDecNum.Text               = wp.DecNum;
     tbDecNum.Enabled            = false;
     tbNote.Text                 = wp.NOTE;
     tbNote.Enabled              = false;
     pfDimDrawing.Init(wp.ZHGUTPATH, true, false, false, RequireEnabled, Roles.Constructor, "VIEWONLY", UVO, "ZHGUTPATH", null, wp);
 }
Exemple #6
0
 private void bview_Click_1(object sender, EventArgs e)
 {
     if (dgWP.SelectedRows.Count == 0)
     {
         return;
     }
     if (WPT == WPTYPE.ZHGUTLIST)
     {
         NewZHGUT ew = new NewZHGUT(ZhgutVO.GetZhgutVOByID(Convert.ToInt32(dgWP.SelectedRows[0].Cells["ID"].Value)), "VIEWONLY", UVO);
         ew.ShowDialog();
     }
     if (WPT == WPTYPE.CABLELIST)
     {
         NewCABLE ew = new NewCABLE(CableVO.GetCableVOByID(Convert.ToInt32(dgWP.SelectedRows[0].Cells["ID"].Value)), "VIEWONLY", UVO);
         ew.ShowDialog();
     }
 }
Exemple #7
0
        private void InitNEWCLONE(ZhgutVO clone)
        {
            if (clone.WPName != "")
            {
                this.Clone = clone;

                //wp.WPType = WPTYPE.WPNAMELIST;
                //wp.ID = (int)r["ID"];

                tbName.Text = Clone.WPName;
                cbCategory.SelectedValue    = Clone.IDCat;
                cbSubCategory.SelectedValue = Clone.IDSubCat;
                tbDecNum.Text               = Clone.DecNum;
                cbCategory.SelectedValue    = Clone.IDCat;    //CHECK!!!!!!!!
                cbSubCategory.SelectedValue = Clone.IDSubCat; //CHECK!!!!!!!!!
                pfDimDrawing.Init(Clone.ZHGUTPATH, true, true, false, RequireEnabled, Roles.Constructor, "NEWCLONE", UVO, "ZHGUTPATH", null, Clone);
                tbNote.Text = Clone.NOTE;
                //AllocateRoles();
            }
        }
Exemple #8
0
 private void bView_Click(object sender, EventArgs e)//просмотр
 {
     if (dgWP.SelectedRows.Count == 0)
     {
         return;
     }
     if (cbPRODUCTTYPE.SelectedIndex == 0)
     {
         NewWPN ew = new NewWPN(WPNameVO.WPNameVOByID(Convert.ToInt32(dgWP.SelectedRows[0].Cells["ID"].Value)), "VIEWONLY", UVO);
         ew.ShowDialog();
     }
     if (cbPRODUCTTYPE.SelectedIndex == 1)
     {
         NewZHGUT ew = new NewZHGUT(ZhgutVO.GetZhgutVOByID(Convert.ToInt32(dgWP.SelectedRows[0].Cells["ID"].Value)), "VIEWONLY", UVO);
         ew.ShowDialog();
     }
     if (cbPRODUCTTYPE.SelectedIndex == 2)
     {
         NewCABLE ew = new NewCABLE(CableVO.GetCableVOByID(Convert.ToInt32(dgWP.SelectedRows[0].Cells["ID"].Value)), "VIEWONLY", UVO);
         ew.ShowDialog();
     }
 }