Example #1
0
        private void agregarObjeto()
        {
            DialogResult dgRes = MessageBox.Show("¿Está seguro que desea agregar el " + this.Name.Substring(0, this.Name.Length - 1) + "?", this.Name, MessageBoxButtons.YesNo);

            if (dgRes == System.Windows.Forms.DialogResult.Yes)
            {
                Negocio.Fragancia _newObj = crearObjeto();

                if (_newObj.agregarObjeto(_newObj))
                {
                    MessageBox.Show(this, this.Name.Substring(0, this.Name.Length - 1) + " agregado correctamente!", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cargarGrillaTotal();
                    resetTxtBox();
                }
            }
        }
Example #2
0
        public Negocio.Fragancia crearObjeto()
        {
            try
            {
                Negocio.Fragancia _newObject = new Negocio.Fragancia();
                _newObject.idFragancia             = idObjetoActual;
                _newObject.NombreReal              = txt_NombreReal.Text;
                _newObject.NombreVenta             = txt_NombreVenta.Text;
                _newObject.idFamiliaOlfativa       = int.Parse(combo_idFamiliaOlfativa.SelectedValue.ToString());
                _newObject.DescOlfativa_NotaSalida = txt_DescOlfativa_NotaSalida.Text;
                _newObject.DescOlfativa_NotaMedia  = txt_DescOlfativa_NotaMedia.Text;
                _newObject.DescOlfativa_NotaFondo  = txt_DescOlfativa_NotaFondo.Text;

                //--- Código especial para stock ------------------------
                if (rb_HayStock.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
                {
                    _newObject.FechaPedidoStock = null;
                }
                else
                {
                    _newObject.FechaPedidoStock = date_FechaPedidoStock.Value;
                }
                //=======================================================

                _newObject.idEstado         = int.Parse(combo_idEstado.SelectedValue.ToString());
                _newObject.FechaIngreso     = date_FechaIngreso.Value;
                _newObject.ContratipoNombre = txt_ContratipoNombre.Text;
                _newObject.ContratipoMarca  = txt_ContratipoMarca.Text;
                _newObject.ContratipoAño    = txt_ContratipoAño.Text;
                _newObject.Equivalencia     = txt_Equivalencia.Text;
                //_newObject.Identificador = long.Parse(txt_Identificador.Text);

                //--- Código especial para el costo --------------------
                _newObject.Costo = float.Parse(txt_Costo.Text);
                //=======================================================

                return(_newObject);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #3
0
        private void eliminarObjeto()
        {
            if (idObjetoActual != -99)
            {
                DialogResult dgRes = MessageBox.Show("¿Está seguro que desea eliminar el " + this.Name.Substring(0, this.Name.Length - 1) + "?", this.Name, MessageBoxButtons.YesNo);
                if (dgRes == System.Windows.Forms.DialogResult.Yes)
                {
                    Negocio.Fragancia _newObjeto = crearObjeto();

                    if (_newObjeto.eliminarObjeto(_newObjeto))
                    {
                        MessageBox.Show(this, this.Name.Substring(0, this.Name.Length - 1) + " eliminado correctamente!", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        cargarGrillaTotal();
                    }
                }
            }
            else
            {
                MessageBox.Show(this, "Debe seleccionar un " + this.Name.Substring(0, this.Name.Length - 1) + "!", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }