protected void desbloquearLinkButton_Click(object sender, EventArgs e) { var usuarioID = ((LinkButton)sender).CommandArgument; AdministradorBLL.DesbloquearUsuario(int.Parse(usuarioID)); //Limpar Tabela MotivoBloqueio CarregarRepeaters(); }
public ActionResult Edit([Bind(Include = "idpelicula,nombre,fecha,duracion,Categoria")] Administrador administrador) { if (ModelState.IsValid) { AdministradorBLL.Update(administrador); return(RedirectToAction("Index")); } return(View(administrador)); }
public IHttpActionResult getAlmacenesList(string id) { var adminList = new AdministradorBLL().getAlmacenAdmin(id); var invercionistaList = new InvercionistaBLL().getAlmacenInv(id); return(Ok(new Entidades.DTO.Almacen.AlmacenListDTO() { inversiones = invercionistaList, admin = adminList })); }
// GET: Administrador/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Administrador administrador = AdministradorBLL.Get(id); if (administrador == null) { return(HttpNotFound()); } return(View(administrador)); }
private void CarregarRepeaters() { //Publicações denuncidas publicacoesDenunciadasRepeater.DataSource = AdministradorBLL.ListaPublicacoesDenunciadas(); publicacoesDenunciadasRepeater.DataBind(); //Usuarios bloqueados usuariosBloqueadosRepeater.DataSource = UsuarioBLL.ListarUsuariosBloqueados(); usuariosBloqueadosRepeater.DataBind(); // solicitacoesRepeater.DataSource = AdministradorBLL.ListarCadastroAtuacao(); solicitacoesRepeater.DataBind(); }
protected void btn_Login_Click(object sender, EventArgs e) { try { if (Page.IsValid) { if (ValidarCampos()) { string email = txtEmail.Text; string senha = txtSenha.Text; if (email.Contains("@upartner.com.br")) { Administrador administrador = AdministradorBLL.Login(email, senha); Session.Add("Administrador", administrador); Response.Redirect("~/Views/Adm/Menu.aspx", false); } else { Usuario usuario = UsuarioBLL.Login(email, senha); if (usuario.FlagBloqueado) { throw new ArgumentException("BLOQUEADO"); } else if (usuario.Usuario_ID == 0) { throw new ArgumentException("INVALIDOS"); } else { Session.Add("Usuario", usuario); Response.Redirect("~/Views/Index/Index.aspx", false); } } } } } catch (Exception ex) { if (ex.Message.ToUpper().Trim() == "BLOQUEADO") { Page.ClientScript.RegisterStartupScript(this.GetType(), "MyKey", "erroLogin(1);", true); } else if (ex.Message.ToUpper().Trim() == "INVALIDOS") { Page.ClientScript.RegisterStartupScript(this.GetType(), "MyKey", "erroLogin(2);", true); } } }
protected void ButtonRegistro_Click(object sender, EventArgs e) { UsuarioBLL usuarioBLL = new UsuarioBLL(); AdministradorBLL administradorBLL = new AdministradorBLL(); int contador = 0; try { if (contador <= 1) { usuario = new Usuario(); usuario.NombreUsuario = InputNombreR.Text; usuario.Email = InputEmailR.Text; usuario.Contrasenia = InputPasswordR.Text; usuario.EstadoConexion = "Conectado"; usuario.Estado = true; usuario.Rol = 'A'; usuarioBLL.agregarUsuario(usuario); administrador = new Administrador(); administrador.Estado = true; administradorBLL.agregarAdmin(administrador); contador++; Session["Registro"] = "SI"; Response.Redirect("Default.aspx"); ///NO OLVIDAR PONER A QUÉ PÁGINA DIRECCIONAR } else { Session["ErrorRegistro"] = "Error al registrarse"; Response.Redirect("Error.aspx"); contador = 0; } } catch (ThreadAbortException ex1) { ///SIEMPRE PONER ESTE CATCH EN CASO DE IR AL CATCH DE ABAJO/// } catch (Exception ex) { Session["ErrorRegistro"] = "Error al registrarse"; Response.Redirect("Error.aspx"); contador = 0; } }
protected void btn_Salvar_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(nomeTextBox.Text) || String.IsNullOrEmpty(sobrenomeTextBox.Text) || String.IsNullOrEmpty(emailTextBox.Text) || String.IsNullOrEmpty(senhaTextBox.Text) || String.IsNullOrEmpty(dataNascTextBox.Text)) { //Page.ClientScript.RegisterStartupScript(this.GetType(), "MyKey", "validacao();", true); } else { if (repetirSenhaTextBox.Text != senhaTextBox.Text) { throw new ArgumentException(); } if (ControleUtil.ValidarMaiorIdade(DateTime.Parse(dataNascTextBox.Text))) //criar metodo para validar menor de idade { throw new ArgumentException(); } if (Page.IsValid) { Administrador usuario = new Administrador(); usuario.Nome = nomeTextBox.Text; usuario.Sobrenome = sobrenomeTextBox.Text; usuario.Email = emailTextBox.Text; usuario.Senha = ControleUtil.GetMd5Hash(senhaTextBox.Text); usuario.DataNascimento = DateTime.Parse(dataNascTextBox.Text); usuario.DataCadastro = DateTime.Now; AdministradorBLL.InserirAdministrador(usuario); //Page.ClientScript.RegisterStartupScript(this.GetType(), "MyKey", "sucessoCadastro();", true); } } } catch (Exception) { throw; } }
public void insertarRegistro() { if (tipoPersona >= 0) { persona = new Persona(); persona.txtNit = txtNit.Text; persona.txtNombreCompleto = txtNombre.Text; persona.txtDireccion = txtDireccion.Text; persona.txtTelefono = txtTelefono.Text; persona.txtCelular = txtCelular.Text; persona.txtCorreo = txtCorreo.Text; persona.intIdUsuairo = IdUsuario.IdUsuarioConectado; if (tipoPersona == 0) { cliente = new Cliente(); if (tipoInsercion == 0) { cliente.fkPersona = PersonaBLL.InsertObjetoPersona(persona); cliente.fkParametroCliente = Convert.ToInt32(boxTipoCliente.SelectedValue); ClienteBLL.InsertObjetoCliente(cliente); MessageBox.Show("El registro se agrego correctamente"); this.borrarDatos(); } if (tipoInsercion == 1) { persona.pkPersona = Convert.ToInt32(txtFkPersonas.Text); PersonaBLL.UpdatePersona(persona); cliente.fkPersona = Convert.ToInt32(txtFkPersonas.Text); cliente.fkParametroCliente = Convert.ToInt32(boxTipoCliente.SelectedValue); ClienteBLL.UpdateCliente(cliente); MessageBox.Show("El registro se ha actualizado correctamente"); frmClientes frm = new frmClientes(); frm.MdiParent = this.MdiParent; frm.WindowState = FormWindowState.Maximized; frm.Show(); this.Dispose(); } } if (tipoPersona == 1) { empleado = new Empleado(); if (tipoInsercion == 0) { if (validacion.nulos(txtPassword)) { empleado.fkPersona = PersonaBLL.InsertObjetoPersona(persona); empleado.txtContraseña = txtPassword.Text; EmpleadoBLL.InsertObjetoEmpleado(empleado); MessageBox.Show("El registro se agrego correctamente"); this.borrarDatos(); } else { MessageBox.Show("Usted no ha ingresado una contrasena"); } } if (tipoInsercion == 1) { if (validacion.nulos(txtPassword)) { persona.pkPersona = Convert.ToInt32(txtFkPersonas.Text); PersonaBLL.UpdatePersona(persona); empleado.fkPersona = Convert.ToInt32(txtFkPersonas.Text); empleado.txtContraseña = txtPassword.Text; EmpleadoBLL.UpdateEmpleado(empleado); MessageBox.Show("El registro se ha actualizado correctamente"); frmEmpleados frm = new frmEmpleados(); frm.MdiParent = this.MdiParent; frm.WindowState = FormWindowState.Maximized; frm.Show(); this.Close(); } else { MessageBox.Show("Usted no ha ingresado una contrasena"); } } } if (tipoPersona == 2) { proveedor = new Proveedor(); if (tipoInsercion == 0) { if (validacion.nulos(txtDescripcion)) { proveedor.fkPersona = PersonaBLL.InsertObjetoPersona(persona); proveedor.txtDescripcion = TxtDescripcion.Text; ProveedorBLL.InsertObjetoProveedor(proveedor); MessageBox.Show("El registro se agrego correctamente"); this.borrarDatos(); } else { MessageBox.Show("Usted no ha ingresado una descripcion"); } } if (tipoInsercion == 1) { if (validacion.nulos(txtDescripcion)) { persona.pkPersona = Convert.ToInt32(txtFkPersonas.Text); PersonaBLL.UpdatePersona(persona); proveedor.fkPersona = Convert.ToInt32(txtFkPersonas.Text); proveedor.txtDescripcion = TxtDescripcion.Text; ProveedorBLL.UpdateProveedor(proveedor); MessageBox.Show("El registro se ha actualizado correctamente"); frmProveedores frm = new frmProveedores(); frm.MdiParent = this.MdiParent; frm.WindowState = FormWindowState.Maximized; frm.Show(); this.Close(); } else { MessageBox.Show("Usted no ha ingresado una descripcion"); } } } if (tipoPersona == 3) { administrador = new Administrador(); if (tipoInsercion == 0) { if (validacion.nulos(txtPassword)) { administrador.fkPersona = PersonaBLL.InsertObjetoPersona(persona); administrador.txtContraseña = txtPassword.Text; AdministradorBLL.InsertObjetoAdministrador(administrador); MessageBox.Show("El registro se agrego correctamente"); this.borrarDatos(); } else { MessageBox.Show("Usted no ha ingresado una contrasena"); } } if (tipoInsercion == 1) { if (validacion.nulos(txtPassword)) { persona.pkPersona = Convert.ToInt32(txtFkPersonas.Text); PersonaBLL.UpdatePersona(persona); administrador.fkPersona = Convert.ToInt32(txtFkPersonas.Text); administrador.txtContraseña = txtPassword.Text; AdministradorBLL.UpdateAdministrador(administrador); MessageBox.Show("El registro se ha actualizado correctamente"); frmEmpleados frm = new frmEmpleados(); frm.MdiParent = this.MdiParent; frm.WindowState = FormWindowState.Maximized; frm.Show(); this.Close(); } else { MessageBox.Show("Usted no ha ingresado una contrasena"); } } } } else { MessageBox.Show("Usted no ha seleccionado el tipo de persona"); } }
private static void Main(string[] args) { //#region REGISTO_LISTAGEM //#region ADMINISTRADOR AdministradorBO a1 = new AdministradorBO(AdministradorBLL.NovoIdAdministradorBLL(), "José Loureiro", "219182191", new DateTime(1999, 1, 26), "964309966", "*****@*****.**", ENUM_NIVEL_ACESSO.Administrador, true); AdministradorBLL.RegistarAdmistradorBLL(a1); //AdministradorBO a2 = new AdministradorBO(AdministradorBLL.NovoIdAdministradorBLL(), // "Carlos Loureiro", // "119482191", // new DateTime(1912, 11, 6), // "964303826", // "cl99mail.com", // ENUM_NIVEL_ACESSO.Administrador, // true); //AdministradorBLL.RegistarAdmistradorBLL(a2); //AdministradorBO a3 = new AdministradorBO(AdministradorBLL.NovoIdAdministradorBLL(), // "Luis Loureiro", // "219182191", // new DateTime(1999, 1, 26), // "964309966", // "*****@*****.**", // ENUM_NIVEL_ACESSO.Administrador, // true); //AdministradorBLL.RegistarAdmistradorBLL(a3); //AdministradorBLL.ListagemAdministradoresBLL(a1); //#endregion ADMINISTRADOR //#region GERENTE GerenteBO g1 = new GerenteBO(GerenteOperacionalBLL.DevolveNovoIdGerenteBLL(), "Luis Silva", "219182191", new DateTime(1942, 5, 15), "914312966", "*****@*****.**", ENUM_NIVEL_ACESSO.GerenteOperacional, true); GerenteOperacionalBLL.RegistaGerenteBLL(g1, a1); GerenteOperacionalBLL.ListagemGerentesBLL(a1); //#endregion GERENTE //#region VEICULO //VeiculoBO carro = new VeiculoBO("12-12-BN", "bmw", "preto", VeiculoBO.ENUM_ESTADO_VEICULO.disponivel); //VeiculoBO carro2 = new VeiculoBO("02-27-99", "opel", "azul", VeiculoBO.ENUM_ESTADO_VEICULO.disponivel); //VeiculoBO carro3 = new VeiculoBO("AA-16-dh", "ferrari", "preto", VeiculoBO.ENUM_ESTADO_VEICULO.disponivel); //FrotaBLL.VeiculoBLL.RegistaVeiculoBLL(carro,1); //FrotaBLL.VeiculoBLL.RegistaVeiculoBLL(carro2, 1); //FrotaBLL.VeiculoBLL.RegistaVeiculoBLL(carro3, 1); VeiculoBLL.ListarFrotaVeiculosBLL(1); //#endregion VEICULO //#region RH //RecursosHumanosBO rh1 = new RecursosHumanosBO(RecursosHumanosBLL.DevolveNovoIdRHBLL(), // "Maria Silva", // "112212112", // new DateTime(1928, 4, 8), // "13212121", // "*****@*****.**", // ENUM_NIVEL_ACESSO.RecursosHumanos, // true); //RecursosHumanosBLL.RegistaRHBLL(rh1, a1); //RecursosHumanosBLL.ListagemRHBLL(a1); //#endregion //#region MOTORISTA //MotoristaBO m1 = new MotoristaBO(new DateTime(2021, 12, 2), // MotoristaBLL.DevolveNovoIdMotorista(), // "Ambrosio Pereira", // "178356172", // new DateTime(1981, 8, 17), // "911727112", // "*****@*****.**", // ENUM_NIVEL_ACESSO.Motorista, // true); //MotoristaBLL.RegistaMotoristaBLL(m1, 1); MotoristaBLL.ListagemMotoristaBLL(1); //#endregion //#endregion //#region ATRIBUICAO //MotoristaBLL.PedirVeiculoBLL(1, "12-12-BN"); //MotoristaBLL.ConsultarMeuPedido(1); //#endregion //GerenteOperacionalBLL.ReverAtribuicaoBLL(1, 1); //MotoristaBLL.ConsultarMeuPedido(1); #region BACKUPS GerenteOperacionalBLL.RestaurarBackupGeral(1); #endregion BACKUPS VeiculoBLL.ListarFrotaVeiculosBLL(1); Console.WriteLine("FIIMMMM"); Console.ReadKey(); }
// GET: Administrador public ActionResult Index() { return(View(AdministradorBLL.list())); }
public ActionResult DeleteConfirmed(int id) { AdministradorBLL.Delete(id); return(RedirectToAction("Index")); }