示例#1
0
        public ActionResult EditarUsuario(int id, string usuNombreUsuario, string usuPassword, string usuNombres, string usuApellidos, string usuCorreo, int usuIdEmpresa, int usuIdSucursal)
        {
            try
            {
                byte[] data = Encoding.GetEncoding(1252).GetBytes(usuPassword.ToUpper());
                var    sha  = new SHA256Managed();
                byte[] contrasena_encriptada = sha.ComputeHash(data);

                tbUsuarios tbUsuarios = _context.tbUsuarios.Find(id);
                if (tbUsuarios != null)
                {
                    tbUsuarios.usuNombreUsuario      = usuNombreUsuario;
                    tbUsuarios.usuPassword           = contrasena_encriptada.ToString();
                    tbUsuarios.usuNombres            = usuNombres;
                    tbUsuarios.usuApellidos          = usuApellidos;
                    tbUsuarios.usuCorreo             = usuCorreo;
                    tbUsuarios.usuIdEmpresa          = usuIdEmpresa;
                    tbUsuarios.usuIdSucursal         = usuIdSucursal;
                    tbUsuarios.usuEsActivo           = 1;
                    _context.Entry(tbUsuarios).State = EntityState.Modified;
                    _context.SaveChanges();
                }
                return(Json(true));
            }
            catch (Exception ex)
            {
                return(Json(false));
            }
        }
