Exemplo n.º 1
0
        public JsonResult DeleteProducto(Annies.Entities.Producto obj)
        {
            var bussingLogic = new Annies.BusinessLogic.Producto();
            var response     = bussingLogic.DeleteProducto(obj);

            return(Json(response));
        }
Exemplo n.º 2
0
        public JsonResult InsertUpdateProducto(Annies.Entities.Producto obj)
        {
            var bussingLogic = new Annies.BusinessLogic.Producto();

            obj.Auditoria = new Annies.Entities.Auditoria
            {
                UsuarioCreacion     = User.Identity.Name,
                UsuarioModificacion = User.Identity.Name
            };
            obj.Operacion = new Operacion
            {
                TipoOperacion = "P",
                Opcion        = obj.IdProducto == null ? "I" : "U"
            };
            //if (obj.Operacion.Opcion == "I")
            //{
            //    if (Session["listado"] != null)
            //    {
            //        var data = (List<Annies.Entities.Producto>)Session["listado"];
            //        var val = data.Where(x => x.Cod_Prod == obj.Cod_Prod);
            //        if (val.Any())
            //        {
            //            var res = new Annies.Common.Response<int>("El codigo ya existe");
            //            return Json(res);
            //        }
            //    }
            //}
            var response = bussingLogic.InsertUpdateProducto(obj);

            return(Json(response));
        }
Exemplo n.º 3
0
        public JsonResult TallasVenta(string Cod_Prod)
        {
            var bussingLogic = new Annies.BusinessLogic.Producto();
            var response     = bussingLogic.TallasVenta(Cod_Prod);

            return(Json(response));
        }
Exemplo n.º 4
0
        public JsonResult TallasProducto(string Cod_Prod)
        {
            var bussingLogic = new Annies.BusinessLogic.Producto();
            var response     = bussingLogic.TallasProducto(Cod_Prod);
            var result       = new Response <IEnumerable <Annies.Entities.Tallas> >(response.Data.Where(x => x.Cantidad > 0));

            return(Json(result));
        }
Exemplo n.º 5
0
        public JsonResult DeleteProducto(Annies.Entities.Producto obj)
        {
            var bussingLogic = new Annies.BusinessLogic.Producto();

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

            return(Json(response));
        }
Exemplo n.º 6
0
 public JsonResult GetAllProductos(Annies.Entities.Producto obj)
 {
     try
     {
         Session["ReporteProducto"] = null;
         var bussingLogic = new Annies.BusinessLogic.Producto();
         var response     = bussingLogic.GetAllProductos(obj);
         Session["ReporteProducto"] = response.Data.ToList();
         return(Json(response));
     }
     catch (Exception ex)
     {
         var result = new Annies.Common.Response <List <Annies.Entities.Producto> >(ex);
         return(Json(result));
     }
 }
Exemplo n.º 7
0
        public JsonResult GetProducto(Annies.Entities.Producto obj)
        {
            try
            {
                var bussingLogic = new Annies.BusinessLogic.Producto();
                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(Annies.Common.ConfigurationUtilities.ErrorCatchDataTable(ex)));
            }
        }
Exemplo n.º 8
0
        public JsonResult InsertUpdateProducto(Annies.Entities.Producto obj)
        {
            var bussingLogic = new Annies.BusinessLogic.Producto();

            obj.Auditoria = new Annies.Entities.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));
        }