Example #1
0
        public IDataMapper <T> Build <T>()
        {
            Object instance = Activator.CreateInstance <T>();

            _command = new SqlCommand();
            Table table;

            table = instance.GetType().GetCustomAttribute <Table>();
            String tableName  = table.getTableName();
            Pk     pkAtribute = null;

            foreach (Object obj in _mapOfObjects)
            {
                String name = obj.ToString().Split(' ')[1];
                Pk     aux  = instance.GetType().GetProperty(name).GetCustomAttribute <Pk>();

                if (aux != null)
                {
                    pkAtribute = aux;
                }
            }

            String pkName = pkAtribute.getPkName();


            return(new Mapper <T>(_connectionManager, _command, _mapOfObjects, tableName, pkName));
        }
        public ActionResult pk()
        {
            Pk p = new Pk();

            p.name  = "Prakashan";
            p.email = "*****@*****.**";
            return(View(p));
        }
Example #3
0
        public void AddExperiencia(int experiencia, List <CarD> cartasDiponiveis)
        {
            int level_inicial = base.LevelAtual;

            base.ReceberExperiencia(experiencia);

            if (level_inicial < base.LevelAtual)
            {
                if (base.LevelAtual % 5 == 0)//pokemon pode evoluir
                {
                    int totalEvolucao = base.LevelAtual - level_inicial;

                    while (totalEvolucao > 0)
                    {
                        if (Pk.Evolucao > 0)
                        {
                            //fazendo a troca do pokemon para sua evolucao
                            Console.WriteLine("\n\nOps... Parece que o " + Pk.Nome + " vai evoluir!");


                            Pk = cartasDiponiveis[IndexOfCardID(IDCard, cartasDiponiveis) + 1].Pk;
                            base.Evolucao();

                            Console.WriteLine("Parabens! seu pokemon evoluiu para " + this.Pk.Nome);
                            //Program.Program.Program.PausarAplicacao();
                        }
                        totalEvolucao--;
                    }
                }
                else
                {
                    Console.WriteLine("ops... Seu pokemon acaba de subir para o level " + base.LevelAtual);
                    Pk.BonusLevel(base.BonusAtributoLevel);
                    //Program.Program.Program.PausarAplicacao();
                }
            }
        }
Example #4
0
 public override int GetHashCode()
 {
     return(Pk.GetHashCode());
 }