コード例 #1
0
        public void AtualizarEstoque(BotItemEstoque estoque)
        {
            BotWoWEntities n = new BotWoWEntities();
            Estoque est = new Estoque();

            try
            {
                est = (from p in n.Estoques where p.idItem == estoque.itemID && p.NomePersonagem == estoque.Personagem select p).First();

                est.Qtd = estoque.Qtd;
                est.dtAtualizado = DateTime.Now;

                n.SaveChanges();

            }
            catch (InvalidOperationException)
            {
                est.idItem = estoque.itemID;
                est.NomePersonagem = estoque.Personagem;
                est.Qtd = estoque.Qtd;
                est.dtAtualizado = DateTime.Now;
                est.dtFabricado = DateTime.Now;

                n.Estoques.AddObject(est);
                n.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Erro na rotina BotControlaEstoque.AtualizarEstoque. {0} itemID: {1} {0}",Environment.NewLine, estoque.itemID), ex);
            }
        }
コード例 #2
0
        public List<BotItemEstoque> RetornaGrupoGemas(string nome)
        {
            List<BotItemEstoque> l = new List<BotItemEstoque>();
            const int VALOR_EM_ESTOQUE = 18;
            const decimal VALOR_MINIMO_AH = 249999;
            BotWoWEntities n = new BotWoWEntities();
            BotWoWEntities n1 = new BotWoWEntities();

            var a = (from i in n.Items
                     join
                         isp in n.SpellItems on i.id equals isp.idItem
                     join
                         est in n.Estoques on isp.idItem equals est.idItem
                     where i.itemClass == 3 && est.Qtd < VALOR_EM_ESTOQUE && est.NomePersonagem == nome
                           && est.dtFabricado < est.dtAtualizado
                           && i.ValorMinnaAH > VALOR_MINIMO_AH
                     select new { idItem = i.id, idSpell = isp.idSpell, qtd = (VALOR_EM_ESTOQUE - est.Qtd) });

            foreach (var item in a)
            {
                BotItemEstoque b = new BotItemEstoque();
                b.itemID = (int)item.idItem;
                b.Personagem = nome;
                b.Qtd = (int)item.qtd;
                b.SpellQueCriaOItem = (int)item.idSpell;
                l.Add(b);

                var x = (from p in n1.Estoques where p.idItem == item.idItem && p.NomePersonagem == nome select p).First();
                x.dtFabricado = DateTime.Now;
                n1.SaveChanges();

            }

            return l;
        }
コード例 #3
0
        public void AtualizaValorItem(decimal idItem, decimal valor)
        {
            BotWoWEntities n = new BotWoWEntities();
            Item i;

            i = (from p in n.Items where p.id == idItem select p).FirstOrDefault();

            if (i != null)
            {
                i.ValorMinnaAH = valor;
                n.SaveChanges();
            }
        }
コード例 #4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                BotWoWEntities n1 = new BotWoWEntities();
                c = (from p in n1.ConfiguracaoEstoques where p.id == codigo select p).First();
                c.Qtd = Decimal.Parse(TextBox1.Text);

                n1.SaveChanges();

                Response.Redirect("ConfigEstoque.aspx");
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
コード例 #5
0
        public Object RecuperaEntity(Entities en)
        {
            Object EF;

            if (en == Entities.MercadoLivre)
            {
                EF = new NSAADMEntities(stringdeconexao());
                return (NSAADMEntities)EF;
            }
            else if (en == Entities.Bot)
            {
                EF = new BotWoWEntities(stringdeconexao());
                return (BotWoWEntities)EF;
            }
            else
            {
                throw new Exception("Enumerador inválido");
            }
        }
コード例 #6
0
        public void PegarSpelleItem(decimal spell, decimal item)
        {
            BotWoWEntities n = new BotWoWEntities();

            try
            {
                var x = (from p in n.SpellItems where p.idItem == item && p.idSpell == spell select p).First();
            }
            catch (Exception)
            {

                SpellItem s = new SpellItem();

                s.idSpell = spell;
                s.idItem = item;

                n.SpellItems.AddObject(s);
                n.SaveChanges();

            }
        }
