示例#1
0
        private string Mensaje(string total)
        {
            productobll = new ProductoBLLImp();
            Producto pr;

            pr = productobll.BuscarPorId(productos[0, 0]);
            string msj = "<h3>Producto:" + pr.nombre + "</h3><br>" +
                         "<h3>Cantidad:" + productos[0, 1] + "</h3><br>" +
                         "<h3>Precio:" + pr.precioVenta + "</h3><br>***********************************************************";

            for (int i = 1; i < productos.Length; i++)
            {
                if (productos[i, 0] == null)
                {
                    msj += "<br><h2>Total:" + total + "</h2>";
                    return(msj);
                }
                else
                {
                    pr   = productobll.BuscarPorId(productos[i, 0]);
                    msj += "<h3>Producto:" + pr.nombre + "</h3><br>" +
                           "<h3>Cantidad:" + productos[i, 1] + "</h3><br>" +
                           "<h3>Precio:" + pr.precioVenta + "</h3><br>***********************************************************";
                }
            }
            msj += "<br><h2>Total:" + total + "</h2>";
            return(msj);
        }
示例#2
0
        public ActionResult Tabla2(string id, string can)
        {
            productobll = new ProductoBLLImp();
            string   htmlCode = string.Empty;
            Producto PR       = productobll.BuscarPorId(id);

            productos[cantidad, 0] = id;
            productos[cantidad, 1] = can;
            int cann;

            if (can.Equals(string.Empty))
            {
                cann = 1;
            }
            else
            {
                cann = int.Parse(can);
            }
            int can2 = int.Parse(PR.precioVenta);

            can2 = can2 * cann;
            productos[cantidad, 2] = can2.ToString();
            cantidad++;
            htmlCode = "<tr id=\"" + PR.idProducto + "\">" +
                       "<td>" + PR.idProducto + "</td>" +
                       "<td>" + PR.nombre + "</td>" +
                       "<td>" + cann + "</td>" +
                       "<td>" + can2 + "</td>" +
                       "<td class=\"text-right\">" +
                       "<a href = \"#\" class=\"btn btn-simple btn-danger btn-icon \" onclick=\"eliminar('" + PR.idProducto + "')\"><i class=\"fa fa-times\" ></i></a>" +
                       "</td>" +
                       "</tr>";
            return(Json(new { result = htmlCode, total = can2 }, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public ActionResult Editar(string idpersona)
        {
            productoBLL = new ProductoBLLImp();
            Producto per = productoBLL.BuscarPorId(idpersona);

            return(Json(new
            {
                nombre = per.nombre,
                cantidad = per.cantidad,
                precioCompra = per.precioCompra,
                precioVenta = per.precioVenta,
                idProducto = per.idProducto
            }, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        public bool Crear(string idCompra, string[,] productos)
        {
            productoBLL = new ProductoBLLImp();
            Producto pr;

            try
            {
                using (unitOfWork = new UnitOfWork(new GymContext()))
                {
                    using (GymContext Context = new GymContext())
                    {
                        for (int i = 0; i < productos.Length; i++)
                        {
                            if (productos[i, 0] == null)
                            {
                                return(true);
                            }
                            else
                            {
                                string         id = ConsecutivoModifica("CRM");
                                CompraProducto cp = new CompraProducto()
                                {
                                    idCompraProducto = id,
                                    idCompra         = idCompra,
                                    idProducto       = productos[i, 0],
                                    cantidad         = int.Parse(productos[i, 1]),
                                    total            = productos[i, 2]
                                };
                                pr          = productoBLL.BuscarPorId(productos[i, 0]);
                                pr.cantidad = pr.cantidad - int.Parse(productos[i, 1]);
                                unitOfWork.compraProductoDAL.Add(cp);
                                productoBLL.Modificar(pr);
                                unitOfWork.Complete();
                            }
                        }
                    }
                }
                return(true);
            }
            catch (Exception a)
            {
                string e = a.Message;
                return(false);
            }
        }
示例#5
0
        public ActionResult Tabla2(string id)
        {
            productoCierreBLL = new CierreProductoBLLImp();
            productoBLL       = new ProductoBLLImp();
            List <CierreProducto> resultado = productoCierreBLL.BuscarCierre(id);
            String htmlCode = String.Empty;

            foreach (CierreProducto per in resultado)
            {
                Producto pro = productoBLL.BuscarPorId(per.idProducto);
                htmlCode += "<tr>" +
                            "<td>" + per.idCierreProducto + "</td>" +
                            "<td>" + per.idProducto + "</td>" +
                            "<td>" + pro.nombre + "</td>" +
                            "<td>" + per.cantidadCierre + "</td>" +
                            "<tr>";
            }
            return(Json(new { result = htmlCode }, JsonRequestBehavior.AllowGet));
        }
示例#6
0
        public ActionResult Segunda(string id)
        {
            compraProductoBLL = new CompraProductoBLLImp();
            productobll       = new ProductoBLLImp();
            List <CompraProducto> resultado = compraProductoBLL.BuscarCierre(id);
            String htmlCode = String.Empty;

            foreach (CompraProducto per in resultado)
            {
                Producto pro = productobll.BuscarPorId(per.idProducto);
                htmlCode += "<tr>" +
                            "<td>" + pro.idProducto + "</td>" +
                            "<td>" + pro.nombre + "</td>" +
                            "<td>" + per.cantidad + "</td>" +
                            "<td>" + pro.precioVenta + "</td>" +
                            "<tr>";
            }
            return(Json(new { result = htmlCode }, JsonRequestBehavior.AllowGet));
        }