// GET: Personal public ActionResult personal() { personal personal = new personal() { name = "ali haider" }; return(View(personal)); }
public ActionResult Edit([Bind(Include = "rut_personal,nombre_completo,apellido_paterno,apellido_materno,direccion_personal")] personal personal) { if (ModelState.IsValid) { db.Entry(personal).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(personal)); }
public ActionResult Details(int id = 0) { personal personal = db.personal.Find(id); if (personal == null) { return(HttpNotFound()); } return(PartialView(personal)); }
private void homepage_Load(object sender, EventArgs e) { //窗口变量赋值 organization = new organization(); personal = new personal(); feedback = new feedback(); administrator = new administrator(); help = new help(); changepassword = new changepassword(); }
public string UpdatePersonService(personal person) { if (data.UpdatePerson(person)) { return("Miembro del equipo editado con exitó"); } else { return("Ha ocurrido un error, intentelo de nuevo, más tarde."); } }
public string AddPersonServie(personal person) { if (data.AddPersonal(person)) { return("Nuevo miembro de personal agregado con éxito"); } else { return("Ha ocurrido un error, inténtelo de nuevo, más tarde."); } }
public ActionResult Create([Bind(Include = "rut_personal,nombre_completo,apellido_paterno,apellido_materno,direccion_personal")] personal personal) { if (ModelState.IsValid) { db.personal.Add(personal); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(personal)); }
public bool AddPersonal(personal person) { dbContext.personal.Add(person); if (dbContext.SaveChanges() == 1) { return(true); } else { return(false); } }
public ActionResult Edit(int id) { personal personal = db.personal.Find(id); if (personal == null) { return(RedirectToAction("Create", new { id = id })); } ViewBag.per_id = id; ViewBag.per_lateralidad = per_lateralidad(personal.per_lateralidad); return(PartialView(personal)); }
public ActionResult Create(int id) { //ViewBag.per_id = new SelectList(db.historia, "his_id", "his_motivo"); personal personal = db.personal.Find(id); if (personal != null) { return(RedirectToAction("Edit", new { id = id })); } ViewBag.per_id = id; ViewBag.per_lateralidad = per_lateralidad(); return(PartialView()); }
// GET: personal/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } personal personal = db.personal.Find(id); if (personal == null) { return(HttpNotFound()); } return(View(personal)); }
public bool DeletePerson(int id) { personal person = dbContext.personal.Where(p => p.idpersona == id).FirstOrDefault(); dbContext.personal.Remove(person); if (dbContext.SaveChanges() == 1) { return(true); } else { return(false); } }
public bool UpdatePerson(personal person) { personal personToUpdate = dbContext.personal.Where(p => p.idpersona == person.idpersona).FirstOrDefault(); personToUpdate.nombre = person.nombre; personToUpdate.puesto = person.puesto; personToUpdate.imagen = person.imagen; personToUpdate.descripcion = person.descripcion; if (dbContext.SaveChanges() == 1) { return(true); } else { return(false); } }
personal ObternerDatosUpdatePersonal() { personal personal = new personal(); personal.id_personal = Convert.ToInt32(lblId.Text ?? "0"); personal.Canton_residencia = txtCanton.Text; personal.Correo_institucional = txtCorreoInsti.Text; personal.Correo_personal = txtCorreoConv.Text; personal.Direccion_domiciliaria = txtDireccion.Text; personal.Discapacidad = dropDisca.Text; personal.Edad = Convert.ToInt32(txtEdad.Text ?? "0"); personal.Encontrado = txtEncontrado.Text; personal.Fecha_de_ingreso_al_instituto = dateInsti.Value; personal.Fecha_nacimiento = dropFecNa.Value; personal.Grupo_ocupacional = Convert.ToInt32(txtGrupOp.Text ?? "0" ); personal.Sector_domicilio = txtSector.Text; personal.Numero_celular = txtNumCel.Text; personal.Numero_convencional = txtTeleConv.Text; personal.Parroquia_residencia = txtParroquiaResi.Text; personal.Primer_apellido = txtPrimerAp.Text; personal.Numero_identificacion = txtIdentificacion.Text; personal.Tipo_identificacion = dropTipoIden.Text; personal.Primer_nombre = txtPrimerN.Text; personal.Provincia_nacimiento = txtProvNaci.Text; personal.Provincia_residencia = txtProvResi.Text; personal.Sector_domicilio = txtSector.Text; personal.Segundo_apellido = txtSegundoAp.Text; personal.Segundo_nombre = txtSegundoN.Text; personal.Tipo_discapaciad = txtDiscap.Text; personal.Tipo_sexo = dropSexo.Text; personal.cargo = txtCargo.Text; personal.dominios_info = txtDomInfo.Text; personal.paisNacimiento = txtPaisNac.Text; personal.id_insti = Convert.ToInt32(lblIdInsti.Text ?? "0"); personal.tipo_contrato = txtTipoContr.Text; personal.titulo_profesion = txtTituloPro.Text; personal.disponible_finde = dropDispoFin.Text; personal.motivo = txtMotivo.Text; personal.parti_bachi = dropSerbA.Text; personal.num_veces = txtNumeroVeces.Text; personal.id_jornada = Convert.ToInt32(lblJornada.Text); personal.nivel_forma = txtNivelFormacion.Text; return(personal); }
//AGREGAR PERSONAL A LA BD public long agregarPersonal(string nombre, string apellidos, string sexo, DateTime fechanacimiento, string estadocivil, string domicilio, int codigopostal, long estado, long municipio, long localidad, long colonia, string telefono, string movil, string correo) { using (var bd = new Conexion()) { long id = 1; personal personal = new personal { per_nombre = nombre, per_apellidos = apellidos, per_sexo = sexo, per_fechanacimiento = fechanacimiento, per_estadocivil = estadocivil, per_domicilio = domicilio, per_codigopostal = codigopostal, per_estado = estado, per_municipio = municipio, per_localidad = localidad, per_colonia = colonia, per_movil = movil, per_telefono = telefono, per_correoelectronico = correo }; long consulta = bd.personal.LongCount(); if (consulta == 0) { bd.Database.ExecuteSqlCommand("ALTER TABLE personal AUTO_INCREMENT=1"); } else { long maxVal = bd.personal.Max(p => p.per_id) + 1; id = maxVal; bd.Database.ExecuteSqlCommand("ALTER TABLE personal AUTO_INCREMENT={0}", maxVal); } bd.personal.Add(personal); bd.SaveChanges(); return(id); } }
public ActionResult Create(personal personal) { if (ModelState.IsValid) { db.personal.Add(personal); db.SaveChanges(); paciente paciente = db.paciente.Find(personal.per_id); if (paciente.pac_genero == "Femenino") { return(RedirectToAction("Create", "Ginecologico", new { id = personal.per_id })); } else { return(RedirectToAction("Create", "Habitos", new { id = personal.per_id })); } } ViewBag.per_id = personal.per_id; ViewBag.per_lateralidad = per_lateralidad(personal.per_lateralidad); return(PartialView(personal)); }
public ActionResult Edit(personal personal) { if (ModelState.IsValid) { db.Entry(personal).State = EntityState.Modified; db.SaveChanges(); paciente paciente = db.paciente.Find(personal.per_id); if (paciente.pac_genero == "Femenino") { return(RedirectToAction("Edit", "Ginecologico", new { id = personal.per_id })); } else { return(RedirectToAction("Edit", "Habitos", new { id = personal.per_id })); } //return RedirectToAction("Edit", "Ginecologico", new { id = personal.per_id }); } ViewBag.per_id = personal.per_id; ViewBag.per_lateralidad = per_lateralidad(personal.per_lateralidad); return(PartialView(personal)); }
private void Informacion_Load(object sender, EventArgs e) { try { personal = personalcontroller.personal(id); if (personal != null) { lblNombre.Text = personal.per_nombre + " " + personal.per_apellidos; lblSexo.Text = personal.per_sexo; lblEstadocivil.Text = personal.per_estadocivil; lblFechaNac.Text = personal.per_fechanacimiento.ToShortDateString(); usuarios = menucontroller.datosUsuario(id); if (usuarios != null) { lblTipoCuenta.Text = usuarios.usu_cargo; } fotospersonal = personalcontroller.fotoPersonal(id); if (fotospersonal != null) { byte[] imagenBuffer = fotospersonal.fot_fotoperfil; System.IO.MemoryStream ms = new System.IO.MemoryStream(imagenBuffer); pbxPerfil.Image = Image.FromStream(ms); } } } catch (Exception ex) { MessageBox.Show("Error: " + ex, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtClave_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar == (Char)Keys.Enter) { if (txtClave.Text == "") { MessageBox.Show("¡Introduce la clave de personal!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); txtClave.Focus(); } else { personal = usuarioscontroller.personal(Convert.ToInt64(txtClave.Text)); if (personal != null) { usuarios = usuarioscontroller.usuarios(Convert.ToInt64(txtClave.Text)); if (usuarios != null) { MessageBox.Show("¡Búsqueda exitosa!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); groupBox1.Enabled = false; groupBox3.Enabled = true; txtUsuario.Enabled = false; btnActualizar.Enabled = true; btnEliminar.Enabled = true; btnGuardar.Enabled = false; btnCancelar.Enabled = true; txtUsuario.Enabled = false; txtNombre.Text = personal.per_nombre + " " + personal.per_apellidos; txtSexo.Text = personal.per_sexo; txtFechaNacimiento.Text = personal.per_fechanacimiento.ToShortDateString(); txtEstadoCivil.Text = personal.per_estadocivil; txtMovil.Text = personal.per_movil; txtTelefono.Text = personal.per_telefono; txtCorreo.Text = personal.per_correoelectronico; fotospersonal = usuarioscontroller.fotospersonal(Convert.ToInt64(txtClave.Text)); if (fotospersonal != null) { byte[] fotografia = fotospersonal.fot_fotoperfil; System.IO.MemoryStream ms = new System.IO.MemoryStream(fotografia); pbxPerfil.Image = Image.FromStream(ms); } txtUsuario.Text = usuarios.usu_usuario; txtContrasena.Text = seguridad.Desencriptar(usuarios.usu_contrasena); txtConfirmar.Text = seguridad.Desencriptar(usuarios.usu_contrasena); cbxCargo.Text = usuarios.usu_cargo; cbxEstadoCuenta.Text = usuarios.usu_estadocuenta; txtContrasena.Focus(); txtContrasena.SelectionStart = 0; txtContrasena.SelectionLength = txtContrasena.Text.Length; } else { DialogResult mensaje = MessageBox.Show("¡Búsqueda exitosa!, el personal esta registrado en el sistema pero no tiene una cuenta de usuario asignada, ¿desea asignarle una cuenta de usuario?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (mensaje == DialogResult.Yes) { groupBox1.Enabled = false; groupBox3.Enabled = true; btnActualizar.Enabled = false; btnEliminar.Enabled = false; btnGuardar.Enabled = true; btnCancelar.Enabled = true; txtUsuario.Enabled = true; txtUsuario.Clear(); txtContrasena.Clear(); txtConfirmar.Clear(); cbxCargo.SelectedIndex = -1; cbxEstadoCuenta.SelectedIndex = -1; txtUsuario.Focus(); } else { groupBox1.Enabled = true; groupBox3.Enabled = false; txtUsuario.Clear(); txtContrasena.Clear(); txtConfirmar.Clear(); cbxCargo.SelectedIndex = -1; cbxEstadoCuenta.SelectedIndex = -1; txtNombre.Clear(); txtSexo.Clear(); txtFechaNacimiento.Clear(); txtEstadoCivil.Clear(); txtMovil.Clear(); txtTelefono.Clear(); txtCorreo.Clear(); pbxPerfil.Image = null; txtClave.Clear(); txtClave.Focus(); } } } else { MessageBox.Show("¡Sin resultados!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } if (!(char.IsNumber(e.KeyChar)) && (e.KeyChar != (char)Keys.Back)) { e.Handled = true; return; } } catch (Exception ex) { MessageBox.Show("Error: " + ex, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void addPersonal(string strYzid) { personal personal = new personal(); personal.id = System.Guid.NewGuid().ToString(); personal.loginId = this.txtEmail.Value; personal.pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPwd.Value, "MD5"); personal.name = this.txtName.Value; personal.telNumber = ""; personal.phoneNumber = ""; personal.webSite = ""; personal.address = ""; personal.team = ""; personal.ifEnable = "0"; personal.detail = ""; personal.email = this.txtEmail.Value; personal.yzid = strYzid; personal.createTime = DateTime.Now; personal.Add(); }
protected void btn_login_Click(object sender, EventArgs e) { string CheckCode = this.txtCheckCode.Value.Trim(); //验证码 if (String.Compare(Request.Cookies["ValidateCode"].Value, CheckCode, true) != 0) { Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('验证码输入不正确,请重新输入!');</script>"); return; } if (this.st_type.Value == "1") { personal personal = new personal(); personal.loginId = this.txtUid.Value.Trim(); personal.pwd = this.txtLogPwd.Value.Trim(); personal.ifEnable = "1"; if (personal.userIfEnable()) { Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('该用户没有认证,请查看邮箱认证用户!');</script>"); return; } else { DataSet dtSet = personal.userLogin(); if (dtSet.Tables[0].Rows.Count > 0) { Session["uid"] = dtSet.Tables[0].Rows[0]["id"].ToString(); Session["uname"] = dtSet.Tables[0].Rows[0]["name"].ToString(); Session["loginId"] = dtSet.Tables[0].Rows[0]["loginId"].ToString(); Session["utype"] = "1"; this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\" onclick=\"loginOut();\" id=\"loginOut\">注销</a><a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\"> 欢迎你," + dtSet.Tables[0].Rows[0]["name"].ToString() + "</a>"; } else { Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('用户名或密码输入错,请重新输入!');</script>"); return; } } } else if (this.st_type.Value == "2") { investor investor = new investor(); investor.loginId = this.txtUid.Value.Trim(); investor.pwd = this.txtLogPwd.Value.Trim(); investor.ifEnable = "1"; if (investor.userIfEnable()) { Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('该用户没有认证,请查看邮箱认证用户!');</script>"); return; } else { DataSet dtSet = investor.userLogin(); if (dtSet.Tables[0].Rows.Count > 0) { Session["uid"] = dtSet.Tables[0].Rows[0]["id"].ToString(); Session["uname"] = dtSet.Tables[0].Rows[0]["name"].ToString(); Session["loginId"] = dtSet.Tables[0].Rows[0]["loginId"].ToString(); Session["utype"] = "2"; this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\" onclick=\"loginOut();\" id=\"loginOut\">注销</a><a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\"> 欢迎你," + dtSet.Tables[0].Rows[0]["name"].ToString() + "</a>"; } else { Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('用户名或密码输入错,请重新输入!');</script>"); return; } } } else if (this.st_type.Value == "3") { company company = new company(); company.loginId = this.txtUid.Value.Trim(); company.pwd = this.txtLogPwd.Value.Trim(); company.ifEnable = "1"; if (company.userIfEnable()) { Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('该用户没有认证,请查看邮箱认证用户!');</script>"); return; } else { DataSet dtSet = company.userLogin(); if (dtSet.Tables[0].Rows.Count > 0) { Session["uid"] = dtSet.Tables[0].Rows[0]["id"].ToString(); Session["uname"] = dtSet.Tables[0].Rows[0]["name"].ToString(); Session["loginId"] = dtSet.Tables[0].Rows[0]["loginId"].ToString(); Session["utype"] = "3"; this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\" onclick=\"loginOut();\" id=\"loginOut\">注销</a><a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\"> 欢迎你," + dtSet.Tables[0].Rows[0]["name"].ToString() + "</a>"; } else { Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('用户名或密码输入错,请重新输入!');</script>"); return; } } } }
public personal GetPerson(int id) { personal person = dbContext.personal.Where(p => p.idpersona == id).FirstOrDefault(); return(person); }
private void txtClave_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar == (Char)Keys.Enter) { if (txtClave.Text == "") { MessageBox.Show("¡Introduce la clave de personal!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); txtClave.Focus(); } else { e.Handled = false; personal = personalcontroller.personal(Convert.ToInt64(txtClave.Text)); if (personal != null) { MessageBox.Show("¡Búsqueda exitosa!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); btnActualizar.Enabled = true; btnEliminar.Enabled = true; btnGuardar.Enabled = false; btnCancelar.Enabled = true; btnIngresar.Enabled = false; btnModificar.Enabled = true; groupBox1.Enabled = false; txtNombre.Text = personal.per_nombre; txtApellidos.Text = personal.per_apellidos; cbxSexo.Text = personal.per_sexo; dtpFechanacimiento.Value = personal.per_fechanacimiento; cbxEstadoCivil.Text = personal.per_estadocivil; cbxMunicipio.Enabled = true; cbxLocalidad.Enabled = true; cbxColonia.Enabled = true; txtDomicilio.Text = personal.per_domicilio; txtCodigo.Text = personal.per_codigopostal.ToString(); cbxEstado.SelectedValue = personal.per_estado; cbxMunicipio.DataSource = personalcontroller.comboBoxMunicipios(personal.per_estado); cbxMunicipio.DisplayMember = "mun_nombremunicipio"; cbxMunicipio.ValueMember = "mun_id"; cbxMunicipio.SelectedValue = personal.per_municipio; cbxLocalidad.DataSource = personalcontroller.comboBoxLocalidades(personal.per_municipio); cbxLocalidad.DisplayMember = "loc_nombrelocalidad"; cbxLocalidad.ValueMember = "loc_id"; cbxLocalidad.SelectedValue = personal.per_localidad; cbxColonia.DataSource = personalcontroller.comboBoxColonias(personal.per_localidad); cbxColonia.DisplayMember = "col_nombrecolonia"; cbxColonia.ValueMember = "col_id"; cbxColonia.SelectedValue = personal.per_colonia; txtTelefono.Text = personal.per_telefono.Replace("(", "").Replace(")", "").Replace("-", ""); txtCelular.Text = personal.per_movil.Replace("-", ""); if (personal.per_correoelectronico == null || personal.per_correoelectronico == "") { txtCorreo.Clear(); cbxProveedor.SelectedIndex = -1; cbxProveedor.Enabled = false; } else { //UBICAMOS EL CARACTER ARROBA (@) Y ANEXAMOS LOS DATOS EN SUS RESPECTIVOS COMBOBOX int ubicacion_arroba = personal.per_correoelectronico.IndexOf("@"); txtCorreo.Text = personal.per_correoelectronico.Substring(0, ubicacion_arroba); cbxProveedor.Text = personal.per_correoelectronico.Substring(ubicacion_arroba + 1); cbxProveedor.Enabled = true; } fotospersonal = personalcontroller.fotoPersonal(personal.per_id); if (fotospersonal != null) { fotografia = fotospersonal.fot_fotoperfil; System.IO.MemoryStream ms = new System.IO.MemoryStream(fotografia); pbxPerfil.Image = Image.FromStream(ms); } foto = 0; txtNombre.Focus(); txtNombre.SelectionStart = 0; txtNombre.SelectionLength = txtNombre.Text.Length; } else { MessageBox.Show("¡Sin resultados!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); lblValidacion10.Visible = false; lblValidacion11.Visible = false; lblValidacion12.Visible = false; lblValidacion13.Visible = false; lblValidacion14.Visible = false; lblValidacion2.Visible = false; lblValidacion3.Visible = false; lblValidacion4.Visible = false; lblValidacion5.Visible = false; lblValidacion6.Visible = false; lblValidacion7.Visible = false; lblValidacion8.Visible = false; lblValidacion9.Visible = false; txtApellidos.Clear(); txtCelular.Clear(); txtClave.Clear(); txtCodigo.Clear(); txtCorreo.Clear(); txtDomicilio.Clear(); txtNombre.Clear(); txtTelefono.Clear(); cbxColonia.SelectedIndex = -1; cbxEstado.SelectedIndex = -1; cbxEstadoCivil.SelectedIndex = -1; cbxLocalidad.SelectedIndex = -1; cbxMunicipio.SelectedIndex = -1; cbxProveedor.SelectedIndex = -1; cbxSexo.SelectedIndex = -1; pbxPerfil.Image = null; dtpFechanacimiento.Value = Convert.ToDateTime(DateTime.Now.ToShortDateString()); btnActualizar.Enabled = false; btnEliminar.Enabled = false; btnGuardar.Enabled = true; btnCancelar.Enabled = true; btnIngresar.Enabled = true; btnModificar.Enabled = false; groupBox1.Enabled = true; foto = 0; txtClave.Focus(); } } } if (!(char.IsNumber(e.KeyChar)) && (e.KeyChar != (char)Keys.Back)) { e.Handled = true; return; } } catch (Exception ex) { MessageBox.Show("Error: " + ex, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["uid"] == null || this.Session["uid"].ToString() == "") { this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\" id=\"User_Register\">注册</a>"; this.lb_showLogin.Text += "<a href=\"javascript:void(0)\" class=\"Rion\" id=\"User_Login\">登录</a>"; } else if (this.Session["uname"] != null) { this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\" onclick=\"loginOut();\" id=\"loginOut\">注销</a> <a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\">欢迎你," + this.Session["uname"].ToString() + "</a>"; if (this.Session["utype"] != null) { if (this.Session["utype"].ToString() == "1") { personal personal = new personal(); personal.GetModel(this.Session["uid"].ToString().Trim()); ; this.lb_name.Text = personal.name; this.lb_email.Text = personal.email; this.lb_type.Text = "个人/创客"; } else if (this.Session["utype"].ToString() == "2") { investor investor = new investor(); investor.GetModel(this.Session["uid"].ToString().Trim()); ; this.lb_name.Text = investor.name; this.lb_email.Text = investor.eamil; this.lb_type.Text = "投资人"; } else if (this.Session["utype"].ToString() == "3") { company company = new company(); company.GetModel(this.Session["uid"].ToString().Trim()); ; this.lb_name.Text = company.name; this.lb_email.Text = company.eamil; this.lb_type.Text = "企业"; } } } }
private void Menu_Load(object sender, EventArgs e) { try { toolTipMethod(); personal = menu.obtenerDatos(id); if (personal != null) { usuarios = menu.datosUsuario(id); if (usuarios != null) { lblNombreUsuario.Text = personal.per_nombre + " " + personal.per_apellidos; lblPrivilegio.Text = usuarios.usu_cargo; if (usuarios.usu_cargo == "ENCARGADO") { //PRIVILEGIOS DEL USUARIO ENCARGADO lblSubMenu11.Enabled = false; lblSubMenu12.Enabled = true; lblSubMenu21.Enabled = false; lblSubMenu22.Enabled = true; lblSubMenu31.Enabled = false; lblSubMenu32.Enabled = true; lblSubMenu41.Enabled = true; lblSubMenu42.Enabled = true; lblSubMenu43.Enabled = false; lblSubMenu44.Enabled = true; lblSubMenu51.Enabled = false; lblSubMenu61.Enabled = true; lblSubMenu62.Enabled = true; } else if (usuarios.usu_cargo == "COBRADOR") { //PRIVILEGIOS DEL USUARIO COBRADOR lblSubMenu11.Enabled = false; lblSubMenu12.Enabled = false; lblSubMenu21.Enabled = false; lblSubMenu22.Enabled = false; lblSubMenu31.Enabled = false; lblSubMenu32.Enabled = true; lblSubMenu42.Enabled = true; lblSubMenu41.Enabled = true; lblSubMenu43.Enabled = false; lblSubMenu44.Enabled = false; lblSubMenu51.Enabled = false; lblSubMenu61.Enabled = true; lblSubMenu62.Enabled = true; } else { //PRIVILEGIOS DE UN USUARIO ADMINISTRADOR lblSubMenu11.Enabled = true; lblSubMenu12.Enabled = true; lblSubMenu21.Enabled = true; lblSubMenu22.Enabled = true; lblSubMenu31.Enabled = true; lblSubMenu32.Enabled = true; lblSubMenu41.Enabled = true; lblSubMenu42.Enabled = true; lblSubMenu43.Enabled = true; lblSubMenu44.Enabled = true; lblSubMenu51.Enabled = true; lblSubMenu61.Enabled = true; lblSubMenu62.Enabled = true; } fotospersonal = menu.obtenerFoto(id); if (fotospersonal != null) { byte[] imagenBuffer = fotospersonal.fot_fotoperfil; System.IO.MemoryStream ms = new System.IO.MemoryStream(imagenBuffer); pbxPerfil.Image = Image.FromStream(ms); } } } } catch (Exception ex) { MessageBox.Show("Error: " + ex, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnLogin_Click(object sender, EventArgs e) { try { int bandera1 = 0, bandera2 = 0; if (txtUsername.Text == "") { lblValidacion1.Text = "* Introduzca su nombre de usuario"; lblValidacion1.Visible = true; bandera1 = 0; } else { lblValidacion1.Visible = false; bandera1 = 1; } if (txtPassword.Text == "") { lblValidacion2.Text = "* Introduzca su contraseña de acceso"; lblValidacion2.Visible = true; bandera2 = 0; } else { lblValidacion2.Visible = false; bandera2 = 1; } if (bandera1 == 1 && bandera2 == 1) { usuarios = logincontroller.inicioSesion(txtUsername.Text, txtPassword.Text); if (usuarios != null) { if (usuarios.usu_estadocuenta == "ACTIVADA") { Menu menu = new Menu(); menu.id = usuarios.usu_personal; personal = logincontroller.obtenerDatos(usuarios.usu_personal); if (personal != null) { MessageBox.Show("BIENVENIDO(A) al sistema, " + personal.per_nombre + " " + personal.per_apellidos + ", a continuación accederá al menú principal.", "ACCESANDO AL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information); menu.Show(); this.Hide(); } } else { MessageBox.Show("Su cuenta no se encuentra activa, acuda a un usuario administrativo para habilitar su acceso", "Información", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUsername.Clear(); txtPassword.Clear(); txtUsername.Focus(); } } else { MessageBox.Show("Las credenciales introducidas son incorrectas", "Información", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUsername.Clear(); txtPassword.Clear(); txtUsername.Focus(); } } } catch (Exception ex) { MessageBox.Show("Error: " + ex, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["user"] != null) { strUid = this.Request.QueryString["user"].ToString(); } else { Response.Write("<script>alert('对不起,参数有误!请联系管理员!');</script>"); Response.Redirect("index.aspx?rend=" + System.Guid.NewGuid().ToString()); return; } if (this.Request.QueryString["type"] != null) { strType = this.Request.QueryString["type"].ToString(); } else { Response.Write("<script>alert('对不起,参数有误!请联系管理员!');</script>"); Response.Redirect("index.aspx?rend=" + System.Guid.NewGuid().ToString()); return; } if (this.Request.QueryString["ren"] != null) { strID = this.Request.QueryString["ren"].ToString(); } else { Response.Write("<script>alert('对不起,参数有误!请联系管理员!');</script>"); Response.Redirect("index.aspx?rend=" + System.Guid.NewGuid().ToString()); return; } if (strType == "1") { personal personal = new personal(); personal.yzid = strID; personal.loginId = strUid; DataSet dtSet = personal.GetAuthenticationList(); if (dtSet.Tables[0].Rows.Count > 0) { personal.ifEnable = "1"; personal.id = dtSet.Tables[0].Rows[0]["id"].ToString(); personal.authenticationTime = DateTime.Now; personal.UpdateAuthenticationList(); } } else if (strType == "2") { investor investor = new investor(); investor.yzid = strID; investor.loginId = strUid; DataSet dtSet = investor.GetAuthenticationList(); if (dtSet.Tables[0].Rows.Count > 0) { investor.ifEnable = "1"; investor.id = dtSet.Tables[0].Rows[0]["id"].ToString(); investor.authenticationTime = DateTime.Now; investor.UpdateAuthenticationList(); } } else if (strType == "3") { company company = new company(); company.yzid = strID; company.loginId = strUid; DataSet dtSet = company.GetAuthenticationList(); if (dtSet.Tables[0].Rows.Count > 0) { company.ifEnable = "1"; company.id = dtSet.Tables[0].Rows[0]["id"].ToString(); company.authenticationTime = DateTime.Now; company.UpdateAuthenticationList(); } } else { Response.Write("<script>alert('对不起,参数有误!请联系管理员!');</script>"); Response.Redirect("index.aspx?rend=" + System.Guid.NewGuid().ToString()); return; } }