示例#1
0
        public Paragon Update(Paragon paragon)
        {
            using (var db = new DomoFinoContext())
            {
                try
                {
                    db.Paragon.AddOrUpdate(paragon); //requires using System.Data.Entity.Migrations;
                    db.SaveChanges();
                    return(db.Paragon.Include(p => p.Category).SingleOrDefault(x => x.Id == paragon.Id));
                    //                    var entity = db.Paragon.Find(paragon);
                    //                    if (entity == null)
                    //                    {
                    //                        return;
                    //                    }
                    //
                    //                    db.Entry(entity).CurrentValues.SetValues(paragon);

                    //                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }
        }
示例#2
0
        public static bool CheckArtifactChance(Mobile m, BaseCreature bc)
        {
            if (bc == null || !bc.EraML)
            {
                return(false);
            }

            return(Paragon.CheckArtifactChance(m, bc));
        }
示例#3
0
        public static bool CheckArtifactChance(Mobile m, BaseCreature bc)
        {
            if (!Core.ML)
            {
                return(false);
            }

            return(Paragon.CheckArtifactChance(m, bc));
        }
        public static bool CheckArtifactChance(Mobile m, BaseCreature bc)
        {
            if (!Core.ML || bc is BasePeerless) // Peerless drops to the corpse, this is handled elsewhere
            {
                return(false);
            }

            return(Paragon.CheckArtifactChance(m, bc));
        }
示例#5
0
 public ParagonVM(Paragon m)
 {
     Id              = m.Id;
     Amount          = m.Amount;
     PurchaseDate    = m.PurchaseDate;
     Note            = m.Note;
     Category        = new CategoryVM(m.Category);
     AddedById       = m.AddedById;
     IsDeletePending = m.IsDeletePending;
     //            UserVM AddedBy = new UserVM(m.AddedBy??);
 }
示例#6
0
        public static bool CheckArtifactChance(Mobile m, BaseCreature bc)
        {
            XmlParagon xa = GetXmlParagon(bc);

            if (xa != null)
            {
                return(xa.XmlCheckArtifactChance(m, bc));
            }
            else
            {
                return(Paragon.CheckArtifactChance(m, bc));
            }
        }
示例#7
0
        public static void GiveArtifactTo(Mobile m, BaseCreature bc)
        {
            XmlParagon xa = GetXmlParagon(bc);

            if (xa != null)
            {
                xa.XmlGiveArtifactTo(m, bc);
            }
            else
            {
                Paragon.GiveArtifactTo(m);
            }
        }
示例#8
0
        public static void UnConvert(BaseCreature bc)
        {
            XmlParagon xa = GetXmlParagon(bc);

            if (xa != null)
            {
                xa.XmlUnConvert(bc);
            }
            else
            {
                Paragon.UnConvert(bc);
            }
        }
示例#9
0
        // static method hooks that interface with the distro Paragon system

        public static bool CheckConvert(BaseCreature bc, Point3D location, Map m)
        {
            XmlParagon xa = GetXmlParagon(bc);

            if (xa != null)
            {
                return(xa.XmlCheckConvert(bc, location, m));
            }
            else
            {
                return(Paragon.CheckConvert(bc, location, m));
            }
        }
示例#10
0
        public Paragon ToModel()
        {
            var m = new Paragon();

            m.Id              = Id;
            m.Amount          = Amount;
            m.PurchaseDate    = PurchaseDate;
            m.Note            = Note;
            m.AddedById       = AddedById;
            m.Category        = Category.ToModel();
            m.CategoryId      = Category.Id;
            m.IsDeletePending = IsDeletePending;
            return(m);
        }
示例#11
0
 public Paragon AddNew(Paragon paragon)
 {
     using (var db = new DomoFinoContext())
     {
         try
         {
             db.Paragon.Add(paragon);
             db.Category.Attach(paragon.Category);
             db.SaveChanges();
             return(paragon);
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
             throw;
         }
     }
 }
示例#12
0
 public void DeleteFromBin(List <int> idList)
 {
     using (var db = new DomoFinoContext())
     {
         try
         {
             idList.ForEach(id =>
             {
                 Paragon paragon = new Paragon()
                 {
                     Id = id
                 };
                 db.Paragon.Attach(paragon);
                 db.Paragon.Remove(paragon);
             });
             db.SaveChanges();
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
             throw;
         }
     }
 }
示例#13
0
        static void showReceipt(Paragon paragon)
        {
            double netto = 0;
            double total = 0;
            double vat8  = 0;
            double vat23 = 0;

            Console.WriteLine($"Data sprzedazy: {DateTime.Now.ToString("dd.MM.yyy")}");
            Console.WriteLine($"Numer Paragonu: {paragon.Kod}");
            Console.WriteLine("---------------------");
            AddedProducts.ForEach(product =>
            {
                Console.WriteLine($"{product.Produkt} {product.ilosc} {Math.Round(product.Cena + product.Cena * product.Vat, 2)}");
                netto += product.Cena;
                total += Math.Round(product.Cena + product.Cena * product.Vat, 2);
                switch (product.Vat)
                {
                case 0.08:
                    vat8 += Math.Round(product.Cena * product.Vat, 2);
                    break;

                case 0.23:
                    vat23 += Math.Round(product.Cena * product.Vat, 2);
                    break;
                }
            });
            Console.WriteLine($"Łacznie do zaplaty: {total} PLN");
            Console.WriteLine("w tym:");
            Console.WriteLine($"Vat 8% {vat8} PLN");
            Console.WriteLine($"Vat 23% {vat23} PLN");

            paragon.Netto  = netto;
            paragon.Brutto = total;
            Receipts.Add(paragon);
            UserSelect(new Till());
        }
示例#14
0
        public static BaseCreature Spawn(int level, Point3D p, Map map, Mobile target, bool guardian)
        {
            if (map == null)
            {
                return(null);
            }

            BaseCreature c = Spawn(level, p, guardian);



            if (c != null)
            {
                bool spawned = false;

                for (int i = 0; !spawned && i < 10; ++i)
                {
                    int x = p.X - 3 + Utility.Random(7);
                    int y = p.Y - 3 + Utility.Random(7);

                    if (map.CanSpawnMobile(x, y, p.Z))
                    {
                        c.MoveToWorld(new Point3D(x, y, p.Z), map);

                        if (HalloweenEventController.Instance != null && HalloweenEventController.Halloween && HalloweenCorruption.CheckCorrupt(c, new Point3D(x, y, p.Z), map))
                        {
                            c.IsCorrupt = true;
                        }

                        if (!c.IsCorrupt && Paragon.CheckConvert(c, new Point3D(x, y, p.Z), map))
                        {
                            c.IsParagon = true;
                        }

                        spawned = true;
                    }
                    else
                    {
                        int z = map.GetAverageZ(x, y);

                        if (map.CanSpawnMobile(x, y, z))
                        {
                            c.MoveToWorld(new Point3D(x, y, z), map);
                            spawned = true;

                            if (HalloweenEventController.Instance != null && HalloweenEventController.Halloween && HalloweenCorruption.CheckCorrupt(c, new Point3D(x, y, z), map))
                            {
                                c.IsCorrupt = true;
                            }

                            if (!c.IsCorrupt && Paragon.CheckConvert(c, new Point3D(x, y, z), map))
                            {
                                c.IsParagon = true;
                            }
                        }
                    }
                }

                if (!spawned)
                {
                    c.Delete();
                    return(null);
                }

                c.HomeMap = c.Map;

                if (target != null)
                {
                    c.Combatant = target;
                }

                return(c);
            }

            return(null);
        }
示例#15
0
 // We don't need no stinking paragons
 public override void OnBeforeSpawn(Point3D location, Map m)
 {
     base.OnBeforeSpawn(location, m);
     Paragon.UnConvert(this);
 }
示例#16
0
        static void shopping(Till Till)
        {
            Console.WriteLine("Podaj Kod Kreskowy");

            string KodKreskowy = Console.ReadLine();

            Product WybranyProdukt = new Product();

            bool prawidlowyKod = false;

            while (!prawidlowyKod)
            {
                if (Till.Products.Exists(product => product.Kod == KodKreskowy))
                {
                    WybranyProdukt = Till.Products.Find(product => product.Kod == KodKreskowy);
                    prawidlowyKod  = true;
                }
                else
                {
                    Console.WriteLine("Podaj Poprawny Kod Kreskowy :)");
                    KodKreskowy = Console.ReadLine();
                }
            }

            Console.WriteLine(WybranyProdukt.Produkt);
            Console.WriteLine("Podaj ilość");

            string ilosc = Console.ReadLine();

            WybranyProdukt.Cena  = WybranyProdukt.Cena * Int32.Parse(ilosc);
            WybranyProdukt.ilosc = ilosc;

            AddedProducts.Add(WybranyProdukt);



            Paragon Paragon = new Paragon();

            Paragon.Kod = Receipts.Count() + 1;



            Console.WriteLine("Nastepny produkt(N)");
            Console.WriteLine("Wydruk paragonu(P)");

            string Akcja = Console.ReadLine();

            switch (Akcja)
            {
            case "N":
                shopping(Till);
                break;

            case "n":
                shopping(Till);
                break;

            case "P":
                showReceipt(Paragon);

                break;

            case "p":
                showReceipt(Paragon);

                break;
            }
        }
示例#17
0
 public string ParagonToHtml()
 {
     return(Paragon.Replace("\n", "<br/>"));
 }
示例#18
0
        public static void UnConvert(BaseCreature bc)
        {
            XmlParagon xa = GetXmlParagon(bc);

            Paragon.UnConvert(bc);
        }