public AdicionarTratamentoResposta AdicionarTratamento(AdicionarTratamentoRequisicao requisicao)
        {
            var resposta = new AdicionarTratamentoResposta();
            try
            {
                var programa = _programaRepositorio.ObterPor(requisicao.CodigoDoPrograma);
                var grupo = _grupoRepositorio.ObterPor(requisicao.CodigoDoGrupoResponsavel);
                var tratamento = new Tratamento
                {
                    Programa = programa,
                    DataSolicitacao = requisicao.DataSolicitacao,
                    Ifx = requisicao.Ifx,
                    Medico = requisicao.Medico,
                    Representante = requisicao.Representante,
                    MotivoSolicitacao = requisicao.MotivoSolicitacao,
                    Status = StatusDoTratamento.Aberto,
                    GrupoResponsavel = grupo
                };

                _tratamentoRepositorio.Adicionar(tratamento);

                _unitOfWork.Commit();
                resposta.Tratamento = tratamento;
                resposta.Sucesso = true;
            }
            catch (RegraException regraException)
            {
                resposta.Erros = regraException.Erros;
            }
            return resposta;
        }
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            if(txtNome.Text==""||mktPreco.Text==""||mktDuracaoMedia.Text==""){
                MessageBox.Show("Preencha os dados","Erro");
            }
            else{
                 String nome;
                 String preco;
                 String duracaoMedia;

                 nome = txtNome.Text;
                 preco = mktPreco.Text;
                 duracaoMedia = mktDuracaoMedia.Text;
            
                 Tratamento tratamento = new Tratamento();

                 tratamento.Nome = nome;
                 tratamento.Preco = double.Parse(preco).ToString("G",System.Globalization.CultureInfo.InvariantCulture);
                 tratamento.DuracaoMedia = duracaoMedia;


                 DAOTratamento daoTratamento = new DAOTratamento();

                 daoTratamento.insereTratamento(tratamento);

                 txtNome.Text="";
                 mktPreco.Clear();
                 mktDuracaoMedia.Clear();
                 this.Close();
            }
        }
        public Tratamento AlterarTratamento(Tratamento tratamento, 
            string ifx,
            string medico,
            string representante,
            string motivoSolicitacao)
        {
            tratamento.Ifx = ifx;
            tratamento.Medico = medico;
            tratamento.Representante = representante;
            tratamento.MotivoSolicitacao = motivoSolicitacao;

            _tratamentoRepositorio.Atualizar(tratamento);
            return tratamento;
        }
        public Tratamento AdicionarTratamento(
            Programa programa, 
            DateTime dataSolicitacao, 
            string ifx,
            string medico, 
            string representante,
            string motivoSolicitacao)
        {
            var tratamento = new Tratamento()
            {
                Programa = programa,
                DataSolicitacao = dataSolicitacao,
                Ifx = ifx,
                Medico = medico,
                Representante = representante,
                MotivoSolicitacao = motivoSolicitacao
            };

            _tratamentoRepositorio.Adicionar(tratamento);
            return tratamento;
        }
 public void Atualizar(Tratamento tratamento)
 {
     repositorio.Atualizar(tratamento);
 }
 public void Gravar(Tratamento tratamento)
 {
     repositorio.Gravar(tratamento);
 }
Exemple #7
0
        public ActionResult Results(Log log, Informacoes data)
        {
            List <Log>         errologs    = new List <Log>();
            List <Informacoes> datas       = new List <Informacoes>();
            List <Tratamento>  tratamentos = new List <Tratamento>();


            BinaryReader b = new BinaryReader(log.file.InputStream);

            byte[] binData = b.ReadBytes((int)log.file.InputStream.Length);

            string result = System.Text.Encoding.UTF8.GetString(binData);

            char[]   delimitadores = new char[] { '\n' };
            string[] strings       = result.Split(delimitadores);

            foreach (string s in strings)
            {
                if (s.Length >= 24)
                {
                    //Validar datas
                    if (s.Substring(13, 1) == ":" && s.Substring(16, 1) == ":")
                    {
                        data     = new Informacoes();
                        data.Dia = s.Substring(8, 2);
                        data.Mes = s.Substring(4, 3);
                        data.Ano = s.Substring(20, 4);

                        string          datac          = data.Dia + " " + data.Mes + " " + data.Ano;
                        IFormatProvider cultura        = new System.Globalization.CultureInfo("en-US", true);
                        DateTime        dataconvertida = DateTime.Parse(datac, cultura, System.Globalization.DateTimeStyles.AssumeLocal);
                        data.Data = dataconvertida.ToString("dd/MM/yyyy");
                    }
                    if (s.StartsWith("ORA-"))
                    {
                        //Validar erros para exibição
                        Regex         restricao = new Regex("[0-9]");
                        StringBuilder be        = new StringBuilder();
                        foreach (Match m in restricao.Matches(s.Substring(0, 9)))
                        {
                            be.Append(m.Value);
                        }
                        data.Numero = "ORA-" + be.ToString();

                        if (tratamentos.Count == 0)
                        {
                            Tratamento tr = new Tratamento();
                            tr.Prefixo = "ORA-";
                            tr.Numero  = be.ToString();
                            tratamentos.Add(tr);
                        }
                        else
                        {
                        }

                        //Validar mensagem para exibição
                        if (s.Substring(9, 1) == ":")
                        {
                            data.Mensagem = s.Substring(10, Convert.ToInt32(s.Length - 10));
                        }
                        else
                        {
                            data.Mensagem = s.Substring(9, Convert.ToInt32(s.Length - 9));
                        }

                        datas.Add(data);
                    }
                }
            }

            Session["datas"] = datas;

            return(View("Grid", datas));
        }
