private void toolStripButtonSave_Click(object sender, EventArgs e) { try { if (VerificaIngreso()) { BLL.Tables.COMEQUIVALENCIAARTICULOSPROVEED _equivalencia = new BLL.Tables.COMEQUIVALENCIAARTICULOSPROVEED(); Entities.Tables.COMEQUIVALENCIAARTICULOSPROVEED _item = new Entities.Tables.COMEQUIVALENCIAARTICULOSPROVEED(); _item.ARTICULO_ID = this.comboBoxProductos.SelectedValue.ToString(); //ARTICULO BEJERMAN _item.ARTICULO_PROVEED = this.textBoxArticuloProveed.Text.ToString(); //ARTICULO DE ESTE PROVEEDOR _item.DESCRIP_ARTICULO_PROVEED = this.textBoxDescripcion.Text.ToString(); // DESCRIPCION DEL PROVEEDOR _item.PROVEED_ID = this.comboBoxProveed.SelectedValue.ToString(); //CODIGO DE PROVEEDOR if (_articulo != string.Empty) { //ESTE ARTICULO YA EXISTE, SOLO MODIFICO LOS DATOS----- _equivalencia.Update(_item); } else { _equivalencia.Add(_item); } MessageBox.Show("Equivalencia se grabó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); //this.comboBoxSubRubro.SelectedIndex = 0; // 01-06-2016 pedido POR MARIANO... PARA NO BORRAR LOS COMBOS //this.comboBoxProductos.SelectedIndex = 0; //this.comboBoxProveed.SelectedIndex = 0; this.labelArticuloBejerman.Text = string.Empty; this.labelDescripcionBejerman.Text = string.Empty; this.textBoxArticuloProveed.Text = string.Empty; this.textBoxDescripcion.Text = string.Empty; _articulo = string.Empty; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void toolStripButtonRemove_Click(object sender, EventArgs e) { try { if (_articulo != string.Empty && _articulo != null) { DialogResult _result = MessageBox.Show("Está por eliminar esta equivalencia, desea continuar?", "Mensaje", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (_result == System.Windows.Forms.DialogResult.OK) { BLL.Tables.COMEQUIVALENCIAARTICULOSPROVEED _elimina = new BLL.Tables.COMEQUIVALENCIAARTICULOSPROVEED(); Entities.Tables.COMEQUIVALENCIAARTICULOSPROVEED _item = new Entities.Tables.COMEQUIVALENCIAARTICULOSPROVEED(); _item.ARTICULO_ID = this.comboBoxProductos.SelectedValue.ToString(); //ARTICULO BEJERMAN _item.PROVEED_ID = this.comboBoxProveed.SelectedValue.ToString(); //CODIGO DE PROVEEDOR _elimina.Remove(_item); MessageBox.Show("Equivalencia eliminada correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); this.comboBoxSubRubro.SelectedIndex = 0; this.comboBoxProductos.SelectedIndex = 0; this.comboBoxProveed.SelectedIndex = 0; this.labelArticuloBejerman.Text = string.Empty; this.labelDescripcionBejerman.Text = string.Empty; this.textBoxArticuloProveed.Text = string.Empty; this.textBoxDescripcion.Text = string.Empty; _articulo = string.Empty; } } else { MessageBox.Show("No existe equivalencia para eliminar", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }