Пример #1
0
        private void btnAgregarBodegas_Click(object sender, EventArgs e)
        {
            string mensaje = String.Empty;

            if (((Empresa)cmbEmpresa.SelectedItem).idEmpresa == 0)
            {
                mensaje += "Seleccione empresa\n";
            }
            if (((Tienda)cmbTienda.SelectedItem).idTienda == 0)
            {
                mensaje += "Seleccione tienda\n";
            }

            if (String.IsNullOrEmpty(mensaje))
            {
                tbBodega _tbBodega = new tbBodega {
                    idBodega = 0, descripcion = String.Empty, esFacturable = true, estadoRegistro = true
                };
                _dbCosolemEntities.ObjectStateManager.ChangeObjectState(_tbBodega, EntityState.Detached);
                _BindingListtbBodega.Add(_tbBodega);
                InactivarRegistros(ref dgvBodegas);
            }
            else
            {
                MessageBox.Show(mensaje, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #2
0
        private void tsbSeleccionar_Click(object sender, EventArgs e)
        {
            Precio precioSeleccionado = ((List <Precio>)dgvPrecios.DataSource).Where(x => x.seleccionado).FirstOrDefault();

            if (precioSeleccionado == null)
            {
                MessageBox.Show("Para poder seleccionar tiene que realizar la búsqueda de un producto", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (precioSeleccionado.precio == 0)
            {
                MessageBox.Show("Producto no tiene precio", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (tipoOrdenVenta == "O" && lvwInventario.CheckedItems.Count == 0)
            {
                MessageBox.Show("Seleccione una bodega de la cual se va a tomar el inventario", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (tipoOrdenVenta == "O" && lvwInventario.CheckedItems.Count > 1)
            {
                MessageBox.Show("Solo se puede seleccionar una bodega de la cual se va a tomar el inventario", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                long idBodega = (tipoOrdenVenta == "O" ? Convert.ToInt64(lvwInventario.CheckedItems[0].Tag) : 0);
                codigoProducto    = precioSeleccionado.codigoProducto;
                bodega            = (from B in _dbCosolemEntities.tbBodega where B.idBodega == idBodega select B).FirstOrDefault();
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }
Пример #3
0
 private void SetearBodega(tbBodega _tbBodega)
 {
     try
     {
         cmbEmpresa.SelectedValue = _tbBodega.tbTienda.idEmpresa;
         cmbEmpresa_SelectionChangeCommitted(null, null);
         cmbTienda.SelectedValue = _tbBodega.idTienda;
         cmbTienda_SelectionChangeCommitted(null, null);
     }
     catch (Exception ex)
     {
         Util.MostrarException(this.Text, ex);
     }
 }