Example #1
0
        public bool ActualizarPastel(DTOPastel _DTOPastel)
        {
            try
            {
                conexion.Open();

                SqlCommand comando = new SqlCommand("SP_Actualizar_Pastel", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.AddWithValue("@idPastel", _DTOPastel.IdPastel);
                comando.Parameters.AddWithValue("@nombrePastel", _DTOPastel.Nombre);
                comando.Parameters.AddWithValue("@tamanio", _DTOPastel.Tamanio);
                int resultado = comando.ExecuteNonQuery();

                return((resultado >= 1) ? true : false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
            finally
            {
                conexion.Close();
            }
        }
Example #2
0
        public bool CambiarEstadoarPastel(DTOPastel DTOPastel)
        {
            try
            {
                conexion.Open();
                SqlCommand comando = new SqlCommand("sp_cambiarEstadoPastel", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.AddWithValue("@idPastel", DTOPastel.gsIdPastel);
                comando.Parameters.AddWithValue("@estado", DTOPastel.gsEstado);
                int resultado = comando.ExecuteNonQuery();
                return((resultado >= 1) ? true : false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);

                throw;
            }
        }
Example #3
0
        public bool InsertarPastel(DTOPastel DTOPastel)
        {
            try
            {
                conexion.Open();
                SqlCommand comando = new SqlCommand("sp_insertPastel", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.Add("@nombrePastel", DTOPastel.gsNombre);
                comando.Parameters.Add("@tamanio", DTOPastel.gsTamanio);
                int resultado = comando.ExecuteNonQuery();
                return((resultado >= 1) ? true : false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);

                throw;
            }
        }
Example #4
0
        public void InsertarPastel()
        {
            pnlAlertaError.Visible = false;
            PanelAlerta.Visible    = false;
            DTOPastel pastelDto = new DTOPastel();

            pastelDto.gsNombre  = txtNombrePastel.Text;
            pastelDto.gsTamanio = int.Parse(txtTamano.Text);
            PastelDao           = new DAOpastel();
            bool resultado = PastelDao.InsertarPastel(pastelDto);

            if (resultado)
            {
                PanelAlerta.Visible = true;
                ListarPastel();
                LimpiarCampos();
            }
            else
            {
                pnlAlertaError.Visible = true;
            }
        }
        public void InsertarPastel()
        {
            pnlAlertaError.Visible  = false;
            pnlAlertaValida.Visible = false;

            DTOPastel _DTOPastel = new DTOPastel();

            _DTOPastel.Nombre  = txtNombrePastel.Text;
            _DTOPastel.Tamanio = int.Parse(txtTamano.Text);

            _DAOPastel = new DAOPastel();
            bool resultado = _DAOPastel.InsertarPastel(_DTOPastel);

            if (resultado)
            {
                pnlAlertaValida.Visible = true;
                ListarPastel();
                LimpiarCampos();
            }
            else
            {
                pnlAlertaError.Visible = true;
            }
        }