Exemplo n.º 1
0
        public async Task <object> UpdImagen(ImagenProducto imagenProducto)
        {
            Response    response    = new Response();
            ResponseSql responsesql = new ResponseSql();

            try
            {
                if (imagenProducto.ACCION == "A" || imagenProducto.ACCION == "M")
                {
                    string directory = _config.GetSection("AppSettings").GetSection("directory").Value;
                    if (imagenProducto.SArchivo != "" && imagenProducto.BImagen != "")
                    {
                        AuxiliarMethods.Base64ToImage(directory, imagenProducto.BImagen, imagenProducto.SArchivo, "Producto");
                    }
                }

                responsesql = await _unitOfWork.Producto.UpdImagen(imagenProducto);

                response.Status  = responsesql.ID_ERR == 0 ? Constant.Status : responsesql.ID_ERR;
                response.Message = responsesql.DESCR_ERR;
                response.Data    = responsesql.IDDATO;
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
Exemplo n.º 2
0
        public async Task <object> UpdMarca(Marca marca)
        {
            Response    response    = new Response();
            ResponseSql responsesql = new ResponseSql();

            try
            {
                if (marca.ACCION == "A" || marca.ACCION == "M")
                {
                    string directory = _config.GetSection("AppSettings").GetSection("directory").Value;
                    marca.SArchivo = marca.SArchivo.ToString().Trim();
                    marca.BImagen  = marca.BImagen.ToString().Trim();
                    if (marca.SArchivo != "" && marca.BImagen != "")
                    {
                        AuxiliarMethods.Base64ToImage(directory, marca.BImagen, marca.SArchivo, "Marca");
                    }
                }
                responsesql = await _unitOfWork.Marca.UpdMarca(marca);

                response.Status  = responsesql.ID_ERR == 0 ? Constant.Status : responsesql.ID_ERR;
                response.Message = responsesql.DESCR_ERR;
                response.Data    = responsesql.IDDATO;
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
Exemplo n.º 3
0
        public async Task <object> UpdTag(TagProducto tag)
        {
            Response    response    = new Response();
            ResponseSql responsesql = new ResponseSql();

            try
            {
                responsesql = await _unitOfWork.Producto.UpdTag(tag);

                response.Status  = responsesql.ID_ERR == 0 ? Constant.Status : responsesql.ID_ERR;
                response.Message = responsesql.DESCR_ERR;
                response.Data    = responsesql.IDDATO;
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
Exemplo n.º 4
0
        public async Task <object> UpdClientes(MuratClientes clientes)
        {
            Response    response    = new Response();
            ResponseSql responsesql = new ResponseSql();

            try
            {
                responsesql = await _unitOfWork.Murat.UpdClientes(clientes);

                response.Status  = responsesql.ID_ERR == 0 ? Constant.Status : responsesql.ID_ERR;
                response.Message = responsesql.DESCR_ERR;
                response.Data    = responsesql.IDDATO;
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
Exemplo n.º 5
0
        public async Task <object> PostTabla(TablaMaestra tablaMaestra)
        {
            Response    response    = new Response();
            ResponseSql responsesql = new ResponseSql();

            try
            {
                responsesql = await _unitOfWork.TablaMaestra.PostTabla(tablaMaestra);

                response.Status  = responsesql.ID_ERR == 0 ? Constant.Status : responsesql.ID_ERR;
                response.Message = responsesql.DESCR_ERR;
                response.Data    = responsesql.IDDATO;
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
Exemplo n.º 6
0
        public async Task <object> UpdPedido(MuratPedidos pedidos)
        {
            Response    response    = new Response();
            ResponseSql responsesql = new ResponseSql();

            try
            {
                var xml = AuxiliarMethods.ArmadoXML(pedidos, pedidos.GetType(), "Pedido");
                responsesql = await _unitOfWork.Murat.UpdPedido(xml);

                response.Status  = responsesql.ID_ERR == 0 ? Constant.Status : responsesql.ID_ERR;
                response.Message = responsesql.DESCR_ERR;
                response.Data    = responsesql.IDDATO;
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
Exemplo n.º 7
0
        public async Task <object> UserMnt(User user)
        {
            Response    response    = new Response();
            ResponseSql responsesql = new ResponseSql();

            response.Message = "Ingresar los siguientes campos: ";
            int cont = 0;

            try
            {
                #region Validation
                if (user.ACCION == "A" || user.ACCION == "M")
                {
                    if (user.UserLogin == null || user.UserLogin == "")
                    {
                        response.Message = response.Message + " Usuario Login. ";
                        cont++;
                    }

                    if (user.Names == null || user.Names == "")
                    {
                        response.Message = response.Message + " Nombres. ";
                        cont++;
                    }

                    if (user.FirstLastName == null || user.FirstLastName == "")
                    {
                        response.Message = response.Message + " Apellido Paterno. ";
                        cont++;
                    }

                    if (user.SecondLastName == null || user.SecondLastName == "")
                    {
                        response.Message = response.Message + " Apellido Materno. ";
                        cont++;
                    }

                    if (user.Email == null || user.Email == "")
                    {
                        response.Message = response.Message + " Email. ";
                        cont++;
                    }

                    if (user.Email != "" && !ValidationEmail(user.Email))
                    {
                        response.Message = response.Message + " Email no válido. ";
                        cont++;
                    }

                    if (cont == 0)
                    {
                        string      accion = user.ACCION == "A" ? "01" : "02";
                        List <User> list   = await _unitOfWork.User.UserId(accion, user.UserId, user.UserLogin);

                        if (list.Count == 0)
                        {
                            responsesql = await _unitOfWork.User.UserMnt(user);

                            response.Status  = responsesql.ID_ERR == 0 ? Constant.Status : responsesql.ID_ERR;
                            response.Message = responsesql.DESCR_ERR;
                            response.Data    = responsesql.IDDATO;
                        }
                        else
                        {
                            response.Status  = Constant.Error400;
                            response.Message = Constant.Existe;
                        }
                    }
                    else
                    {
                        response.Status = Constant.Error400;
                    }
                }
                else
                {
                    responsesql = await _unitOfWork.User.UserMnt(user);

                    response.Status  = Int32.Parse(responsesql.DESCR_ERR);
                    response.Message = responsesql.DESCR_ERR;
                    response.Data    = responsesql.IDDATO;
                }
                #endregion
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }