public frmHorarioCadastro(Operacao _operacao, AppDataContext con, Funcionario _funcionario) { InitializeComponent(); operacao = _operacao; funcionario = _funcionario; servico = new HorarioService(con); }
public FuncionariosController(PontoSimplesContext context, FuncionarioService funcionarioService, SetorService setorService, HorarioService horarioService) { //_context = context; _funcionarioService = funcionarioService; _setorService = setorService; _horarioService = horarioService; }
private void btnAceptar_Click(object sender, EventArgs e) { try { validarEntidad(); HorarioService s = new HorarioService(); if (this.horario.Id != 0) { s.Update(horario); } else { s.Insert(horario); } CommonHelper.ShowInfo("Horario guardado con éxito."); this.DialogResult = DialogResult.OK; } catch (WarningException ex) { CommonHelper.ShowWarning(ex.Message); } catch (Exception ex) { CommonHelper.ShowError(ex.Message); } }
private void btnAsignarHorario_Click(object sender, EventArgs e) { try { validarHorario(); HorarioService s = new HorarioService(); var aux = s.GetAll().Find(x => x.HoraInicio == horario.HoraInicio && x.HoraFin == horario.HoraFin && x.DiaSemana == horario.DiaSemana); if (aux == null) { horario.Id = s.Insert(horario); } else { horario = aux; } new ComisionService().AsignarHorario(comision.Id, horario.Id); cargarGrilla(); } catch (WarningException ex) { CommonHelper.ShowWarning(ex.Message); } catch (Exception ex) { CommonHelper.ShowError(ex.Message); } }
public void Confirmar() { horarioService = new HorarioService(context); horarioExpediente = new HorarioExpediente(); DateTime dateIni = dtDataIni.Value.Date; DateTime dateFim = dtDataFim.Value.Date; DataTable tabela = horarioService.GetHorarioXml(dateIni, dateFim); if (tabela.Rows.Count != 0) { SaveFileDialog saveFile = new SaveFileDialog(); saveFile.FileName = NomeArquivo(); saveFile.ShowDialog(); if (gerarXml(tabela, saveFile.FileName)) { MetroFramework.MetroMessageBox.Show(this, "Arquivo gerado com sucesso", "Sucesso!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Question); } else { MetroFramework.MetroMessageBox.Show(this, "O Arquivo não foi gerado, entrar em contato com o suporte.", "Erro!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand); } } else { MetroFramework.MetroMessageBox.Show(this, "Não há informações nesse período", "Atençaõ!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } }
/// <summary> /// Carrega os services para manipular os dados no banco de dados. /// </summary> static void carregaServices() { string ConnectionString_Desenvolvimento = "mongodb://127.0.0.1:27017/?readPreference=primary&ssl=false"; agendamentodb = new AgendamentoService(new DatabaseSettings() { DatabaseName = "agendamento", ConnectionString = ConnectionString_Desenvolvimento, Agendamento = "agendamento" }); reservadb = new ReservaService(new DatabaseSettings() { DatabaseName = "agendamento", ConnectionString = ConnectionString_Desenvolvimento, Reserva = "reserva" }); horariodb = new HorarioService(new DatabaseSettings() { DatabaseName = "agendamento", ConnectionString = ConnectionString_Desenvolvimento, Horario = "horario" }); }
public frmHorarios(AppDataContext con) { InitializeComponent(); txtCPF.CustomButton.Click += new EventHandler(txtCPF_Click); validate = new ValidateCPF_CNPJ(); context = con; funcionario = new Funcionario(); servico = new HorarioService(context); horarioExpediente = new HorarioExpediente(); }
public HorariosViewModel(string dia, int grupo) { Horarios = new ObservableCollection <Horario>(); _dialogService = new DialogService(); hora = new HorarioService(); _dia = dia; _grupo = grupo; LoadHorarios(_dia, _grupo); isRefreshing = false; }
public AppointmentController() { Title = "Agendas"; PersonaService = new PersonaService(); horarioService = new HorarioService(); EmpresaService = new EmpresaService(); UsuarioService = new UsuarioService(); TipoIdentificacionService = new TipoIdentificacionService(); agendaService = new AgendaService(); EntityService = new AppointmentService(); }
public void LerXml(string caminho) { servicoHorario = new HorarioService(context); servicoFuncionario = new FuncionarioService(context); XmlDocument doc = new XmlDocument(); doc.Load(caminho); XmlNodeList xmlHorarios = doc.GetElementsByTagName("Horarios"); //Usando for para imprimir na tela for (int x = 0; x < xmlHorarios.Count; x++) { HorarioExpediente horarioExpediente = new HorarioExpediente(); //Preenchendo Objeto. horarioExpediente.Funcionario.Id = int.Parse(xmlHorarios[x]["IdFuncionario"].InnerText); horarioExpediente.Funcionario.Nome = xmlHorarios[x]["NomeFuncionario"].InnerText; horarioExpediente.Funcionario.CPF = xmlHorarios[x]["CPFFuncionario"].InnerText; horarioExpediente.Data = Convert.ToDateTime(xmlHorarios[x]["Data"].InnerText); horarioExpediente.Entrada = Convert.ToDateTime(xmlHorarios[x]["Entrada"].InnerText); horarioExpediente.Saida = Convert.ToDateTime(xmlHorarios[x]["Saida"].InnerText); if (servicoFuncionario.GetFuncionarioCPFExiste(horarioExpediente.Funcionario.CPF)) { if (servicoHorario.GetHorarioArquivo(horarioExpediente.Funcionario.CPF, horarioExpediente.Data, horarioExpediente.Entrada)) { servicoHorario.Insert(horarioExpediente); } else { MetroFramework.MetroMessageBox.Show(this, "Esse arquivo já foi processado no sistema.", "Atenção!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand); return; } } else { MetroFramework.MetroMessageBox.Show(this, "O Funcionário: " + horarioExpediente.Funcionario.Nome.ToString() + ", " + "com CPF: " + horarioExpediente.Funcionario.Nome.ToString() + " não está cadastrado no banco principal, cadastre e leia o arquivo novamente", "Atenção!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand); return; } } MetroFramework.MetroMessageBox.Show(this, "O arquivo foi processado com sucesso.", "Processado com sucesso!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Question); }
private void validarEntidad() { string errores = ""; if (dtpHoraInicio.Text.Trim() == "" || dtpHoraFin.Text.Trim() == "") { errores += "Debe completar todos los campos" + Environment.NewLine; } if (cmbDia.SelectedItem == null) { errores += "Debe seleccionar un día" + Environment.NewLine; } if (errores != "") { throw new WarningException(errores); } if (horario == null) { horario = new Horario(); } horario.HoraInicio = dtpHoraInicio.Value.TimeOfDay; horario.HoraFin = dtpHoraFin.Value.TimeOfDay; horario.DiaSemana = (DiaDeLaSemana)cmbDia.SelectedItem; HorarioService s = new HorarioService(); var horarios = s.GetAll().FindAll(x => x.Deshabilitado == false); foreach (var Horario in horarios) { if (Horario.Id != horario.Id) { if (Horario.HoraInicio == horario.HoraInicio && Horario.HoraFin == horario.HoraFin && Horario.DiaSemana == horario.DiaSemana) { throw new WarningException("Ya existe un horario con los mismos datos."); } } } }
private void cargarGrilla() { HorarioService s = new HorarioService(); try { Horarios = s.GetAll(); dgvGrilla.DataSource = Horarios.FindAll(x => x.Deshabilitado == false); dgvGrilla.Columns["Id"].HeaderText = "Código"; dgvGrilla.Columns["HoraInicio"].HeaderText = "Hora de inicio"; dgvGrilla.Columns["HoraFin"].HeaderText = "Hora de fin"; dgvGrilla.Columns["DiaSemana"].HeaderText = "Día de la semana"; dgvGrilla.Columns["Deshabilitado"].Visible = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEliminar_Click(object sender, EventArgs e) { if (!CommonHelper.SeleccionoRegistro(dgvGrilla)) { return; } if (!CommonHelper.Confirma()) { return; } try { HorarioService s = new HorarioService(); Horario entidad = (Horario)dgvGrilla.SelectedRows[0].DataBoundItem; s.Delete(entidad.Id); cargarGrilla(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//public HorariosController(PontoSimplesContext context) //{ // _context = context; //} public HorariosController(PontoSimplesContext context, HorarioService horarioService) { _context = context; _horarioService = horarioService; }
public HorarioAppService(HorarioService horarioService) : base(horarioService) { _horarioService = horarioService; }
public void OnComplete(object Capture, string ReaderSerialNumber, Sample Sample) { this.Invoke(new Function(delegate() { this.imgDigital.Enabled = true; })); this.Invoke(new Function(delegate() { this.Cursor = Cursors.WaitCursor; })); sp.ConvertToPicture(Sample, ref img); FuncionarioService funServ = new FuncionarioService(context); funcionarios = new List <Funcionario>(); funcionarios = funServ.GetFuncionarios(); byte[] bytes = Sample.Bytes; Process(Sample); if (impressaoLocalizada) { if (funcionario != null) { if (funcionario.Id == 0) { return; } if ((impressaoLocalizada) && (funcionarioAnterior != null)) { if (funcionarioAnterior.Id == 0) { impressaoLocalizada = false; } if (funcionario.Id == funcionarioAnterior.Id) { HorarioExpediente horarioExpediente = new HorarioExpediente(); HorarioService serviceHorario = new HorarioService(context); horarioExpediente.Data = DateTime.Now.Date; HorarioExpediente ultimoHorario = serviceHorario.GetLastHorario(funcionario.Id); horarioExpediente.Funcionario = funcionario; if (ultimoHorario == null) { horarioExpediente.Entrada = DateTime.Now; horarioExpediente.Saida = new DateTime(); serviceHorario.Insert(horarioExpediente); updateStatus("Horário de entrada lançado com sucesso..."); } else { if ((ultimoHorario.Entrada != DateTime.MinValue) && (ultimoHorario.Saida == DateTime.MinValue)) { ultimoHorario.Saida = DateTime.Now; serviceHorario.Update(ultimoHorario); updateStatus("Horário de saída lançado com sucesso..."); } else { horarioExpediente.Entrada = DateTime.Now; horarioExpediente.Saida = new DateTime(); serviceHorario.Insert(horarioExpediente); updateStatus("Horário de entrada lançado com sucesso..."); } } funcionario = new Funcionario(); funcionarioAnterior = funcionario; this.Invoke(new Function(delegate() { limparTela(); })); cp.StopCapture(); cp = new DPFP.Capture.Capture(); cp.StartCapture(); cp.EventHandler = this; } } if ((impressaoLocalizada == false) || (funcionarioAnterior == null)) { PreencherTela(); updateStatus("Impressão digital localizada. \nPara efetuar o lançamento do ponto e coloque novamente o mesmo dedo no leitor."); funcionarioAnterior = funcionario; impressaoLocalizada = true; } else { impressaoLocalizada = false; } } else { updateStatus("Impressão digital não localizada. \nTente novamente."); funcionarioAnterior = null; impressaoLocalizada = false; } } else { funcionario = new Funcionario(); funcionarioAnterior = funcionario; this.Invoke(new Function(delegate() { limparTela(); })); cp.StopCapture(); cp = new DPFP.Capture.Capture(); cp.StartCapture(); cp.EventHandler = this; this.Invoke(new Function(delegate() { limparTela(); })); } this.Invoke(new Function(delegate() { this.Cursor = Cursors.Default; })); this.Invoke(new Function(delegate() { this.imgDigital.Enabled = false; })); }