private DataTable FiltrarCliente(string nombre, string apellido, string mail, int tipoDoc, int numDoc) { DaoSP dao = new DaoSP(); DataTable tabla_Cliente; int docVacio = 0; if (numDoc != docVacio) { tabla_Cliente = dao.ObtenerDatosSP("dropeadores.getCliente", numDoc); } else { tabla_Cliente = dao.ObtenerDatosSP("dropeadores.getCliente", docVacio); } var final_rol = ""; var posFiltro = true; var filtrosBusqueda = new List <string>(); if (nombre != "") { filtrosBusqueda.Add("nombre LIKE '%" + nombre + "%'"); } if (apellido != "") { filtrosBusqueda.Add("apellido LIKE '%" + apellido + "%'"); } if (mail != "") { filtrosBusqueda.Add("mail LIKE '%" + mail + "%'"); } if (tipoDoc != -1) { filtrosBusqueda.Add("tipoDocumento LIKE '%" + comboTipoDoc.Items[tipoDoc] + "%'"); } if (numDoc != 0) { filtrosBusqueda.Add("numeroDocumento = " + numDoc); } foreach (var filtro in filtrosBusqueda) { if (!posFiltro) { final_rol += " AND " + filtro; } else { final_rol += filtro; posFiltro = false; } } if (tabla_Cliente != null) { tabla_Cliente.DefaultView.RowFilter = final_rol; } return(tabla_Cliente); }
private DataTable FiltrarEmpresa(string razonSocial, string cuit, string mail) { DaoSP dao = new DaoSP(); DataTable tabla_empresa; Empresa emp = new Empresa(); string cuitVacio = "00-00000000-00"; if (cuit == "") { tabla_empresa = dao.ObtenerDatosSP("dropeadores.getEmpresa", cuitVacio); } else { tabla_empresa = dao.ObtenerDatosSP("dropeadores.getEmpresa", cuit); } var final_rol = ""; var posFiltro = true; var filtrosBusqueda = new List <string>(); if (cuit != "") { filtrosBusqueda.Add("empresa_Cuit LIKE '%" + cuit + "%'"); } if (razonSocial != "") { filtrosBusqueda.Add("empresa_razon_social LIKE '%" + razonSocial + "%'"); } if (mail != "") { filtrosBusqueda.Add("empresa_mail LIKE '%" + mail + "%'"); } foreach (var filtro in filtrosBusqueda) { if (!posFiltro) { final_rol += " AND " + filtro; } else { final_rol += filtro; posFiltro = false; } } int cant = emp.existEmpresa(razonSocial, cuit, mail); if (tabla_empresa != null && cant >= 1) { // error cuando probas por filtrar por 2 campos y alguno es incorrecto tabla_empresa.DefaultView.RowFilter = final_rol; } else { tabla_empresa = null; dataGridViewEmpresa.DataSource = null; } return(tabla_empresa); }
//public string Mail //{ // get // { // if (mail != null) // return mail.Address; // else // return "''"; // } // set // { // if (value != "") // mail = new MailAddress(value); // } //} //public int Telefono //{ // get { return _telefono; } // set { _telefono = value; } //} //public string Fecha_nacimiento // { // get { return ((DateTime)fechaNacimiento).ToString("yyyyMMdd"); } // set { fechaNacimiento = DateTime.Parse(value); } // } //public DateTime? Fecha_nacimiento_struct //{ // get { return fechaNacimiento; } // set { fechaNacimiento = value; } //} #endregion #region Constructor //public Usuario() //{ // this.eliminado = false; // this.habilitado = true; //} #endregion //public bool estoyInhabilitado() { return habilitado; } public int Alta() { int retorno = 9; try { DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); Usuario usuario = new Usuario(); Cliente cli = new Cliente(); Domicilio dire = cliente.Cli_Dir; Tarjeta tar = new Tarjeta(); int cant = cli.existEmpresa(cliente.cuil, cliente.numeroDocumento); // if (dao.EjecutarSP("dropeadores.ExistCliente",cliente.cuil,cliente.numeroDocumento)==0) if (cant == 0) { if (dao.EjecutarSP("dropeadores.Domicilio_Cli_Alta", dire.calle, dire.numero, dire.piso, dire.dpto, dire.localidad, dire.cp) > 0) { dt = dao.ObtenerDatosSP("dropeadores.DireCli_ObtenerId"); DataRow row = dt.Rows[0]; int idDireClienteInsertado = int.Parse(row["Id"].ToString()); if (dao.EjecutarSP("dropeadores.Cli_Alta", cliente.nombre, cliente.apellido, cliente.tipoDocumento, cliente.numeroDocumento, cliente.mail, cliente.fechaNacimiento, cliente.cuil, cliente.telefono, idDireClienteInsertado, this.fechaCreacionPsw) > 0) { dt = dao.ObtenerDatosSP("dropeadores.Cli_ObtenerId", idDireClienteInsertado); DataRow row2 = dt.Rows[0]; int idClienteInsertado = int.Parse(row2["Id"].ToString()); if (dao.EjecutarSP("dropeadores.Cliente_Alta_Tarjeta", cliente.Cli_Tar.propietario, cliente.Cli_Tar.numero, cliente.Cli_Tar.fechaVencimiento, cliente.numeroDocumento) > 0) { if (dao.EjecutarSP("dropeadores.Usuario_Alta", cliente.numeroDocumento, this.username, this.password, this.fechaCreacionPsw, this.creadoPor) > 0) { retorno = 0; } else { retorno = -1; } } } } } return(retorno); } catch (Exception ex) { return(-1); } }
public static DataTable obtenerTabla(string tipoDoc, int nroDoc) { DaoSP dao = new DaoSP(); if (dao.EjecutarSP("dropeadores.ExistTarjetaCliente", nroDoc) == 0) { return(dao.ObtenerDatosSP("dropeadores.ObtenerClienteSinTarjeta", tipoDoc, nroDoc)); } else { return(dao.ObtenerDatosSP("dropeadores.ObtenerClienteEspecifico", tipoDoc, nroDoc)); } }
private DataTable FiltrarGrado(string tipo) { DaoSP dao = new DaoSP(); Grado grado = new Grado(); DataTable tabla_Cliente = null; string tipoVacio = ""; int cant = grado.existGrado(tipo); var final_rol = ""; var posFiltro = true; var filtrosBusqueda = new List <string>(); if (cant != 0) { if (tipo != tipoVacio) { tabla_Cliente = dao.ObtenerDatosSP("dropeadores.getGrado", tipo); } else { tabla_Cliente = dao.ObtenerDatosSP("dropeadores.getGrado", tipoVacio); } if (tipo != "") { filtrosBusqueda.Add("DESCRIPCIÓN LIKE '%" + tipo + "%'"); } foreach (var filtro in filtrosBusqueda) { if (!posFiltro) { final_rol += " AND " + filtro; } else { final_rol += filtro; posFiltro = false; } } if (tabla_Cliente != null) { tabla_Cliente.DefaultView.RowFilter = final_rol; } return(tabla_Cliente); } return(tabla_Cliente); }
private void ComprarPPAL_Load(object sender, EventArgs e) { cargarTabla(); DaoSP dao = new DaoSP(); dtSource = dao.ObtenerDatosSP("dropeadores.getTablaPublicacion", fech.getFechaSistema()); }
private void comboCategoria_SelectedIndexChanged(object sender, EventArgs e) { try { if (comboCategoria.SelectedIndex != 0) { DaoSP dao = new DaoSP(); TipoUbicacion tu2 = new TipoUbicacion(); DataTable dtPrecioCategoria = new DataTable(); dtPrecioCategoria = dao.ObtenerDatosSP("dropeadores.getPrecioDeUbicacionPorCategoria", publicacion.codigo, comboCategoria.SelectedValue); if (dtPrecioCategoria.Rows.Count <= 0) { MessageBox.Show("No hay ubicaciones con precios pertenecientes a esa categoria.", "¡Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DataRow row2 = dtPrecioCategoria.Rows[0]; decimal precio = decimal.Parse(row2["precio"].ToString()); textPrecio.Text = precio.ToString(); } } } catch (Exception ex) { throw ex; } }
public Usuario obtenerUsuariosByName(string name) { try { DaoSP daoSP = new DaoSP(); DataTable dt; dt = daoSP.ObtenerDatosSP("dropeadores.obtenerUsuarioByUsername", name); DataRow row = dt.Rows[0]; Usuario u = new Usuario(); Cliente cliente = new Cliente(); Empresa empresa = new Empresa(); u.Id = int.Parse(row["id"].ToString()); u.cliente = cliente; u.empresa = empresa; u.username = row["username"].ToString(); u.password = row["password"].ToString(); u.cambioPsw = int.Parse(row["cambioPsw"].ToString()); u.creadoPor = row["creadoPor"].ToString(); u.cliente.numeroDocumento = int.Parse(row["clienteId"].ToString()); u.empresa.Empresa_Cuit = row["CuitEmpresa"].ToString(); return(u); } catch (Exception ex) { throw ex; } }
private void cargarTabla() { DaoSP prueba = new DaoSP(); CargarData.cargarGridView(dataGridViewCompras, prueba.ObtenerDatosSP("dropeadores.getTablaPublicacion", fech.getFechaSistema())); CargarData.AddButtonSeleccionar(dataGridViewCompras); }
public DataTable getClientesMayorCompras(DataGridView dataGridView1, string trimestre, string anio) { DataTable dt = new DataTable(); DaoSP dao = new DaoSP(); dt = dao.ObtenerDatosSP("dropeadores.getClientesMayorCantCompras", trimestre, anio); return(dt); }
public DataTable getLocalidadesNoVendidas(DataGridView dataGridView1, string trimestre, string anio) { DataTable dt = new DataTable(); DaoSP dao = new DaoSP(); dt = dao.ObtenerDatosSP("dropeadores.getClientesMasPuntosVencidos", trimestre, anio); return(dt); }
public DataTable obtenerFuncionalidadesDT() { try { DaoSP daoSP = new DaoSP(); return(daoSP.ObtenerDatosSP("getFuncionalidades")); } catch (Exception ex) { throw ex; } }
public void PasarAInhabilitado(string username) { try { DaoSP daoSP = new DaoSP(); DataTable dt; dt = daoSP.ObtenerDatosSP("dropeadores.pasarAInhabilitado", username); } catch (Exception ex) { throw ex; } }
public int insertarRolPorFunc(string nombre, DataGridView dgvFuncionalidades) { DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); List <int> ChkedRow = new List <int>(); int i = 0; for (i = 0; i <= dgvFuncionalidades.RowCount - 1; i++) { if (Convert.ToBoolean(dgvFuncionalidades.Rows[i].Cells["seleccion"].Value) == true) { ChkedRow.Add(i); } } if (ChkedRow.Count == 0) { MessageBox.Show("Debe Seleccionar al menos una funcionalidad", "Error al crear el Rol", MessageBoxButtons.OK, MessageBoxIcon.Error); return(-1); } else { if (dao.EjecutarSP("dropeadores.Alta_Rol", nombre) > 0) { dt = dao.ObtenerDatosSP("dropeadores.Rol_ObtenerId"); DataRow rowRol = dt.Rows[0]; int idRol = int.Parse(rowRol["Id"].ToString()); foreach (int k in ChkedRow) { //Insertar en el muchos a muchos ese ID de rol y cada Funcionalidad Seleccionada int idFunc = int.Parse(dgvFuncionalidades.Rows[k].Cells["Id_Funcionalidad"].Value.ToString()); if (dao.EjecutarSP("dropeadores.AltaRolPorFuncionalidad", idRol, idFunc) < 0) { MessageBox.Show("Ha ocurrido un error..", "Error al crear el Rol", MessageBoxButtons.OK, MessageBoxIcon.Error); return(-1); } else { return(0); } } return(0); } else { MessageBox.Show("Ha ocurrido un error", "Error al crear el Rol", MessageBoxButtons.OK, MessageBoxIcon.Error); return(-1); } } }
public DataTable obtenerTiposDocumentosDt() { try { DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); dt = dao.ObtenerDatosSP("getTipoDocumentos"); return(dt); } catch (Exception ex) { throw ex; } }
//Se realiza el alta de un nuevo rol mediante un objeto que se transforma en una query //public int agregarRol(Rol rol) { // try // { DaoObject dao = new DaoObject(); // return dao.Guardar(rol); // } // catch (Exception ex) // { // throw ex; // } //} public int agregarRolSP(Rol rol) { try { DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); dt = dao.ObtenerDatosSP("RolAlta", rol.NombreRol); return(Convert.ToInt32(dt.Rows[0]["roId"])); } catch (Exception ex) { throw ex; } }
public DataTable obtenerUsuariosDt() { try { DaoSP daoSP = new DaoSP(); return(daoSP.ObtenerDatosSP("getUsuarios")); } catch (Exception ex) { throw ex; } }
//public string ObtenerRol(string username) //{ // DaoSP dao = new DaoSP(); // DataTable dt = new DataTable(); // try // { // dt = dao.ObtenerDatosSP("dropeadores.obtenerRolDeUsuario", username); // string rol; // List<string> roles = new List<string>; // foreach (DataRow i in dt.Rows) // { // rol = i["rol"].ToString(); // roles.Add(rol); // } // return // } // catch (Exception ex) // { // throw ex; // } //} public int AltaEmpresa() { //int retorno=9; try { DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); Domicilio dom = empresa.Empresa_Dom; Empresa emp = new Empresa(); int cant = emp.existEmpresa(empresa.Empresa_razon_social, empresa.Empresa_Cuit, ""); if (cant == 0) { if (dao.EjecutarSP("dropeadores.Domicilio_empresa_Alta", dom.calle, dom.numero, dom.piso, dom.dpto, dom.localidad, dom.cp, dom.ciudad) > 0) { dt = dao.ObtenerDatosSP("dropeadores.DireEmp_ObtenerId"); DataRow row = dt.Rows[0]; int idDomEmpresaInsertado = int.Parse(row["Id"].ToString()); if (dao.EjecutarSP("dropeadores.Empresa_Alta", empresa.Empresa_Cuit, empresa.Empresa_mail, empresa.Empresa_telefono, empresa.Empresa_razon_social, idDomEmpresaInsertado) > 0) { dt = dao.ObtenerDatosSP("dropeadores.Emp_ObtenerId", idDomEmpresaInsertado); } DataRow row2 = dt.Rows[0]; string idEmpresaInsertada = row2["cuit"].ToString(); dao.EjecutarSP("dropeadores.Usuario_Alta_Empresa", idEmpresaInsertada, empresa.Empresa_Cuit, empresa.Empresa_Cuit); } return(1); } else { return(0); } } catch (Exception ex) { return(-1); } }
public void altaItem() { try { DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); dt = dao.ObtenerDatosSP("dropeadores.altaItem", this.Cantidad, this.Monto, this.descripcion, this.compraId, this.facturaId); //DataRow row2 = dt.Rows[0]; //int idFactura = int.Parse(row2["Id"].ToString()); } catch (Exception ex) { throw ex; } }
public int altaFactura() { try { DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); dt = dao.ObtenerDatosSP("dropeadores.altaFactura", this.Fecha, this.TotalComisionCobrada, this.TotalEmpresaPagado, this.empresaId); DataRow row2 = dt.Rows[0]; int idFactura = int.Parse(row2["Id"].ToString()); return(idFactura); } catch (Exception ex) { throw ex; } }
private void GenerarRendicionComisiones_Load(object sender, EventArgs e) { try { lblEmpresa.Text = userLog.empresa.Empresa_Cuit; DataTable dt = new DataTable(); DaoSP dao = new DaoSP(); dt = dao.ObtenerDatosSP("dropeadores.GetComprasPorEmpresa", userLog.empresa.Empresa_Cuit); //CargarData.cargarGridView(dataGridView1, dt); dtSource = dt; //CargarData.AddCheckColumn(dataGridView1, "seleccion"); } catch (Exception ex) { throw ex; } }
public DataTable GetFuncionalidadesPorUsuario(int usuarioId) { try { DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); if (usuarioId == 0) { return(dt); } return(dao.ObtenerDatosSP("dropeadores.GetFuncionalidades", usuarioId)); } catch (Exception ex) { throw; } }
public int darAltaPrecioPorCategoria(decimal precio, string categoria) { try { int tipoUbicacionId; DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); dt = dao.ObtenerDatosSP("dropeadores.altaTipoUbicacion", categoria, precio); DataRow row = dt.Rows[0]; tipoUbicacionId = int.Parse(row["Id"].ToString()); return(tipoUbicacionId); } catch (Exception ex) { throw ex; } }
public int buscarCodigoCategoria(string categoria) { try { int tipoUbicacionId; DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); dt = dao.ObtenerDatosSP("dropeadores.buscarCodigoTipoUbicacion", categoria); DataRow row = dt.Rows[0]; tipoUbicacionId = int.Parse(row["codigo"].ToString()); return(tipoUbicacionId); } catch (Exception ex) { throw ex; } }
public int getIdByDescripcion(string descripcion) { try { int Id; DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); dt = dao.ObtenerDatosSP("dropeadores.getIdByDescripcion", descripcion); DataRow row = dt.Rows[0]; Id = int.Parse(row["Id"].ToString()); return(Id); } catch (Exception ex) { throw ex; } }
public int altaPublicacion() { try { int id = 0; DaoSP dao = new DaoSP(); DataTable dt = new DataTable(); dt = dao.ObtenerDatosSP("dropeadores.altaPublicacion", descripcion, stock, fechaPublicacion, fechaEspectaculo, direccion, rubroId, gradoId, empresaId, estado); DataRow row = dt.Rows[0]; id = int.Parse(row["Id"].ToString()); return(id); } catch (Exception ex) { throw ex; } }
public Usuario obtenerUsuariosById(int id) { try { DaoSP daoSP = new DaoSP(); DataTable dt; dt = daoSP.ObtenerDatosSP("obtenerUsuarioById", id); return(new Usuario() { nombre = dt.Columns["nombre"].ColumnName, apellido = dt.Columns["apellido"].ColumnName, numDocu = int.Parse(dt.Columns["numDocu"].ColumnName) }); } catch (Exception ex) { throw ex; } }
public Usuario obtenerUsuariosByName(string name) { try { DaoSP daoSP = new DaoSP(); DataTable dt; dt = daoSP.ObtenerDatosSP("obtenerUsuarioByUsername", name); DataRow row = dt.Rows[0]; Usuario u = new Usuario(); return(new Usuario() { username = row["username"].ToString(), password = row["password"].ToString(), cambioPsw = int.Parse(row["cambioPsw"].ToString()), creadoPor = row["creadoPor"].ToString() }); } catch (Exception ex) { throw ex; } }
public int login(Usuario user) { int ret = -4; try { DaoSP daoSP = new DaoSP(); DataTable dt; string userN; string pass; userN = user.username; pass = user.password; dt = daoSP.ObtenerDatosSP("dropeadores.login", userN, pass, ret); DataRow row = dt.Rows[0]; ret = int.Parse(row["ret"].ToString()); return(ret); } catch (Exception ex) { return(ret); } }
public void queryComprar() { DaoSP tj = new DaoSP(); DataTable dt = new DataTable(); Ubicacion ubic = new Ubicacion(); string tipoDoc = ""; int nroDoc = 0; dt = tj.ConsultarConQuery("select c.TipoDocumento as 'TIPO DOCUMENTO', c.NumeroDocumento as 'NUMERO DOCUMENTO' from dropeadores.Cliente c join dropeadores.Usuario u on (u.clienteId=c.NumeroDocumento) where c.NumeroDocumento=" + usuario.cliente.numeroDocumento); foreach (DataRow row in dt.Rows) { tipoDoc = Convert.ToString(row["TIPO DOCUMENTO"]); nroDoc = Convert.ToInt32(row["NUMERO DOCUMENTO"]); } int cantidadUbicacionesCompradas = ubicacionesSeleccionadas.Count; DaoSP dao = new DaoSP(); foreach (DataGridViewRow row in dataGridViewCompra.Rows) { ubic.fila = Convert.ToChar(row.Cells[0].Value.ToString()); ubic.asiento = Convert.ToInt32(row.Cells[1].Value.ToString()); ubic.publicacionId = Convert.ToInt32(row.Cells[5].Value.ToString()); // dt = dao.ObtenerDatosSP("dropeadores.updateUbicacion", ubic.publicacionId, ubic.fila, ubic.asiento); if (dao.EjecutarSP("dropeadores.updateUbicacion", ubic.publicacionId, ubic.fila, ubic.asiento) > 0) { if (dao.EjecutarSP("dropeadores.InsertCompra", tipoDoc, nroDoc, fech.getFechaSistema(), IDtarjeta, cantidadUbicacionesCompradas, lblImporte.Text, ubic.fila, ubic.asiento, ubic.publicacionId) > 0) { dt = dao.ObtenerDatosSP("dropeadores.obtenerIDcompra"); DataRow row2 = dt.Rows[0]; int IDcompra = int.Parse(row2["Id"].ToString()); calcularPuntos(IDcompra); dt = tj.ObtenerDatosSP("dropeadores.updatePuntos", usuario.cliente.numeroDocumento); MessageBox.Show("La compra fue realizada con éxito"); } } } }