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("Успешно добавлено!"); }
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(); }
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(); } }