public bool Insertar() { bool Retornar = false; int id = 0; object identity = null; try { DbPresta db = new DbPresta(); identity = db.ObtenerValor(String.Format("Insert into Cliente(UsuarioCoId,Nombre,Telefono,Cedula,Direccion,FechaNacimiento,FechaRegistro,Estado) values({0},'{1}','{2}','{3}','{4}',Convert(datetime,'{5}',5), Convert(datetime,'{6}',5),{7}) Select @@IDENTITY", this.UsuarioCoId, this.Nombre, this.Telefono, this.Cedula, this.Direccion, this.FechaNacimiento, this.FechaRegistro, this.Estado)); int.TryParse(identity.ToString(), out id); if (id > 0) { Retornar = db.Ejecutar(String.Format("Insert into DatosClientes(ClienteId,EstadoCivil,Hijo,Vivienda,Vehiculo,DireccionTrabajo,TelefonoTrabajo,Ingreso,Remesa) Values({0},{1},{2},{3},{4},'{5}','{6}',{7},{8})", id, EstadoCivil, this.Hijo, this.Vivienda, this.Vehiculo, this.DireccionTrabajo, this.TelefonoTrabajo, this.Ingreso, this.Remesa)); if (this.Ubicacion.Count > 0) { foreach (Ubicacion item in this.Ubicacion) { db.Ejecutar(String.Format("Insert into Ubicacion(ClienteId,Descripcion,Latitude,Longitude) Values({0},'{1}',{2},{3})", id, item.Descripcion, item.Latitude, item.Longitude)); } } } } catch (Exception e) { throw e; } return(Retornar); }
public void ActualizarEstadoSubscripcion(int UsuarioId) { DbPresta db = new DbPresta(); DataTable dt = new DataTable(); float AuxiliarMes = 0; try { ValidarEstadoAdministrativo(UsuarioId); if (this.Estado == 1) { AuxiliarMes = Utilitario.ObtenerMes(DateTime.Now, Convert.ToDateTime(this.FechaCreacion)); if (AuxiliarMes >= 1) { db.Ejecutar(String.Format("update Usuario set Estado = {0} where UsuarioId = {1}", 3, UsuarioId)); //3 ES EL ESTADO DE BENCIMIENTO DE LA PRUEBA GRATIS db.Ejecutar(String.Format("update UsuarioCo set Estado = {0} where UsuarioId = {1}", 3, UsuarioId)); this.Estado = 3; } } }catch (Exception ex) { throw ex; } }
public void ActualizarFechaCorte() { DbPresta db = new DbPresta(); try { db.Ejecutar(String.Format("Update Prestamo set FechaCorte = Convert(datetime,'{0}',5) where PrestamoId = {1} and UsuarioCoId = {2}", this.FechaCorte, this.PrestamoId, this.UsuarioCoId)); }catch (Exception ex) { throw ex; } }
public void ActualizarEstado() { DbPresta db = new DbPresta(); try { db.Ejecutar(String.Format("Update Prestamo set Estado = {0} where PrestamoId = {1}", this.Estado, this.PrestamoId)); }catch (Exception ex) { throw ex; } }
public bool Actualizar() { bool Retornar = false; try { DbPresta db = new DbPresta(); db.Ejecutar(String.Format("delete from Abono where PrestamoId =" + this.PrestamoId)); foreach (Abono item in this.Detalle) { Retornar = db.Ejecutar(String.Format("Insert into Abono(ClienteId,PrestamoId,Cantidad,Fecha,UsuarioCoId) Values({0},{1},{2},Convert(datetime,'{3}',5),{4} )", this.ClienteId, this.PrestamoId, item.Cantidad, item.Fecha, this.UsuarioCoId)); } } catch (Exception e) { throw e; } return(Retornar); }
public bool Actualizar() { bool Retornar = false; DataTable dt = new DataTable(); // int id = 0; try { DbPresta db = new DbPresta(); Retornar = db.Ejecutar(string.Format("update Cliente set Nombre ='{0}', Telefono ='{1}', Cedula='{2}', Direccion='{3}', Estado ={4} where ClienteId ={5}", this.Nombre, this.Telefono, this.Cedula, this.Direccion, this.Estado, this.ClienteId)); if (this.ClienteId > 0) { Retornar = db.Ejecutar(String.Format("update DatosClientes set EstadoCivil ={0}, Hijo={1}, Vehiculo ={2},DireccionTrabajo='{3}', TelefonoTrabajo='{4}', Ingreso={5}, Remesa={6} where ClienteId={7}", this.EstadoCivil, this.Hijo, this.Vehiculo, this.DireccionTrabajo, this.TelefonoTrabajo, this.Ingreso, this.Remesa, this.ClienteId)); if (this.Ubicacion.Count > 0) { db.Ejecutar(String.Format("delete from Ubicacion where ClienteId ={0}", this.ClienteId)); foreach (Ubicacion item in this.Ubicacion) { db.Ejecutar(String.Format("Insert into Ubicacion(ClienteId,Descripcion,Latitude,Longitude) Values({0},'{1}','2',{3})", ClienteId, item.Descripcion, item.Latitude, item.Longitude)); } } } } catch (Exception ex) { throw ex; } return(Retornar); }
public bool Insertar() { bool Resultado = false; DbPresta db = new DbPresta(); try { Resultado = db.Ejecutar(String.Format("Insert into CuentaBancaria(NombreBanco,TipoCuenta,Cedula,NumeroCuenta,UsuarioId) values('{0}','{1}','{2}','{3}',{4})", this.NombreBanco, this.TipoCuenta, this.Cedula, this.NumeroCuenta, this.UsuarioId)); } catch (Exception e) { throw e; } return(Resultado); }
public bool Actualizar() { bool Resultado = false; DbPresta db = new DbPresta(); try { Resultado = db.Ejecutar(String.Format("Ubdate CuentaBancaria set NombreBanco='{0}',TipoCuenta='{1}',Cedulta='{2}',NumeroCuenta='{3}' where UsuarioId = {4}", this.NombreBanco, this.TipoCuenta, this.Cedula, this.NumeroCuenta, this.UsuarioId)); } catch (Exception e) { throw e; } return(Resultado); }
public bool Actualizar(string tabla) // TABLA PORQUE ME FUNCIONA PARA REGISTRAR LAS MORAS PAGADAS Y TAMBIEN LAS MORAS ACUMULADAS { bool Retornar = false; try { DbPresta db = new DbPresta(); Retornar = db.Ejecutar(String.Format("Update " + tabla + " set Cantidad = {0},Fecha = Convert(datetime,'{1}',5) where PrestamoId = {1}", this.Cantidad, this.Fecha, this.PrestamoId)); } catch (Exception e) { throw e; } return(Retornar); }
public bool Editar(string Tabla, string TipoUsuarioId) { bool Retornar = false; DbPresta db = new DbPresta(); try { Retornar = db.Ejecutar(String.Format("Update " + Tabla + " set Nombre='{0}',FechaCreacion= Convert(datetime,'{1}',5),Contrasena='{2}',Telefono='{3}',Correo='{4}' where " + TipoUsuarioId + " = {5}", this.Nombre, this.FechaCreacion, this.Contrasena, this.Telefono, this.Correo, this.UsuarioId)); } catch (Exception e) { throw e; } return(Retornar); }
public bool Insertar() { bool Resultado = false; try { DbPresta db = new DbPresta(); Resultado = db.Ejecutar(String.Format("Insert Herramienta(UsuarioId,Valor,Cantidad,Descripcion,Fecha) Values({0},{1},{2},'{3}',Convert(datetime,'{4}',5))", this.UsuarioId, this.Valor, this.Cantidad, this.Descripcion, this.Fecha)); } catch (Exception e) { throw e; } return(Resultado); }
public bool Actualizar(string DbDato, string Valor, string ValorCondicion) { bool Resultado = false; DbPresta db = new DbPresta(); try { //SE ACTUALIZARA PORQUE EL ADMINISTRADOR TIENE QUE ACTUALIZAR LA FECHA Resultado = db.Ejecutar(String.Format(" update Herramienta set " + DbDato + " where Valor ={1} and UsuarioId = {2} ", Valor, ValorCondicion, this.UsuarioId)); } catch (Exception ex) { throw ex; } return(Resultado); }
public bool ActualizarFecha() { bool Resultado = false; DbPresta db = new DbPresta(); try { //SE ACTUALIZARA PORQUE EL ADMINISTRADOR TIENE QUE ACTUALIZAR LA FECHA Resultado = db.Ejecutar(String.Format(" Update Herramienta set Fecha = Convert(datetime,'{0}',5) where Valor = 4 and UsuarioId = {1}", this.Fecha, this.UsuarioId)); } catch (Exception ex) { throw ex; } return(Resultado); }
public bool Insertar(string tabla) { bool Retornar = false; try { DbPresta db = new DbPresta(); Retornar = db.Ejecutar(String.Format("Insert into " + tabla + "(PrestamoId,Cantidad,Fecha) Values({0},{1},Convert(datetime,'{2}',5))", this.PrestamoId, this.Cantidad, this.Fecha)); } catch (Exception e) { throw e; } return(Retornar); }
public bool Insertar() { bool Retornar = false; try { DbPresta db = new DbPresta(); foreach (Nota item in this.Detalle) { Retornar = db.Ejecutar(String.Format("Insert into Nota(PrestamoId,ClienteId,Descripcion,Fecha) values({0},{1},'{2}',Convert(datetime,'{3}',5))", item.PrestamoId, item.ClienteId, item.Descripcion, item.Fecha)); } } catch (Exception e) { throw e; } return(Retornar); }