public IHttpActionResult PostPAT(PAT pAT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PAT.Add(pAT); try { db.SaveChanges(); } catch (DbUpdateException) { if (PATExists(pAT.SindicatoCod, pAT.CargaHoraria)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = pAT.CargaHoraria }, new PATDTO(pAT))); }
/// <summary> /// Wertet eine SI Tabelle aus. /// </summary> /// <param name="pat"></param> private void OnPATFound(PAT pat) { // At least count it Interlocked.Increment(ref m_ValidPATCount); // Disabled if (m_WaitForService == 0) { return; } // Nothing more to do in PMT mode if (m_WaitForPID != 0) { return; } // Try to find the PID of the service ushort pmtPID; if (pat.ProgramIdentifier.TryGetValue(m_WaitForService, out pmtPID) && (pmtPID != 0)) { // Can wait m_WaitForPID = pmtPID; } else { // Disable m_WaitForService = 0; } }
/// <summary> /// Scan for the first non-empty PAT, and use it to read the PID for the PMT table. /// </summary> /// <returns>PID of PMT</returns> private int DecodePAT() { int pmt_pid = -1; foreach (var pat_pkt in Packets[0]) { PAT pat = new PAT(pat_pkt.payload); int rq_count = 1; if (pat.Map.ContainsKey(0)) { rq_count++; } if (pat.Map.Count < rq_count) { continue; // doesn't contain a non-network PID. } pmt_pid = pat.Map.First(a => a.Key != 0).Value; } if (pmt_pid < 1 || !Packets.ContainsKey(pmt_pid)) { throw new DemuxException("PAT refered to a PID that was not in the stream"); } return(pmt_pid); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { PAT patValue = (PAT)value; string errorString = string.Empty; if (!(string.IsNullOrEmpty(patValue.PAT5) || patValue.PAT5 == "D8")) { errorString = "PAT05 should only be D8 "; } errorString += ValidateElement.GetValidation(patValue.PAT6, Element.Situational, 1, 35, "PAT06"); if (!(string.IsNullOrEmpty(patValue.PAT7) || patValue.PAT7 == "01")) { errorString += "PAT07 should only be 01 "; } errorString += ValidateElement.GetValidation(patValue.PAT8, Element.Situational, 1, 10, "PAT08"); if (!(string.IsNullOrEmpty(patValue.PAT9) || patValue.PAT9 == "Y")) { errorString += "PAT09 should only be Y "; } if (errorString == string.Empty) { return(null); } return(new ValidationResult(errorString)); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { PAT patValue = (PAT)value; string ErrorString = string.Empty; if (!(patValue.PAT1 == "01" || patValue.PAT1 == "19" || patValue.PAT1 == "20" || patValue.PAT1 == "21" || patValue.PAT1 == "39" || patValue.PAT1 == "40" || patValue.PAT1 == "G8")) { ErrorString = "PAT01 should be 01,19,20,21,39,40,G8 "; } if (!(patValue.PAT5 == "D8" || string.IsNullOrEmpty(patValue.PAT5))) { ErrorString += "PAT05 should be D8"; } if (!(patValue.PAT7 == "01" || string.IsNullOrEmpty(patValue.PAT7))) { ErrorString += "PAT07 should be 01"; } if (!(patValue.PAT9 == "Y" || string.IsNullOrEmpty(patValue.PAT9))) { ErrorString += "PAT09 should be Y"; } ErrorString += ValidateElement.GetValidation(patValue.PAT6, Element.Situational, 1, 35, "PAT06") + ValidateElement.GetValidation(patValue.PAT8, Element.Situational, 1, 10, "PAT08"); if (ErrorString == string.Empty) { return(null); } return(new ValidationResult(ErrorString)); }
public IHttpActionResult PutPAT(int sindicatoCod, int cargaHoraria, PAT pAT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (cargaHoraria != pAT.CargaHoraria || sindicatoCod != pAT.SindicatoCod) { return(BadRequest()); } db.Entry(pAT).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PATExists(sindicatoCod, cargaHoraria)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public PATDTO(PAT p) { if (p == null) { return; } CargaHoraria = p.CargaHoraria; Valor = p.Valor; SindicatoCod = p.SindicatoCod; }
public IHttpActionResult GetPAT(int sindicatoCod, int cargaHoraria) { PAT pAT = db.PAT.Find(cargaHoraria, sindicatoCod); if (pAT == null) { return(NotFound()); } return(Ok(new PATDTO(pAT))); }
public PATDTO(PAT p) { if (p == null) { return; } CargaHoraria = p.CargaHoraria; Valor = p.Valor; SindicatoCod = p.SindicatoCod; if (p.Sindicato != null) { NomeSindicato = p.Sindicato.NomeSindicato; } }
public IHttpActionResult DeletePAT(int sindicatoCod, int cargaHoraria) { PAT pAT = db.PAT.Find(cargaHoraria, sindicatoCod); if (pAT == null) { return(NotFound()); } PATDTO p = new PATDTO(pAT); db.PAT.Remove(pAT); db.SaveChanges(); return(Ok(p)); }
public IHttpActionResult EditPAT(PAT PAT) { if (PAT == null) { return(BadRequest("pat object cannot be found the http request body")); } try { PAT.CreatedDate = DateTime.Now; jobsService.EditPAT(PAT); var pats = jobsService.GetJobPATs(PAT.JobId); var html = Helpers.RenderPartial("~/Views/Shared/Partial/Jobs/PATs.cshtml", pats); return(Ok(html)); } catch (Exception ex) { return(InternalServerError(ex)); } }
/// <summary> /// Verarbeitet die Liste der Dienste auf dem aktuellen Transportstrom. /// </summary> /// <param name="table">Die Liste der Dienste.</param> private void ProcessAssociationTable(PAT table) { // Count m_patProcessed++; // Remember m_lastPAT = table; // Read the mapping var mapping = new HashSet <ushort>(table.Services); // Reset foreach (var terminated in m_lastPMTs.Keys.Where(key => !mapping.Contains(key)).ToArray()) { m_parser.RemoveFilter(terminated); } // Add foreach (var active in mapping.Where(key => !m_lastPMTs.ContainsKey(key))) { Register <PMT>(table[active].Value, ProcessMappingTable); } }
public IHttpActionResult PostPAT(PAT PAT) { if (PAT == null) { return(BadRequest("pat object cannot be found the http request body")); } try { PAT.CreatedDate = DateTime.Now; var id = jobsService.InsertPAT(PAT); var projectTaskId = jobsService.GetJob(PAT.JobId).ProjectTaskId; if (projectTaskId != null) { projectsService.FinishTaskPercentage((int)projectTaskId); } var inspectors = authService.GetInspectorUsers().ToList(); Notification.Email(inspectors, NotificationObjectType.PAT, PAT); Notification.System(inspectors, NotificationObjectType.PAT, User.UserId, Url.Link("JobDetails", new { id = PAT.JobId }), PAT); //Notification.OnEmailNotification += (a1, a2) => //{ // return new EmailStatus(); //}; // Log.Inforamtion(Type.Sql, "log title", "log body") // Log.Error(Type.Sql, "log title", "log body") // Log.Warning(Type.Csv, "log title", "log text") var pats = jobsService.GetJobPATs(PAT.JobId); var html = Helpers.RenderPartial("~/Views/Shared/Partial/Jobs/PATs.cshtml", pats); return(Ok(html)); } catch (Exception ex) { return(InternalServerError(ex)); } }
/// <summary> /// Scan for the first non-empty PAT, and use it to read the PID for the PMT table. /// </summary> /// <returns>PID of PMT</returns> private int DecodePAT() { int pmt_pid = -1; foreach (var pat_pkt in Packets[0]) { PAT pat = new PAT(pat_pkt.payload); int rq_count = 1; if (pat.Map.ContainsKey(0)) rq_count++; if (pat.Map.Count < rq_count) continue; // doesn't contain a non-network PID. pmt_pid = pat.Map.First(a => a.Key != 0).Value; } if (pmt_pid < 1 || !Packets.ContainsKey(pmt_pid)) { throw new DemuxException("PAT refered to a PID that was not in the stream"); } return pmt_pid; }
//Para cáculo de DSR, necessita-se da qtda de dias úteis e não úteis em cada mês. //Para isso, usa-se a tabela QtdaDias, que tem associada à ela uma escala de trabalho. //Foi criada a escala 1 (Dias úteis) e 2 (Dias não úteis) para esse cálculo public static IEnumerable <CalculoEventoContratacao> CalculaContratacaoCiclo(Contratacao cont, Ciclo ciclo) { Contexto db = new Contexto(); if (cont == null || ciclo == null) { return(null); } List <CalculoEventoContratacao> lista = new List <CalculoEventoContratacao>(); PAT pat = db.PAT.Find(cont.CargaHoraria, cont.Filial.SindicatoCod); ConvenioMed conveMed = null; ConvenioOdo convOdo = null; Encargos encargos = db.Encargos.Find(cont.EmpresaCod); EscalaTrabalho diasUteis = db.EscalaTrabalho.Find(1), diasNaoUteis = db.EscalaTrabalho.Find(2); float salario = 0, salarioBase = cont.Salario, valorConvMed = 0, valorDep = 0, valorConvOdo = 0; float valorPasse = db.Cidade.Find(cont.CidadeNome).VTPasse, valorPat = pat.Valor, peric = 0; float adCondutor = (float)(salarioBase * 0.1), vtDescontado = 0, somaHEs = 0, somaHNs = 0, baseEncargos = 0; int qtdaPasses = db.CargaHoraria.Find(cont.CargaHoraria).QtdaPassesDiario; if (cont.ConvenioPlanoCod != null) { conveMed = db.ConvenioMed.Find(cont.ConvenioPlanoCod); valorConvMed = (float)conveMed.Valor; valorDep = (float)conveMed.ValorDependentes; } if (cont.ConvenioOdoCod != null) { convOdo = db.ConvenioOdo.Find(cont.ConvenioOdoCod); valorConvOdo = convOdo.Valor; } foreach (MesOrcamento mes in ciclo.MesesOrcamento) { int numAno = mes.Mes.Year, numMes = mes.Mes.Month; int qtda = db.ContratacaoMes.Find(cont.Codigo, mes.Codigo).Qtda; int qtdaDias = db.QtdaDias.Find(numMes, cont.CodEscala).Qtda; QtdaDias qtDiasObj = db.QtdaDias.Find(numMes, diasUteis.Codigo); int qtdaDiasUteis = qtDiasObj == null ? 22 : qtDiasObj.Qtda; qtDiasObj = db.QtdaDias.Find(numMes, diasNaoUteis.Codigo); int qtdaDiasNaoUteis = qtDiasObj == null ? 8 : qtDiasObj.Qtda; //Horas Extras List <HEContratacao> hes = db.HEContratacao .Where(x => x.ContratacaoCod == cont.Codigo && x.CodMesOrcamento == mes.Codigo) .ToList(); //Horas Noturnas List <AdNoturnoContratacao> hns = db.AdNoturnoContratacao .Where(x => x.CodContratacao == cont.Codigo && x.CodMesOrcamento == mes.Codigo) .ToList(); //**************** REAJUSTES **************** Reajuste reajSalario = db.Reajuste.Find(numAno, numMes, cont.Filial.SindicatoCod); if (reajSalario != null) { salarioBase *= (float)(reajSalario.PercentualReajuste + 1); peric = (float)(salarioBase * 0.3); adCondutor = (float)(salarioBase * 0.1); salario = salarioBase; } if (conveMed != null) { ReajConvenioMed reajConvMed = db.ReajConvenioMed.Find(numAno, numMes, cont.ConvenioPlanoCod); if (reajConvMed != null) { valorConvMed *= (float)(reajConvMed.PercentualReajuste + 1); } } if (convOdo != null) { ReajConvenioOdo reajConvenioOdo = db.ReajConvenioOdo.Find(numAno, cont.ConvenioOdoCod, numMes); if (reajConvenioOdo != null) { valorConvOdo *= (reajConvenioOdo.PercentualReajuste + 1); } } ReajPAT reajPAT = db.ReajPAT.Find(numAno, numMes, cont.Filial.SindicatoCod); if (reajPAT != null) { valorPat *= (reajPAT.PercentualReajuste + 1); } ReajVTPasse reajPasse = db.ReajVTPasse.Find(numAno, cont.CidadeNome, numMes); if (reajPasse != null) { valorPasse *= (float)(reajPasse.PercentualReajuste + 1); } //****************** Cálculos ****************** if (qtda > 0) { //********************** SALÁRIOS E ADICIONAIS ********************** lista.Add(new CalculoEventoContratacao { CodEvento = "SALARIO", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = salario }); if (cont.Periculosidade) { lista.Add(new CalculoEventoContratacao { CodEvento = "PERICUL", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = peric }); } if (cont.AdCondutor) { lista.Add(new CalculoEventoContratacao { CodEvento = "ADI-COND", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = adCondutor }); } somaHEs = 0; hes.ForEach(x => { somaHEs += salario / cont.CargaHoraria * x.QtdaHoras * x.PercentualHoras / 100; lista.Add(new CalculoEventoContratacao { CodEvento = "HE-" + x.PercentualHoras.ToString(), CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = somaHEs }); }); somaHNs = 0; hns.ForEach(x => { somaHNs = salario / x.PercentualHoras / 100 / cont.CargaHoraria * x.QtdaHoras; lista.Add(new CalculoEventoContratacao { CodEvento = "AD-N-" + x.PercentualHoras.ToString(), CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = somaHNs }); }); //************************** BENEFÍCIOS ************************** vtDescontado = (valorPasse * qtdaDias) - (float)(salarioBase * 0.6); if (vtDescontado > 0) { lista.Add(new CalculoEventoContratacao { CodEvento = "VT-PASSE", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = vtDescontado }); } lista.Add(new CalculoEventoContratacao { CodEvento = "PAT", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = valorPat * pat.Percentual }); lista.Add(new CalculoEventoContratacao { CodEvento = "CONV-MED", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = valorConvMed }); lista.Add(new CalculoEventoContratacao { CodEvento = "CONV-ODO", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = valorConvOdo }); //************************** ENCARGOS ************************** baseEncargos = salario + (cont.Periculosidade ? peric : 0) + (cont.AdCondutor ? adCondutor : 0) + somaHEs + somaHNs; lista.Add(new CalculoEventoContratacao { CodEvento = "INSS", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = baseEncargos * encargos.INSS }); lista.Add(new CalculoEventoContratacao { CodEvento = "INCRA", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = baseEncargos * encargos.INCRA }); lista.Add(new CalculoEventoContratacao { CodEvento = "SAL-EDU", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = baseEncargos * encargos.SalEducacao }); lista.Add(new CalculoEventoContratacao { CodEvento = "SEBRAE", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = baseEncargos * encargos.Sebrae }); lista.Add(new CalculoEventoContratacao { CodEvento = "SESI", CodContratacao = cont.Codigo, CodMesOrcamento = mes.Codigo, Valor = baseEncargos * encargos.SESI }); } } return(lista); }
public int InsertPAT(PAT pAT) { var res = pATRepository.Insert(pAT.AutoMapObject <PAT, DB.PAT>()); return(res.PATId); }
public void EditPAT(PAT pAT) { var original = pATRepository.GetById(b => b.PATId == pAT.PATId); pATRepository.Update(original, pAT.AutoMapObject <PAT, DB.PAT>()); }
//O valor do Convênio Médico e do Convênio Odontológico será um valor aberto, na base. //As premissas serão somente para novas contratações public static IEnumerable <CalculoEventoBase> CalculaFuncionarioCiclo(Funcionario func, Ciclo ciclo) { Contexto db = new Contexto(); List <CalculoEventoBase> lista = new List <CalculoEventoBase>(); PAT pat = db.PAT.Find(func.CargaHoraria, func.SindicatoCod); if (pat == null) { throw new PATNaoCadastradaException(); } Encargos encargos = db.Encargos.Find(func.EmpresaCod); if (encargos == null) { throw new EncargosNaoEncontradosException(); } //db.Database.ExecuteSqlCommand("insert into CalculoEventoBase (CodEvento, MatriculaFuncionario, CodMesOrcamento, Valor) select CodEvento, MatriculaFuncionario, CodMesOrcamento, Valor from ValoresAbertosBase a inner join MesOrcamento b on a.CodMesOrcamento = b.Codigo where MatriculaFuncionario = {0} and b.CicloCod = {1}", func.Matricula, ciclo.Codigo); float baseEncargos = 0; float somaHEs, somaHNs; float salario = func.Salario, salarioBase = func.Salario; float valorConvMed = func.ValorConvMedico; float valorConvOdo = func.ValorConvOdontologico; float passe = func.Filial.Cidade.VTPasse; float frete = func.Filial.Cidade.VTFretadoValor; int qtdaPasses = db.CargaHoraria.Find(func.CargaHoraria).QtdaPassesDiario; foreach (MesOrcamento m in ciclo.MesesOrcamento) { int ano = m.Mes.Year, mes = m.Mes.Month; int qtdaDias = db.QtdaDias.Find(mes, func.CodEscalaTrabalho).Qtda; //Reajustes Reajuste reajSal = db.Reajuste.Find(ano, mes, func.SindicatoCod); ReajConvenioMed reajMed = db.ReajConvenioMed.Find(ano, mes, func.ConvenioMedCod); ReajConvenioOdo reajOdo = db.ReajConvenioOdo.Find(ano, func.CodConvenioOdo, mes); ReajVTFretado reajVTFretado = db.ReajVTFretado.Find(ano, func.CidadeNome, mes); ReajVTPasse reajVTPasse = db.ReajVTPasse.Find(ano, func.CidadeNome, mes); if (reajSal != null) { salarioBase *= (float)(reajSal.PercentualReajuste + 1); if (salarioBase < reajSal.PisoSalarial) { salarioBase = reajSal.PisoSalarial; } } if (reajMed != null) { valorConvMed *= (float)(reajMed.PercentualReajuste + 1); } if (reajOdo != null) { valorConvOdo *= (reajOdo.PercentualReajuste + 1); } if (reajVTFretado != null) { frete *= (float)(reajVTFretado.PercentualReajuste + 1); } if (reajVTPasse != null) { passe *= (float)(reajVTPasse.PercentualReajuste + 1); } //Horas Extras List <HEBase> hes = db.HEBase .Where(x => x.FuncionarioMatricula == func.Matricula && x.CodMesOrcamento == m.Codigo) .ToList(); //Horas Noturnas List <AdNoturnoBase> hns = db.AdNoturnoBase .Where(x => x.FuncionarioMatricula == func.Matricula && x.CodMesOrcamento == m.Codigo) .ToList(); FuncionarioFerias ferias = func.FuncionarioFerias.Where(x => x.CodMesOrcamento == m.Codigo).FirstOrDefault(); if (ferias == null) { salario = salarioBase; } else { salario = salarioBase * (30 - ferias.QtdaDias) / 30; //Encontra salário proporcional aos dias trabalhados } // ********************** SALÁRIOS E ADICIONAIS ********************** CalculoEventoBase calculoSalario = new CalculoEventoBase { CodEvento = "SALARIO", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = salario }; lista.Add(calculoSalario); CalculoEventoBase calculoPeric = new CalculoEventoBase { Valor = 0 }; if (func.Periculosidade) { calculoPeric.CodEvento = "PERICUL"; calculoPeric.MatriculaFuncionario = func.Matricula; calculoPeric.CodMesOrcamento = m.Codigo; calculoPeric.Valor = (float)(salario * 0.3); lista.Add(calculoPeric); } CalculoEventoBase calculoAdCondutor = new CalculoEventoBase { Valor = 0 }; if (func.AdCondutor) { calculoAdCondutor.CodEvento = "ADI-COND"; calculoAdCondutor.MatriculaFuncionario = func.Matricula; calculoAdCondutor.CodMesOrcamento = m.Codigo; calculoAdCondutor.Valor = (float)(salario * 0.1); lista.Add(calculoAdCondutor); } somaHEs = 0; hes.ForEach(x => { somaHEs += salario / func.CargaHoraria * x.QtdaHoras * x.PercentualHoras / 100; lista.Add(new CalculoEventoBase { CodEvento = "HE-" + x.PercentualHoras.ToString(), MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = somaHEs }); }); somaHNs = 0; hns.ForEach(x => { somaHNs = salario / x.PercentualHoras / 100 / func.CargaHoraria * x.QtdaHoras; lista.Add(new CalculoEventoBase { CodEvento = "AD-N-" + x.PercentualHoras.ToString(), MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = somaHNs }); }); //BASE DE ENCARGOS baseEncargos = calculoSalario.Valor + calculoPeric.Valor + calculoAdCondutor.Valor + somaHEs + somaHNs; // ********************** BENEFÍCIOS ********************** float vtDescontado = 0; if (func.VTFretadoFlag) { vtDescontado = frete - (float)(salarioBase * 0.6); if (vtDescontado > 0) { lista.Add(new CalculoEventoBase { CodEvento = "VT-FRETE", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = vtDescontado }); } } else { vtDescontado = (passe * qtdaDias) - (float)(salarioBase * 0.6); if (vtDescontado > 0) { lista.Add(new CalculoEventoBase { CodEvento = "VT-PASSE", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = vtDescontado }); } } lista.Add(new CalculoEventoBase { CodEvento = "PAT", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = pat.Valor * pat.Percentual }); lista.Add(new CalculoEventoBase { CodEvento = "AUX-CRE", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = func.AuxCreche }); lista.Add(new CalculoEventoBase { CodEvento = "PREV-PRI", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = func.PrevidenciaPrivada }); lista.Add(new CalculoEventoBase { CodEvento = "CONV-MED", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = func.ValorConvMedico }); lista.Add(new CalculoEventoBase { CodEvento = "CONV-ODO", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = func.ValorConvOdontologico }); // ********************** ENCARGOS ********************** lista.Add(new CalculoEventoBase { CodEvento = "INSS", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = baseEncargos * encargos.INSS }); lista.Add(new CalculoEventoBase { CodEvento = "INCRA", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = baseEncargos * encargos.INCRA }); lista.Add(new CalculoEventoBase { CodEvento = "SAL-EDU", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = baseEncargos * encargos.SalEducacao }); lista.Add(new CalculoEventoBase { CodEvento = "SENAI", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = baseEncargos * encargos.Senai }); lista.Add(new CalculoEventoBase { CodEvento = "SEBRAE", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = baseEncargos * encargos.Sebrae }); lista.Add(new CalculoEventoBase { CodEvento = "SESI", MatriculaFuncionario = func.Matricula, CodMesOrcamento = m.Codigo, Valor = baseEncargos * encargos.SESI }); } return(lista); }
/// <summary> /// Versucht, aus der aktuellen <i>Program Access Table</i> das Programm des /// eingehenden Transport Streams zu ermitteln. /// </summary> /// <remarks> /// Nur das erste Programm wird berücksichtigt. /// </remarks> /// <param name="pat">Eine SI Tabelle.</param> private void ProcessPAT(Section pat) { // Not active if (!IsRunning) { return; } // Validate if (!pat.IsValid) { return; } // Attach to table PAT table = pat.Table as PAT; // Validate if (null == table) { return; } if (!table.IsValid) { return; } if (null == table.ProgramIdentifier) { return; } // Get the first IEnumerator <KeyValuePair <ushort, ushort> > programEnum = table.ProgramIdentifier.GetEnumerator(); if (!programEnum.MoveNext()) { return; } // Compare current PMT if (m_CurrentPMT == programEnum.Current.Value) { return; } // Remove the audio names m_AudioNames = new string[0]; // Stop current PMT if (0 != m_CurrentPMT) { m_TSParser.RemoveFilter(m_CurrentPMT); } // Re-create parser m_PMTParser = new Parser(); // Connect to handler m_PMTParser.SectionFound += ProcessPMT; // Change m_CurrentPMT = programEnum.Current.Value; m_CurrentService = null; CurrentEntry = null; NextEntry = null; // Create PMT m_TSParser.SetFilter(m_CurrentPMT, true, m_PMTParser.OnData); }
public async Task <bool> Authenticate(string organization, string project, string personalAccessToken) { PAT pat = new PAT(organization, project, personalAccessToken); return(await pat.AuthenticatePAT()); }
/// <summary> /// Meldet zu den SI Tabellen STD und PAT die Liste aller Dienste, die von einer /// Quellgruppe angeboten werden. /// </summary> /// <param name="services">Die SI Informationen über die Dienste.</param> /// <param name="associations">Die SI Informationen mit der Zuordnung der Dienste /// zu den <i>Program Mapping Table (PMT)</i> Tabellen.</param> /// <returns>Die gewünschte Informationsinstanz.</returns> public static GroupInformation ToGroupInformation(this SDT[] services, PAT[] associations) { // Create new var info = new GroupInformation(); // See what we need if (services == null) { return(info); } if (services.Length < 1) { return(info); } if (associations == null) { return(info); } if (associations.Length < 1) { return(info); } // All services we processed var processed = new HashSet <ushort>(); // Get the first (and normally only) PAT as a reference PAT pat = associations[0]; // Process all service tables foreach (var service in services) { if (service.TransportStream == pat.TransportStream) { foreach (var entry in service.Table.Services) { if (associations[0][entry.ServiceIdentifier].HasValue) { // Find the description var descr = EPG.DescriptorExtensions.Find <EPG.Descriptors.Service>(entry.Descriptors); if (descr == null) { continue; } // Get the type SourceTypes type; // Check mode if (descr.ServiceType == EPG.ServiceTypes.DigitalTelevision) { type = SourceTypes.TV; } else if (descr.ServiceType == EPG.ServiceTypes.DigitalRadio) { type = SourceTypes.Radio; } else if (descr.ServiceType == EPG.ServiceTypes.SDTVDigitalTelevision) { type = SourceTypes.TV; } else if (descr.ServiceType == EPG.ServiceTypes.HDTVDigitalTelevision) { type = SourceTypes.TV; } else if (descr.ServiceType == EPG.ServiceTypes.SkyHDTV) { type = SourceTypes.TV; } else if (descr.ServiceType == EPG.ServiceTypes.SkyNVOD) { type = SourceTypes.TV; } else { type = SourceTypes.Unknown; } // Add the station info.Sources.Add( new Station { TransportStream = service.TransportStream, Service = entry.ServiceIdentifier, Provider = descr.ProviderName, IsEncrypted = entry.Scrambled, Network = service.Network, Name = descr.ServiceName, SourceType = type, }); // Mark as done processed.Add(entry.ServiceIdentifier); } } } } // Get the first SDT as a reference var sdt = services[0]; // No check all services foreach (var serviceIdentifier in associations[0].Services) { if (!processed.Contains(serviceIdentifier)) { info.Sources.Add( new Station { Name = string.Format("Service {0}", serviceIdentifier), TransportStream = sdt.TransportStream, SourceType = SourceTypes.Unknown, Service = serviceIdentifier, Network = sdt.Network, Provider = "Service", IsService = true, }); } } // Report return(info); }