コード例 #7
0
        private void GravaAtualizaItem(Item it)
        {
            BotWoWEntities n = new BotWoWEntities();

            try
            {
                Item c = (from p in n.Items where p.id == it.id select p).First();

                //NovoItem.armor = Convert.ToInt32(Obj["armor"].ToString());
                //NovoItem.baseArmor = Convert.ToInt32(Obj["baseArmor"].ToString());
                c.buyPrice = it.buyPrice;
                c.containerSlots = it.containerSlots;
                c.Desc = it.Desc;
                //NovoItem.disenchantingSkillRank = Convert.ToInt32(Obj["disenchantingSkillRank"].ToString());
                //NovoItem.displayInfoId = Convert.ToInt32(Obj["displayInfoId"].ToString());
                c.equippable = it.equippable;
                //NovoItem.hasSockets = Convert.ToBoolean(Obj["hasSockets"].ToString());
                //NovoItem.heroicTooltip = Convert.ToBoolean(Obj["heroicTooltip"].ToString());
                c.icon = it.icon;
                c.id = it.id;
                c.inventoryType = it.inventoryType;
                //NovoItem.isAuctionable = Convert.ToBoolean(Obj["isAuctionable"].ToString());
                c.itemBind = it.itemBind;
                c.itemClass = it.itemClass;
                c.itemLevel = it.itemLevel;
                c.itemSubClass = it.itemSubClass;
                c.maxCount = it.maxCount;
                c.maxDurability = it.maxDurability;
                c.minFactionId = it.minFactionId;
                c.minReputation = it.minReputation;
                //NovoItem.name = Obj["name"].ToString();
                //NovoItem.nameDescription = Obj["nameDescription"].ToString();
                //NovoItem.nameDescriptionColor = Obj["nameDescriptionColor"].ToString(); ;
                c.quality = it.quality;
                //NovoItem.requiredLevel = Convert.ToInt32(Obj["requiredLevel"].ToString());
                //NovoItem.requiredSkill = Convert.ToInt32(Obj["requiredSkill"].ToString());
                //NovoItem.requiredSkillRank = Convert.ToInt32(Obj["requiredSkillRank"].ToString());
                //NovoItem.sellPrice = Convert.ToInt32(Obj["sellPrice"].ToString());
                c.stackable = it.stackable;
                //NovoItem.upgradable = Convert.ToBoolean(Obj["upgradable"].ToString());

                n.SaveChanges();
            }
            catch (InvalidOperationException)
            {
                n.Items.AddObject(it);
                n.SaveChanges();
            }

            catch (Exception ex)
            {
                throw new Exception("Erro na rotina GravaAtualizaItem", ex);
            }
        }
コード例 #8
0
        public void ZeraEstoque(string nome)
        {
            BotWoWEntities n = new BotWoWEntities();

            var x = (from p in n.Estoques where p.NomePersonagem == nome select p);
            foreach (Estoque item in x)
            {
                item.Qtd = 0;
            }
            n.SaveChanges();
        }
コード例 #9
0
        public int RetornaQTDaProduzir(int idItem, string NomePersonagem)
        {
            BotWoWEntities n = new BotWoWEntities();

            try
            {
                var x = (from p in n.Estoques where p.idItem == idItem && p.NomePersonagem == NomePersonagem && p.dtAtualizado > p.dtFabricado select p).First();
                var y = (from p in n.ConfiguracaoEstoques where p.idItem == idItem && p.NomePersonagem == NomePersonagem select p).First();

                x.dtFabricado = DateTime.Now;
                n.SaveChanges();

                return (int)y.Qtd - (int)x.Qtd;
            }
            catch (Exception)
            {

                return 0;
            }
        }
コード例 #10
0
        public List<BotItemEstoque> RetornaItensEnchantInscr(string Real, string Faccao)
        {
            List<BotItemEstoque> l = new List<BotItemEstoque>();
            List<decimal> IDs = new List<decimal>();

            const int VALOR_EM_ESTOQUE = 18;

            IDs.Add(87559);
            IDs.Add(87560);
            IDs.Add(83007);
            IDs.Add(83006);

            BotWoWEntities n = new BotWoWEntities();
            BotWoWEntities n1 = new BotWoWEntities();

            var a = (from i in n.Items
                     join
                         isp in n.SpellItems on i.id equals isp.idItem
                     join
                         est in n.Estoques on isp.idItem equals est.idItem
                     where IDs.Any(x => x == i.id)
                           && est.Qtd < VALOR_EM_ESTOQUE
                           && est.dtFabricado < est.dtAtualizado
                     select new { idItem = i.id, idSpell = isp.idSpell, qtd = (VALOR_EM_ESTOQUE - est.Qtd), nome = est.NomePersonagem });

            foreach (var item in a)
            {
                BotItemEstoque b = new BotItemEstoque();
                b.itemID = (int)item.idItem;
                b.Personagem = item.nome;
                b.Qtd = (int)item.qtd;
                b.SpellQueCriaOItem = (int)item.idSpell;
                l.Add(b);

                var x = (from p in n1.Estoques where p.idItem == item.idItem && p.NomePersonagem == item.nome select p).First();
                x.dtFabricado = DateTime.Now;
                n1.SaveChanges();

            }

            return l;
        }