protected void btnIngresar_Click(object sender, EventArgs e) { lbValidator.Text = ""; string email = txtEmail.Text; string password = txtPassword.Text; if (String.IsNullOrEmpty(email)) { lbValidator.Text = "La casilla Email no debe estar Vacía"; return; } if (String.IsNullOrEmpty(password)) { lbValidator.Text = "La casilla Contraseña no debe estar Vacía"; return; } UserADM obj = UserADM_BRL.getUserAdmByEmail(email); if (obj == null) { lbValidator.Text = "El email no se encuentra registrado en el Sistema"; return; } if (!password.Equals(obj.Password.Trim())) { lbValidator.Text = "Contraseña Incorrecta"; return; } Session["User"] = obj; Response.Redirect("~/JoyanaADMI/UsersAdmin/ListAdmins.aspx"); lbValidator.Text = ""; }
protected void Page_Load(object sender, EventArgs e) { admiLogeado = (UserADM)Session["User"]; if (admiLogeado == null) { Response.Redirect("~/JoyanaADMI/UsersAdmin/LoginAdmin.aspx"); } txtCI.Text = admiLogeado.CI; txtNombre.Text = admiLogeado.Nombre; txtApellido.Text = admiLogeado.Apellido; txtEmail.Text = admiLogeado.Email; txtTelefono.Text = admiLogeado.Telefono; txtDireccion.Text = admiLogeado.Direccion; pnPassword.Visible = false; pnBtnConfirm.Visible = false; if (!IsPostBack) { Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache); Response.Cache.SetAllowResponseInBrowserHistory(false); Response.Cache.SetNoStore(); } }
public static UserADM getUserAdmByID(int userAdmID) { UserADMTableAdapter adapter = new UserADMTableAdapter(); UserADM_DS.UserADMDataTable table = adapter.GetUserADMByID(userAdmID); if (table.Rows.Count == 0) { return(null); } UserADM_DS.UserADMRow row = table[0]; UserADM obj = new UserADM() { UserId = row.UserId, Nombre = row.nombre, Apellido = row.apellido, Email = row.email, Password = row.password, CI = row.CI, Telefono = row.telefono, Direccion = row.direccion }; return(obj); }
protected void Page_Load(object sender, EventArgs e) { UserADM admiLogeado = (UserADM)Session["User"]; if (admiLogeado == null) { Response.Redirect("~/JoyanaADMI/UsersAdmin/LoginAdmin.aspx"); return; } string strId = Request.Params["Id"]; int id = 0; try { id = Convert.ToInt32(strId); } catch (Exception ex) { Console.Write(ex.Message); } if (id <= 0) { return; } UserADM obj = UserADM_BRL.getUserAdmByID(id); objSelected = obj; if (!IsPostBack) { txtCI.Text = obj.CI.Trim(); txtNombre.Text = obj.Nombre.Trim(); txtApellido.Text = obj.Apellido.Trim(); txtTelefono.Text = obj.Telefono.Trim(); txtDireccion.Text = obj.Direccion.Trim(); Permiso perm; for (int i = 0; i < checkPermisos.Items.Count; i++) { perm = Permiso_BRL.getPermisoByDescription(checkPermisos.Items[i].Text); if (AdmiPermiso_BRL.tienePermiso(obj.UserId, perm.PermisoId)) { checkPermisos.Items[i].Selected = true; } } } if (!IsPostBack) { Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache); Response.Cache.SetAllowResponseInBrowserHistory(false); Response.Cache.SetNoStore(); } }
protected void Page_Load(object sender, EventArgs e) { UserADM obj = (UserADM)Session["User"]; if (obj == null) { Response.Redirect("~/JoyanaADMI/UsersAdmin/LoginAdmin.aspx"); return; } //Validacion si puede registrar admins Permiso permAddAdmin = Permiso_BRL.getPermisoByDescription("Registrar Administrador"); if (!AdmiPermiso_BRL.tienePermiso(obj.UserId, permAddAdmin.PermisoId)) { itemAddAdmi.Visible = false; } else { itemAddAdmi.Visible = true; } //Validacion si puede Editar Admins permAddAdmin = Permiso_BRL.getPermisoByDescription("Editar Administrador"); if ((!AdmiPermiso_BRL.tienePermiso(obj.UserId, permAddAdmin.PermisoId))) { GridAdmins.Columns[5].Visible = false; } else { GridAdmins.Columns[5].Visible = true; } //Validacion si puede eliminar Admins permAddAdmin = Permiso_BRL.getPermisoByDescription("Eliminar Administrador"); if ((!AdmiPermiso_BRL.tienePermiso(obj.UserId, permAddAdmin.PermisoId))) { GridAdmins.Columns[6].Visible = false; } else { GridAdmins.Columns[6].Visible = true; } cargarAdmins(); if (!IsPostBack) { cargarAdmins(); Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache); Response.Cache.SetAllowResponseInBrowserHistory(false); Response.Cache.SetNoStore(); } }
public static void updateUserADM(UserADM obj) { if (obj == null) { throw new ArgumentException("El Administrador no puede ser nulo"); } UserADMTableAdapter adapter = new UserADMTableAdapter(); adapter.Update(obj.Nombre, obj.Apellido, obj.Email, obj.Password, obj.CI, obj.Telefono, obj.Direccion, obj.UserId); }
protected void Page_Load(object sender, EventArgs e) { UserADM obj = (UserADM)Session["User"]; if (obj == null) { Response.Redirect("~/JoyanaADMI/UsersAdmin/LoginAdmin.aspx"); } else { txtPerfilName.Text = obj.Nombre; } }
protected void Page_Load(object sender, EventArgs e) { UserADM obj = (UserADM)Session["User"]; if (obj == null) { Response.Redirect("~/JoyanaADMI/UsersAdmin/LoginAdmin.aspx"); return; } if (!IsPostBack) { Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache); Response.Cache.SetAllowResponseInBrowserHistory(false); Response.Cache.SetNoStore(); } lbValidator.Text = ""; }
public static int insertUserADM(UserADM obj) { if (obj == null) { throw new ArgumentException("El objeto Admi no debe ser nulo"); } int?userADM_Id = null; UserADMTableAdapter adapter = new UserADMTableAdapter(); adapter.Insert(obj.Nombre, obj.Apellido, obj.Email, obj.Password, obj.CI, obj.Telefono, obj.Direccion, ref userADM_Id); if (userADM_Id == null || userADM_Id <= 0) { throw new ArgumentException("La llave primaria no se generó correctamente"); } return(userADM_Id.Value); }
public static List <UserADM> GetAdmins() { UserADMTableAdapter adapter = new UserADMTableAdapter(); UserADM_DS.UserADMDataTable table = adapter.GetUserADM(); List <UserADM> resultado = new List <UserADM>(); foreach (var row in table) { UserADM obj = new UserADM(); obj.UserId = row.UserId; obj.CI = row.CI; obj.Nombre = row.nombre; obj.Apellido = row.apellido; obj.Email = row.email; obj.Password = row.password; obj.Telefono = row.telefono; obj.Direccion = row.direccion; resultado.Add(obj); } return(resultado); }
protected void btnRegistrar_Click(object sender, EventArgs e) { lbValidator.Text = ""; string nombre = txtNombre.Text; string apellido = txtApellido.Text; string email = txtEmail.Text; string password = txtPassword.Text; string rePassword = txtRePassword.Text; string ci = txtCI.Text; string telefono = txtTelefono.Text; string direccion = txtDireccion.Text; if (String.IsNullOrEmpty(ci)) { lbValidator.Text = "La casilla CI no puede estar Vacía"; return; } if (String.IsNullOrEmpty(nombre)) { lbValidator.Text = "La casilla Nombre no puede estar Vacía"; return; } if (String.IsNullOrEmpty(apellido)) { lbValidator.Text = "La casilla Apellido no puede estar Vacía"; return; } if (String.IsNullOrEmpty(email)) { lbValidator.Text = "La casilla Email no puede estar Vacía"; return; } if (String.IsNullOrEmpty(password)) { lbValidator.Text = "La casilla Contraseña no puede estar Vacía"; return; } if (String.IsNullOrEmpty(telefono)) { lbValidator.Text = "La casilla Telefono no puede estar Vacía"; return; } if (String.IsNullOrEmpty(direccion)) { lbValidator.Text = "La casilla Dirección no puede estar Vacía"; return; } if (!password.Equals(rePassword)) { lbValidator.Text = "Las Contraseñas colocadas no coinciden"; return; } UserADM temp = UserADM_BRL.getUserAdmByCI(ci); if (temp != null) { lbValidator.Text = "Ya existe un Administrador registrado con ese CI"; return; } temp = UserADM_BRL.getUserAdmByEmail(email); if (temp != null) { lbValidator.Text = "Ya existe un Administrador registrado con ese Email"; return; } UserADM obj = new UserADM() { Nombre = nombre, Apellido = apellido, Email = email, Password = password, CI = ci, Telefono = telefono, Direccion = direccion }; int codigoAdmi = UserADM_BRL.insertUserADM(obj); AdmiPermiso admPerm; Permiso tempPerm; //Le inserto los permisos for (int i = 0; i < checkPermisos.Items.Count; i++) { if (checkPermisos.Items[i].Selected) { tempPerm = Permiso_BRL.getPermisoByDescription(checkPermisos.Items[i].Text); admPerm = new AdmiPermiso() { UserAdmId = codigoAdmi, PermisoId = tempPerm.PermisoId }; AdmiPermiso_BRL.insertAdmiPermiso(admPerm); } } lbValidator.Text = ""; Response.Redirect("~/JoyanaADMI/UsersAdmin/ListAdmins.aspx"); }