protected void Page_Load(object sender, EventArgs e) { us = new Usuario(); String valor = Request.QueryString["id"]; int id = int.Parse(valor); us.Id_usuario = id; Mrol.DataSource = NGUsuario.getInstance().listarRol(); Mrol.DataTextField = "Rol"; Mrol.DataValueField = "Id_rol"; Mrol.DataBind(); this.registro = NGUsuario.getInstance().getUsuarioporid(id); Id_usuario.Value = valor; if (registro.Read()) { us.Nombre = this.registro["Nombre_Usuario"].ToString(); us.Id_rol = Convert.ToInt32(this.registro["Id_rol"]); id_empleado = Convert.ToInt32(this.registro["Id_empleado"]); } //Mostrar datos en el textbox this.empleados = NGEmpleado.getInstance().ListarEmpleadoPorId(id_empleado); if (empleados.Read()) { Mempleado.Text = empleados["Nombre_empleado"].ToString() + " " + empleados["Apellido"].ToString(); } }
public static bool EliminarEmp(String id) { bool resp = false; Empleado ep = new Empleado() { Id_Empleado = Convert.ToInt32(id) }; Console.Write(ep); resp = NGEmpleado.getInstance().Eliminarempleado(ep); return(resp); }
public void EditarFormulario(object sender, EventArgs e) { if (IsValid) { Empleado emp = Modificar(); bool resp = NGEmpleado.getInstance().Modificarempleado(emp); if (resp == true) { ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript: Modificarempleado(); ", true); } else { Response.Redirect("Updemp.aspx" + Id_Emp.Value); } } else { ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript: ADD(); ", true); } }
protected void Page_Load(object sender, EventArgs e) { this.empleado = NGEmpleado.getInstance().listarempleado(); us = new Usuario(); String valor = Request.QueryString["id"]; int id = int.Parse(valor); us.Id_usuario = id; if (!IsPostBack) { Mrol.DataSource = NGUsuario.getInstance().listarRol(); Mrol.DataTextField = "Rol"; Mrol.DataValueField = "Id_rol"; Mrol.DataBind(); } this.registro = NGUsuario.getInstance().getUsuarioporid(id); Id_usuario.Value = valor; if (registro.Read()) { us.Nombre = this.registro["Nombre_Usuario"].ToString(); us.Id_rol = Convert.ToInt32(this.registro["Id_rol"]); // id_empleado = Convert.ToInt32(this.registro["Id_empleado"]); } /* if(!IsPostBack) * { * //Mostrar datos en el textbox * this.empleados = dte.getEmpleadoporid(id_empleado); * if (empleados.Read()) * { * Musuario.Text = empleados["Nombre_empleado"].ToString() + " " + empleados["Apellido"].ToString(); * Mcedula.Text = empleados["Cedula"].ToString(); * } * }*/ }
protected void Page_Load(object sender, EventArgs e) { //Creacion de los objetos emp = new Empleado(); //Obtener id del empleado String valor = Request.QueryString["id"]; int id = int.Parse(valor); emp.Id_Empleado = id; //Lamamos al metodo buscar empleado por id this.registro = NGEmpleado.getInstance().ListarEmpleadoPorId(id); Id_Emp.Value = valor; //Comenzamos a recorer el sqldatareader if (registro.Read()) { this.emp.Cedula = this.registro["cedula"].ToString(); this.emp.Nombre_Empleado = this.registro["Nombre_empleado"].ToString(); this.emp.Apellido = this.registro["Apellido"].ToString(); this.emp.Cargo = this.registro["Cargo"].ToString(); } }
protected void InsertarEmpleado(object sender, EventArgs e) { if (IsValid)//valido que si mi formulario esta correcto { //Registro del Empleado Empleado emp = GetEntity(); //LLAMANDO A CAPA DE NEGOCIO bool resp = NGEmpleado.getInstance().guardarempleado(emp); if (resp == true) { ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript: InsertarEmpleado(); ", true); //Response.Redirect("BuscarCliente.aspx"); } else { Response.Write("<script>alert('REGISTRO INCORRECTO.')</script)"); } } else { ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript: ADD(); ", true); } }