public ActionResult Empleado(int idEmpleado) { if (!ValidarSesion()) { Session.Add("Mensaje", "Sesion no se encuentra iniciada."); return(RedirectToAction("Intranet", "Home")); } if (idEmpleado > 0) { EmpleadoService empleadoService = new EmpleadoService(); Empleado empleado = new Empleado(); if (empleadoService.ObtenerEmpleado(idEmpleado, out empleado)) { ModelState.Clear(); ViewBag.boton = "Modificar"; return(View(empleado)); } } if (idEmpleado == 0) { ViewBag.boton = "Guardar"; return(View()); } Session.Add("Mensaje", "Error la mostrar información del empleado seleccionado"); return(RedirectToAction("Empleados", "Admin")); }
public frmEmpleados() { InitializeComponent(); chkTodos.Checked = true; InitializeDataGridView(); oEmpleadoService = new EmpleadoService(); }
public MenuVeterinarioFrm() { var connectionString = ConfigurationManager.ConnectionStrings["ConnectionRochety"].ConnectionString; empleadoService = new EmpleadoService(connectionString); InitializeComponent(); }
// GET: Cliente //-------------------------Mostrar todos------------------------- public ActionResult _MostrarTodos() { List <Client> listaClientes = ClienteService.ObtenerListaClientes(); List <Empleado> listaEmpleados = EmpleadoService.ObtenerListaEmpleados(); List <InterfaceGanancias> listaGanancias = new List <InterfaceGanancias>(); Afip afip = new Afip(); // TODO borar porque esta el alta del cliente //if (listaClientes.Count == 0) { Client c = new Client(); c.Dni = "12345678"; c.Name = "Cliente"; c.Gastos = 50; c.Ventas = 100; c.Ganancias = c.ObtenerGanancias(); ClienteService.Agregar(c); Empleado e = new Empleado(); e.Legajo = "87654321"; e.Name = "Empleado"; e.Salario = 100; e.Ganancias = c.ObtenerGanancias(); EmpleadoService.Agregar(e); listaGanancias.AddRange(listaEmpleados); listaGanancias.AddRange(listaClientes); decimal recaudTotal = afip.CalcRecaudacionTtl(listaGanancias); ViewBag.RecTotal = recaudTotal; //return View(listaClientes); return(View(listaGanancias)); }
public void Setup() { var options = new DbContextOptionsBuilder <CreditoContext>().UseSqlServer("Server=localhost;Database=AcmeLtda;Trusted_Connection=True;MultipleActiveResultSets=true").Options; context = new CreditoContext(options); unitOfWork = new UnitOfWork(context); service = new EmpleadoService(unitOfWork); }
public RegistrarVeterinarioFrm() { var connectionString = ConfigurationManager.ConnectionStrings["desktop-2hfrprb"].ConnectionString; EmpleadoService = new EmpleadoService(connectionString); InitializeComponent(); }
public frmEmpleados() { InitializeComponent(); InitializeDataGridView(); empleado = new EmpleadoService(); rol = new RolService(); sexo = new SexoService(); }
/** * Método para cargar todos los Empleados de la base * **/ public void allEmpleado() { clS = new EmpleadoService(); dtgEmpleados.DataSource = clS.allEmpleado(); cmbRol.DisplayMember = "nombreRol"; cmbRol.ValueMember = "idRolUsuario"; cmbRol.DataSource = new RolUsuarioServices().allSucursales(); }
private void CrearEmpleado() { empleadoService = new EmpleadoService(unitOfWork); var requestEmpleado = new CrearEmpleadoRequest { Cedula = "1065840833", Nombre = "Duvan", Salario = 1200000 }; empleadoService.CrearEmpleado(requestEmpleado); }
public EmpleadoCrear() { InitializeComponent(); _empleadoService = new EmpleadoService(); _tandaLaborService = new TandaLaborService(); DateTime today = DateTime.Today; lblEmpleadoIngreso.Text = today.ToString("dd/MM/yyyy"); }
public SolicitudesPendientesView() { InitializeComponent(); _solicitudPendienteService = new SolicitudPendienteService(); _candidatoService = new CandidatoService(); _empleadoService = new EmpleadoService(); _solicitudes = new List <SolicitudPendiente>(); _empleados = new List <Empleado>(); }
private void PictureBox1_Click(object sender, EventArgs e) { Empleado empleado = MapearEmpleado(); EmpleadoService service = new EmpleadoService(); string mensaje = service.Guardar(empleado); MessageBox.Show(mensaje, "Mensaje de Guardado", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); Limpiar(); }
//No se utilizan por el momento. //private MarcaService Smarca; //private ModeloService Smodelo; public frmDetallesOT() { InitializeComponent(); InitializeDataGridView(); empleadoS = new EmpleadoService(); montoTrabajo = 0; //No se utilizan por el momento //Smarca = new MarcaService(); //Smodelo = new ModeloService(); }
public void RegistrarEmpleadoTest() { var request = new CrearEmpleadoRequest { Cedula = "98032461204", Nombre = "Duvan", Salario = 1200000 }; EmpleadoService _service = new EmpleadoService(new UnitOfWork(_context)); var response = _service.CrearEmpleado(request); Assert.AreEqual($"Se registro con exito el empleado Duvan.", response.Mensaje); }
public void RegistrarEmpleadoRepetidoTest() { var request = new CrearEmpleadoRequest { Cedula = "1065840833", Nombre = "Duvan", Salario = 1200000 }; EmpleadoService _service = new EmpleadoService(new UnitOfWork(_context)); _service.CrearEmpleado(request); var response = _service.CrearEmpleado(request); Assert.AreEqual($"El empleado con numero de cedula 1065840833 ya se encuentra registrado", response.Mensaje); }
public Inspeccionar() { InitializeComponent(); _inspeccionService = new InspeccionService(); _clienteService = new ClienteService(); _vehiculoService = new VehiculoService(); _empleadoService = new EmpleadoService(); _context = new ApplicationDbContext(); DateTime today = DateTime.Today; lblInspecFechaActual.Text = today.ToString("dd/MM/yyyy"); lblInspecEmpConectado.Text = InicioSesion.ConectedUser; }
public frmTransaccion() { InitializeComponent(); grdDetalle.AutoGenerateColumns = false; transaccionService = new TransaccionService(); clienteService = new ClienteService(); prendaService = new PrendaService(); empleadoService = new EmpleadoService(); listaFacturaDetalle = new BindingList <VentaDetalle>(); }
public ActionResult Guardar(Empleado empleado) { EmpleadoService empleadoService = new EmpleadoService(); if (empleadoService.RegistrarEmpleado(empleado)) { Session.Add("Mensaje", "Datos registrados Exitosamente"); } else { Session.Add("Mensaje", "Error al modificar los, favor reintente más tarde o contáctese al +56 9 8554 7132"); } return(RedirectToAction("Empleados", "Admin")); }
public List <EpleadoViewModel> empleadosViewModel() { var empleados = new EmpleadoService().GetEmpleados(); List <EpleadoViewModel> empleadosViewModel = new List <EpleadoViewModel>(); foreach (var item in empleados) { empleadosViewModel.Add(new EpleadoViewModel { Legajo = item.Legajo, Nombre = item.Nombre }); } return(empleadosViewModel); }
public ActionResult Ingresar(Empleado empleado) { EmpleadoService empleadoService = new EmpleadoService(); if (empleadoService.AutenticarEmpleado(empleado)) { if (empleadoService.ObtenerEmpleado(empleado.Correo, out empleado)) { Session.Add("Empleado", empleado); } Session["Mensaje"] = null; return(PanelAdmin()); } Session.Add("Mensaje", "Error al validar usuario o clave."); return(RedirectToAction("Intranet", "Home")); }
public ActionResult Modificar(Empleado empleado, string accion) { if (accion.Equals("Modificar")) { EmpleadoService empleadoService = new EmpleadoService(); if (empleadoService.ModificarEmpleado(empleado)) { Session.Add("Mensaje", "Datos modificados Exitosamente"); } else { Session.Add("Mensaje", "Error al modificar los, favor reintente más tarde o contáctese al +56 9 8554 7132"); } return(RedirectToAction("Empleados", "Admin")); } return(Guardar(empleado)); }
public void SetUp() { /*var optionsSqlServer = new DbContextOptionsBuilder<BancoContext>() * .UseSqlServer("Server=.\\;Database=Banco;Trusted_Connection=True;MultipleActiveResultSets=true") * .Options;*/ var optionsInMemory = new DbContextOptionsBuilder <LibranzasContext>().UseInMemoryDatabase("Libranzas").Options; _context = new LibranzasContext(optionsInMemory); unitOfWork = new UnitOfWork(_context); crearEmpleadoService = new EmpleadoService(unitOfWork); var request = new CrearEmpleadoRequest { Cedula = "1065840833", Nombre = "Duvan", Salario = 1200000 }; crearEmpleadoService.CrearEmpleado(request); crearCreditoService = new CreditoService(unitOfWork); }
public IEnumerable <EmpleadoViewModel> GetAllEmpleados() { var empleadoDtoList = new EmpleadoService().GetEmpleados(""); viewModelList = new List <EmpleadoViewModel>(); foreach (EmpleadoDto item in empleadoDtoList) { viewModelList.Add( new EmpleadoViewModel { Legajo = item.Legajo, NombreEmpleado = item.NombreEmpleado, TarjetaRFID = item.TarjetaRFID, NombreSeccion = item.NombreSeccion }); } return(viewModelList); }
private void BtnGuardar_Click(object sender, EventArgs e) { try { EmpleadoService ServicoEmpleado = new EmpleadoService(); Identificacion = TxtIdentificacion.Text; Nombre = TxtNombre.Text; Apellido = TxtApellido.Text; HorasTrabajadas = Convert.ToDecimal(TxtHorasTrabajadas.Text); ValorHorasTrabajadas = Convert.ToDecimal(TxtValorHorasTrabajadas.Text); Empleado Empleado = new EmpleadoContratista(Identificacion, Nombre, Apellido, HorasTrabajadas, ValorHorasTrabajadas); string Resultado = ServicoEmpleado.Guardar(Empleado); MessageBox.Show(Resultado, "Resultado de guardar", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Verifique los datosdigitados: " + ex.Message, "Error en los datos", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult Empleados() { if (!ValidarSesion()) { Session.Add("Mensaje", "Sesion no se encuentra iniciada."); return(RedirectToAction("Intranet", "Home")); } EmpleadoService empleadoService = new EmpleadoService(); List <Empleado> listaEmpleados = new List <Empleado>(); if (empleadoService.ListarEmpleados(out listaEmpleados)) { ViewBag.Message = (string)Session["Mensaje"]; Session["Mensaje"] = null; return(View(listaEmpleados)); } Session.Add("Mensaje", "Error la mostrar información de los empleados"); return(RedirectToAction("PanelAdmin", "Admin")); }
private void BtnEliminar_Click(object sender, EventArgs e) { if (this.txtLegajo.Text.Length == 0) { lblError.ForeColor = Color.DarkRed; lblError.Text = "Error: Seleccione al menos una fila."; timerError.Enabled = true; } else { Empleado oEmpleado = new Empleado(); EmpleadoService oEmpleadoService = new EmpleadoService(); oEmpleado.Legajo = Convert.ToInt32(this.txtLegajo.Text); oEmpleadoService.EliminarEmpleado(oEmpleado); lblError.ForeColor = Color.DarkRed; lblError.Text = "Usuario " + oEmpleado.Legajo + " eliminado con exito"; timerError.Enabled = true; this.Limpiar(); this.CargarGrilla(); } }
public EmpleadoController(EmpleadoService serv) { _serv = serv; }
static void Main(string[] args) { int opcion,horasTrabajadas; string identificacion,nombre; double sueldoPorHora; ConsoleKeyInfo op; List<Empleado> EmpleadoLista = new List<Empleado>(); EmpleadoService Empleadoservicio = new EmpleadoService(); EmpleadoService.EmpleadoDTO empleadoDTO = new EmpleadoService.EmpleadoDTO(); do { Console.WriteLine("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°"); Console.WriteLine("°** MENU DE OPCIONES ** °"); Console.WriteLine("°1. Guardar °"); Console.WriteLine("°2. Buscar por identificacion°"); Console.WriteLine("°3. Consultar °"); Console.WriteLine("°4. Eliminar °"); Console.WriteLine("°5. Modificar °"); Console.WriteLine("°6. Salir °"); Console.WriteLine("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°"); opcion = Convert.ToInt16(Console.ReadLine()); switch (opcion) { case 1: try { do { Console.Clear(); Console.WriteLine("Digite identificacion del Empleado"); empleadoDTO.Identificacion = Console.ReadLine(); Console.WriteLine("Digite el Nombre del empleado: "); empleadoDTO.Nombre = Console.ReadLine(); Console.WriteLine("Digite El Sueldo por Hora del Empleado"); empleadoDTO.SueldoPorHora = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Digite las Horas trabajadas del Empleado"); empleadoDTO.HorasTrabajadas = Convert.ToInt16(Console.ReadLine()); Console.WriteLine(Empleadoservicio.Guardar(Empleadoservicio.CrearEmpleado(empleadoDTO))); Console.WriteLine("Desea Continuar S/N"); op = Console.ReadKey(); Console.Clear(); } while (op.Key == ConsoleKey.S); } catch (Exception) { Console.WriteLine(); } break; case 2: // BUSCRA ID Console.Clear(); try { Respuesta respuesta; Console.WriteLine("Ingrese el codigo que desea buscar"); identificacion = Console.ReadLine(); respuesta = Empleadoservicio.Buscar(identificacion); Console.WriteLine(respuesta.Mensaje); Console.WriteLine(respuesta.Empleado.ToString()); Console.WriteLine(); } catch (Exception ) { Console.WriteLine(); } break; case 3: // CONSULTAR Console.Clear(); foreach (var item in Empleadoservicio.Consultar()) { Console.WriteLine(item.ToString()); } break; case 4: //ELIMINAR Console.Clear(); try { Respuesta respuesta = new Respuesta(); Console.WriteLine("Digite identificacion del empleado a eliminar: "); identificacion = Console.ReadLine(); respuesta=Empleadoservicio.Buscar(identificacion); Console.WriteLine(Empleadoservicio.Eliminar(respuesta.Empleado)); } catch (Exception ) { } break; case 5: try { Respuesta respuesta = new Respuesta(); Console.Clear(); Console.WriteLine("Digite identificacion del empleado a modificar: "); identificacion = Console.ReadLine(); respuesta=Empleadoservicio.Buscar(identificacion); if (respuesta.Empleado==null) { Console.WriteLine(respuesta.Mensaje); } else { Console.Write("Digite nueva identificacion: "); identificacion = Console.ReadLine(); empleadoDTO.Identificacion = identificacion; Console.Write("Digite nuevo nombre: "); nombre = Console.ReadLine(); empleadoDTO.Nombre = nombre; Console.Write("Digite sueldo por hora: "); sueldoPorHora = Convert.ToDouble(Console.ReadLine()); empleadoDTO.SueldoPorHora = sueldoPorHora; Console.Write("Digite horas trabajadas: "); horasTrabajadas = Convert.ToInt16(Console.ReadLine()); empleadoDTO.HorasTrabajadas = horasTrabajadas; Empleado empleadoNuevo = Empleadoservicio.CrearEmpleado(empleadoDTO); Empleado empleadoViejo = respuesta.Empleado; Empleadoservicio.Modificar(empleadoNuevo, empleadoViejo); } // Empleadoservicio.CrearEmpleado(empleadoDTO); } catch (Exception) { } break; case 6: Console.WriteLine("Pulse enter para salir"); break; } } while (opcion < 6); Console.ReadKey(); }
public EmpleadoController(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; _service = new EmpleadoService(_unitOfWork); }
public InicioSesion() { InitializeComponent(); _empleadoService = new EmpleadoService(); _context = new ApplicationDbContext(); }