private void LoadDataRegistroDeReforma(RrResponse response) { Item.DataCadastro = response.DataAbertura; Item.Equipamento = response.DescricaoEquipamento; Item.NomeCliente = response.NomeCliente; Item.NotaFiscal = response.NumeroNF; Item.NumeroItem = txtItem.Text; Item.NumeroRR = txtRR.Text; Item.DescricaoRR = response.RR; Item.Cidade = response.Cidade; Item.NomeFantasia = response.NomeFantasia; }
public static RrResponse GetRr(string command, string userId, string password, string url) { RrResponse rr = new RrResponse(); using (OracleConnection con = new OracleConnection(string.Format(conString, userId, password, url))) { using (OracleCommand cmd = con.CreateCommand()) { try { con.Open(); cmd.BindByName = true; //Use the command to display employee names from // the EMPLOYEES table cmd.CommandText = command; //// Assign id to the department number 50 //OracleParameter user = new OracleParameter("nome", usuario); //OracleParameter pass = new OracleParameter("senha", senha); //cmd.Parameters.Add(user); //cmd.Parameters.Add(pass); //Execute the command and use DataReader to display the data var dataSet = cmd.ExecuteReader(); if (dataSet.Read()) { rr.DataAbertura = dataSet.GetValue(0).ToString(); rr.NumeroNF = Convert.ToInt32(dataSet.GetValue(1)); rr.NomeCliente = dataSet.GetValue(2).ToString(); rr.DescricaoEquipamento = dataSet.GetValue(3).ToString(); rr.NomeFantasia = dataSet.GetValue(4).ToString(); rr.Cidade = dataSet.GetValue(5).ToString(); rr.RR = dataSet.GetValue(6).ToString(); } rr.Success = true; return(rr); } catch (Exception ex) { rr.Success = false; throw new Exception(ex.Message); } } } }
private void ProcessRRNumber(RegistroDeReforma registroDeReforma) { RrResponse response = new RrResponse(); var task = new GenericTask() .WithPreExecuteProcess((b) => { Program.Main.ShowLoading(); }).WithBackGroundProcess((b, t) => { try { var request = new RrRequest(); request.Item = Convert.ToInt32(registroDeReforma.NumeroItem); request.Registro = Convert.ToInt32(registroDeReforma.NumeroRR); request.PasswordBD = ConfigurationBase.Instance.PasswordBD; request.Url = ConfigurationBase.Instance.ApiUrl; request.UserId = ConfigurationBase.Instance.UserIdBD; response = RrApi.Instance.GetRr(request); } catch (Exception ex) { Program.Main.ShowMessage("Ocorreu um erro ao buscar a RR", ToastLength.Long, ToastMessageType.Error); } }).WithPosExecuteProcess((b, t) => { if (response.Success) { txtClientName.Text = response.NomeCliente; txtData.Text = response.DataAbertura; txtEquipamentoDescription.Text = response.DescricaoEquipamento; txtNroNota.Text = response.NumeroNF.ToString(); LoadDataRegistroDeReforma(response); } Program.Main.HideLoading(); }).Execute(); }