示例#2
0
 public ActionResult EditarProducto(int id, string prIdInterno, string prDetalle, int prCantidad, decimal prPrecioCosto, decimal prPrecioVenta, int prMoneda, int prIdSucursal, int prIdProveedor, int prIdImpuesto)
 {
     try
     {
         tbProducto tbProducto = _context.tbProducto.Find(id);
         if (tbProducto != null)
         {
             tbProducto.prIdInterno           = prIdInterno;
             tbProducto.prDetalle             = prDetalle;
             tbProducto.prCantidad            = prCantidad;
             tbProducto.prPrecioCosto         = prPrecioCosto;
             tbProducto.prPrecioVenta         = prPrecioVenta;
             tbProducto.prMoneda              = prMoneda;
             tbProducto.prIdSucursal          = prIdSucursal;
             tbProducto.prIdProveedor         = prIdProveedor;
             tbProducto.prIdImpuesto          = prIdImpuesto;
             _context.Entry(tbProducto).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#3
0
 public ActionResult EditarEmpresa(int id, string empNombre, string empDireccion, string empTelefono, int empPais, int empMoneda, int empLenguaje, int empLicencia, int empCantidaduser, int empUsuariocrea)
 {
     try
     {
         tbEmpresa tbEmpresa = _context.tbEmpresa.Find(id);
         if (tbEmpresa != null)
         {
             tbEmpresa.empNombre             = empNombre;
             tbEmpresa.empDireccion          = empDireccion;
             tbEmpresa.empTelefono           = empTelefono;
             tbEmpresa.empPais               = empPais;
             tbEmpresa.empMoneda             = empMoneda;
             tbEmpresa.empLenguaje           = empLenguaje;
             tbEmpresa.empLicencia           = empLicencia;
             tbEmpresa.empCantidadUser       = empCantidaduser;
             tbEmpresa.empUsuarioModifica    = empUsuariocrea;
             tbEmpresa.empFechaModifica      = DateTime.Now;
             _context.Entry(tbEmpresa).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#4
0
 public ActionResult EditarProveedor(int pvid, string pvNombre, string pvTelefono, string pvCorreo, string pvDireccion, string pvDescripcion)
 {
     try
     {
         tbProveedores tbProveedores = _context.tbProveedores.Find(pvid);
         if (tbProveedores != null)
         {
             tbProveedores.pvNombre              = pvNombre;
             tbProveedores.pvTelefono            = pvTelefono;
             tbProveedores.pvCorreo              = pvCorreo;
             tbProveedores.pvDireccion           = pvDireccion;
             tbProveedores.pvDescripcion         = pvDescripcion;
             _context.Entry(tbProveedores).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#5
0
 public ActionResult EditarLenguaje(int id, string nombre)
 {
     try
     {
         tbLenguaje tbLenguaje = _context.tbLenguaje.Find(id);
         if (tbLenguaje != null)
         {
             tbLenguaje.lenNombre             = nombre;
             tbLenguaje.lenFehcaActivacion    = DateTime.Now;
             _context.Entry(tbLenguaje).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#6
0
 //[HttpPost]
 //[ValidateAntiForgeryToken]
 public ActionResult EditarSucursal(int id, string sucNombre, int sucIdEmpresa)
 {
     try
     {
         tbSucursales tbSucursales = _context.tbSucursales.Find(id);
         if (tbSucursales != null)
         {
             tbSucursales.sucNombre             = sucNombre;
             tbSucursales.sucIdEmpresa          = sucIdEmpresa;
             _context.Entry(tbSucursales).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
 public ActionResult EditarCategoria(int catId, string catNombre, string catDescripcion)
 {
     try
     {
         tbCategoriaProducto tbCategoriaProducto = _context.tbCategoriaProducto.Find(catId);
         if (tbCategoriaProducto != null)
         {
             tbCategoriaProducto.catNombre             = catNombre;
             tbCategoriaProducto.catDescripcion        = catDescripcion;
             _context.Entry(tbCategoriaProducto).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
 public ActionResult EditarApertura(int id, decimal acValorApertura, int acEstado, int acIdUsuario)
 {
     try
     {
         tbAperturaCaja tbAperturaCaja = _context.tbAperturaCajas.Find(id);
         if (tbAperturaCaja != null)
         {
             tbAperturaCaja.acValorApertura       = acValorApertura;
             tbAperturaCaja.acEstado              = acEstado;
             tbAperturaCaja.acIdUsuario           = acIdUsuario;
             _context.Entry(tbAperturaCaja).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#9
0
 public ActionResult EditarRegistro(int id, string rtCAI, string rtRangoAutoInicio, string rtRangoAutoFinal)
 {
     try
     {
         tbRegistroTributario tbRegistroTributario = _context.tbRegistroTributario.Find(id);
         if (tbRegistroTributario != null)
         {
             tbRegistroTributario.rtCAI                 = rtCAI;
             tbRegistroTributario.rtRangoAutoInicio     = rtRangoAutoInicio;
             tbRegistroTributario.rtRangoAutoFinal      = rtRangoAutoFinal;
             _context.Entry(tbRegistroTributario).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#10
0
 public ActionResult EditarLicencia(int id, string tlicDescripcion)
 {
     try
     {
         tbTipoLicencia tbTipoLicencia = _context.tbTipoLicencia.Find(id);
         if (tbTipoLicencia != null)
         {
             tbTipoLicencia.tlicDescripcion       = tlicDescripcion;
             tbTipoLicencia.tlicFechaModifica     = DateTime.Now;
             tbTipoLicencia.tlicUsuarioModifica   = 1;
             _context.Entry(tbTipoLicencia).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#11
0
 public ActionResult EditarPais(int id, string paNombre, int paCodPostal, string paAbreviatura)
 {
     try
     {
         tbPaises tbPaises = _context.tbPaises.Find(id);
         if (tbPaises != null)
         {
             tbPaises.paNombre              = paNombre;
             tbPaises.paCodPostal           = paCodPostal;
             tbPaises.paAbreviatura         = paAbreviatura;
             _context.Entry(tbPaises).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#12
0
 public ActionResult EditarVendedor(int id, string venNombre, int venTuId, int venEstado)
 {
     try
     {
         tbVendedores tbVendedores = _context.tbVendedores.Find(id);
         if (tbVendedores != null)
         {
             tbVendedores.venNombre             = venNombre;
             tbVendedores.venTuId               = venTuId;
             tbVendedores.venEstado             = venEstado;
             _context.Entry(tbVendedores).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#13
0
 public ActionResult EditarTasa(int id, string descripcion, decimal valor, int moneda)
 {
     try
     {
         tbTasaCambio tbTasaCambio = _context.tbTasaCambio.Find(id);
         if (tbTasaCambio != null)
         {
             tbTasaCambio.tcDescripcion         = descripcion;
             tbTasaCambio.tcValor               = valor;
             tbTasaCambio.tcIdMoneda            = moneda;
             _context.Entry(tbTasaCambio).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#14
0
 public ActionResult EditarMoneda(int id, string abreviatura, string nombre)
 {
     try
     {
         tbMoneda tbMoneda = _context.tbMoneda.Find(id);
         if (tbMoneda != null)
         {
             tbMoneda.moAbreviatura         = abreviatura;
             tbMoneda.moNombre              = nombre;
             tbMoneda.moFechaModifica       = DateTime.Now;
             tbMoneda.moUsuarioModifica     = 1;
             _context.Entry(tbMoneda).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#15
0
 public ActionResult EditarCierreCaja(int id, decimal ccTotalCierre, int ccIdEmpresa, int ccIdSucursal, int ccIdUsuario)
 {
     try
     {
         tbCierreCaja tbCierreCaja = _context.tbCierreCajas.Find(id);
         if (tbCierreCaja != null)
         {
             tbCierreCaja.ccTotalCierre         = ccTotalCierre;
             tbCierreCaja.ccIdEmpresa           = ccIdEmpresa;
             tbCierreCaja.ccIdSucursal          = ccIdSucursal;
             tbCierreCaja.ccIdUsuario           = ccIdUsuario;
             _context.Entry(tbCierreCaja).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#16
0
 public ActionResult EditarDescuento(int id, string desCampaña, int desPorcentaje, DateTime desFechaInicio, DateTime desFechaFin, int desProducto)
 {
     try
     {
         tbDescuentos tbDescuentos = _context.tbDescuentos.Find(id);
         if (tbDescuentos != null)
         {
             tbDescuentos.desNombreCampaña      = desCampaña;
             tbDescuentos.desPorcentaje         = desPorcentaje;
             tbDescuentos.desFechaInicio        = desFechaInicio;
             tbDescuentos.desFechaFinal         = desFechaFin;
             tbDescuentos.desIdProducto         = desProducto;
             _context.Entry(tbDescuentos).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
示例#17
0
 public ActionResult EditarCliente(int id, string clNombre, string clApellido, string clTelefono, string clIdentidad, string clRTN, string clDireccion, int clIdEmpresa)
 {
     try
     {
         tbClientes tbClientes = _context.tbClientes.Find(id);
         if (tbClientes != null)
         {
             tbClientes.clNombre              = clNombre;
             tbClientes.clApellido            = clApellido;
             tbClientes.clTelefono            = clTelefono;
             tbClientes.clIdentidad           = clIdentidad;
             tbClientes.clRTN                 = clRTN;
             tbClientes.clDireccion           = clDireccion;
             tbClientes.clIdEmpresa           = clIdEmpresa;
             _context.Entry(tbClientes).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }