예제 #1
0
        public void EliminarTest()

        {
            bool eliminar = OrdenBLL.Eliminar(1);

            Assert.AreEqual(eliminar, true);
        }
예제 #2
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Orden>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:    //todo
                    listado = OrdenBLL.GetList(p => true);
                    break;

                case 1:    //ID
                    int id = Convert.ToInt32(CriterioTextBox.Text);
                    listado = OrdenBLL.GetList(p => p.OrdenId == id);
                    break;

                case 2:    //Fecha
                    DateTime fecha = Convert.ToDateTime(CriterioTextBox.Text);
                    listado = OrdenBLL.GetList(p => p.Fecha == fecha);
                    break;
                }
            }
            else
            {
                listado = OrdenBLL.GetList(p => true);
            }

            ConsultaDataGrid.ItemsSource = null;
            ConsultaDataGrid.ItemsSource = listado;
        }
예제 #3
0
        private void BucarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Orden>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    listado = OrdenBLL.GetList(x => true);
                    break;

                case 1:
                    int id;
                    id      = int.Parse(CriterioTextBox.Text);
                    listado = OrdenBLL.GetList(x => x.OrdenId == id);
                    break;

                case 2:
                    int clienteid;
                    clienteid = int.Parse(CriterioTextBox.Text);
                    listado   = OrdenBLL.GetList(x => x.ClienteId == clienteid);
                    break;
                }
            }
            else
            {
                listado = OrdenBLL.GetList(p => true);
            }
            ConsultarDataGrid.ItemsSource = null;
            ConsultarDataGrid.ItemsSource = listado;
        }
예제 #4
0
        public void BuscarTest()
        {
            Ordene ordene = new Ordene();

            ordene = OrdenBLL.Buscar(1);
            Assert.IsNotNull(ordene);
        }
        public void ExisteTest()
        {
            bool paso = false;

            paso = OrdenBLL.Existe(1);
            Assert.AreEqual(paso, true);
        }
