private void CargarDepositos() { try { //Limpia el combo this.comboBoxN_Deposito.SuspendLayout(); this.comboBoxN_Deposito.DataSource = null; this.comboBoxN_Deposito.Items.Clear(); BLL.Tables.STKDEPOSITO _deposito = new BLL.Tables.STKDEPOSITO(); Entities.Tables.STKDEPOSITO _itemSeleccion = new Entities.Tables.STKDEPOSITO(); _deposito.Items(); //Carga el item de Seleccion _itemSeleccion.DESCRIPCION = "<Seleccione un Depósito>"; _itemSeleccion.DEPOSITO_ID = 0; _deposito.Result.Insert(0, _itemSeleccion); //Carga el combo this.comboBoxN_Deposito.DisplayMember = BLL.Tables.STKDEPOSITO.ColumnNames.DESCRIPCION; this.comboBoxN_Deposito.ValueMember = BLL.Tables.STKDEPOSITO.ColumnNames.DEPOSITO_ID; this.comboBoxN_Deposito.DataSource = _deposito.Result.ToArray(); this.comboBoxN_Deposito.ResumeLayout(); this.comboBoxN_Deposito.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CargarDepositos() { try { BLL.Tables.STKDEPOSITO _dep = new BLL.Tables.STKDEPOSITO(); _dep.WhereParameter.Add(DAL.Tables.STKDEPOSITO.ColumnEnum.codEmp, DAL.SqlEnums.OperandEnum.Equal, Clases.Usuario.EmpresaLogeada.EmpresaIngresada.ToString().Trim()); _dep.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.OR, DAL.Tables.STKDEPOSITO.ColumnEnum.codEmp, DAL.SqlEnums.OperandEnum.Equal, "AMBA");//TAMBIEN TRAIGO LA EMPRESA AMBA _dep.OrderByParameter.Add(DAL.Tables.STKDEPOSITO.ColumnEnum.descripcion); _dep.ItemList(); Entities.Tables.STKDEPOSITO _itemSeleccion = new Entities.Tables.STKDEPOSITO(); //Limpia el combo this.comboBoxDeposito.SuspendLayout(); this.comboBoxDeposito.DataSource = null; this.comboBoxDeposito.Items.Clear(); //Carga el item de Seleccion _itemSeleccion.DESCRIPCION = "<Seleccione un Depósito>"; _itemSeleccion.DEPOSITO_ID = 0; _dep.Result.Insert(0, _itemSeleccion); //Carga el combo this.comboBoxDeposito.DisplayMember = BLL.Tables.STKDEPOSITO.ColumnNames.DESCRIPCION; this.comboBoxDeposito.ValueMember = BLL.Tables.STKDEPOSITO.ColumnNames.DEPOSITO_ID; this.comboBoxDeposito.DataSource = _dep.Result.ToArray(); this.comboBoxDeposito.ResumeLayout(); comboBoxDeposito.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void toolStripButtonSave_Click(object sender, EventArgs e) { try { Entities.Tables.STKDEPOSITO _item = new Entities.Tables.STKDEPOSITO(); BLL.Tables.STKDEPOSITO _deposito = new BLL.Tables.STKDEPOSITO(); _item.CODEMP = Clases.Usuario.EmpresaLogeada.EmpresaIngresada; _item.DEPOSITO_ID = _idDeposito; _item.DESCRIPCION = this.textBoxDescrip.Text.Trim(); _item.STOCKNEGATIVO = 1; //verifico si la variable es distinta de cero if (_idDeposito != 0) { //ESTOY ACTUALIZANDO UN ESTADO if (this.textBoxDescrip.Text.Trim() != string.Empty) { _deposito.Update(_item); _idDeposito = 0; this.textBoxDescrip.Text = string.Empty; MessageBox.Show("La Operación se realizó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Debe ingresar una descripción", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.textBoxDescrip.Focus(); } } else { //ES UN NUEVO INGRESO if (this.textBoxDescrip.Text.Trim() != string.Empty) { _deposito.Add(_item); _idDeposito = 0; this.textBoxDescrip.Text = string.Empty; MessageBox.Show("La Operación se realizó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Debe ingresar una descripción", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.textBoxDescrip.Focus(); } } CargarDepositos(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }