/// <summary> /// Load the entity data. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtID_Validated(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txtID.Text)) { try { RhpBEFuncionario employee = PriEngine.Engine.RecursosHumanos.Funcionarios.Edita(txtID.Text); if (employee != null) { txtID.Text = employee.Funcionario; txtName.Text = employee.Nome; dtHireDate.Value = employee.DataAdmissao; txtSituation.Text = employee.Situacao; txtWorkPolicy.Text = employee.Instrumento; txtWorkLocation.Text = employee.Estabelecimento; txtSocialSec.Text = employee.SegurancaSocial; txtIncomeTax.Text = employee.IRS; txtIncomeType.Text = employee.TipoRendimento; txtVacantions.Text = employee.FormaPagSF; txtChristmas.Text = employee.FormaPagSN; cmbChristAlloMonth.SelectedIndex = employee.MesSubsNatal - 1; cmbVacationAlloMonth.SelectedIndex = employee.MesSubsidioFerias - 1; } } catch (Exception ex) { MessageBox.Show($"An error occurred while loading the entity: \n {ex.Message}"); } } }
/// <summary> /// Create a new employee on the system. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdSave_Click(object sender, EventArgs e) { RhpBEFuncionario employee = new RhpBEFuncionario { Funcionario = txtID.Text, Nome = txtName.Text, DataAdmissao = dtHireDate.Value, Situacao = txtSituation.Text, Instrumento = txtWorkPolicy.Text, Estabelecimento = txtWorkLocation.Text, SegurancaSocial = txtSocialSec.Text, IRS = txtIncomeTax.Text, TipoRendimento = txtIncomeType.Text, FormaPagSF = txtVacantions.Text, FormaPagSN = txtChristmas.Text, MesSubsNatal = cmbChristAlloMonth.SelectedIndex + 1, MesSubsidioFerias = cmbVacationAlloMonth.SelectedIndex + 1, // Check if entity already exist. // If exists them set this flag to true to tell the system to perform an update operation. EmModoEdicao = PriEngine.Engine.RecursosHumanos.Funcionarios.Existe(txtID.Text) }; try { PriEngine.Engine.RecursosHumanos.Funcionarios.Actualiza(employee); } catch (Exception Ex) { MessageBox.Show($"Unable to save employee. \n {Ex.Message}"); } this.Close(); }
public void Processar(DataView dt) { try { string codigo; RhpBEFuncionario _funcionario; for (int i = 0; i < dt.Count; i++) { DataRowView dr = dt[i]; codigo = StringHelper.DaString(dr["Codigo"]); if (codigo.Length > 0 && !bso.RecursosHumanos.Funcionarios.Existe(codigo)) { string conta = StringHelper.DaString(dr["NIB/Conta"]); _funcionario = new RhpBEFuncionario() { Funcionario = codigo, Nome = StringHelper.DaString(dr["Nome"]), DataAdmissao = Convert.ToDateTime(dr["DataAdmissao"]), NumeroBI = Convert.ToString(dr["NumeroBI"]), VencimentoMensal = Convert.ToDouble(dr["VencimentoBase"]), Vencimento = Convert.ToDouble(dr["VencimentoBase"]), Instrumento = "001", Periodo = "P01", Moeda = bso.Contexto.MoedaBase, TipoProcessamento = 2, TipoCalculoVencimento = 1, TipoRendimento = "A", TabIRPS = "TAB2014", Estabelecimento = Convert.ToString(dr["CodEstabelecimento"]), Situacao = Convert.ToString(dr["SituacaoProfissional"]) }; bso.RecursosHumanos.Funcionarios.Actualiza(_funcionario); } } } catch (Exception ex) { throw ex; } }
private void cmdSave_Click(object sender, EventArgs e) { try { RhpBEFuncionario objfuncionario = PriEngine.Engine.RecursosHumanos.Funcionarios.Edita(txtEmployee.Text); if (objfuncionario == null) { MessageBox.Show("The Employee doesn't exist."); } int result = 0; string message = ""; PriEngine.Engine.RecursosHumanos.SegurancaSocial.RegistarVinculoRegimeGeral(txtPassword.Text, objfuncionario, ref result, ref message); MessageBox.Show($"Successful communication: \n {result}: {message}"); } catch (Exception ex) { MessageBox.Show($"An error occurred while executing the operation: \n {ex.Message}"); } }
private void btProcessar_Click(object sender, EventArgs e) { try { string str_codigo = txtCodigo.Text; string str_nome = txtNome.Text; decimal dbl_salario = txtSalario.Value; var funcionario = new RhpBEFuncionario(); if (BSO.RecursosHumanos.Funcionarios.Existe(str_codigo)) { //PSO.Dialogos.MostraAviso("Atenção o Funcionario Já existe !!!"); } else { funcionario.Funcionario = str_codigo; funcionario.Nome = str_nome; funcionario.VencimentoMensal = (double)dbl_salario; funcionario.Vencimento = (double)dbl_salario; funcionario.TipoRendimento = "A"; funcionario.TabIRPS = "TAB2014"; funcionario.DataAdmissao = DateTime.Now; funcionario.Situacao = "001"; funcionario.Instrumento = "001"; funcionario.Estabelecimento = "001"; BSO.RecursosHumanos.Funcionarios.Actualiza(funcionario); PSO.Dialogos.MostraAviso("Gravado Com Sucesso"); } } catch (Exception ex) { PSO.Dialogos.MostraAviso("Aconteceu um erro na gravação", StdPlatBS100.StdBSTipos.IconId.PRI_Exclama, ex.Message); } }
/// <summary> /// Create a new employee on the system. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdSave_Click(object sender, EventArgs e) { RhpBEFuncionario employee = new RhpBEFuncionario { Funcionario = txtID.Text, Nome = txtName.Text, DataAdmissao = dtHireDate.Value, Situacao = txtSituation.Text, Instrumento = txtWorkPolicy.Text, Estabelecimento = txtWorkLocation.Text, SegurancaSocial = txtSocialSec.Text, IRS = txtIncomeTax.Text, TipoRendimento = txtIncomeType.Text, FormaPagSF = txtVacantions.Text, FormaPagSN = txtChristmas.Text, MesSubsNatal = cmbChristAlloMonth.SelectedIndex + 1, MesSubsidioFerias = cmbVacationAlloMonth.SelectedIndex + 1, // Check if entity already exist. // If exists them set this flag to true to tell the system to perform an update operation. EmModoEdicao = PriEngine.Engine.RecursosHumanos.Funcionarios.Existe(txtID.Text) }; try { // Create payment method with dummy data if (!employee.EmModoEdicao) { PriEngine.Engine.RecursosHumanos.FuncFormasPagamento.Actualiza(new RhpBEFormaPagamento { ID = Guid.NewGuid().ToString(), Forma = 1, Moeda = PriEngine.Engine.Contexto.MoedaEuro, Entidade = employee.Funcionario, ContaEmpresa = "001", Default = true }); } PriEngine.Engine.RecursosHumanos.Funcionarios.Actualiza(employee); // Create payment method with dummy data if (!employee.EmModoEdicao) { PriEngine.Engine.RecursosHumanos.FuncFormasPagamento.Actualiza(new RhpBEFormaPagamento { ID = Guid.NewGuid().ToString(), Forma = 1, Moeda = PriEngine.Platform.Contexto.Empresa.MoedaEuro, Entidade = employee.Funcionario, ContaEmpresa = "001", Default = true }); } } catch (Exception Ex) { MessageBox.Show($"Unable to save employee. \n {Ex.Message}"); } this.Close(); }