public EditWPCategory(string ENTITY_) { this.ENTITY = ENTITY_; InitializeComponent(); DBCategory dbc = new DBCategory(this.ENTITY); dgWP.DataSource = dbc.GetAll(); dgWP.Columns["ID"].Visible = false; dgWP.Columns["CATEGORYNAME"].HeaderText = "Наименование категории"; dgWP.Columns["CATEGORYNAME"].Width = 200; dgWP.Columns["srt"].Visible = false; switch (this.ENTITY) { case "WPNAMELIST": this.Text = "Категории изделия"; break; case "CABLELIST": this.Text = "Категории кабелей"; break; case "ZHGUTLIST": this.Text = "Категории жгутов"; break; case "RUNCARDLIST": this.Text = "Категории технологических карт"; break; } }
private void WPName_Load(object sender, EventArgs e) { if (WPT == WPTYPE.CABLELIST) { DBCategory dbc = new DBCategory("CABLELIST"); cbCAT.ValueMember = "ID"; cbCAT.DisplayMember = "CATEGORYNAME"; cbCAT.DataSource = dbc.GetAll(); cbCAT.SelectedValue = 13; DBCableList dbcab = new DBCableList(); dgWP.DataSource = dbcab.GetAllCables(); ShowDGV_CABLE(); } if (WPT == WPTYPE.ZHGUTLIST) { DBCategory dbc = new DBCategory("ZHGUTLIST"); cbCAT.ValueMember = "ID"; cbCAT.DisplayMember = "CATEGORYNAME"; cbCAT.DataSource = dbc.GetAll(); cbCAT.SelectedValue = 15; DBZhgutList dbz = new DBZhgutList(); dgWP.DataSource = dbz.GetAllZhguts(); ShowDGV_ZHGUT(); } }
private void bEditCategory_Click(object sender, EventArgs e)//редактировать категории { if (cbCAT.Text == "") { MessageBox.Show("Выберите категорию!"); return; } string Entity = ""; if (cbPRODUCTTYPE.SelectedIndex == 0) { Entity = "WPNAMELIST"; } if (cbPRODUCTTYPE.SelectedIndex == 1) { Entity = "ZHGUTLIST"; } if (cbPRODUCTTYPE.SelectedIndex == 2) { Entity = "CABLELIST"; } int selval = (int)cbCAT.SelectedValue; EditWPCategory ed = new EditWPCategory(Entity); ed.ShowDialog(); DBCategory dbc = new DBCategory(Entity); cbCAT.ValueMember = "ID"; cbCAT.DisplayMember = "CATEGORYNAME"; cbCAT.DataSource = dbc.GetAll(); cbCAT.SelectedValue = selval; cbCAT_SelectedIndexChanged(sender, e); }
private void cbPRODUCTTYPE_SelectedIndexChanged(object sender, EventArgs e) { cbFilter.SelectedIndex = 0; tbFilter.Text = ""; if (cbPRODUCTTYPE.SelectedIndex == 0) //"WPNAMELIST" { DBCategory dbc = new DBCategory("WPNAMELIST"); cbCAT.ValueMember = "ID"; cbCAT.DisplayMember = "CATEGORYNAME"; cbCAT.DataSource = dbc.GetAll(); //cbCAT.SelectedValue = dbc.GetSubCatNE_PRISVOENO(); cbCAT.SelectedIndex = 0; FillDGV_WPNAMELIST(); } if (cbPRODUCTTYPE.SelectedIndex == 1) //"ZHGUTLIST" { DBCategory dbc = new DBCategory("ZHGUTLIST"); cbCAT.ValueMember = "ID"; cbCAT.DisplayMember = "CATEGORYNAME"; cbCAT.DataSource = dbc.GetAll(); //cbCAT.SelectedValue = 2; cbCAT.SelectedIndex = 0; FillDGV_ZHGUTLIST(); } if (cbPRODUCTTYPE.SelectedIndex == 2) //"CABLELIST" { DBCategory dbc = new DBCategory("CABLELIST"); cbCAT.ValueMember = "ID"; cbCAT.DisplayMember = "CATEGORYNAME"; cbCAT.DataSource = dbc.GetAll(); //cbCAT.SelectedValue = 2; cbCAT.SelectedIndex = 0; FillDGV_CABLELIST(); } SetPermissions(); }