public frmVentanaHome(Empleado empleado) { this.empleado = empleado; InitializeComponent(); nModulo = 0; lblNombreEmpleado.Text = empleado.Nombres + " " + empleado.ApellidoPaterno; }
public override int add() { try { Empleado dataCarrero = new Empleado { NOMBRE = carter.Nombre, DIRECCION = carter.Direccion, TELEFONO = carter.Telefono, CIUDAD = carter.Ciudad, TIPO = 2 }; Data.Empleados.InsertOnSubmit(dataCarrero); Data.SubmitChanges(); ModelUsers modelUser = new ModelUsers(); //datos para agregar usuario modelUser.user.CodigoEmpleado = dataCarrero.CODIGO; modelUser.user.Usuario = carter.Usuario.Usuario; modelUser.user.Clave = carter.Usuario.Clave; modelUser.user.Tipousuario = carter.Usuario.Tipousuario; modelUser.user.Sincroniza = carter.Usuario.Sincroniza; modelUser.add(); return 1; } catch (Exception exc) { Utils.logExceptionError(exc); return 0; } }
public frmDetalleFacturaProveedor(Empleado empleado, FacturaProveedor factura) { this.empleado = empleado; InitializeComponent(); // validaciones this.txtNroFact.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaNumerico); this.txtNroFact.KeyUp += new System.Windows.Forms.KeyEventHandler(Utils.Utils.ValidaBlancos); if (factura != null) { this.factura = factura; MostrarFactura(); bloquearCampos(); btnRegistrar.Text = "Eliminar"; lblTipoCambio.Visible = false; } else { this.factura = new FacturaProveedor(); this.factura.Id = 0; factLineas = new List<FacturaProveedorLinea>(); } load = 0; }
public bool ValidateNewEmpleado(string nombre, string apellido, short puesto, decimal sueldo, DateTime contratacion, bool activo) { Empleado e=new Empleado { Nombre = nombre, Apellido = apellido, Puesto = puesto, Sueldo = sueldo, Contratacion = contratacion, Activo = activo }; bool valid = !string.IsNullOrEmpty(e.Nombre) ? true : false; bool tmp = !string.IsNullOrEmpty(e.Apellido) ? true : false; valid = valid && tmp; tmp = e.Puesto > 0 ? true : false; valid = valid && tmp; tmp = e.Sueldo > 0 ? true : false; valid = valid && tmp; tmp = e.Contratacion != null ? true : false; valid = valid && tmp; tmp = e.Activo != null ? true : false; valid = valid && tmp; return valid; }
private void btnCrear_Click(object sender, EventArgs e) { // Persona persona = new Persona(Persona.SexoPersona.MUJER); // Persona p = new Persona(); ArrayList coleccion = new ArrayList(); // Empleado emp = new Empleado("gd"); emp.Nombre = "Armando"; // p.Nombre = "Diego"; p.FechaNacimiento = DateTime.Parse("01/01/2015"); p.Sexo = Persona.SexoPersona.HOMBRE; p.Apellido = "Simbaña"; this.lstDatosPersona.Items.Clear(); this.lstDatosPersona.Items.Add(p.Nombre); this.lstDatosPersona.Items.Add(p.FechaNacimiento.ToLongDateString()); this.lstDatosPersona.Items.Add(p.Sexo); this.lstDatosPersona.Items.Add(p.Apellido); this.lstDatosPersona.Items.Add(p.GetNombreCompleto()); this.lstDatosPersona.Items.Add(emp.GetNombreCompleto()); // this.lstDatosPersona.Items.Add(emp.Nombre); // this.lstDatosPersona.Items.Add("Vacaciones Persona: "+ p.GetDiasVacaciones()); this.lstDatosPersona.Items.Add("Vacaciones Persona: " + emp.GetDiasVacaciones()); // //no puedo acceder a SalarioMinimo por estar protegido //p.SalarioMinimo = 1500; //this.lstDatosPersona.Items.Add("Salario: " + p.SalarioMinimo()); }
public void Activar(Empleado empleado) { empleado.Estado = "Activo"; new EmpleadoDA().Update(empleado); empleado.Usuario.Estado = "Activo"; new UsuarioDA().Save(empleado.Usuario); }
public void Guardar() { if (ceditor.ID < 0) { Empleado em = new Empleado { NOMBRE = ceditor.Nombre, CIUDAD = ceditor.Ciudad, DIRECCION = ceditor.Direccion, TELEFONO = ceditor.Telefono }; data.Empleados.InsertOnSubmit(em); } else { var query = from carrero in data.Empleados where carrero.CODIGO == ceditor.ID select carrero; Empleado em = query.First<Empleado>(); em.NOMBRE = ceditor.Nombre; em.DIRECCION = ceditor.Direccion; em.CIUDAD = ceditor.Ciudad; em.TELEFONO = ceditor.Telefono; } data.SubmitChanges(); toDGV(); }
public Persona BuscarPorId(int id) { try { Empleado empleado = null; SqlConnection con = db.ConectaDb(); string select = string.Format("select em.IdEmpleado,em.Nombre,em.Apellido,em.Email,em.Dni,em.Usuario,em.Clave,ca.IdCargo from Cargo as ca,Empleado as em where ca.IdCargo=em.IdCargo and em.IdEmpleado={0}", id); SqlCommand cmd = new SqlCommand(select, con); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { empleado = new Empleado(); empleado.IdPersona = (int)reader["IdEmpleado"]; empleado.Nombre = (string)reader["Nombre"]; empleado.Apellido = (string)reader["Apellido"]; empleado.Email = (string)reader["Email"]; empleado.Dni = (string)reader["Dni"]; empleado.Usuario = (string)reader["Usuario"]; empleado.Clave = (string)reader["Clave"]; empleado.cargo = new CargoDAODB().BuscarPorId((int)reader["IdCargo"]); } reader.Close(); return empleado as Persona; } catch (Exception ex) { return null; } finally { db.DesconectaDb(); } }
public frmDetalleEmpleado(Empleado empleado) { InitializeComponent(); init(); this.empleado = empleado; this.usuario = empleado.Usuario; btnRegistrar.Text = "Modificar"; txtAnexo.Text = empleado.Anexo; txtApeMaterno.Text = empleado.ApellidoMaterno; txtApePaterno.Text = empleado.ApellidoPaterno; txtEmail.Text = empleado.Email; txtNombres.Text = empleado.Nombres; txtNumeroDocumento.Text = empleado.NumeroDocumento; txtTelefono.Text = empleado.Telefono; txtNombreUsuario.Text = empleado.Usuario.NombreUsuario; cboRol.Text = empleado.Usuario.Rol.Descripcion; cboEstadoCivil.Text = empleado.EstadoCivil; cboLocal.Text = empleado.Local.Nombre; cboTipoDocumento.Text = empleado.TipoDocumento; cboArea.Text = empleado.Cargo.Area.Descripcion; cboCargo.Text = empleado.Cargo.Descripcion; IND_MENSAJE = Utils.Utils.MODIFICACION_OK; gbxInfoPersonal.Enabled = false; gbxInforLaboral.Enabled = false; gbxInfoUsuario.Enabled = false; btnRegistrar.Text = "Editar"; }
public frmIngresarProductos(Empleado empleado) { local = empleado.Local; if (!local.Estado.Equals("Activo")) { Utils.Utils.Mensaje("El local del cual está realizando la transacción no está activo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } InitializeComponent(); this.empleado = empleado; this.local = empleado.Local; dgvProductos.AllowUserToAddRows = false; dgvProductos.AllowUserToDeleteRows = false; txtNroDocumento.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaNumerico); this.AcceptButton = btnCargarDatos; List<ListItem> listItem = new List<ListItem>(); ListItem e1 = new ListItem("Compra", (int)TipoMov.Compra); ListItem e3 = new ListItem("Consignacion", (int)TipoMov.Consignacion); ListItem e4 = new ListItem("Transferencia", (int)TipoMov.Transferencia); listItem.Add(e1); listItem.Add(e3); listItem.Add(e4); lblFecha.Show(); cboTipoMovimiento.DataSource = listItem; cboTipoMovimiento.DisplayMember = "Mostrar"; cboTipoMovimiento.ValueMember = "Valor"; zonas = (new ZonasBL()).ObtenerDatos(this.local); }
public frmAperturarCaja(Empleado empleado) { try { InitializeComponent(); this.empleado = empleado; this.turnoxempleado = TurnoXEmpleadoBL.findTurnoXEmpleado(empleado.Id); this.txtMontoInicialSoles.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaNumerico); this.txtMontoInicialDolares.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaNumerico); this.txtMontoInicialSoles.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaBlancos); this.txtMontoInicialDolares.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaBlancos); inicializarCampos(); cajaSeleccionada = null; tipoCambio = new TipoCambioBL().DameUltimo(); if (continuar) { if (!ValidarTurnos()) { Utils.Utils.Error(null, "Su turno de trabajo aun no empieza"); this.continuar = false; this.Dispose(); } } else this.Dispose(); } catch (Exception exception) { Utils.Utils.Error(null, "EL empleado no tiene turno asignado"); continuar = false; } }
public void DarDeBaja(Empleado empleado) { empleado.Estado = "Inactivo"; new EmpleadoDA().Update(empleado); empleado.Usuario.Estado = "Inactivo"; new UsuarioDA().Save(empleado.Usuario); }
public frmReporteCaja(Empleado empleado) { InitializeComponent(); this.empleado = empleado; listaRegistroCaja = new List<RegistroCaja>(); listaRegistroxCaja = new List<IList<RegistroCaja>>(); this.listaCajas = new CajaBL().findLocalCajas(this.empleado.Local); }
public frmReporteIncidencias(Empleado empleado) { InitializeComponent(); this.empleado = empleado; init(); this.FormBorderStyle = FormBorderStyle.FixedSingle; this.MaximizeBox = false; }
public frmAsignarTurnoEmpleado(Empleado empleado) { InitializeComponent(); this.empleado = empleado; this.txtEmpleado.Text = String.Format("{0} {1} {2}", empleado.Nombres, empleado.ApellidoPaterno, empleado.ApellidoMaterno); this.turnos = TurnoBL.findAll(); this.turnosEmpleado = TurnoXEmpleadoBL.findTurnoXEmpleadoAll(empleado.Id); }
public frmTomaActivo(string _Usuario, Inventario _Inventario, Parametro ubicacion, Empleado custodio) { InitializeComponent(); mUsuario = _Usuario; mInventario = _Inventario; pUbicacion = ubicacion; eCustodio = custodio; }
public frmNuevaSolicitudTransferencia(Empleado empleado) { InitializeComponent(); init(); this.empleado = empleado; this.lineas = new List<SolicitudTransferenciaLinea>(); IND_MENSAJE = Utils.Utils.REGISTRO_OK; }
public frmAjustes(Empleado empleado) { InitializeComponent(); this.empleado = empleado; init(); this.FormBorderStyle = FormBorderStyle.FixedSingle; this.MaximizeBox = false; IND_MENSAJE = Utils.Utils.MODIFICACION_OK; }
public frmRegistrarDevolucion(Empleado empleado) { InitializeComponent(); lblFechaActual.Text = DateTime.Today.ToShortDateString(); txtNroDocumento.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaNumerico); lblTienda.Text = empleado.Local.Nombre; lblEmpleado.Text = empleado.Nombres; this.empleado = empleado; }
public frmDetalleVenta(Empleado empleado) { InitializeComponent(); this.empleado = empleado; txtNumeroMedio.KeyPress += new KeyPressEventHandler(Utils.Utils.ValidaNumerico); txtMonto.KeyPress += new KeyPressEventHandler(Utils.Utils.ValidaNumerico); txtMonto.KeyPress += new KeyPressEventHandler(enterEvent); }
public frmBusquedaTransferencias(Empleado empleado, int quienMeLlama) { InitializeComponent(); this.empleado = empleado; init(); this.FormBorderStyle = FormBorderStyle.FixedSingle; this.MaximizeBox = false; Ingreso_Salida = quienMeLlama; }
public frmSolicitudes(Empleado empleado, int externo) { InitializeComponent(); this.empleado = empleado; this.NroLlamada = 0; this.SolEmitidas = null; this.SolRecepcionadas = null; this.externo = externo; }
public frmDetalleEmpleado() { InitializeComponent(); init(); empleado = new Empleado(); usuario = new Usuario(); empleado.Id = 0; IND_MENSAJE = Utils.Utils.REGISTRO_OK; }
/// <summary> /// verifica si un codigo existe en la coleccion /// </summary> /// <param name="ce"></param> /// <returns></returns> public bool existeCodigo(Empleado ce) { Boolean salida = false; foreach (Empleado c in this) { if (c.Legajo == ce.Legajo) salida = true; } return salida; }
public string Register(Empleado emp) { ServiceClient service = new ServiceClient(); service.CreateUser(emp); service.Close(); return "Se ha creado el usuario con exito"; }
public frmCerrarCaja(Empleado empleado) { InitializeComponent(); this.txtSaldoDolares.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaNumerico); this.txtSaldoSoles.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaNumerico); this.txtSaldoDolares.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaBlancos); this.txtSaldoDolares.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Utils.Utils.ValidaBlancos); this.empleado = empleado; tipoCambio = new TipoCambioBL().DameUltimo(); }
public frmIncidenciasAlmacen(Empleado empleado) { InitializeComponent(); init(); this.empleado = empleado; this.lineas = new List<string>(); this.cantidades = new List<string>(); this.listaCantidadesOC = new List<int>(); IND_MENSAJE = Utils.Utils.REGISTRO_OK; }
public frmSolicitudes(Empleado empleado, int externo) { InitializeComponent(); this.empleado = empleado; this.SolEmitidas = null; this.SolRecepcionadas = null; this.externo = externo; this.FormBorderStyle = FormBorderStyle.FixedSingle; this.MaximizeBox = false; }
public frmRegDarBaja(Empleado empleado) { InitializeComponent(); this.empleado = empleado; init(); this.FormBorderStyle = FormBorderStyle.FixedSingle; this.MaximizeBox = false; IND_MENSAJE = Utils.Utils.MODIFICACION_OK; this.articulos = new List<ArticuloXLocal>(); this.incidencias = new List<Incidencia>(); }
public void Grabar(Empleado empleado) { empleado.Estado = "Activo"; if (empleado.Id == 0) { new EmpleadoDA().Save(empleado); } else { new EmpleadoDA().Update(empleado); } }
public void DeleteEmpleado(Empleado empleado) { empleados.Remove(empleado); }
public void add(Stock stock, Empleado auditor, int cant) { connection.update(INSERT_INGRESO_STOCK, stock.sucursal_id, stock.producto_codigo, auditor.dni, cant); connection.update(UPDATE_ADD_STOCK, cant, stock.sucursal_id, stock.producto_codigo); }
static void ModificarEmpleado(Facultad F) { ConsolaHelper H = new ConsolaHelper(); Validaciones V = new Validaciones(); try { if (F.CantidadEmpleados() == 0) { throw new ListaEmpleadoVaciaException(); } else { try { string leg; bool flag = false; do { leg = H.PedirLegajoAModificar(); flag = V.ValidarLegajoEmpleado(leg); } while (!flag); try { if (F.TraerEmpleadoporLegajo(Convert.ToInt32(leg)) == null) { throw new EmpleadoInexistenteException(); } else { Empleado E = F.TraerEmpleadoporLegajo(Convert.ToInt32(leg)); H.MostrarMensaje("Nombre: " + E.Nombre + " Apellido: " + E.Apellido); bool flag2 = false; bool flag3 = false; string pedirN; string pedirA; do { H.MostrarMensaje("Ingrese el nuevo nombre o presione la tecla 'F' para saltear este paso: "); pedirN = H.PedirModificar(); flag2 = V.ValidarStringNULL(pedirN); } while (!flag2); do { H.MostrarMensaje("Ingrese el nuevo apellido o presione la tecla 'F' para saltear este paso: "); pedirA = H.PedirModificar(); flag3 = V.ValidarStringNULL(pedirA); } while (!flag3); F.ModificarEmpleado(pedirN, pedirA, Convert.ToInt32(leg)); } } catch (EmpleadoInexistenteException e) { H.MostrarMensaje(e.Message); } } catch (Exception e) { H.MostrarMensaje(e.Message); } } } catch (ListaEmpleadoVaciaException e) { H.MostrarMensaje(e.Message); } }
public bool Update(Empleado entidad) { return(repositorio.Update(entidad)); }
protected void btnEliminar_Click(object sender, EventArgs e) { try { string confirmValue = Request.Form["confirm_value"]; if (Chk_estado.Checked == false && confirmValue == "Yes") { //DepartamentoGlobal = Singleton.opdepartamento.BuscarDepartamentosPorNombre(ddlDepartamento.Text); var IdDepartamento = DepartamentoGlobal.IdDepartamento.ToString(); //RolGlobal = Singleton.oproles.BuscarRolesPorNombre(ddlRol.Text); // RolGlobal = Singleton.oproles.BuscarRolesPorNombre(ddlRol.Text); RolGlobal = Singleton.oproles.BuscarRolesPorNombre(ddlRol.Text); var IdRol = RolGlobal.IdRol.ToString(); Empleado emple = new Empleado() { Cedula = txtcedula.Text, Nombre = txtNombre.Text, Direccion = txtDireccion.Text, Telefono = txtTelefono.Text, Correo = txtCorreo.Text, EstadoCivil = txtEstadoCivil.Text, FechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text), IdDepartamento = Convert.ToInt32(IdDepartamento), IdRol = Convert.ToInt32(IdRol), Estado = Chk_estado.Checked, Bloqueado = Chk_bloqueado.Checked, Imagen = EmpleadoGlobal.Imagen, // Genero = DDLgenero.SelectedItem.ToString(), Genero = txtGenero.Text, Password = EmpleadoGlobal.Password, IntentosFallidos = Convert.ToInt32(EmpleadoGlobal.IntentosFallidos), DiasVacaciones = EmpleadoGlobal.DiasVacaciones, DiasAntesCaducidad = EmpleadoGlobal.DiasAntesCaducidad, ContraseñaCaducada = false, FechaCaducidadContraseña = EmpleadoGlobal.FechaCaducidadContraseña, FechaIngreso = EmpleadoGlobal.FechaIngreso, SesionIniciada = EmpleadoGlobal.SesionIniciada, }; Singleton.OpEmpleados.ActualizarEmpleados(emple); Empleadosmantenimiento.Visible = false; frmImg.Visible = false; mensaje.Visible = false; mensajawarning.Visible = false; mensajeError.Visible = false; mensajeinfo.Visible = true; textomensajeinfo.InnerHtml = "Usuario eliminado"; txtcedula.ReadOnly = false; txtcedula.Text = string.Empty; } else if (Chk_estado.Checked = true && confirmValue == "Yes") { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Debes desahabilitar el estado!')", true); } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Operacion Cancelada!')", true); } } catch { mensajeError.Visible = true; mensajeinfo.Visible = false; mensaje.Visible = false; textoMensajeError.InnerHtml = "Ha ocurrido un error"; } }
public static int InsertObjetoEmpleado(Empleado objEmpleado) { return(InsertDatosEmpleado(objEmpleado.fkPersona, objEmpleado.txtContraseña)); }
public NuevaVentaView(Empleado empleadoLog) { InitializeComponent(); EmpleadoLogueado = empleadoLog; }
protected void btn_añadir_Click(object sender, EventArgs e) { Empleado empleado = new Empleado(); empleado.Username = txt_username.Text; empleado.Id_codigo = long.Parse(txt_identi.Text); empleado.Telefono = long.Parse(txt_telefono.Text); empleado = new DAOEmpleado().BuscarUsername(empleado); if (long.Parse(txt_telefono.Text) <= 0 || long.Parse(txt_identi.Text) <= 0) { lb_mensaje.ForeColor = Color.Red; lb_mensaje.Text = "Ingrese numeros mayores a 0"; } else if (empleado == null) { if (txt_identi.Text != "" && txt_nombre.Text != "" && txt_apellido.Text != "" && txt_telefono.Text != "" && txt_username.Text != "" && txt_clave.Text != "") { Empleado user = new Empleado(); user.Id_codigo = long.Parse(txt_identi.Text); user.Nombre = txt_nombre.Text; user.Apellido = txt_apellido.Text; user.Telefono = long.Parse(txt_telefono.Text); user.Username = txt_username.Text; user.Clave = txt_clave.Text; user.Session = Session.SessionID.ToString(); user.LastModifify = DateTime.Now; user.Id_rol = 2; user.Estado_id = 1; new DAOEmpleado().InsertarEmpleado(user); txt_nombre.Text = string.Empty; txt_apellido.Text = string.Empty; txt_identi.Text = string.Empty; txt_telefono.Text = string.Empty; txt_username.Text = string.Empty; txt_clave.Text = string.Empty; GridView1.DataBind(); lb_mensaje.ForeColor = Color.Green; lb_mensaje.Text = "Registro Exitoso"; } else { lb_mensaje.ForeColor = Color.Red; lb_mensaje.Text = "Error Campos Vacios"; } } else if (empleado.Username == txt_username.Text) { lb_mensaje.ForeColor = Color.Red; lb_mensaje.Text = "Nombre De Usuario ya registrado"; } else if (empleado.Id_codigo == long.Parse(txt_identi.Text)) { lb_mensaje.ForeColor = Color.Red; lb_mensaje.Text = "Codigo ya registrado"; } else if (empleado.Telefono == long.Parse(txt_telefono.Text)) { lb_mensaje.ForeColor = Color.Red; lb_mensaje.Text = "Telefono ya registrado"; } else { lb_mensaje.ForeColor = Color.Red; lb_mensaje.Text = "Error campos vacios"; } }
public static void UpdateEmpleado(Empleado objEmpleado) { UpdateEmployee(objEmpleado.fkPersona, objEmpleado.txtContraseña); }
public void InsertarEmpleado(Empleado empleado) { ManajedorSQL.InsertEmpleado(empleado); }
public Task <Empleado> Remove(Empleado empleado) { throw new NotImplementedException(); }
public void update(Empleado empleado) { throw new NotImplementedException(); }
public ActionResult Crear(Empleado empleado, string listIdDepartamento) { try { if (ModelState.IsValid) { if (!Utilerias.ValidarCorreo(empleado.Correo)) { } clsEmpleado Objempleado = new clsEmpleado(); clsUsuario objUsuario = new clsUsuario(); clsBitacoraEmpleado objBitacoraEmpleado = new clsBitacoraEmpleado(); bool Resultado = Objempleado.AgregarEmpleado(empleado.IdTipoIdentificacion, empleado.Identificacion, empleado.Nombre, empleado.Apellido1, empleado.Apellido2, empleado.Direccion, empleado.fechaNacimiento, listIdDepartamento, empleado.Correo, empleado.Telefono, empleado.Provincia, empleado.Canton, empleado.Distrito, empleado.fechaEntrada, empleado.fechaSalida, empleado.Estado, true); string nombreUsuario = (string)Session["Usuario"]; int IdUsuario = objUsuario.ConsultarIdUsuario(nombreUsuario); objBitacoraEmpleado.AgregarBitacoraEmpleado(IdUsuario, nombreUsuario, DateTime.Now, empleado.IdTipoIdentificacion, empleado.Identificacion, empleado.Nombre, empleado.Apellido1, empleado.Apellido2, empleado.Direccion, empleado.fechaNacimiento, listIdDepartamento, empleado.Correo, empleado.Telefono, empleado.Provincia, empleado.Canton, empleado.Distrito, empleado.fechaEntrada, empleado.fechaSalida, empleado.Estado, true); if (Resultado) { TempData["exitoMensaje"] = "El empleado se ha insertado exitosamente."; return(RedirectToAction("Crear")); } else { clsTipoIdentificacion tiposIdentificacion = new clsTipoIdentificacion(); ViewBag.ListaSexo = new SelectList(new[] { new SelectListItem { Value = "1", Text = "Hombre" }, new SelectListItem { Value = "2", Text = "Mujer" } }, "Value", "Text"); ViewBag.ListaEstados = new SelectList(new[] { new SelectListItem { Value = "1", Text = "Activo" }, new SelectListItem { Value = "0", Text = "Inactivo" } }, "Value", "Text"); ViewBag.ListaProvincias = CargaProvincias(); ViewBag.ListaTiposIdentificacion = tiposIdentificacion.ConsultarTipoIdentificacion(); TempData["errorMensaje"] = "Se presentó un error al intentar insertar este elemento, revise que los datos coincidan con lo que especifican los campos"; clsSancion ObjSancion = new clsSancion(); ViewBag.Lista = ObjSancion.ConsultarDepartamento().ToList(); return(View("Crear")); } } else { clsTipoIdentificacion tiposIdentificacion = new clsTipoIdentificacion(); ViewBag.ListaSexo = new SelectList(new[] { new SelectListItem { Value = "H", Text = "Hombre" }, new SelectListItem { Value = "M", Text = "Mujer" } }, "Value", "Text"); ViewBag.ListaEstados = new SelectList(new[] { new SelectListItem { Value = "1", Text = "Activo" }, new SelectListItem { Value = "0", Text = "Inactivo" } }, "Value", "Text"); ViewBag.ListaProvincias = CargaProvincias(); ViewBag.ListaTiposIdentificacion = tiposIdentificacion.ConsultarTipoIdentificacion(); clsSancion ObjSancion = new clsSancion(); ViewBag.Lista = ObjSancion.ConsultarDepartamento().ToList(); return(View("Crear")); } } catch { TempData["errorMensaje"] = "Todos los campos son obligatorios."; return(View()); } }
protected LocalComercial CargarLocal() { int padron; string direccion = txtDireccion.Text; string accion = ddlAccion.SelectedValue; int precio; double tamaño; int habitacion; int baños; bool habilitacion = false; Empleado empleado = null; Zonas zona = null; if (String.IsNullOrWhiteSpace(txtLoca.Text)) { throw new ExcepcionPersonalizada("Debe indcar la localidad."); } string dep = ddlDepa.SelectedValue; string loc = txtLoca.Text; try { empleado = (Empleado)Session["USER"]; } catch { throw new ExcepcionPersonalizada("Ocurrio un problema al buscar al empleado"); } try { InterfaceLogicaZona inter = FabricaLogica.GetLogicaZona(); zona = inter.Buscar(dep, loc); if (zona == null) { throw new ExcepcionPersonalizada("Debe ingresar una zona valida."); } } catch (ExcepcionPersonalizada ex) { throw ex; } catch { throw new ExcepcionPersonalizada("Ocurrio un problema al buscar la zona"); } try { padron = Convert.ToInt32(txtPadron.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El Padron debe ser un numero entero."); } try { precio = Convert.ToInt32(txtPrecio.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El Precio debe ser un numero entero."); } try { tamaño = Convert.ToDouble(txtTamaño.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El Tamaño debe ser un numero decimal."); } try { habitacion = Convert.ToInt32(txtHabitacion.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El numero de habitaciones debe ser un numero entero."); } try { baños = Convert.ToInt32(txtBaño.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El numero de baños debe ser un numero entero."); } if (rbtnSi.Checked) { habilitacion = true; } LocalComercial local = new LocalComercial(padron, direccion, precio, accion, baños, habitacion, tamaño, habilitacion, empleado, zona); return(local); }
public bool DeshabilitarEmpleado(Empleado empleado) { DBAccess dBAccess = new DBAccess(); return(dBAccess.DeshabilitarRegistro("Empleado", "idEmpleado", empleado.IdEmpleado)); }
public void SetEmpleado(Empleado pEmpleado) { empleado = pEmpleado; }
public JsonResult InsertarEmpleado() { var empleado = new Empleado(); var insert = false; string archivo = ""; var ruta = Server.MapPath("~/Uploads/Empleado/"); try { empleado.id = Convert.ToInt32(Request.Form["Id"]); empleado.nombres = Request.Form["Nombre"]; empleado.apellidos = Request.Form["Apellido"]; empleado.direccion = Request.Form["Direccion"]; empleado.celular = Request.Form["Celular"]; empleado.tipoDocumento = Request.Form["TipoDocumento"]; empleado.documento = Request.Form["Documento"]; HttpPostedFileBase foto = Request.Files["Foto"]; if (string.IsNullOrWhiteSpace(empleado.nombres)) { return(Json(new { Success = false, Message = "Falta completar el nombre." })); } if (string.IsNullOrWhiteSpace(empleado.apellidos)) { return(Json(new { Success = false, Message = "Falta completar los apellidos." })); } if (string.IsNullOrWhiteSpace(empleado.celular)) { return(Json(new { Success = false, Message = "Falta completar el numero de celular." })); } if (empleado.id > 0) { var obtenerEmpleado = _unit.Empleado.GetEntitybyId(empleado.id); empleado.foto = obtenerEmpleado.foto; if (string.IsNullOrEmpty(obtenerEmpleado.foto)) { if (foto == null) { return(Json(new { Success = false, Message = "Falta completar la foto." })); } archivo = (DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + foto.FileName).ToLower(); empleado.foto = archivo; foto.SaveAs(ruta + archivo); } else { if (foto != null) { archivo = (DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + foto.FileName).ToLower(); empleado.foto = archivo; foto.SaveAs(ruta + archivo); if (System.IO.File.Exists(ruta + obtenerEmpleado.foto)) { System.IO.File.Delete(ruta + obtenerEmpleado.foto); } } } var result = _unit.Empleado.Update(empleado); } else { archivo = (DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + foto.FileName).ToLower(); empleado.foto = archivo; insert = Convert.ToBoolean(_unit.Empleado.Insert(empleado)); foto.SaveAs(ruta + archivo); } } catch (Exception ex) { throw new Exception(ex.Message); } return(Json(new { Success = true, Message = "Registro Exitoso" })); }
protected void btnModificar_Click(object sender, EventArgs e) { try { // DepartamentoGlobal = Singleton.opdepartamento.BuscarDepartamentosPorNombre(ddlDepartamento.Text); //DepartamentoGlobal = Singleton.opdepartamento.BuscarDepartamentosPorNombre(ddlDepartamento.Text); DepartamentoGlobal = Singleton.opdepartamento.BuscarDepartamentosPorNombre(ddlDepartamento.Text); var IdDepartamento = DepartamentoGlobal.IdDepartamento.ToString(); EmpleadoGlobal = Singleton.OpEmpleados.BuscarEmpleados(txtcedula.Text); // DESMADRE DE MARCOS bool bloqueoOrigen = EmpleadoGlobal.Bloqueado; //RolGlobal = Singleton.oproles.BuscarRolesPorNombre(ddlRol.Text); //RolGlobal = Singleton.oproles.BuscarRolesPorNombre(ddlRol.Text); RolGlobal = Singleton.oproles.BuscarRolesPorNombre(ddlRol.Text); var IdRol = RolGlobal.IdRol.ToString(); //string nombrearchivo = Path.GetFileName(fileUpload1.FileName); //fileUpload1.SaveAs(Server.MapPath("~/Empleados/" + nombrearchivo)); if (Chk_bloqueado.Checked == bloqueoOrigen) { Empleado emple = new Empleado() { Cedula = txtcedula.Text, Nombre = txtNombre.Text, Direccion = txtDireccion.Text, Telefono = txtTelefono.Text, Correo = txtCorreo.Text, // EstadoCivil = DddlEstadoCivil.SelectedItem.ToString(), EstadoCivil = txtEstadoCivil.Text, FechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text), IdDepartamento = Convert.ToInt32(IdDepartamento), IdRol = Convert.ToInt32(IdRol), Estado = Chk_estado.Checked, Imagen = EmpleadoGlobal.Imagen, Bloqueado = Chk_bloqueado.Checked, // Genero = DDLgenero.SelectedItem.ToString(), Genero = txtGenero.Text, Password = EmpleadoGlobal.Password, IntentosFallidos = EmpleadoGlobal.IntentosFallidos, DiasVacaciones = EmpleadoGlobal.DiasVacaciones, DiasAntesCaducidad = EmpleadoGlobal.DiasAntesCaducidad, ContraseñaCaducada = false, FechaCaducidadContraseña = EmpleadoGlobal.FechaCaducidadContraseña, FechaIngreso = EmpleadoGlobal.FechaIngreso, SesionIniciada = EmpleadoGlobal.SesionIniciada }; Singleton.OpEmpleados.ActualizarEmpleados(emple); Singleton.opaudi.InsertarAuditoriasAdmin(Login.EmpleadoGlobal.Nombre, Login.EmpleadoGlobal.Cedula, false, false, false, false, false, true, false, false, false, false, false, false, false, false); Empleadosmantenimiento.Visible = false; frmImg.Visible = false; mensajeinfo.Visible = false; mensaje.Visible = false; mensajeError.Visible = false; mensajawarning.Visible = true; textomensajewarning.InnerHtml = "La cuenta ha sido actualizada"; txtcedula.ReadOnly = false; txtcedula.Focus(); txtcedula.Text = string.Empty; } else if (/*bloqueoOrigen != Chk_bloqueado.Checked &&*/ bloqueoOrigen == true && Chk_bloqueado.Checked == false) { Empleado emple = new Empleado() { Cedula = txtcedula.Text, Nombre = txtNombre.Text, Direccion = txtDireccion.Text, Telefono = txtTelefono.Text, Correo = txtCorreo.Text, EstadoCivil = txtEstadoCivil.Text, FechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text), IdDepartamento = Convert.ToInt32(IdDepartamento), IdRol = Convert.ToInt32(IdRol), Estado = Chk_estado.Checked, Bloqueado = false, Imagen = EmpleadoGlobal.Imagen, //Genero = DDLgenero.SelectedItem.ToString(), Genero = txtGenero.Text, Password = EmpleadoGlobal.Password, IntentosFallidos = 0, DiasVacaciones = EmpleadoGlobal.DiasVacaciones, DiasAntesCaducidad = EmpleadoGlobal.DiasAntesCaducidad, ContraseñaCaducada = false, FechaCaducidadContraseña = EmpleadoGlobal.FechaCaducidadContraseña, FechaIngreso = EmpleadoGlobal.FechaIngreso, SesionIniciada = EmpleadoGlobal.SesionIniciada, }; Singleton.OpEmpleados.ActualizarEmpleados(emple); Singleton.opaudi.InsertarAuditoriasAdmin(Login.EmpleadoGlobal.Nombre, Login.EmpleadoGlobal.Cedula, false, false, false, false, false, true, false, false, false, false, false, false, false, false); Empleadosmantenimiento.Visible = false; frmImg.Visible = false; mensajeinfo.Visible = false; mensaje.Visible = false; mensajeError.Visible = false; mensajawarning.Visible = true; textomensajewarning.InnerHtml = "La cuenta ha sido desbloqueada"; txtcedula.ReadOnly = false; txtcedula.Focus(); txtcedula.Text = string.Empty; } else if (bloqueoOrigen == false && Chk_bloqueado.Checked == true) { Empleado emple = new Empleado() { Cedula = txtcedula.Text, Nombre = txtNombre.Text, Direccion = txtDireccion.Text, Telefono = txtTelefono.Text, Correo = txtCorreo.Text, EstadoCivil = txtEstadoCivil.Text, FechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text), IdDepartamento = Convert.ToInt32(IdDepartamento), IdRol = Convert.ToInt32(IdRol), Estado = Chk_estado.Checked, Bloqueado = true, Imagen = EmpleadoGlobal.Imagen, // Genero = DDLgenero.SelectedItem.ToString(), Genero = txtGenero.Text, Password = EmpleadoGlobal.Password, IntentosFallidos = 4, DiasVacaciones = EmpleadoGlobal.DiasVacaciones, DiasAntesCaducidad = EmpleadoGlobal.DiasAntesCaducidad, ContraseñaCaducada = false, FechaCaducidadContraseña = EmpleadoGlobal.FechaCaducidadContraseña, FechaIngreso = EmpleadoGlobal.FechaIngreso, SesionIniciada = EmpleadoGlobal.SesionIniciada, }; Singleton.OpEmpleados.ActualizarEmpleados(emple); Singleton.opaudi.InsertarAuditoriasAdmin(Login.EmpleadoGlobal.Nombre, Login.EmpleadoGlobal.Cedula, false, false, false, false, false, true, false, false, false, false, false, false, false, false); Empleadosmantenimiento.Visible = false; frmImg.Visible = false; mensajeinfo.Visible = false; mensaje.Visible = false; mensajeError.Visible = false; mensajawarning.Visible = true; textomensajewarning.InnerHtml = "La cuenta ha sido bloqueada"; txtcedula.ReadOnly = false; txtcedula.Focus(); txtcedula.Text = string.Empty; } else { Empleado emple = new Empleado() { Cedula = txtcedula.Text, Nombre = txtNombre.Text, Direccion = txtDireccion.Text, Telefono = txtTelefono.Text, Correo = txtCorreo.Text, EstadoCivil = txtEstadoCivil.Text, FechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text), IdDepartamento = Convert.ToInt32(IdDepartamento), IdRol = Convert.ToInt32(IdRol), Estado = Chk_estado.Checked, Imagen = EmpleadoGlobal.Imagen, Bloqueado = EmpleadoGlobal.Bloqueado, // Genero = DDLgenero.SelectedItem.ToString(), Genero = txtGenero.Text, Password = EmpleadoGlobal.Password, IntentosFallidos = EmpleadoGlobal.IntentosFallidos, DiasVacaciones = EmpleadoGlobal.DiasVacaciones, DiasAntesCaducidad = EmpleadoGlobal.DiasAntesCaducidad, ContraseñaCaducada = false, FechaCaducidadContraseña = EmpleadoGlobal.FechaCaducidadContraseña, FechaIngreso = EmpleadoGlobal.FechaIngreso, SesionIniciada = EmpleadoGlobal.SesionIniciada, }; Singleton.OpEmpleados.ActualizarEmpleados(emple); Empleadosmantenimiento.Visible = false; Singleton.opaudi.InsertarAuditoriasAdmin(Login.EmpleadoGlobal.Nombre, Login.EmpleadoGlobal.Cedula, false, false, false, false, false, true, false, false, false, false, false, false, false, false); frmImg.Visible = false; mensajeinfo.Visible = false; mensaje.Visible = false; mensajeError.Visible = false; mensajawarning.Visible = true; textomensajewarning.InnerHtml = "La cuenta ha sido actualizada"; txtcedula.ReadOnly = false; txtcedula.Focus(); txtcedula.Text = string.Empty; } } catch { mensajeError.Visible = true; mensajeinfo.Visible = false; mensaje.Visible = false; textoMensajeError.InnerHtml = "Ha ocurrido un error"; } }
//Metodo BuscarEmpleado public bool BuscarEmpleado(Empleado objEmpleado) { return(objEmpleadoDAO.BuscarEmpleado(objEmpleado)); }
protected void Buscar(object sender, EventArgs e) { divDatos.Visible = false; divMecanico.Visible = false; btnTaller.Visible = false; btnEntregar.Visible = false; String query = stringBusqueda.Text.Trim(); if (!String.IsNullOrEmpty(query)) { using (var db = new Entities1()) { int nOrden; Ordene orden = null; if (Int32.TryParse(query, out nOrden)) { orden = db.Ordenes.Where(x => x.Id == nOrden).FirstOrDefault(); } else { orden = db.Ordenes.Where(x => x.Vehiculo.patente == query).OrderByDescending(x => x.Id).FirstOrDefault(); } if (orden != null) { txtId.Text = orden.Id.ToString("000000"); txtPatente.Text = orden.Vehiculo.patente; txtXCliente.Text = orden.Cliente.apellido + " " + orden.Cliente.nombre; txtDni.Text = orden.Cliente.dni; divDatos.Visible = true; int ultimoEstado = orden.OrdenesEstados.OrderByDescending(x => x.fecha).First().Estado.Id; switch (ultimoEstado) { case 1: //es presupuesto btnTaller.Visible = true; btnEntregar.Visible = false; divMecanico.Visible = true; using (var context = new Entities1()) { List <Empleado> mecanicos = new List <Empleado>(); foreach (var user in context.AspNetUsers) { if (user.AspNetRoles.Any(x => x.Name == "Mecanico")) { List <Ordene> ordenesMecanico = context.Ordenes.Where(x => x.mecanico_id == user.Id).ToList(); bool ocupado = false; foreach (var o in ordenesMecanico) { List <OrdenesEstado> estados = o.OrdenesEstados.OrderByDescending(x => x.fecha).ToList(); Estado ue = estados.FirstOrDefault().Estado; if (ue.Id == 2 || ue.Id == 3) { ocupado = true; } } if (!ocupado) { Empleado emp = context.Empleados.Where(x => x.usuario_id == user.Id).FirstOrDefault(); if (emp != null) { mecanicos.Add(emp); } } } } ddMecanicos.DataSource = mecanicos; ddMecanicos.DataBind(); } break; case 2: //esta asignada lblMessage.Text = "La orden fue asignada y pronto estará en proceso"; break; case 3: //esta en proceso lblMessage.Text = "La orden esta en proceso"; break; case 4: //esta finalizada lblMessage.Text = "La orden se encuentra en proceso de pago"; break; case 5: //esta abonada btnEntregar.Visible = true; btnTaller.Visible = false; break; case 6: //esta retirada lblMessage.Text = "El vehiculo ya fue entregado"; break; default: lblMessage.Text = "Lo sentimos, algo salió mal."; break; } } else { lblMessage.Text = "No se encontró una orden."; } } } }
public static void LimiteSueldoEmpleado(Empleado e, float s) { Console.WriteLine("El empleado " + e.Nombre + " con legajo " + e.Legajo.ToString() + " se le asigno el sueldo " + s.ToString()); }
public bool Create(Empleado entidad) { return(repositorio.Create(entidad)); }
protected void Operar(object sender, EventArgs e) { int ordenID; if (Int32.TryParse(txtId.Text, out ordenID)) { using (var db = new Entities1()) { Ordene orden = db.Ordenes.Where(x => x.Id == ordenID).FirstOrDefault(); if (orden != null) { Button btn = (Button)sender; if (btn.ID == btnEntregar.ID) { OrdenesEstado oe = new OrdenesEstado(); oe.fecha = DateTime.Now; oe.estado_id = 6; oe.usuario_id = User.Identity.GetUserId(); orden.OrdenesEstados.Add(oe); db.SaveChanges(); lblMessage.Text = "Operacion exitosa."; } else { if (ddMecanicos.SelectedIndex > 0) { bool falta = false; foreach (OrdenesServicio os in orden.OrdenesServicios) { int idServicio = os.servicio_id.Value; if (Falta_Producto(idServicio, 1)) { falta = true; } } if (!falta) { OrdenesEstado oe = new OrdenesEstado(); oe.estado_id = 2; oe.fecha = DateTime.Now; oe.usuario_id = User.Identity.GetUserId(); orden.OrdenesEstados.Add(oe); int idEmpleado = Int32.Parse(ddMecanicos.SelectedValue); Empleado emp = db.Empleados.Where(x => x.Id == idEmpleado).FirstOrDefault(); orden.mecanico_id = emp.usuario_id; db.SaveChanges(); lblMessage.Text = "Orden enviada a taller"; } else { lblMessage.Text = "Hay faltante de productos"; } } else { lblMessage.Text = "Debe seleccionar un mecanico."; } } } else { lblMessage.Text = "Algo salio mal, lo sentimos."; } } } else { lblMessage.Text = "No hay una orden seleccionada"; } }
public Produccion(Empleado X) { Empleado = X; InitializeComponent(); }
public LineaConNumeroYEmpleadoSpecification(int numeroOrden, Empleado empleado) : base(x => x.Numero == numeroOrden && x.Empleado == empleado) { AddInclude(x => x.OrdenesDeProduccion); AddInclude(x => x.Empleado); }
public async Task <IActionResult> Detalle(int id) { SolicitudViatico sol = new SolicitudViatico(); ListaEmpleadoViewModel empleado = new ListaEmpleadoViewModel(); List <ItinerarioViatico> lista = new List <ItinerarioViatico>(); try { if (id.ToString() != null) { var respuestaSolicitudViatico = await apiServicio.SeleccionarAsync <Response>(id.ToString(), new Uri(WebApp.BaseAddress), "api/SolicitudViaticos"); if (respuestaSolicitudViatico.IsSuccess) { var solicitudViaticoViewModel = new SolicitudViaticoViewModel(); sol = JsonConvert.DeserializeObject <SolicitudViatico>(respuestaSolicitudViatico.Resultado.ToString()); var solicitudViatico = new SolicitudViatico { IdEmpleado = sol.IdEmpleado, }; var respuestaEmpleado = await apiServicio.SeleccionarAsync <Response>(solicitudViatico.IdEmpleado.ToString(), new Uri(WebApp.BaseAddress), "api/Empleados"); if (respuestaEmpleado.IsSuccess) { var emp = JsonConvert.DeserializeObject <Empleado>(respuestaEmpleado.Resultado.ToString()); var empleadoEnviar = new Empleado { NombreUsuario = emp.NombreUsuario, }; empleado = await apiServicio.ObtenerElementoAsync1 <ListaEmpleadoViewModel>(empleadoEnviar, new Uri(WebApp.BaseAddress), "api/Empleados/ObtenerDatosCompletosEmpleado"); lista = new List <ItinerarioViatico>(); var itinerarioViatico = new ItinerarioViatico { IdSolicitudViatico = sol.IdSolicitudViatico }; lista = await apiServicio.ObtenerElementoAsync1 <List <ItinerarioViatico> >(itinerarioViatico, new Uri(WebApp.BaseAddress) , "api/ItinerarioViatico/ListarItinerariosViaticos"); if (lista.Count != 0) { solicitudViaticoViewModel.SolicitudViatico = sol; solicitudViaticoViewModel.ListaEmpleadoViewModel = empleado; solicitudViaticoViewModel.ItinerarioViatico = lista; } else { //return this.Redireccionar("SolicitudViaticosTH", "ListadoEmpleadosSolicitudViaticos", $"{Mensaje.ErrorItinerario}"); return(this.RedireccionarMensajeTime("SolicitudViaticosTH", "DetalleSolicitudViaticos", new { id = sol.IdEmpleado }, $"{Mensaje.ErrorItinerario}|{"25000"}")); } } return(View(solicitudViaticoViewModel)); } } return(BadRequest()); } catch (Exception) { return(BadRequest()); } }
public void ModificarEmpleado(Empleado empleado) { ManajedorSQL.UpdateEmpleado(empleado); }
public void llenarControles() { daoEmpleado = new DaoEmpleado(); daoEstado = new DaoEstado(); elemento = new Empleado(); Municipio elementoMunicipio = new Municipio(); Asentamiento elementoAsentamiento = new Asentamiento(); Conexion.abrirConexion(); elemento = daoEmpleado.consultarUno(id); if (elemento != null) { txtClave.Text = elemento.Clave.ToString(); // elemento.Estatus = Convert.ToChar(tx); if (elemento.Estatus == 1) { rdActivo.Checked = true; } else { rdInactivo.Checked = true; } if (elemento.Sexo == 1) { rdMasculino.Checked = true; } else { rdFemenino.Checked = true; } txtCURP.Text = elemento.CURP; txtNombre.Text = elemento.Nombre; txtApellidos.Text = elemento.Apellidos; txtTelefono.Text = elemento.Numero; dtFecha.Value = DateTime.Parse(elemento.Fecha); txtCalleNumero.Text = elemento.CalleNumero; //Obtener el estado y municipio daoEstado = new DaoEstado(); daoMunicipio = new DaoMunicipio(); daoAsentamiento = new DaoAsentamiento(); elementoMunicipio = daoMunicipio.consultarUno(Convert.ToInt32(elemento.Municipio)); cmbEstado.SelectedIndex = elementoMunicipio.Estado; cargarMunicipios(Convert.ToInt32(elementoMunicipio.Estado), "", "Editar"); cmbMunicipio.SelectedItem = elementoMunicipio.Nombre; //Obtener el asentamiento cargarAsentamientos(elementoMunicipio.Nombre); elementoAsentamiento = daoAsentamiento.consultarUno(elemento.Asentamiento); cmbAsentamiento.SelectedItem = elementoAsentamiento.Nombre; } Conexion.cerrarConexion(); }
public void EliminarEmpleado(Empleado empleado) { ManajedorSQL.DeleteEmpleado(empleado); }
//string strConnString = ConfigurationManager.ConnectionStrings["SISTEM_ALIADOSConnectionString"].ConnectionString; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["UserSessionEmpleado"] != null) { Empleado objEmpeado = (Empleado)Session["UserSessionEmpleado"]; lblNombreUSer.Text = objEmpeado.Nombre; } } //if (!Page.IsPostBack)//si hay un fifetente de postback //{ // Page.MaintainScrollPositionOnPostBack = true; //} //try //{ // //SESSION DE USUARIO CAPTURA // if (Session["User"] != null) // { // Dashboard.Visible = false; // catalogos.Visible = true; // //divElectoral.Visible = false; // Busqueda.Visible = false; // string NumEmpleado = Session["User"].ToString(); // //DateTime Hoy = DateTime.Today; // //string fecha_actualMaster = Hoy.ToString("dd/MM/yyyy HH:mm:ss"); // //SqlConnection connection = new SqlConnection(); // string NomCom = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // //SqlCommand cmd = new SqlCommand(NomCom, connection); // //SqlDataReader registro = cmd.ExecuteReader(); // //lblNombreUSer.Text = registro["empleadoCom"].ToString(); // //lblNombreUSer.Text = ConexionBD(NomCom, ); // using (SqlConnection conn = new SqlConnection(strConnString)) // { // string sql = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // SqlCommand command = new SqlCommand(sql, conn); // conn.Open(); // SqlDataReader registro = command.ExecuteReader(); // if (registro.Read()) // { // lblNombreUSer.Text = registro["empleadoCom"].ToString(); // } // } // } // else if (Session["Admin"] != null) // { // string NumEmpleado = Session["Admin"].ToString().Trim(); // string NomCom = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // using (SqlConnection conn = new SqlConnection(strConnString)) // { // string sql = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // SqlCommand command = new SqlCommand(sql, conn); // conn.Open(); // SqlDataReader registro = command.ExecuteReader(); // if (registro.Read()) // { // lblNombreUSer.Text = registro["empleadoCom"].ToString(); // } // } // } // /*SESION DISTRITAL*/ // else if (Session["User1"] != null) // { // Dashboard.Visible = false; // catalogos.Visible = true; // //divElectoral.Visible = true; // M_Distrito.Visible = false; // Busqueda.Visible = false; // M_Seccion.Visible = false; // M_Manzana.Visible = false; // string NumEmpleado = Session["User1"].ToString().Trim(); // string NomCom = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // using (SqlConnection conn = new SqlConnection(strConnString)) // { // string sql = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // SqlCommand command = new SqlCommand(sql, conn); // conn.Open(); // SqlDataReader registro = command.ExecuteReader(); // if (registro.Read()) // { // lblNombreUSer.Text = registro["empleadoCom"].ToString(); // } // } // } // /*SESION REGIONAL*/ // else if (Session["User2"] != null) // { // Dashboard.Visible = false; // catalogos.Visible = true; // //divElectoral.Visible = true; // Busqueda.Visible = false; // M_Region.Visible = false; // M_Distrito.Visible = false; // M_Manzana.Visible = false; // string NumEmpleado = Session["User2"].ToString().Trim(); // string NomCom = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // using (SqlConnection conn = new SqlConnection(strConnString)) // { // string sql = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // SqlCommand command = new SqlCommand(sql, conn); // conn.Open(); // SqlDataReader registro = command.ExecuteReader(); // if (registro.Read()) // { // lblNombreUSer.Text = registro["empleadoCom"].ToString(); // } // } // } // /*SESION SECCIONAL*/ // else if (Session["User3"] != null) // { // Dashboard.Visible = false; // catalogos.Visible = true; // //divElectoral.Visible = true; // Busqueda.Visible = false; // M_Distrito.Visible = false; // M_Region.Visible = false; // string NumEmpleado = Session["User3"].ToString().Trim(); // string NomCom = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // using (SqlConnection conn = new SqlConnection(strConnString)) // { // string sql = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // SqlCommand command = new SqlCommand(sql, conn); // conn.Open(); // SqlDataReader registro = command.ExecuteReader(); // if (registro.Read()) // { // lblNombreUSer.Text = registro["empleadoCom"].ToString(); // } // } // } // /*SESION MANZANERO*/ // else if (Session["User4"] != null) // { // Dashboard.Visible = false; // catalogos.Visible = true; // //divElectoral.Visible = true; // Busqueda.Visible = false; // M_Distrito.Visible = false; // M_Seccion.Visible = false; // M_Seccion.Visible = false; // M_Manzana.Visible = false; // string NumEmpleado = Session["User4"].ToString().Trim(); // string NomCom = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // using (SqlConnection conn = new SqlConnection(strConnString)) // { // string sql = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // SqlCommand command = new SqlCommand(sql, conn); // conn.Open(); // SqlDataReader registro = command.ExecuteReader(); // if (registro.Read()) // { // lblNombreUSer.Text = registro["empleadoCom"].ToString(); // } // } // } // else if (Session["Datos"] != null) // { // string NumEmpleado = Session["Datos"].ToString().Trim(); // string NomCom = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // using (SqlConnection conn = new SqlConnection(strConnString)) // { // string sql = "select CONCAT(nom_Empleado,' ', Ape_PatEmpleado,' ', Ape_MatEmpleado) as empleadoCom from tblEmpleado where num_empleado=" + "'" + NumEmpleado + "'"; // SqlCommand command = new SqlCommand(sql, conn); // conn.Open(); // SqlDataReader registro = command.ExecuteReader(); // if (registro.Read()) // { // lblNombreUSer.Text = registro["empleadoCom"].ToString(); // } // } // } // else // { // Response.Redirect("Index.aspx"); // } //} //catch //{ // Response.Redirect("Index.aspx"); //} }