Categoria & Clientes Controller Code
Categoria & Clientes Controller Code
#nullable disable
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link]
{
[Authorize(Roles = "Administrador,Bodeguero")]
public class CategoriaProductoesController : Controller
{
private readonly storeplacedbContext _context;
// GET: CategoriaProductoes
public async Task<IActionResult> Index()
{
[Link] = TempData["Message"];
[Link] = TempData["class"];
[Link] = TempData["icon"];
return View(await _context.[Link]());
}
// GET: CategoriaProductoes/Details/5
public async Task<IActionResult> Details(int? id)
{
if (id == null)
{
return NotFound();
}
return View(categoriaProducto);
}
// GET: CategoriaProductoes/Create
public IActionResult Create()
{
[Link] = TempData["Message"];
return View();
}
// POST: CategoriaProductoes/Create
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult>
Create([Bind("Idcategoria,Descripcion")] CategoriaProducto
categoriaProducto)
{
if ([Link])
{
_context.Add(categoriaProducto);
await _context.SaveChangesAsync();
TempData["Message"] = "El registro se guardo correctamente";
TempData["class"] = "alert alert-success alert-dismissible
fade show";
TempData["icon"] = "bi bi-check-circle me-1";
return RedirectToAction(nameof(Index));
}
else
{
TempData["Message"] = "Llene todos los campos
correctamente";
}
return View(categoriaProducto);
}
// GET: CategoriaProductoes/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if (id == null)
{
return NotFound();
}
// POST: CategoriaProductoes/Edit/5
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id,
[Bind("Idcategoria,Descripcion")] CategoriaProducto categoriaProducto)
{
if (id != [Link])
{
return NotFound();
}
if ([Link])
{
try
{
_context.Update(categoriaProducto);
TempData["Message"] = "El registro se actualizo
correctamente";
TempData["class"] = "alert alert-success alert-
dismissible fade show";
TempData["icon"] = "bi bi-check-circle me-1";
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!
CategoriaProductoExists([Link]))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
return View(categoriaProducto);
}
// GET: CategoriaProductoes/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if (id == null)
{
return NotFound();
}
return View(categoriaProducto);
}
// POST: CategoriaProductoes/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
var categoriaProducto = await
_context.[Link](id);
_context.[Link](categoriaProducto);
TempData["Message"] = $"La categoria
'{[Link]}' se elimino correctamente";
TempData["class"] = "alert alert-info alert-dismissible fade
show";
TempData["icon"] = "bi bi-info-circle me-1";
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
#nullable disable
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link]
{
[Authorize(Roles = "Administrador,Cajero")]
public class ClientesController : Controller
{
private readonly storeplacedbContext _context;
// GET: Clientes
public async Task<IActionResult> Index()
{
[Link] = TempData["Message"];
[Link] = TempData["class"];
[Link] = TempData["icon"];
var storeplacedbContext = _context.[Link](c =>
[Link]);
return View(await [Link]());
}
// GET: Clientes/Details/5
public async Task<IActionResult> Details(int? id)
{
if (id == null)
{
return NotFound();
}
return View(cliente);
}
// GET: Clientes/Create
public IActionResult Create()
{
ViewData["Idctgcliente"] = new
SelectList(_context.CategoriaClientes, "Idcategoria", "Idcategoria");
return View();
}
// POST: Clientes/Create
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult>
Create([Bind("Idcliente,Nit,Idctgcliente,Nombre,Apellido,Direccion,Telefono"
)] Cliente cliente)
{
if ([Link])
{
_context.Add(cliente);
TempData["Message"] = "El registro se guardo correctamente";
TempData["class"] = "alert alert-success alert-dismissible
fade show";
TempData["icon"] = "bi bi-check-circle me-1";
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
ViewData["Idctgcliente"] = new
SelectList(_context.CategoriaClientes, "Idcategoria", "Idcategoria",
[Link]);
return View(cliente);
}
// GET: Clientes/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if (id == null)
{
return NotFound();
}
// POST: Clientes/Edit/5
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id,
[Bind("Idcliente,Nit,Idctgcliente,Nombre,Apellido,Direccion,Telefono")]
Cliente cliente)
{
if (id != [Link])
{
return NotFound();
}
if ([Link])
{
try
{
_context.Update(cliente);
TempData["Message"] = "El registro se actualizo
correctamente";
TempData["class"] = "alert alert-success alert-
dismissible fade show";
TempData["icon"] = "bi bi-check-circle me-1";
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!ClienteExists([Link]))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
ViewData["Idctgcliente"] = new
SelectList(_context.CategoriaClientes, "Idcategoria", "Idcategoria",
[Link]);
return View(cliente);
}
// GET: Clientes/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if (id == null)
{
return NotFound();
}
var cliente = await _context.Clientes
.Include(c => [Link])
.FirstOrDefaultAsync(m => [Link] == id);
if (cliente == null)
{
return NotFound();
}
return View(cliente);
}
// POST: Clientes/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
var cliente = await _context.[Link](id);
_context.[Link](cliente);
TempData["Message"] = $"El Cliente '{[Link]}
{[Link]}' se elimino correctamente";
TempData["class"] = "alert alert-info alert-dismissible fade
show";
TempData["icon"] = "bi bi-info-circle me-1";
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link]
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly storeplacedbContext _context;
namespace [Link]
{
public class LoginController : Controller
{
private readonly storeplacedbContext _context;
[HttpPost]
public async Task<IActionResult> Index(Usuario user)
{
Usuario _user = UserIsvalid(user);
if (_user != null)
{
var claims = new List<Claim>
{
new Claim([Link],
_user.[Link]()),
new Claim([Link], _user.Nombre + " " +
_user.Apellido),
new Claim([Link], _user.Correo),
};
[Link](new Claim([Link],
_user.[Link]));
await
[Link]([Link]);
#nullable disable
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link]
{
[Authorize(Roles = "Bodeguero,Administrador")]
//[Authorize(Roles = "Administrador")]
public class ProductosController : Controller
{
private readonly storeplacedbContext _context;
private readonly string _cn;
// GET: Productos
public async Task<IActionResult> Index()
{
[Link] = TempData["Message"];
[Link] = TempData["class"];
[Link] = TempData["icon"];
var storeplacedbContext = _context.[Link](p =>
[Link]);
return View(await [Link]());
}
// GET: Productos/Details/5
public async Task<IActionResult> Details(string id)
{
if (id == null)
{
return NotFound();
}
return View(producto);
}
// GET: Productos/Create
public IActionResult Create()
{
[Link] = TempData["Message_err"];
ViewData["Idcategoria"] = new
SelectList(_context.CategoriaProductos, "Idcategoria", "Descripcion");
return View();
}
// POST: Productos/Create
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult>
Create([Bind("Barcode,Idcategoria,Nombre,Costo,Porcganacia,Stock,Precio")]
Producto producto)
{
if ([Link])
{
_context.Add(producto);
TempData["Message"] = "El registro se guardo correctamente";
TempData["class"] = "alert alert-success alert-dismissible
fade show";
TempData["icon"] = "bi bi-check-circle me-1";
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
else if (![Link]) {
TempData["Message_err"] = "Llene todos los campos
correctamente";
// GET: Productos/Edit/5
public async Task<IActionResult> Edit(string id)
{
if (id == null)
{
return NotFound();
}
// POST: Productos/Edit/5
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(string id,
[Bind("Barcode,Idcategoria,Nombre,Costo,Porcganacia,Stock,Precio")] Producto
producto)
{
if (id != [Link])
{
return NotFound();
}
if ([Link])
{
try
{
_context.Update(producto);
TempData["Message"] = "El registro se actualizo
correctamente";
TempData["class"] = "alert alert-success alert-
dismissible fade show";
TempData["icon"] = "bi bi-check-circle me-1";
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!ProductoExists([Link]))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
ViewData["Idcategoria"] = new
SelectList(_context.CategoriaProductos, "Idcategoria", "Descripcion",
[Link]);
return View(producto);
}
// GET: Productos/Delete/5
public async Task<IActionResult> Delete(string id)
{
if (id == null)
{
return NotFound();
}
return View(producto);
}
// POST: Productos/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(string id)
{
var producto = await _context.[Link](id);
_context.[Link](producto);
TempData["Message"] = $"El Producto '{[Link]}' se
elimino correctamente";
TempData["class"] = "alert alert-info alert-dismissible fade
show";
TempData["icon"] = "bi bi-info-circle me-1";
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
private bool ProductoExists(string id)
{
return _context.[Link](e => [Link] == id);
}
}
}
#nullable disable
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link]
{
[Authorize(Roles = "Administrador,Bodeguero")]
public class ProveedoresController : Controller
{
private readonly storeplacedbContext _context;
// GET: Proveedores
public async Task<IActionResult> Index()
{
[Link] = TempData["Message"];
[Link] = TempData["class"];
[Link] = TempData["icon"];
return View(await _context.[Link]());
}
// GET: Proveedores/Details/5
public async Task<IActionResult> Details(int? id)
{
if (id == null)
{
return NotFound();
}
return View(proveedor);
}
// GET: Proveedores/Create
public IActionResult Create()
{
return View();
}
// POST: Proveedores/Create
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult>
Create([Bind("Idproveedor,Nombre,Direccion,Telefono")] Proveedor proveedor)
{
if ([Link])
{
_context.Add(proveedor);
TempData["Message"] = "El registro se guardo correctamente";
TempData["class"] = "alert alert-success alert-dismissible
fade show";
TempData["icon"] = "bi bi-check-circle me-1";
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
return View(proveedor);
}
// GET: Proveedores/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if (id == null)
{
return NotFound();
}
// POST: Proveedores/Edit/5
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id,
[Bind("Idproveedor,Nombre,Direccion,Telefono")] Proveedor proveedor)
{
if (id != [Link])
{
return NotFound();
}
if ([Link])
{
try
{
_context.Update(proveedor);
TempData["Message"] = "El registro se actualizo
correctamente";
TempData["class"] = "alert alert-success alert-
dismissible fade show";
TempData["icon"] = "bi bi-check-circle me-1";
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!ProveedorExists([Link]))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
return View(proveedor);
}
// GET: Proveedores/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if (id == null)
{
return NotFound();
}
return View(proveedor);
}
// POST: Proveedores/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
var proveedor = await _context.[Link](id);
TempData["Message"] = $"El Proveedor '{[Link]}' se
elimino correctamente";
TempData["class"] = "alert alert-info alert-dismissible fade
show";
TempData["icon"] = "bi bi-info-circle me-1";
_context.[Link](proveedor);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
#nullable disable
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link]
{
[Authorize(Roles = "Administrador")]
public class UsuariosController : Controller
{
private readonly storeplacedbContext _context;
// GET: Usuarios
public async Task<IActionResult> Index()
{
[Link] = TempData["Message"];
[Link] = TempData["class"];
[Link] = TempData["icon"];
var storeplacedbContext = _context.[Link](u =>
[Link]);
return View(await [Link]());
}
// GET: Usuarios/Details/5
public async Task<IActionResult> Details(int? id)
{
if (id == null)
{
return NotFound();
}
return View(usuario);
}
// GET: Usuarios/Create
public IActionResult Create()
{
//[Link] = TempData["Message_err"];
ViewData["Idrol"] = new SelectList(_context.Rols, "Idrol",
"Descripcion");
return View();
}
// POST: Usuarios/Create
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult>
Create([Bind("Idusuario,Nombre,Apellido,Correo,Idrol,Contraseña")] Usuario
usuario)
{
if (UsuarioExists([Link]))
{
TempData["Message_err"] = "Este usuario ya existe";
ViewData["Idrol"] = new SelectList(_context.Rols, "Idrol",
"Descripcion", [Link]);
return View(usuario);
}
else
{
[Link]ña = [Link]([Link]ña);
_context.Add(usuario);
TempData["Message"] = "El registro se guardo correctamente";
TempData["class"] = "alert alert-success alert-dismissible
fade show";
TempData["icon"] = "bi bi-check-circle me-1";
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
}
// GET: Usuarios/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if (id == null)
{
return NotFound();
}
// POST: Usuarios/Edit/5
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id,
[Bind("Idusuario,Nombre,Apellido,Correo,Idrol,Contraseña")] Usuario usuario)
{
if (id != [Link])
{
return NotFound();
}
_context.Update(usuario);
TempData["Message"] = "El registro se actualizo correctamente";
TempData["class"] = "alert alert-success alert-dismissible fade
show";
TempData["icon"] = "bi bi-check-circle me-1";
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
ViewData["Idrol"] = new SelectList(_context.Rols, "Idrol",
"Descripcion", [Link]);
return View(usuario);
}
// GET: Usuarios/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if (id == null)
{
return NotFound();
}
return View(usuario);
}
// POST: Usuarios/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
var usuario = await _context.[Link](id);
_context.[Link](usuario);
TempData["Message"] = $"El Producto '{[Link]}
{[Link]}' se elimino correctamente";
TempData["class"] = "alert alert-info alert-dismissible fade
show";
TempData["icon"] = "bi bi-info-circle me-1";
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
}
}
#nullable disable
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link]
{
[Authorize(Roles = "Administrador,Cajero")]
public class VentasController : Controller
{
private readonly storeplacedbContext _context;
// GET: Ventas
public async Task<IActionResult> Index()
{
var storeplacedbContext = _context.[Link](v =>
[Link]).Include(v => [Link]);
return View(await [Link]());
}
// GET: Ventas/Details/5
public async Task<IActionResult> Details(uint? id)
{
if (id == null)
{
return NotFound();
}
return View(venta);
}
// GET: Ventas/Create
public IActionResult Create()
{
IEnumerable<Producto> Productos = _context.[Link](p
=> [Link]);
Tuple<Venta, IEnumerable<Producto>> model = new Tuple<Venta,
IEnumerable<Producto>>(new Venta(), Productos);
var Cliente = _context.[Link](x => new { [Link],
Nombre = [Link](" ", [Link], [Link], [Link]) }).ToList();
ViewData["Idcliente"] = new SelectList(Cliente, "Idcliente",
"Nombre");
ViewData["Idproducto"] = new SelectList(_context.Productos,
"Barcode", "Nombre");
return View(model);
}
// POST: Ventas/Create
// To protect from overposting attacks, enable the specific
properties you want to bind to.
// For more details, see [Link]
LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult>
Create([Bind("Idventa,Idcliente,Idusuario,Fecha,Total")] Venta venta)
{
if ([Link])
{
_context.Add(venta);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
ViewData["Idcliente"] = new SelectList(_context.Clientes,
"Idcliente", "Idcliente", [Link]);
ViewData["Idusuario"] = new SelectList(_context.Usuarios,
"Idusuario", "Idusuario", [Link]);
return View(venta);
}
// GET: Ventas/Edit/5
public async Task<IActionResult> Edit(uint? id)
{
if (id == null)
{
return NotFound();
}
[HttpPost]
public JsonResult Add(VentaViewModel venta)
{
using (var Transaccion = _context.[Link]())
{
try
{
Venta _Venta = new Venta
{
Idcliente = [Link],
Idusuario = [Link],
Fecha = [Link]([Link]),
Total = [Link]
};
_context.Add(_Venta);
_context.SaveChanges();
_context.SaveChanges();
//[Link] = "Registro insertado";
[Link]();
return Json(true);
}
catch (Exception ex)
{
[Link]();
return Json(venta);
}
}
MODELS
using System;
using [Link];
namespace [Link]
{
public partial class CategoriaCliente
{
public CategoriaCliente()
{
Clientes = new HashSet<Cliente>();
}
using System;
using [Link];
using [Link];
namespace [Link]
{
public partial class Venta
{
public Venta()
{
DetalleVenta = new HashSet<DetalleVenta>();
}
using System;
using [Link];
namespace [Link]
{
public partial class Usuario
{
public Usuario()
{
Ingresos = new HashSet<Ingreso>();
Venta = new HashSet<Venta>();
}
using System;
using [Link];
namespace [Link]
{
public partial class Proveedor
{
public Proveedor()
{
Ingresos = new HashSet<Ingreso>();
}
using System;
using [Link];
namespace [Link]
{
public partial class Producto
{
public Producto()
{
DetalleIngresos = new HashSet<DetalleIngreso>();
DetalleVenta = new HashSet<DetalleVenta>();
}
namespace [Link]
{
public partial class DetalleIngreso
{
public int IddetalleIngreso { get; set; }
public int Idingreso { get; set; }
public string? Idproducto { get; set; }
public int Cantidad { get; set; }
public decimal? Precio { get; set; }
using System;
using [Link];
namespace [Link]
{
public partial class Cliente
{
public Cliente()
{
Venta = new HashSet<Venta>();
}
using System;
using [Link];
using [Link];
using [Link];
namespace [Link]
{
public partial class storeplacedbContext : DbContext
{
public storeplacedbContext()
{
}
public storeplacedbContext(DbContextOptions<storeplacedbContext>
options)
: base(options)
{
}
[Link]<CategoriaCliente>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("categoria_cliente");
[Link]<CategoriaProducto>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("categoria_producto");
[Link]<Cliente>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("cliente");
[Link]<DetalleIngreso>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("detalle_ingreso");
[Link]<DetalleVenta>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("detalle_venta");
[Link]<Ingreso>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("ingreso");
[Link]<Producto>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("producto");
[Link]<Proveedor>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("proveedor");
[Link]<Rol>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("rol");
[Link]<Usuario>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("usuario");
[Link]<Venta>(entity =>
{
[Link](e => [Link])
.HasName("PRIMARY");
[Link]("venta");
OnModelCreatingPartial(modelBuilder);
}
CONEXIÓN
{
"Logging": {
"LogLevel": {
"Default": "Information",
"[Link]": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"default": "server=localhost;port=3306;user=root;database=storeplacedb"
},
"AppSettings": {
"Language": "es"
}
}
namespace StorePlace
{
public class Encrypt
{
public static string Encriptar(string str)
{
if(str != null)
{
SHA256 sha256 = [Link]();
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] stream = null;
StringBuilder sb = new StringBuilder();
stream = [Link]([Link](str));
for (int i = 0; i < [Link]; i++)
[Link]("{0:x2}", stream[i]);
return [Link]();
}
return "";
}