Exemple #8
0
        private void btSim_Click(object sender, RoutedEventArgs e)
        {
            switch (i)
            {
            case 1:
                try
                {
                    Conexao      con     = new Conexao();
                    String       Insert  = "INSERT INTO `chatbot`.`usuario` (`idUsuario`, `Nome`, `Vida`, `velocidadeDeLocomocao`, `velocidadeDeAtaque`, `Mana`, `Gold`, `regeneracaoDeVida`, `danoBase`, `armadura`, `regeneracaoDeMana`, `TempoDeJogo`,`Raca`) VALUES ('1', 'Null', '150', '1.5', '0.5', '150', '0', '1.5', '4', '15', '0.5', '0','1')";
                    MySqlCommand inserir = new MySqlCommand(Insert, con.conectar);
                    inserir.ExecuteReader();
                    Classe janela = new Classe();
                    janela.Show();
                    this.Close();
                    break;
                }
                catch (MySqlException E) {
                    Tratamento erro = new Tratamento(E.ToString(), 2);
                    Environment.Exit(0);
                    break;
                }

            case 2:
                try
                {
                    Conexao      con     = new Conexao();
                    String       Insert  = "INSERT INTO `chatbot`.`usuario` (`idUsuario`, `Nome`, `Vida`, `velocidadeDeLocomocao`, `velocidadeDeAtaque`, `Mana`, `Gold`, `regeneracaoDeVida`, `danoBase`, `armadura`, `regeneracaoDeMana`, `TempoDeJogo`,`Raca`) VALUES ('1', 'Null', '150', '1.5', '0.5', '150', '0', '1.5', '4.0', '15', '0.5', '0','2')";
                    MySqlCommand inserir = new MySqlCommand(Insert, con.conectar);
                    inserir.ExecuteReader();
                    Classe janela = new Classe();
                    janela.Show();
                    this.Close();
                    break;
                }
                catch (MySqlException E)
                {
                    Tratamento erro = new Tratamento(E.ToString(), 2);
                    Environment.Exit(0);
                    break;
                }

            case 3:
                try
                {
                    Conexao      con     = new Conexao();
                    String       Insert  = "INSERT INTO `chatbot`.`usuario` (`idUsuario`, `Nome`, `Vida`, `velocidadeDeLocomocao`, `velocidadeDeAtaque`, `Mana`, `Gold`, `regeneracaoDeVida`, `danoBase`, `armadura`, `regeneracaoDeMana`, `TempoDeJogo`,`Raca`) VALUES ('1', 'Null', '100', '1.0', '1.0', '100', '0', '1.5', '6', '15', '0.5', '0','3')";
                    MySqlCommand inserir = new MySqlCommand(Insert, con.conectar);
                    inserir.ExecuteReader();
                    Classe janela = new Classe();
                    janela.Show();
                    this.Close();
                    break;
                }
                catch (MySqlException E)
                {
                    Tratamento erro = new Tratamento(E.ToString(), 2);
                    Environment.Exit(0);
                    break;
                }

            case 4:
                try
                {
                    Conexao      con     = new Conexao();
                    String       Insert  = "INSERT INTO `chatbot`.`usuario` (`idUsuario`, `Nome`, `Vida`, `velocidadeDeLocomocao`, `velocidadeDeAtaque`, `Mana`, `Gold`, `regeneracaoDeVida`, `danoBase`, `armadura`, `regeneracaoDeMana`, `TempoDeJogo`,`Raca`) VALUES ('1', 'Null', '150', '1.5', '0.5', '150', '0', '1.5', '4', '15', '0.5', '0','4')";
                    MySqlCommand inserir = new MySqlCommand(Insert, con.conectar);
                    inserir.ExecuteReader();
                    Classe janela = new Classe();
                    janela.Show();
                    this.Close();
                    break;
                }
                catch (MySqlException E)
                {
                    Tratamento erro = new Tratamento(E.ToString(), 2);
                    Environment.Exit(0);
                    break;
                }

            case 5:
                try
                {
                    Conexao      con     = new Conexao();
                    String       Insert  = "INSERT INTO `chatbot`.`usuario` (`idUsuario`, `Nome`, `Vida`, `velocidadeDeLocomocao`, `velocidadeDeAtaque`, `Mana`, `Gold`, `regeneracaoDeVida`, `danoBase`, `armadura`, `regeneracaoDeMana`, `TempoDeJogo`,`Raca`) VALUES ('1', 'Null', '150', '1.5', '0.5', '150', '0', '1.5', '4', '15', '0.5', '0','5')";
                    MySqlCommand inserir = new MySqlCommand(Insert, con.conectar);
                    inserir.ExecuteReader();
                    Classe janela = new Classe();
                    janela.Show();
                    this.Close();
                    break;
                }
                catch (MySqlException E)
                {
                    Tratamento erro = new Tratamento(E.ToString(), 2);
                    Environment.Exit(0);
                    break;
                }
            }
        }