Esempio n. 1
0
        public JsonResult DeleteProducto(Producto obj)
        {
            var bussingLogic = new GP.BusinessLogic.BLProducto();

            obj.Auditoria = new Auditoria
            {
                UsuarioModificacion = User.Identity.Name
            };
            var response = bussingLogic.DeleteProducto(obj);

            return(Json(response));
        }
Esempio n. 2
0
 public JsonResult GetAllProductos(Producto obj)
 {
     try
     {
         Session["ReporteProducto"] = null;
         var bussingLogic = new GP.BusinessLogic.BLProducto();
         var response     = bussingLogic.GetAllProductos(obj);
         Session["ReporteProducto"] = response.Data.ToList();
         return(Json(response));
     }
     catch (Exception ex)
     {
         var result = new GP.Common.Response <List <Producto> >(ex);
         return(Json(result));
     }
 }
Esempio n. 3
0
        public JsonResult GetProducto(Producto obj)
        {
            try
            {
                var bussingLogic = new GP.BusinessLogic.BLProducto();
                obj.Stock_Prod  = 1;
                obj.Estado_Prod = 1;
                var ctx         = HttpContext.GetOwinContext();
                var tipoUsuario = ctx.Authentication.User.Claims.FirstOrDefault().Value;

                string draw   = Request.Form.GetValues("draw")[0];
                int    inicio = Convert.ToInt32(Request.Form.GetValues("start").FirstOrDefault());
                int    fin    = Convert.ToInt32(Request.Form.GetValues("length").FirstOrDefault());

                obj.Auditoria = new Auditoria
                {
                    TipoUsuario = tipoUsuario
                };
                obj.Operacion = new Operacion
                {
                    Inicio = (inicio / fin),
                    Fin    = fin
                };

                var response     = bussingLogic.GetProducto(obj);
                var Datos        = response.Data;
                int totalRecords = Datos.Any() ? Datos.FirstOrDefault().Operacion.TotalRows : 0;
                int recFilter    = totalRecords;

                var result = (new
                {
                    draw = Convert.ToInt32(draw),
                    recordsTotal = totalRecords,
                    recordsFiltered = recFilter,
                    data = Datos
                });

                return(Json(result));
            }
            catch (Exception ex)
            {
                return(Json(ConfigurationUtilities.ErrorCatchDataTable(ex)));
            }
        }
Esempio n. 4
0
        public JsonResult InsertUpdateProducto(Producto obj)
        {
            var bussingLogic = new GP.BusinessLogic.BLProducto();

            obj.Auditoria = new Auditoria
            {
                UsuarioCreacion     = User.Identity.Name,
                UsuarioModificacion = User.Identity.Name
            };

            //var tallasxml = obj.Tallas_Prod.Select(i => new XElement("Talla",
            //            new XElement("talla", i.Talla),
            //            new XElement("cod_prod", i.CodigoProducto),
            //            new XElement("cantidad", i.Cantidad)));
            //obj.TallasXml = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), new XElement("Tallas", tallasxml));

            var response = bussingLogic.InsertUpdateProducto(obj);

            return(Json(response));
        }