protected void Page_Load(object sender, EventArgs e) { var idUserToEdit = Session["idUserToEdit"]; try { if (idUserToEdit == null) { Response.Redirect("Users.aspx"); } else { Personal user = PersonalController.searchUserById(Convert.ToInt32(idUserToEdit)); txtName.Attributes.Add("placeholder", user.nombre); txtLastname.Attributes.Add("placeholder", user.apellido); txtPhone.Attributes.Add("placeholder", user.telefono); txtEmail.Attributes.Add("placeholder", user.correo); txtPassword.Attributes.Add("placeholder", user.password); if (!Page.IsPostBack) { userArea.Text = user.area.ToString(); userRole.Text = user.rol.ToString(); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + ex.Message + "');", true); } }
protected void Page_Load(object sender, EventArgs e) { try { var loginId = Session["loginId"]; if (Session["loginId"] == null) { Response.Redirect("login.aspx"); } else { Personal user = PersonalController.searchUserById(Convert.ToInt32(loginId)); if (user.rol != 0) { linkUsers.Visible = false; //Response.Redirect("inventory.aspx"); } lblUser.InnerText = user.nombre + " " + user.apellido; titleDate.InnerText = DateTime.Now.ToString(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + ex.Message + "');", true);; } }
private void mostrarPersonal() { DataTable dtPersonal = new DataTable(); PersonalController funcion = new PersonalController(); funcion.mostrarPersonal(ref dtPersonal, desde, hasta); dgPersonal.DataSource = dtPersonal; diseñarDgPersonal(); }
private void buscarPersonal() { PersonalController funcion = new PersonalController(); DataTable dtPersonal = new DataTable(); funcion.buscarPersonal(ref dtPersonal, desde, hasta, txtBuscador.Text); dgPersonal.DataSource = dtPersonal; diseñarDgPersonal(); }
private void bwLoadData_DoWork(object sender, DoWorkEventArgs e) { DateTime today = DateTime.Now; lineList = LineController.Select(section.SectionId); personalList = PersonalController.Select(section.Keyword); workerLoginList = WorkerLoginController.SelectByLine(section.SectionId, today); lineAllList = LineController.Select(); }
private void habilitarPersonal() { Logica.Personal parametros = new Logica.Personal(); PersonalController funcion = new PersonalController(); parametros.idPersonal = idPersonal; if (funcion.restaurarPersonal(parametros) == true) { mostrarPersonal(); } }
private void buscarPersonalIdent() { DataTable dtPersonal = new DataTable(); PersonalController funcion = new PersonalController(); funcion.buscarPersonalIdentificacion(ref dtPersonal, txtIdentificacion.Text); if (dtPersonal.Rows.Count > 0) { identificacion = dtPersonal.Rows[0]["identificacion"].ToString(); idPersonal = Convert.ToInt32(dtPersonal.Rows[0]["idPersonal"]); txtNombre.Text = dtPersonal.Rows[0]["nombres"].ToString() + " " + dtPersonal.Rows[0]["apellidos"].ToString(); } }
private void workerLoad_DoWork(object sender, DoWorkEventArgs e) { personals = PersonalController.Get(""); List <String> lines = personals.Select(p => p.Department).Distinct().ToList(); cboLines.Dispatcher.Invoke((Action)(() => cboLines.ItemsSource = lines)); int[] days = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; cboDay.Dispatcher.Invoke((Action)(() => cboDay.ItemsSource = days)); int[] months = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; cboMonth.Dispatcher.Invoke((Action)(() => cboMonth.ItemsSource = months)); int[] years = { DateTime.Now.Year - 1, DateTime.Now.Year }; cboYear.Dispatcher.Invoke((Action)(() => cboYear.ItemsSource = years)); }
private void insertarPersonal() { Logica.Personal parametros = new Logica.Personal(); PersonalController funcion = new PersonalController(); parametros.nombres = txtNombres.Text; parametros.apellidos = txtApellidos.Text; parametros.identificacion = txtIdentificacion.Text; parametros.pais = cboPais.Text; parametros.idCargo = idCargo; parametros.sueldoPorHora = Convert.ToDouble(txtSueldo.Text); if (funcion.insertarPersonal(parametros) == true) { reiniciarPaginado(); mostrarPersonal(); PanelRegistro.Visible = false; } }
private void editarPersonal() { Logica.Personal parametros = new Logica.Personal(); PersonalController funcion = new PersonalController(); parametros.idPersonal = idPersonal; parametros.nombres = txtNombres.Text; parametros.apellidos = txtApellidos.Text; parametros.identificacion = txtIdentificacion.Text; parametros.pais = cboPais.Text; parametros.idCargo = idCargo; parametros.sueldoPorHora = Convert.ToDouble(txtSueldo.Text); parametros.estado = "M"; if (funcion.actualizarPersonal(parametros) == true) { mostrarPersonal(); PanelRegistro.Visible = false; } }
protected void btnLogin_Click(object sender, EventArgs e) { try { var login = new Personal() { correo = txtEmail.Text, password = txtPassword.Text, }; var user = PersonalController.login(login); Session["loginId"] = user.idPersonal; Response.Redirect("inventory.aspx"); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + ex.Message + "');", true);; } }
private void eliminarPersonal() { idPersonal = Convert.ToInt32(dgPersonal.SelectedCells[2].Value); identificacion = dgPersonal.SelectedCells[5].Value.ToString(); Logica.Personal parametros = new Logica.Personal(); PersonalController funcion = new PersonalController(); parametros.idPersonal = idPersonal; parametros.nombres = ""; parametros.apellidos = ""; parametros.identificacion = identificacion; parametros.pais = ""; parametros.idCargo = 0; parametros.sueldoPorHora = 0; parametros.estado = "E"; if (funcion.eliminarPersonal(parametros) == true) { mostrarPersonal(); } }
protected void btnInsert_Click(object sender, EventArgs e) { try { Personal user = new Personal(); user.nombre = txtName.Text; user.apellido = txtLastname.Text; user.telefono = txtPhone.Text; user.correo = txtEmail.Text; user.password = txtPassword.Text; user.area = userArea.SelectedValue; user.rol = Convert.ToInt32(userRole.SelectedValue); PersonalController.insertUser(user); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Nuevo usuario agregado');", true); Response.Redirect("Users.aspx"); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + ex.Message + "');", true); } }
protected void btnEdit_Click(object sender, EventArgs e) { var idUserToEdit = Session["idUserToEdit"]; try { Personal user = PersonalController.searchUserById(Convert.ToInt32(idUserToEdit)); if (!string.IsNullOrEmpty(txtName.Text)) { user.nombre = txtName.Text; } if (!string.IsNullOrEmpty(txtLastname.Text)) { user.apellido = txtLastname.Text; } if (!string.IsNullOrEmpty(txtPhone.Text)) { user.telefono = txtPhone.Text; } if (!string.IsNullOrEmpty(txtEmail.Text)) { user.correo = txtEmail.Text; } if (!string.IsNullOrEmpty(txtPassword.Text)) { user.password = txtPassword.Text; } user.area = userArea.SelectedValue; user.rol = Convert.ToInt32(userRole.SelectedValue); PersonalController.editUser(user); Response.Redirect("Users.aspx"); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + ex.Message + "');", true); } }
protected void btnConfirm_Click(object sender, EventArgs e) { PersonalController.removeUser(Convert.ToInt32(Session["idUserToDelete"])); Page_Load(null, null); }
protected void Page_Load(object sender, EventArgs e) { gvUsers.DataSource = PersonalController.searchUserByCriteria(""); gvUsers.DataBind(); }
private void bwLoadData_DoWork(object sender, DoWorkEventArgs e) { lineList = LineController.Select(section.SectionId); personalList = PersonalController.Select(); }
void threadLoad_DoWork(object sender, DoWorkEventArgs e) { lineList = LineController.Select(); personalList = PersonalController.Select(section.Keyword_1); }
private void contar() { PersonalController funcion = new PersonalController(); funcion.contarPersonal(ref contador); }
private void bwLoadData_DoWork(object sender, DoWorkEventArgs e) { personalList = PersonalController.Select(section.Keyword); }