public void CarregaDadosEmpregador(org.cesar.dmplight.watchComm.impl.printpoint.PrintPointEmployerMessage empregador) { this.mskCEI.Text = empregador.CEI.PadLeft(12, Char.Parse("0")).Substring(0, 12); if (empregador.EmployerType == org.cesar.dmplight.watchComm.impl.printpoint.EmployeerType.CPF) { this.cboTipoPessoa.SelectedIndex = 1; } else { this.cboTipoPessoa.SelectedIndex = 0; } this.mskCPF_CNPJ.Text = empregador.CPF_CNPJ; empregador.Name = empregador.Name.PadRight(150, Char.Parse(" ")); this.txtNomeEmpresa1.Text = empregador.Name.Substring(0, 36); if (empregador.Name.Length > 36) { this.txtNomeEmpresa2.Text = empregador.Name.Substring(36, 36); } if (empregador.Name.Length > 72) { this.txtNomeEmpresa3.Text = empregador.Name.Substring(72, 36); } if (empregador.Name.Length > 108) { this.txtNomeEmpresa4.Text = empregador.Name.Substring(108, 36); } if (empregador.Name.Length > 144) { this.txtNomeEmpresa5.Text = empregador.Name.Substring(144); } empregador.Address = empregador.Address.PadRight(100, Char.Parse(" ")); this.txtEnderecoEmpresa1.Text = empregador.Address.Substring(0, 36); if (empregador.Address.Length > 36) { this.txtEnderecoEmpresa2.Text = empregador.Address.Substring(36, 36); } if (empregador.Address.Length > 72) { this.txtEnderecoEmpresa3.Text = empregador.Address.Substring(72); } }
private void btnObterEmpregadorRelogio_Click(object sender, EventArgs e) { InstanciaWatchComm(); try { _watchComm.OpenConnection(); org.cesar.dmplight.watchComm.impl.printpoint.PrintPointEmployerMessage empregador = this._watchComm.InquiryEmployeer(); CarregaDadosEmpregador(empregador); ComandoRecepcionadoComSucesso(); } catch (Exception ex) { ErroDuranteRecepcaoDoComando(ex); } finally { _watchComm.CloseConnection(); } }