public static List <ContaDominio> retornaContas()
        {
            //contasCadastradas = new List<ContaDominio>();
            if (contasCadastradas.Count == 0)
            {
                ContaDominio conta1 = new ContaDominio
                {
                    Agencia        = "0002220",
                    Id             = 1,
                    taxaManutencao = 50,
                    TipoConta      = 0,
                };
                ContaDominio conta2 = new ContaDominio
                {
                    Agencia        = "0062430",
                    Id             = 2,
                    taxaManutencao = 30,
                    TipoConta      = 2,
                };

                contasCadastradas.Add(conta1);
                contasCadastradas.Add(conta2);
                return(contasCadastradas.OrderBy(C => C.Id).ToList());
            }
            else
            {
                return(contasCadastradas.OrderBy(C => C.Id).ToList());
            }
        }
        private void ubtnGravar_Click(object sender, EventArgs e)
        {
            try
            {
                if (_conta == null)
                {
                    _conta = new ContaDominio();
                }

                _conta.Agencia        = utxtAgencia.Text;
                _conta.taxaManutencao = Convert.ToInt32(utxtTaxa.Text);
                _conta.TipoConta      = RetornaTipoConta();
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
        internal void entrar(ContaDominio objConta)
        {
            if (objConta == null)
            {
                throw new NullReferenceException();
            }

            if (string.IsNullOrEmpty(objConta.strEmail) && string.IsNullOrEmpty(objConta.strGametag))
            {
                throw new ArgumentException("Um email ou gametag válido deve ser informado.");
            }

            if (string.IsNullOrEmpty(objConta.strSenha))
            {
                throw new ArgumentException("A senha deve ser informada.");
            }

            var lstFil = new List <Filtro>();

            if (!string.IsNullOrEmpty(objConta.strEmail))
            {
                lstFil.Add(new Filtro(this.clnStrEmail, objConta.strEmail.ToLower()));
            }
            else
            {
                lstFil.Add(new Filtro(this.clnStrGametag, objConta.strGametag));
            }

            lstFil.Add(new Filtro(this.clnStrSenha, objConta.strSenha));

            try
            {
                this.recuperar(lstFil);

                if (this.clnIntId.intValor < 1)
                {
                    throw new Exception("Login inválido.");
                }

                objConta.intId = this.clnIntId.intValor;
            }
            finally
            {
                this.liberarThread();
            }
        }
Beispiel #4
0
        internal void contaSalvar(ContaDominio objConta)
        {
            try
            {
                this.bloquearThread();

                this.contaSalvarValidar(objConta);

                this.contaSalvarPreparar(objConta);

                this.salvar(objConta);

                objConta.intId = this.clnIntId.intValor;
            }
            finally
            {
                this.liberarThread();
            }
        }
Beispiel #5
0
        private void contaSalvarValidar(ContaDominio objConta)
        {
            if (objConta == null)
            {
                throw new NullReferenceException();
            }

            if (string.IsNullOrEmpty(objConta.strEmail))
            {
                throw new ArgumentException("O email deve ser informado.");
            }

            if (string.IsNullOrEmpty(objConta.strEmail))
            {
                throw new ArgumentException("O email deve ser informado.");
            }

            if (string.IsNullOrEmpty(objConta.strGametag))
            {
                throw new ArgumentException("A gametag deve ser informada.");
            }

            if (string.IsNullOrEmpty(objConta.strSenha))
            {
                throw new ArgumentException("A senha deve ser informada.");
            }

            this.recuperar(this.clnStrEmail, objConta.strEmail.ToLower());

            if (this.clnIntId.intValor > 0)
            {
                throw new ArgumentException("Este email já está sendo usado.");
            }

            this.recuperar(this.clnStrGametag, objConta.strGametag);

            if (this.clnIntId.intValor > 0)
            {
                throw new ArgumentException("Esta gametag já está sendo usada.");
            }
        }
Beispiel #6
0
        internal void aparenciaSalvar(ContaDominio objConta, SessaoDominio objSessao, PersonagemDominio objPersonagem)
        {
            if (objConta == null)
            {
                throw new NullReferenceException();
            }

            if (objConta.intId < 1)
            {
                throw new Exception();
            }

            if (objSessao == null)
            {
                throw new NullReferenceException();
            }

            if (objSessao.intId < 1)
            {
                throw new Exception();
            }

            if (objPersonagem == null)
            {
                throw new NullReferenceException();
            }

            this.desativarTodos(objConta);

            objPersonagem.booAtivo            = true;
            objPersonagem.intContaId          = objConta.intId;
            objPersonagem.intDinheiro         = 2500;
            objPersonagem.intSangue           = 100;
            objPersonagem.intSessaoCadastroId = objSessao.intId;
            objPersonagem.intSessaoUltimaId   = objSessao.intId;

            this.salvar(objPersonagem);
        }
 public CadastroConta(ContaDominio contaVelha) : this()
 {
     conta = contaVelha;
 }
Beispiel #8
0
 public int Deletar(ContaDominio entidade)
 {
     return(_repositorioCliente.Excluir(entidade.Id));
 }
Beispiel #9
0
 public ContaDominio Atualizar(ContaDominio entidade)
 {
     return(_repositorioCliente.Atualizar(entidade));
 }
Beispiel #10
0
 public ContaDominio Inserir(ContaDominio entidade)
 {
     return(_repositorioCliente.Adicionar(entidade));
 }
Beispiel #11
0
 private void desativarTodos(ContaDominio objConta)
 {
     this.dbe.execSql(string.Format("update {0} set {1} = false where {2} = {3};", this.sqlNome, this.clnBooAtivo.sqlNome, this.clnIntContaId.sqlNome, objConta.intId));
 }
Beispiel #12
0
 private void contaSalvarPreparar(ContaDominio objConta)
 {
     objConta.strEmail = objConta.strEmail.ToLower();
 }