예제 #1
0
        private void bAdd_Click(object sender, EventArgs e)//добавить
        {
            PreviousState ps = new PreviousState(dgWP);

            if (cbPRODUCTTYPE.SelectedIndex == 0)
            {
                NewWPN nwp = new NewWPN(null, "NEW", UVO);
                nwp.ShowDialog();
            }
            if (cbPRODUCTTYPE.SelectedIndex == 1)
            {
                NewZHGUT nwp = new NewZHGUT(null, "NEW", UVO);//zhguts
                nwp.ShowDialog();
            }
            if (cbPRODUCTTYPE.SelectedIndex == 2)
            {
                NewCABLE nwp = new NewCABLE(null, "NEW", UVO);//cables
                nwp.ShowDialog();
            }

            int idsub = (cbSubCat.SelectedValue != null) ? (int)cbSubCat.SelectedValue : 0;

            cbCAT_SelectedIndexChanged(sender, e);
            cbSubCat.SelectedValue = idsub;
            ps.Restore();

            //MessageBox.Show("Успешно добавлено!");
        }
예제 #2
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();
        }
예제 #3
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();
     }
 }