private void btnAceptar_Click(object sender, EventArgs e) { if (this.ValidarInputs()) { double precioOferta, precioLista; double.TryParse(inputPrecioOferta.Text, out precioOferta); double.TryParse(inputPrecioLista.Text, out precioLista); try { new RepositorioOfertas().Guardar( dateTimePickerFechaPublicacion.Value, dateTimePickerFechaVencimiento.Value, precioOferta, precioLista, Int32.Parse(inputStockDisponible.Text), Int32.Parse(inputMaxUnidadesPorCliente.Text), inputCodigo.Text, inputDescripcion.Text, idProveedor ); MessageBoxUtil.ShowInfo("La oferta fue guardada exitosamente"); NavigableFormUtil.BackwardTo(this, previousForm); } catch (SqlException ex) { MessageBoxUtil.ShowError(ex.Message); } } }
private void dgvClientes_CellContentClick(object sender, DataGridViewCellEventArgs e) { string nombre = dgvClientes.CurrentRow.Cells[0].Value.ToString(); string apellido = dgvClientes.CurrentRow.Cells[1].Value.ToString(); int idCliente = Int32.Parse(dgvClientes.CurrentRow.Cells["id_cliente"].Value.ToString()); string DNI = dgvClientes.CurrentRow.Cells[2].Value.ToString(); if (MessageBox.Show("¿Desea canjear la oferta para el cliente " + nombre + " " + apellido + " ?", "Atención", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { StoredProcedureParameters param = new StoredProcedureParameters() .AddParameter("@id_proveedor", new RepositorioProveedores().ObtenerIdProveedorDeUsuario(Session.Instance.IdUsuario)) .AddParameter("@id_cliente", idCliente) .AddParameter("@fecha_actual", DateTime.Parse(ConfigurationManager.AppSettings["FechaSistema"])) .AddParameter("@id_compra", idCompra); try { new Conexion().ExecDataTableStoredProcedure(StoredProcedures.CanjearCompra, param); MessageBoxUtil.ShowInfo("Compra canjeada exitosamente"); previousForm.LlenarTablaOfertas(); NavigableFormUtil.BackwardToDifferentWindow(this, previousForm); } catch (Exception ex) { MessageBoxUtil.ShowError(ex.Message); } } }
private void dgvEmpresas_CellContentClick(object sender, DataGridViewCellEventArgs e) { string razon_social = dgvEmpresas.CurrentRow.Cells[0].Value.ToString(); string mail = dgvEmpresas.CurrentRow.Cells[1].Value.ToString(); string telefono = dgvEmpresas.CurrentRow.Cells[2].Value.ToString(); string calle = dgvEmpresas.CurrentRow.Cells[3].Value.ToString(); string nro_calle = dgvEmpresas.CurrentRow.Cells[4].Value.ToString(); string depto = dgvEmpresas.CurrentRow.Cells[5].Value.ToString(); string localidad = dgvEmpresas.CurrentRow.Cells[6].Value.ToString(); string codigo_postal = dgvEmpresas.CurrentRow.Cells[7].Value.ToString(); string ciudad = dgvEmpresas.CurrentRow.Cells[8].Value.ToString(); string ciut = dgvEmpresas.CurrentRow.Cells[9].Value.ToString(); string username = dgvEmpresas.CurrentRow.Cells[10].Value.ToString(); bool habilitada = ConnectionFactory.Instance() .CreateConnection() .ExecuteSingleOutputSqlQuery <bool>(@"SELECT habilitado FROM LOS_DE_GESTION.Usuario WHERE username="******"'" + username + "'"); NavigableFormUtil.ForwardTo(this, new ModificacionEmpresa(razon_social, mail, telefono, calle, nro_calle, depto, localidad, codigo_postal, ciudad, ciut, username, habilitada, this)); }
private void btnModificar_Click(object sender, EventArgs e) { if (cmbModificacion.SelectedItem == null) { MessageBoxUtil.ShowError("Seleccione un grado de publicación."); } else { if (txtDescripcion.Text == "") { MessageBoxUtil.ShowInfo("Complete el campo descripcion."); } else { try { decimal idGradoSeleccionado = ((ComboBoxItem <decimal>)cmbModificacion.SelectedItem).Value; GradoDePublicacion grado = new GradoDePublicacion(idGradoSeleccionado, txtDescripcion.Text, nudPorcentaje.Value); gradoRepository.ModificarGradoDePublicacion(grado); MessageBoxUtil.ShowInfo("Grado de publicación modificado correctamente."); NavigableFormUtil.BackwardTo(this, callerForm); } catch (StoredProcedureException ex) { MessageBoxUtil.ShowError(ex.Message); } } } }
private void btnListProvMayorFact_Click(object sender, EventArgs e) { int indiceSemestre = nroSemestre.SelectedIndex;//indice seleccionado if (indiceSemestre != -1) { int semestre = Convert.ToInt32(nroSemestre.Items[indiceSemestre].ToString()); int indiceAño = selectAño.SelectedIndex; if (indiceAño != -1) { int año = Convert.ToInt32(selectAño.Items[indiceAño].ToString()); NavigableFormUtil.ForwardToDifferentWindow(this, new ListadoProMayorFact(this, semestre, año)); } else { MessageBoxUtil.ShowError("Seleccione un año"); } } else { MessageBoxUtil.ShowError("Seleccione un año"); } }
public void Do(System.Windows.Forms.Form from) { closeable.Dispose(); closeable.Close(); NavigableFormUtil.BackwardTo(from, new LoginForm()); }
private void dgvRoles_CellContentClick(object sender, DataGridViewCellEventArgs e) { int idRol = int.Parse(dgvRoles.CurrentRow.Cells["id_rol"].Value.ToString()); string nombre = dgvRoles.CurrentRow.Cells["nombre"].Value.ToString(); bool habilitado = bool.Parse(dgvRoles.CurrentRow.Cells["habilitado"].Value.ToString()); NavigableFormUtil.ForwardToDifferentWindow(this, new FormModificacionRol(this, idRol, nombre, habilitado)); }
private void gridProveedores_CellContentClick(object sender, DataGridViewCellEventArgs e) { int idProveedor = Int32.Parse(gridProveedores.CurrentRow.Cells[0].Value.ToString()); Console.WriteLine(idProveedor); NavigableFormUtil.ForwardTo(this, new CrearOferta(previousForm, idProveedor)); }
private void btnAceptar_Click(object sender, EventArgs e) { if (this.ValidarTarjeta()) { clienteRepository.AsociarTarjeta(txtNroTarjeta.Text, Session.Instance().LoggedUsername); MessageBoxUtil.ShowInfo("Tarjeta asociada correctamente. Intente hacer la compra nuevamente."); NavigableFormUtil.BackwardTo(this, callerForm); } }
private bool TieneTarjeta() { if (!clienteRepository.ClienteTieneTarjeta(Session.Instance().LoggedUsername)) { MessageBoxUtil.ShowError("No se puede realizar la compra, no tiene una tarjeta asociada."); NavigableFormUtil.ForwardTo(this, new AsociarTarjeta(this)); return(false); } return(true); }
private void btnSeleccionar_Click(object sender, EventArgs e) { try { string codigoPublicacion = dgvResultados.SelectedRows[0].Cells[0].Value.ToString(); NavigableFormUtil.ForwardTo(this, new UbicacionesForm(this, codigoPublicacion)); } catch (ArgumentOutOfRangeException) { MessageBoxUtil.ShowError("Seleccione una fila válida."); } }
private void btnModificarPassword_Click(object sender, EventArgs e) { if (this.ValidarPasswordNoVacio()) { if (this.ValidarPasswordNuevo()) { this.CambiarPassword(idUsuarioAModificar, txtNuevoPassword.Text); MessageBoxUtil.ShowInfo("Contraseña modificada correctamente. Acceda nuevamente."); NavigableFormUtil.BackwardTo(this, new Login.Login()); } } }
private void btnAceptar_Click(object sender, EventArgs e) { if (cmbFuncionalidades.SelectedItem == null) { MessageBoxUtil.ShowError("Seleccione una funcionalidad"); } else { int funcionalidadId = ((ComboBoxItem <int>)cmbFuncionalidades.SelectedItem).Value; NavigableFormUtil.ForwardTo(this, GetSelectedForm(funcionalidadId)); } }
private void btnAceptar_Click(object sender, EventArgs e) { if (cmbFuncionalidades.SelectedItem == null) { MessageBoxUtil.ShowError("Seleccione una funcionalidad."); } else { decimal selectedItemId = ((ComboBoxItem <decimal>)cmbFuncionalidades.SelectedItem).Value; NavigableFormUtil.ForwardTo(this, PostLoginFormFactory.CreateForm(selectedItemId, this)); } }
private void btnEditar_Click(object sender, EventArgs e) { if (dgvPublicaciones.SelectedRows.Count == 0) { MessageBox.Show("Por favor seleccione una fila"); } else { NavigableFormUtil.ForwardTo(this, new EditarPublicacionSeleccionada( decimal.Parse(dgvPublicaciones.SelectedRows[0].Cells[0].Value.ToString()), this) ); } }
private void btnAceptar_Click(object sender, EventArgs e) { if (this.validarUseryPass()) { if (this.comboUserType.Text.Equals("Cliente")) { NavigableFormUtil.ForwardTo(this, new RegistroAltaCliente(this, txtUserName.Text, txtUserPass.Text)); } else if (this.comboUserType.Text.Equals("Proveedor")) { NavigableFormUtil.ForwardTo(this, new RegistroAltaProveedor(this, txtUserName.Text, txtUserPass.Text)); } } }
private void btnComprar_Click(object sender, EventArgs e) { if (this.ValidarSeleccionDeUbicaciones() && this.TieneTarjeta()) { clienteRepository.ValidarVencimientoDePuntosDeCliente(Session.Instance().LoggedUsername); IList <decimal> idsUbicaciones = this.IdsSeleccionados(); decimal idCompra = compraRepository.GenerarCompra(this.CrearCompra(), this.CalcularPuntosGanados()); ubicacionRepository.ActualizarUbicacionesCompradas(idCompra, idsUbicaciones); MessageBoxUtil.ShowInfo("Compra realizada correctamente."); NavigableFormUtil.BackwardTo(this, callerForm); } }
private void btnGuardar_Click(object sender, EventArgs e) { StoredProcedureParameters inputParameters = new StoredProcedureParameters() .AddParameter("id_rol", idRol) .AddParameter("nombre", inputNombre.Text) .AddParameter("habilitado", checkBoxHabilitado.Checked); try { new Conexion().ExecStoredProcedure(StoredProcedures.ModificarRol, inputParameters); MessageBoxUtil.ShowInfo("Rol modificado correctamente"); previousForm.LlenarGrilla(); NavigableFormUtil.BackwardTo(this, previousForm); } catch (SqlException ex) { MessageBoxUtil.ShowError(ex.Message); } }
private void grillaClientes_CellContentClick(object sender, DataGridViewCellEventArgs e) { string nombre = grillaClientes.CurrentRow.Cells[0].Value.ToString(); string apellido = grillaClientes.CurrentRow.Cells[1].Value.ToString(); string dni = grillaClientes.CurrentRow.Cells[2].Value.ToString(); string mail = grillaClientes.CurrentRow.Cells[3].Value.ToString(); string telefono = grillaClientes.CurrentRow.Cells[4].Value.ToString(); string direccion = grillaClientes.CurrentRow.Cells[5].Value.ToString(); string piso = grillaClientes.CurrentRow.Cells[6].Value.ToString(); string dpto = grillaClientes.CurrentRow.Cells[7].Value.ToString(); string localidad = grillaClientes.CurrentRow.Cells[8].Value.ToString(); string codigoPostal = grillaClientes.CurrentRow.Cells[9].Value.ToString(); DateTime fechaNac = DateTime.Parse(grillaClientes.CurrentRow.Cells[10].Value.ToString()); NavigableFormUtil.ForwardToDifferentWindow(this, new FormModificacion(this, nombre, apellido, dni, mail, telefono, direccion, piso, dpto, localidad, codigoPostal, fechaNac)); }
private void btnAceptar_Click(object sender, EventArgs e) { if (this.ValidarInputs()) { try { new RepositorioTarjetas().Guardar(cmbTipoTarjeta.Text, inputCodigo.Text); previousForm.VolverACargarTarjetas(); NavigableFormUtil.BackwardToDifferentWindow(this, previousForm); } catch (SqlException ex) { MessageBoxUtil.ShowError(ex.Message); } } }
private void btnModificarPassword_Click(object sender, EventArgs e) { if (this.ValidarPasswordNoVacio()) { if (this.ValidarPasswordNuevo()) { usuarioRepository.CambiarPassword(usuarioAModificar, txtNuevoPassword.Text); if (usuarioRepository.EsUsuarioMigrado(usuarioAModificar)) { usuarioRepository.ActualizarUsuarioMigrado(usuarioAModificar); } // Session.Instance().CloseSession(); MessageBoxUtil.ShowInfo("Contraseña modificada correctamente. Acceda nuevamente."); NavigableFormUtil.BackwardTo(this, new Login.LoginForm()); } } }
private void dgvClientes_CellContentClick(object sender, DataGridViewCellEventArgs e) { string username = dgvClientes.CurrentRow.Cells[0].Value.ToString(); string nombre = dgvClientes.CurrentRow.Cells[1].Value.ToString(); string apellido = dgvClientes.CurrentRow.Cells[2].Value.ToString(); string tipo_documento = dgvClientes.CurrentRow.Cells[3].Value.ToString(); string nro_documento = dgvClientes.CurrentRow.Cells[4].Value.ToString(); string CUIL = dgvClientes.CurrentRow.Cells[5].Value.ToString(); string mail = dgvClientes.CurrentRow.Cells[6].Value.ToString(); string telefono = dgvClientes.CurrentRow.Cells[7].Value.ToString(); string calle = dgvClientes.CurrentRow.Cells[8].Value.ToString(); string nro_calle = dgvClientes.CurrentRow.Cells[9].Value.ToString(); string nro_piso = dgvClientes.CurrentRow.Cells[10].Value.ToString(); string depto = dgvClientes.CurrentRow.Cells[11].Value.ToString(); string localidad = dgvClientes.CurrentRow.Cells[12].Value.ToString(); string codigo_postal = dgvClientes.CurrentRow.Cells[13].Value.ToString(); string fecha_nacimiento = dgvClientes.CurrentRow.Cells[14].Value.ToString(); string fecha_creacion = dgvClientes.CurrentRow.Cells[15].Value.ToString(); string tarjeta = dgvClientes.CurrentRow.Cells[16].Value.ToString(); bool habilitado = ConnectionFactory.Instance() .CreateConnection() .ExecuteSingleOutputSqlQuery <bool>(@"SELECT habilitado FROM LOS_DE_GESTION.Usuario WHERE username ="******"'" + username + "'"); NavigableFormUtil.ForwardTo(this, new ModificacionCliente(habilitado, username, nombre, apellido, tipo_documento, nro_documento, CUIL, mail, telefono, calle, nro_calle, nro_piso, depto, localidad, codigo_postal, fecha_nacimiento, fecha_creacion, tarjeta, this)); }
private void button1_Click(object sender, EventArgs e) { string selectedRol = cbRol.Text; IdRol = ConnectionFactory.Instance().CreateConnection().ExecuteSingleOutputSqlQuery <decimal>(@"SELECT id_Rol FROM LOS_DE_GESTION.Rol WHERE nombre=" + "'" + selectedRol + "'"); //Si es una modificacion ir a la pantalla modificacion if (Option == 1) { NavigableFormUtil.ForwardTo(this, new ModificacionRol(IdRol, this)); } //Si no ir a la pantalla de baja else { NavigableFormUtil.ForwardTo(this, new ABMRol.BajaRolForm(this, IdRol)); } }
private void btnAceptar_Click(object sender, EventArgs e) { if (this.ValidarInputs()) { try { int idTarjeta = cmbTarjeta.SelectedItem != null ? ((ComboBoxItem <int>)cmbTarjeta.SelectedItem).Value : -1; new RepositorioCargas().Guardar(Int32.Parse(inputMonto.Text), cmbTipoPago.Text, idTarjeta); MessageBoxUtil.ShowInfo("La carga fue exitosa"); NavigableFormUtil.BackwardTo(this, previousForm); } catch (SqlException ex) { MessageBoxUtil.ShowError(ex.Message); } } }
private void grillaProveedores_CellContentClick(object sender, DataGridViewCellEventArgs e) { string mail = grillaProveedores.CurrentRow.Cells["mail"].Value.ToString(); int idProveedor = int.Parse(grillaProveedores.CurrentRow.Cells["id_proveedor"].Value.ToString()); decimal telefono = decimal.Parse(grillaProveedores.CurrentRow.Cells["telefono"].Value.ToString()); string cuit = grillaProveedores.CurrentRow.Cells["cuit"].Value.ToString(); string direccion = grillaProveedores.CurrentRow.Cells["direccion"].Value.ToString(); string piso = grillaProveedores.CurrentRow.Cells["piso"].Value.ToString(); string dpto = grillaProveedores.CurrentRow.Cells["departamento"].Value.ToString(); string localidad = grillaProveedores.CurrentRow.Cells["localidad"].Value.ToString(); string ciudad = grillaProveedores.CurrentRow.Cells["ciudad"].Value.ToString(); string codigoPostal = grillaProveedores.CurrentRow.Cells["codigo_postal"].Value.ToString(); string razonSocial = grillaProveedores.CurrentRow.Cells["razon_social"].Value.ToString(); string rubro = grillaProveedores.CurrentRow.Cells["rubro"].Value.ToString(); string nombreContacto = grillaProveedores.CurrentRow.Cells["nombre_contacto"].Value.ToString(); NavigableFormUtil.ForwardToDifferentWindow(this, new FormModificacion(this, idProveedor, mail, telefono, cuit, direccion, piso, dpto, localidad, ciudad, codigoPostal, razonSocial, rubro, nombreContacto)); }
private void btnAceptar_Click(object sender, EventArgs e) { if (!TextFieldUtils.IsAnyFieldEmpty(this)) { StoredProcedureParameterMap inputParameters = new StoredProcedureParameterMap(); inputParameters.AddParameter("@id_Rol", IdRol); inputParameters.AddParameter("@nombreRolNuevo", tbNombreNuevo.Text); try { ConnectionFactory.Instance() .CreateConnection() .ExecuteDataTableStoredProcedure(SpNames.ModificarRol, inputParameters); MessageBox.Show("Nombre del rol modificado exitosamente!"); NavigableFormUtil.BackwardTo(this, CallerForm); } catch (StoredProcedureException ex) { MessageBox.Show(ex.Message); } } }
private void dgvUsuarios_CellContentClick(object sender, DataGridViewCellEventArgs e) { int idUsuario = int.Parse(dgvUsuarios.CurrentRow.Cells["id_usuario"].Value.ToString()); bool habilitado = bool.Parse(dgvUsuarios.CurrentRow.Cells["habilitado"].Value.ToString()); string username = dgvUsuarios.CurrentRow.Cells["username"].Value.ToString(); if (MessageBox.Show("¿Desea modificar la contraseña del usuario " + username + " ?", "Atención", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { if (!habilitado) { MessageBoxUtil.ShowError("El usuario ya se encontraba deshabilitado"); } else { NavigableFormUtil.ForwardTo(this, new ModificarPasswordUsuario(idUsuario, this)); } } }
private void btnSiguiente_Click(object sender, EventArgs e) { if (controlValidator.Validate()) { decimal selectedRolId = ((ComboBoxItem <decimal>)cmbRoles.SelectedItem).Value; Usuario newUser = UsuarioFactory.CrearNuevoUsuario(selectedRolId, txtUsername.Text, txtPassword.Text); try { IAccionPostCreacionUsuario accionPostCreacion = new VolverALogin(this); NavigableFormUtil.ForwardTo(this, ABMClienteEmpresaFormFactory.CrearForm(selectedRolId, this, newUser, accionPostCreacion)); } catch (StoredProcedureException ex) { MessageBoxUtil.ShowError(ex.Message); } } }
private void btnAgregar_Click(object sender, EventArgs e) { if (!TextFieldUtils.IsAnyFieldEmpty(this)) { IdRol = ConnectionFactory.Instance().CreateConnection().ExecuteSingleOutputSqlQuery <decimal>("SELECT TOP 1 (id_Rol+1) FROM LOS_DE_GESTION.Rol ORDER BY id_Rol DESC "); StoredProcedureParameterMap inputParameters = new StoredProcedureParameterMap(); inputParameters.AddParameter("@nombreRol", tbRolNombre.Text); inputParameters.AddParameter("@id_rol", IdRol); inputParameters.AddParameter("@habilitado", cbHabilitado.Checked); try { ConnectionFactory.Instance() .CreateConnection() .ExecuteDataTableStoredProcedure(SpNames.AltaRol, inputParameters); inputParameters.RemoveParameters(); foreach (DataGridViewCell c in dgvFuncionalidades.SelectedCells) { inputParameters.AddParameter("@id_Rol", IdRol); decimal id_funcionalidad = ConnectionFactory.Instance() .CreateConnection() .ExecuteSingleOutputSqlQuery <decimal>(@"SELECT id_Funcionalidad FROM LOS_DE_GESTION.Funcionalidad WHERE nombre=" + "'" + c.Value.ToString() + "'"); inputParameters.AddParameter("@funcionalidadRol", id_funcionalidad); ConnectionFactory.Instance() .CreateConnection() .ExecuteDataTableStoredProcedure(SpNames.AgregarFuncionalidadRol, inputParameters); inputParameters.RemoveParameters(); } MessageBox.Show("Rol dado de alta correctamente!"); NavigableFormUtil.BackwardTo(this, CallerForm); } catch (StoredProcedureException ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Por favor rellena todos los campos"); } }
private void btnLogin_Click(object sender, EventArgs e) { RepositorioUsuarios repositorioUsuarios = new RepositorioUsuarios(); RepositorioRoles repositorioRoles = new RepositorioRoles(); try { int idUsuario = repositorioUsuarios.ObtenerIdUsuarioAPartirDeCredenciales(inputUsername.Text, inputPassword.Text); Session.Instance.OpenSession(idUsuario); IList <Rol> rolesUsuario = repositorioRoles.ObtenerRolesDeUsuario(idUsuario); NavigableFormUtil.ForwardTo(this, new SeleccionarFuncionalidad.SeleccionarFuncionalidad(this, rolesUsuario)); } catch (SqlException ex) { MessageBoxUtil.ShowError(ex.Message); } }