public FuncionarioPaModelo ParametrosAtualizaFunForm(string @login, string @nome, int @indice) { FuncionarioPaModelo fcPaMd = new FuncionarioPaModelo(); try { MySqlCommand myCm = new MySqlCommand("MYSP_PARAMETRO_FORM_FUNCIONARIOS", this.Conexao.ObjetoConexao); myCm.CommandType = CommandType.StoredProcedure; myCm.Parameters.AddWithValue("_LOGIN", @login); myCm.Parameters.AddWithValue("_NOME", @nome); this.Conexao.Conectar(); MySqlDataReader dr = myCm.ExecuteReader(CommandBehavior.CloseConnection); dr.Read(); fcPaMd.IDEnd = Convert.ToInt32(dr["IDEND"]); fcPaMd.IDPessoa = Convert.ToInt32(dr["IDPSS"]); fcPaMd.IDTelefone = Convert.ToInt32(dr["IDTEL"]); fcPaMd.IDFuncionario = Convert.ToInt32(dr["IDFUN"]); fcPaMd.IDFuncEmp = Convert.ToInt32(dr["ID"]); fcPaMd.IDEmpresa = Convert.ToInt32(dr["IDEMP"]); fcPaMd.Razao = Convert.ToString(dr["RAZAO"]); fcPaMd.Estado = Convert.ToInt32(dr["EST"]); fcPaMd.Cidade = Convert.ToString(dr["CIDADE"]); fcPaMd.Bairro = Convert.ToString(dr["BAIRRO"]); fcPaMd.Logradouro = Convert.ToString(dr["LOG"]); fcPaMd.NumeroEnd = Convert.ToString(dr["NUM"]); fcPaMd.Nome = Convert.ToString(dr["NOME"]); fcPaMd.Aniversario = Convert.ToDateTime(dr["NIVER"]); fcPaMd.NumeroTel = Convert.ToString(dr["TEL"]); fcPaMd.NumeroCel = Convert.ToString(dr["CEL"]); fcPaMd.Login = Convert.ToString(dr["LOGIN"]); fcPaMd.Senha = Convert.ToString(dr["SENHA"]); fcPaMd.Funcao = Convert.ToInt32(dr["FUNCAO"]); } catch (Exception ex) { MessageBox.Show("Houve problemas. Erro: \n\n" + ex.Message); } finally { this.Conexao.Desconectar(); } return(fcPaMd); }
private void CarregarCampos(FuncionarioPaModelo fcPaMd) { fcAtMd.IDEnd = fcPaMd.IDEnd; fcAtMd.IDPessoa = fcPaMd.IDPessoa; fcAtMd.IDTelefone = fcPaMd.IDTelefone; fcAtMd.IDFuncionario = fcPaMd.IDFuncionario; fcAtMd.IDFuncEmp = fcPaMd.IDFuncEmp; this.txtATLFunNome.Text = fcPaMd.Nome; this.txtATLFunTel.Text = fcPaMd.NumeroTel; this.txtATLFunCel.Text = fcPaMd.NumeroCel; this.txtATLFunLogin.Text = fcPaMd.Login; this.CarregarItemComboPerfil(fcPaMd.Funcao); this.CarregarComboEmpresa(fcPaMd.Razao); this.dtATLFunAniversario.Value = fcPaMd.Aniversario; this.CarregarItemComboEstado(fcPaMd.Estado); this.txtATLFunCidade.Text = fcPaMd.Cidade; this.txtATLFunBairro.Text = fcPaMd.Bairro; this.txtATLFunLog.Text = fcPaMd.Logradouro; this.txtATLFunNum.Text = fcPaMd.NumeroEnd; }