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 bool Buscar(int UsuarioId) { bool Resultado = false; DataTable dt = new DataTable(); try { DbPresta db = new DbPresta(); dt = db.ObtenerDatos(String.Format("Select * from Herramienta where UsuarioId =" + UsuarioId)); if (dt.Rows.Count > 0) { this.UsuarioId = Convert.ToInt32(dt.Rows[0]["UsuarioId"].ToString()); Resultado = true; } } catch (Exception e) { throw e; } return(Resultado); }
public bool Insertar() { bool Retornar = false; object identity = null; int id = 0; try { DbPresta db = new DbPresta(); identity = db.ObtenerValor(String.Format("Insert into Prestamo(ClienteId,Cuota,Taza,Monto,Interes,FechaInicio,FechaTermino,Estado,Total,CantidadCuota,FechaCorte,UsuarioCoId) values({0},{1},{2},{3},{4},Convert(datetime,'{5}',5),Convert(datetime,'{6}',5),{7},{8},{9},Convert(datetime,'{10}',5),{11}) select @@Identity", this.ClienteId, this.Cuota, this.Taza, this.Monto, this.Interes, this.FechaInicio, this.FechaTermino, this.Estado, this.Total, this.CantidadCuota, this.FechaCorte, this.UsuarioCoId)); int.TryParse(identity.ToString(), out id); if (id > 0) { Retornar = true; this.PrestamoId = id; } } catch (Exception e) { throw e; } return(Retornar); }
public bool Buscar() { bool Retornar = false; DbPresta db = new DbPresta(); DataTable dt = new DataTable(); try { dt = db.ObtenerDatos(String.Format("select UsuarioId,NombreBanco,TipoCuenta,NumeroCuenta,Cedula from CuentaBancaria where UsuarioId = {0}", this.UsuarioId)); if (dt.Rows.Count > 0) { this.UsuarioId = Convert.ToInt32(dt.Rows[0]["UsuarioId"]); this.NombreBanco = dt.Rows[0]["NombreBanco"].ToString(); this.TipoCuenta = dt.Rows[0]["TipoCuenta"].ToString(); this.NumeroCuenta = dt.Rows[0]["NumeroCuenta"].ToString(); this.Cedula = dt.Rows[0]["Cedula"].ToString(); } } catch (Exception e) { throw e; } return(Retornar); }
public bool ValidarCliente(string Cedula, string Nombre, int UsuarioId) { DbPresta db = new DbPresta(); bool Valor = false; DataTable dt = new DataTable(); dt = db.ObtenerDatos(String.Format("Select C.ClienteId as ClienteId,C.Nombre as Nombre from Cliente as C inner join UsuarioCo as Uc on Uc.UsuarioCoId = C.UsuarioCoId inner join Usuario as U on U.UsuarioId = Uc.UsuarioId" + " where C.Cedula ='{0}' or C.Nombre='{1}' and U.UsuarioId = " + UsuarioId, Cedula, Nombre)); try { if (dt.Rows.Count > 0) { Valor = true; this.ClienteId = Convert.ToInt32(dt.Rows[0]["ClienteId"]); this.Nombre = dt.Rows[0]["Nombre"].ToString(); this.CantidadCliente = dt.Rows.Count; } else { Valor = false; } } catch (Exception e) { throw e; } return(Valor); }
public bool Buscar(int id) { bool retornar = false; DataTable dt = new DataTable(); DbPresta db = new DbPresta(); try { dt = db.ObtenerDatos(String.Format("Select * from Prestamo where PrestamoId = " + id.ToString() + " and UsuarioCoId = " + this.UsuarioCoId)); if (dt.Rows.Count > 0) { this.Total = Convert.ToSingle(dt.Rows[0]["Total"].ToString()); this.Interes = Convert.ToSingle(dt.Rows[0]["Interes"].ToString()); this.CantidadCuota = Convert.ToSingle(dt.Rows[0]["CantidadCuota"].ToString()); this.Cuota = Convert.ToInt32(dt.Rows[0]["Cuota"].ToString()); this.FechaCorte = dt.Rows[0]["FechaCorte"].ToString(); } }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 bool Buscar(int IdBuscado) { DataTable dt = new DataTable(); DbPresta db = new DbPresta(); bool Valor = false; try { dt = db.ObtenerDatos(String.Format("Select * from Cuadre " + Condicion)); if (dt.Rows.Count > 0) { Valor = true; } foreach (DataRow row in dt.Rows) { AgregarCuadre(Convert.ToInt32(row["CuadreId"]), Convert.ToInt32(row["UsuarioCoId"]), row["Fecha"].ToString(), Convert.ToSingle(row["Total"]), Convert.ToSingle(row["P1"]), Convert.ToSingle(row["P5"]), Convert.ToSingle(row["P10"]), Convert.ToSingle(row["P25"]), Convert.ToSingle(row["P50"]), Convert.ToSingle(row["P100"]), Convert.ToSingle(row["P200"]), Convert.ToSingle(row["P500"]), Convert.ToSingle(row["P1000"]), Convert.ToSingle(row["P2000"]), Convert.ToSingle(row["TotalCheque"]), Convert.ToSingle(row["TotalTarjeta"]), Convert.ToSingle(row["TotalTransaccion"]), Convert.ToInt32(row["CantidadCheque"]), Convert.ToInt32(row["CantidadTarjeta"]), Convert.ToInt32(row["CantidadTransaccion"])); } } catch (Exception ex) { throw ex; } return(Valor); }
public static DataTable Lista(string Campo, string Tabla, string Condicion) { DataTable dt = new DataTable(); DbPresta db = new DbPresta(); dt = db.ObtenerDatos(String.Format("Select " + Campo + Tabla + Condicion)); return(dt); }
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 Buscar(int id) { bool Retornar = false; try { DbPresta db = new DbPresta(); DataTable dt = new DataTable(); DataTable dt2 = new DataTable(); dt = db.ObtenerDatos(String.Format("Select * from Cliente where ClienteId = {0}", id)); dt2 = db.ObtenerDatos(String.Format("Select * from DatosClientes where ClienteId = {0}", id)); if (dt.Rows.Count > 0) { this.ClienteId = Convert.ToInt32(dt.Rows[0]["ClienteId"]); this.UsuarioCoId = Convert.ToInt32(dt.Rows[0]["UsuarioCoId"]); this.Nombre = Convert.ToString(dt.Rows[0]["Nombre"]); this.Telefono = Convert.ToString(dt.Rows[0]["Telefono"]); this.Cedula = Convert.ToString(dt.Rows[0]["Cedula"]); this.Direccion = Convert.ToString(dt.Rows[0]["Direccion"]); this.FechaNacimiento = Convert.ToString(dt.Rows[0]["FechaNacimiento"]); this.FechaRegistro = Convert.ToString(dt.Rows[0]["FechaRegistro"]); this.Estado = Convert.ToInt32(dt.Rows[0]["Estado"]); if (dt2.Rows.Count > 0) { this.DatosClienteId = Convert.ToInt32(dt2.Rows[0]["DatosClienteId"]); this.EstadoCivil = Convert.ToInt32(dt2.Rows[0]["EstadoCivil"]); this.Hijo = Convert.ToInt32(dt2.Rows[0]["Hijo"]); this.Vivienda = Convert.ToInt32(dt2.Rows[0]["Vivienda"]); this.Vehiculo = Convert.ToInt32(dt2.Rows[0]["Vehiculo"]); this.DireccionTrabajo = Convert.ToString(dt2.Rows[0]["DireccionTrabajo"]); this.TelefonoTrabajo = Convert.ToString(dt2.Rows[0]["TelefonoTrabajo"]); this.Ingreso = Convert.ToSingle(dt2.Rows[0]["Ingreso"]); this.Remesa = Convert.ToSingle(dt2.Rows[0]["Remesa"]); } //this.Ubicacion = dt3. Retornar = true; } } 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 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 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 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 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 void ValidarEstadoAdministrativo(int UsuarioId) { DbPresta db = new DbPresta(); DataTable dt = new DataTable(); dt = db.ObtenerDatos(String.Format("Select Estado from Usuario where UsuarioId =" + UsuarioId)); try { if (dt.Rows.Count > 0) { // this.UsuarioId = Convert.ToInt32(dt.Rows[0]["UsuarioId"].ToString()); this.Estado = Convert.ToInt32(dt.Rows[0]["Estado"].ToString()); } } catch (Exception e) { throw e; } }
public bool Insertar(string Tabla) { bool Resultado = false; object Identity = null; int Retornar = 0; DbPresta db = new DbPresta(); try { if (Tabla == "UsuarioCo") { Identity = db.ObtenerValor(String.Format("Insert into " + Tabla + " (Nombre,Contrasena,Telefono,Correo,FechaCreacion,Estado,UsuarioId) Values('{0}','{1}','{2}','{3}',Convert(datetime,'{4}',5),{5},{6}) select @@IDENTITY", this.Nombre, this.Contrasena, this.Telefono, this.Correo, this.FechaCreacion, this.Estado, this.UsuarioId)); int.TryParse(Identity.ToString(), out Retornar); if (Retornar > 0) { this.UsuarioId = Retornar; Resultado = true; } } else { Identity = db.ObtenerValor(String.Format("Insert into " + Tabla + " (Nombre,Contrasena,Telefono,Correo,FechaCreacion,Estado,RNC) Values('{0}','{1}','{2}','{3}',Convert(datetime,'{4}',5),{5},'{6}') select @@IDENTITY", this.Nombre, this.Contrasena, this.Telefono, this.Correo, this.FechaCreacion, this.Estado, this.RNC)); int.TryParse(Identity.ToString(), out Retornar); if (Retornar > 0) { this.UsuarioId = Retornar; Resultado = true; } } } catch (Exception e) { throw e; } return(Resultado); }
public bool ValidarLog(string Correo, string Contrasena, string TipoUsuario, string UsuarioId) { DbPresta db = new DbPresta(); bool Valor = false; DataTable dt = new DataTable(); dt = db.ObtenerDatos(String.Format("Select * from " + TipoUsuario + " where Correo ='{0}' AND Contrasena='{1}' ", Correo, Contrasena)); try { if (dt.Rows.Count > 0) { if (TipoUsuario == "UsuarioCo") { this.UsuarioCoId = Convert.ToInt32(dt.Rows[0][UsuarioId]); } this.UsuarioId = Convert.ToInt32(dt.Rows[0]["UsuarioId"]); this.Correo = dt.Rows[0]["Correo"].ToString(); this.Nombre = dt.Rows[0]["Nombre"].ToString(); this.FechaCreacion = Utilitario.FormatoFecha(dt.Rows[0]["FechaCreacion"].ToString()); } else { Valor = false; } } catch (Exception e) { throw e; } if (this.UsuarioId > 0) { Valor = true; } return(Valor); }
public bool Buscar(int id, string TipoUsuario, string UsuarioId) { bool Retornar = false; DbPresta db = new DbPresta(); DataTable dt = new DataTable(); try { dt = db.ObtenerDatos(String.Format("select * from " + TipoUsuario + " where " + UsuarioId + " = " + id)); if (dt.Rows.Count > 0) { this.UsuarioId = id; this.Nombre = dt.Rows[0]["Nombre"].ToString(); this.Contrasena = dt.Rows[0]["Contrasena"].ToString(); this.Telefono = dt.Rows[0]["Telefono"].ToString(); this.Correo = dt.Rows[0]["Correo"].ToString(); this.FechaCreacion = dt.Rows[0]["FechaCreacion"].ToString(); this.Estado = Convert.ToInt32(dt.Rows[0]["Estado"]); if (TipoUsuario == "Usuario") { this.RNC = dt.Rows[0]["RNC"].ToString(); } if (TipoUsuario == "UsuarioCo") { this.UsuarioCoId = id; this.UsuarioId = Convert.ToInt32(dt.Rows[0]["UsuarioId"].ToString()); } Retornar = true; } } catch (Exception e) { throw e; } return(Retornar); }
public bool Insertar() { bool Retornar = false; try { DbPresta db = new DbPresta(); 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 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); }
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() { DbPresta db = new DbPresta(); bool Valor = false; object Identity; int Retornar = 0; try { Identity = db.ObtenerValor(String.Format("Insert into Cuadre(UsuarioCoId,Total,Fecha,P1,P5,P10,P25,P50,P100,P200,P500,P1000,P2000,Estado) values({0},{1},Convert(datetime,'{2}',5),{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13}) Select @@IDENTITY", this.UsuarioCoId, this.Total, this.Fecha, this.P1, this.P5, this.P10, this.P25, this.P50, this.P100, this.P200, this.P500, this.P1000, this.P2000, this.Estado)); int.TryParse(Identity.ToString(), out Retornar); if (Retornar > 0) { this.CuadreId = Retornar; Valor = true; } } catch (Exception e) { throw e; } return(Valor); }