예제 #6
0
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            bool paso = false;

            if (string.IsNullOrWhiteSpace(OrdenIdTextBox.Text) || OrdenIdTextBox.Text == "0")
            {
                paso = OrdenBLL.Guardar(orden);
            }
            else
            {
                if (!ExisteBD())
                {
                    MessageBox.Show("No Se puede Modificar porque no existe", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                paso = OrdenBLL.Modificar(orden);
            }

            if (paso)
            {
                Limpiar();
                MessageBox.Show("Guardado!!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No fue posible guardar!!", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #7
0
        public void cargarDetalle()
        {
            OrdenBLL ordBLL = new OrdenBLL();

            if (Session["numero_boleta"] != null)
            {
                int       numeroBoleta = Int32.Parse(Session["numero_boleta"].ToString());
                DataTable dtTOTAL      = ordBLL.GetDetalleByBoleta(numeroBoleta);
                if (dtTOTAL.Rows.Count > 0)
                {
                    GridView2.DataSource = ordBLL.GetDetalleByBoleta(numeroBoleta);
                    GridView2.DataBind();
                    Button5.Visible = true;
                }
                else
                {
                    Label2.Visible       = false;
                    Label3.Visible       = false;
                    RadioButton1.Visible = false;
                    RadioButton2.Visible = false;
                    Label4.Visible       = false;
                }
                GetTotal(numeroBoleta);
            }
        }
예제 #8
0
        private void guardarButton_Click(object sender, RoutedEventArgs e)
        {
            Ordenes ordenes;
            bool    paso = false;

            if (!Validar())
            {
                return;
            }

            ordenes = LlenaClase();

            if (Convert.ToInt32(idTextBox.Text) == 0)
            {
                paso = OrdenBLL.Guardar(ordenes);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    MessageBox.Show("No se puede Modificar una persona que no existe", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                paso = OrdenBLL.Modificar(ordenes);
            }
            if (paso)
            {
                MessageBox.Show("Guardado!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
                LimpiarCampos();
            }
            else
            {
                MessageBox.Show("No fue posible guardar!!", "Fallo");
            }
        }
예제 #9
0
        /*
         *      private bool validar()
         *      {
         *          bool paso = true;
         *
         *          if (string.IsNullOrWhiteSpace(MontoTextbox.Text))
         *          {
         *              MessageBox.Show("No puede dejar campos vacios");
         *              MontoTextbox.Focus();
         *              paso = false;
         *          }
         *
         *          if (string.IsNullOrWhiteSpace(ProductoIdTextbox.Text))
         *          {
         *              MessageBox.Show("No puede dejar campos vacios");
         *              ProductoIdTextbox.Focus();
         *              paso = false;
         *          }
         *
         *
         *          return paso;
         *
         *      }
         */
        private void Button_Guardar(object sender, RoutedEventArgs e)
        {
            Orden orden = new Orden();
            bool  paso  = false;

            // if (!validar())
            // return;

            orden = LlenaClase();

            if (IdTextbox.Text == "0")
            {
                paso = OrdenBLL.Guardar(orden);
            }
            else
            {
                if (!ExisteEnLaBaseDatos())
                {
                    MessageBox.Show("Personas No Existe!!");
                }
                MessageBox.Show("Persona Modificada!!");
                paso = OrdenBLL.Modificar(orden);
            }

            if (paso)
            {
                MessageBox.Show("¡¡Guardado!!");
            }
            else
            {
                MessageBox.Show("No se Guardo!!");
            }
        }
        public void EliminarTest()
        {
            bool paso = false;

            paso = OrdenBLL.Eliminar(1);

            Assert.AreEqual(paso, true);
        }
예제 #11
0
        public void GetListTest()
        {
            var lista = new List <Ordene>();

            lista = OrdenBLL.GetList(p => true);

            Assert.IsNotNull(lista);
        }
        public void GetListTest()
        {
            bool paso = false;

            List <Ordenes> ordenes = OrdenBLL.GetList(o => true);

            if (ordenes != null)
            {
                paso = true;
            }

            Assert.AreEqual(paso, true);
        }
예제 #13
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Orden anterior = OrdenBLL.Buscar(Convert.ToInt32(OrdenIdTextBox.Text));

            if (anterior != null)
            {
                orden = anterior;
                Actualizar();
            }
            else
            {
                MessageBox.Show("Persona no Encontrada");
            }
        }
        public void BuscarTest()
        {
            Ordenes orden = new Ordenes();
            bool    paso  = false;

            orden = OrdenBLL.Buscar(1);

            if (orden != null)
            {
                paso = true;
            }

            Assert.AreEqual(paso, true);
        }
        public void ModificarTest()
        {
            bool           paso           = false;
            Ordenes        orden          = new Ordenes();
            OrdenesDetalle ordenesDetalle = new OrdenesDetalle();

            orden.ordenId    = 1;
            orden.suplidorId = 1;
            orden.fecha      = DateTime.Now;
            orden.monto      = 250;

            paso = OrdenBLL.Modificar(orden);

            Assert.AreEqual(paso, true);
        }
예제 #16
0
        private void eliminarButton_Click(object sender, RoutedEventArgs e)
        {
            int id;

            int.TryParse(idTextBox.Text, out id);


            if (OrdenBLL.Eliminar(id))
            {
                MessageBox.Show("Eliminado", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("Erro Al eliminar una persona");
            }
        }
예제 #17
0
        private void Button_Eliminar(object sender, RoutedEventArgs e)
        {
            int id;

            int.TryParse(IdTextbox.Text, out id);


            if (OrdenBLL.Eliminar(id))
            {
                MessageBox.Show("Eliminado con exito!!");
            }
            else
            {
                MessageBox.Show("No se pudo Eliminar!!");
            }
        }
예제 #18
0
        private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            int id;

            id = Convert.ToInt32(OrdenIdTextBox.Text);

            Limpiar();

            if (OrdenBLL.Eliminar(id))
            {
                MessageBox.Show("Eliminado", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show(OrdenIdTextBox.Text, "No se puede eliminar una persona que no existe");
            }
        }
예제 #19
0
        private void buscarButton_Click(object sender, RoutedEventArgs e)
        {
            int     id;
            Ordenes ordenes = new Ordenes();

            int.TryParse(idTextBox.Text, out id);
            ordenes = OrdenBLL.Buscar(id);

            if (ordenes != null)
            {
                MessageBox.Show("Persona Encontrada", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
                LlenaCampos(ordenes);
            }
            else
            {
                MessageBox.Show("Persona no econtrada", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                LimpiarCampos();
            }
        }
예제 #20
0
        private void Button_Buscar(object sender, RoutedEventArgs e)
        {
            int id;

            int.TryParse(IdTextbox.Text, out id);
            Orden orden = new Orden();

            orden = OrdenBLL.Buscar(id);

            if (orden != null)
            {
                MessageBox.Show("Persona Encontrada!!");
                LlenaCampo(orden);
            }
            else
            {
                MessageBox.Show("Persona No Encontrada!!");
            }
        }
예제 #21
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            int   id;
            Orden ordes = new Orden();

            int.TryParse(OrdenIdTextBox.Text, out id);

            Limpiar();

            ordes = OrdenBLL.Buscar(id);

            if (ordes != null)
            {
                MessageBox.Show("Persona Encontrada");
                LlenaCampo(ordes);
            }

            else
            {
                MessageBox.Show("Persona no Encontrada");
            }
        }
예제 #22
0
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            Orden ordenes;
            bool  paso = false;

            if (!Validar())
            {
                return;
            }

            ordenes = LlenaClase();
            Limpiar();

            //Determinar si es guardar o modificar

            if (string.IsNullOrWhiteSpace(OrdenIdTextBox.Text) || OrdenIdTextBox.Text == "0")
            {
                paso = OrdenBLL.Guardar(ordenes);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    MessageBox.Show("No se puede modificar una persona que no existe", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                paso = OrdenBLL.Modificar(ordenes);
            }

            //Informar el resultado
            if (paso)
            {
                MessageBox.Show("Guardado!!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No fue posible guardar!!", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public void InsertarTest()
        {
            bool           paso           = false;
            Ordenes        orden          = new Ordenes();
            OrdenesDetalle ordenesDetalle = new OrdenesDetalle();

            orden.ordenId    = 0;
            orden.suplidorId = 1;
            orden.fecha      = DateTime.Now;
            orden.monto      = 2500;

            ordenesDetalle.ordenDetalleId = 0;
            ordenesDetalle.ordenId        = 0;
            ordenesDetalle.productId      = 1;
            ordenesDetalle.producto       = "Malta Morena";
            ordenesDetalle.cantidad       = 5;
            ordenesDetalle.costo          = 500;

            orden.OrdenesDetalles.Add(ordenesDetalle);

            paso = OrdenBLL.Insertar(orden);

            Assert.AreEqual(paso, true);
        }
예제 #24
0
        private bool ExisteEnLaBaseDeDatos()
        {
            Ordenes ordenes = OrdenBLL.Buscar(Convert.ToInt32(idTextBox.Text));

            return(ordenes != null);
        }
예제 #25
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            OrdenBLL ordBLL = new OrdenBLL();

            //ordBLL.creaOrden();
            if (Session["numero_boleta"] == null)
            {
            }
            else if (Session["numero_boleta"] != null && GridView1.Rows.Count > 0)
            {
                string faltaStock = "";
                foreach (GridViewRow row in GridView1.Rows)
                {
                    int    id  = int.Parse(row.Cells[1].Text);
                    string cat = row.Cells[3].Text;
                    if (cat != "bebible")
                    {
                        PlatoBLL plaBLL          = new PlatoBLL();
                        int      stockactual     = plaBLL.verificaStock(id);
                        int      stockSolicitado = int.Parse(((TextBox)row.Cells[5].FindControl("TextBox1")).Text);
                        if (stockactual < stockSolicitado)
                        {
                            faltaStock = faltaStock + row.Cells[2].Text + " Stock Actual: " + stockactual + "\\n ";
                        }
                    }
                    else if (cat == "bebible")
                    {
                        BebestibleBLL bebesBLL        = new BebestibleBLL();
                        int           stockactual     = bebesBLL.verificaStock(id);
                        int           stockSolicitado = int.Parse(((TextBox)row.Cells[5].FindControl("TextBox1")).Text);
                        if (stockactual < stockSolicitado)
                        {
                            faltaStock = faltaStock + row.Cells[2].Text + " Stock Actual: " + stockactual + "\\n ";
                        }
                    }
                }



                if (faltaStock.Length <= 0)
                {
                    bool check = ordBLL.creaOrden(int.Parse(Session["numero_boleta"].ToString()));
                    if (check)
                    {
                        foreach (GridViewRow row in GridView1.Rows)
                        {
                            int id       = int.Parse(row.Cells[1].Text);
                            int cantidad = int.Parse(((TextBox)row.Cells[5].FindControl("TextBox1")).Text);

                            if (row.Cells[3].Text != "bebible")
                            {
                                PlatoBLL plBLL = new PlatoBLL();
                                plBLL.ingresaRelacion(id, cantidad);
                                plBLL.reduceStock(id, cantidad);
                            }
                            else if (row.Cells[3].Text == "bebible")
                            {
                                BebestibleBLL bebBLL = new BebestibleBLL();
                                bebBLL.agregarRelacion(id, cantidad);
                                bebBLL.reduceStock(id, cantidad);
                            }
                        }
                        Session["pedido"] = null;
                        Response.Redirect("/CarroCompras.aspx");
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('No se pudo Generar la orden: \\n Insuficiente Stock de: \\n" + faltaStock + " ')", true);
                }
            }
        }
예제 #26
0
        private bool ExisteEnLaBaseDeDatos()
        {
            Orden ordenes = OrdenBLL.Buscar((int)OrdenIdTextBox.Text.ToInt());

            return(ordenes != null);
        }
예제 #27
0
        private bool ExisteBD()
        {
            orden = OrdenBLL.Buscar(Convert.ToInt32(OrdenIdTextBox.Text));

            return(orden != null);
        }
예제 #28
0
        private bool ExisteEnLaBaseDatos()
        {
            Orden orden = OrdenBLL.Buscar((int)Convert.ToInt32(ClienteIdTextbox.Text));

            return(orden != null);
        }
예제 #29
0
        public void ExisteTest()
        {
            bool existe = OrdenBLL.Existe(1);

            Assert.AreEqual(existe, false);
        }