Esempio n. 1
0
        public void FillData()
        {
            PawnShop shop = new PawnShop();

            shop.FillTestData(100);
            Assert.AreEqual("Product0", shop.Deposits[0].Products[0].Name);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //test items for inventory
            InventoryItem item1 = new InventoryItem("zeko", "mali zeko", 20);
            InventoryItem item2 = new InventoryItem("autic", "mali crveni", 24);
            InventoryItem item3 = new InventoryItem("pingvin", "plisani medvjedic", 28);
            InventoryItem item4 = new InventoryItem("Samsung mobile", "mobitel pametni smarthphone", 2);
            var Item5 = new Car("Golf", "crne boje", 12500, "Limuzina", "VW", 2008, (Car.Conditions)1 );
             var Item6 = new Car("Golf 5", "crne i bijele boje", 10500, "Limuzina", "VW", 2005, (Car.Conditions)2 );
            //Test employee
            Employee Amar = new Employee("Amar", "Isakovic", 55);
            PawnShop TesasnjiPawn = new PawnShop("Tesanjski pawn shop");
            TesasnjiPawn.AddEmployee(Amar);
            TesasnjiPawn.AddItem(item1);
            TesasnjiPawn.AddItem(item2);
            TesasnjiPawn.AddItem(item3);
            TesasnjiPawn.AddItem(item4);
            TesasnjiPawn.AddItem(Item5);
             TesasnjiPawn.AddItem(Item6);
            Console.WriteLine(TesasnjiPawn);
            //Sorting NO.2
            TesasnjiPawn.PrintSortedByName();

            Console.WriteLine("ovo je sada soritanje po cijeni");

            //sorting
            TesasnjiPawn.PrintSortedByPrice();
            string SEARCHTERM = "Golf";

            //Search Method test
            TesasnjiPawn.Search(SEARCHTERM);

            Console.ReadLine();
        }
Esempio n. 3
0
        public static void CreatePawnShop(Vector3 location)
        {
            // Create the pawnshop blip
            Blip newBlip = World.CreateBlip(location);

            newBlip.IsShortRange = true;
            newBlip.Sprite       = BlipSprite.DollarBill;
            newBlip.Color        = BlipColor.Green;
            newBlip.Name         = "Pawn Shop";

            PawnShop shop = new PawnShop()
            {
                displayName = World.GetStreetName(location) + " Pawn",
                markerX     = location.X,
                markerY     = location.Y,
                markerZ     = location.Z
            };

            // Add the blip and shop
            config.pawnShops.Add(shop);
            blips.Add(newBlip);

            // Save the configuration json
            File.WriteAllText(modConfig, JsonConvert.SerializeObject(config, Formatting.Indented));
        }
 public MainForm(PawnShop shop)
 {
     InitializeComponent();
     Shop = shop;
     ClientBindingSource.DataSource  = Shop.Clients;
     ForSaleBindingSource.DataSource = Shop.Warehouse;
 }
Esempio n. 5
0
 public static void PrintInventory(PawnShop p)
 {
     foreach (Inventory i in p.Inventory)
     {
        Console.WriteLine(i);       
     }
 }
 public ReportForm(PawnShop shop)
 {
     InitializeComponent();
     saveFileDialog1.Filter = "Text files(*.txt)|*.txt|All files(*.*)|*.*";
     shop.GetReport();
     ReportBox.Text = File.ReadAllText(REPORT);
 }
Esempio n. 7
0
 static void PrintSearchResults(PawnShop ps, string s)
 {
     List<InventoryItem> items = ps.Find(s);
     foreach (var item in items)
     {
         Console.WriteLine(item);
     }
 }
Esempio n. 8
0
  static void Search(PawnShop p, string s)
  {
      List<ISearchable> res = p.Find(s);
      foreach (ISearchable r in res) 
      {
          Console.WriteLine(r);
      }
 }
Esempio n. 9
0
 static void PrintInventory(PawnShop ps)
 {
     foreach (var item in ps.Inventory)
     {
         Console.WriteLine(item);
         Console.WriteLine();
     }
 }
Esempio n. 10
0
 static void SortByPrice(PawnShop ps)
 {
     List<InventoryItem> sbp = ps.SortByPrice();
     foreach (var item in sbp)
     {
         Console.WriteLine(item);
         Console.WriteLine();
     }
 }
Esempio n. 11
0
        static void Main(string[] args)
        {
            PawnShop p = new PawnShop();
            Inventory i = new Inventory(1, "Painting", "Picasso's painting", 1000000);
            Vehiacle v = new Vehiacle("Sedan", 2006, "Alfa Romeo", "Weak", 2, "Car", "Sports car", 15000);
            Watches w = new Watches("Gold", "Rolex", 1978, 7, "Watch", "Expensive", 50000);
            p.AddInventory(i);
            p.AddInventory(v);
            p.AddInventory(w);

            PrintInventory(p);
        }
Esempio n. 12
0
 public void Load()
 {
     using (Stream stream = File.OpenRead(filePath))
     {
         var      serializer = new BinaryFormatter();
         PawnShop sh         = (PawnShop)serializer.Deserialize(stream);
         Copy(sh.Products, shop.Products);
         Copy(sh.Clients, shop.Clients);
         Copy(sh.Deposits, shop.Deposits);
         Copy(sh.ForSales, shop.ForSales);
     }
 }
Esempio n. 13
0
 public LogForm()
 {
     InitializeComponent();
     Shop = new PawnShop();
     if (File.Exists("shop.bin"))
     {
         Shop.Load();
     }
     else
     {
         Shop.FillTestData(100);
     }
 }
 public void Load()
 {
     using (Stream stream = File.OpenRead(filePath))
     {
         var      serializer = new BinaryFormatter();
         PawnShop sh         = (PawnShop)serializer.Deserialize(stream);
         Copy(sh.Products, Shop.Products);
         Copy(sh.Clients, Shop.Clients);
         Copy(sh.Deposits, Shop.Deposits);
         Copy(sh.Warehouse, Shop.Warehouse);
         Copy(sh.BannedUsers, Shop.BannedUsers);
     }
 }
Esempio n. 15
0
        static void Main()
        {
            PawnShop shop = new PawnShop();

            //shop.FillTestData(100);
            //shop.Save();
            //shop.ForSales.Clear();
            shop.Load();
            Console.WriteLine(shop.ForSales[0].Products[0].Id);
            Console.ReadKey();



            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());
        }
Esempio n. 16
0
        static void Main(string[] args)
        {
            PawnShop ps = new PawnShop();
            InventoryItem book = new InventoryItem("book", "some book", 50.00);
            InventoryItem watch = new Watch("watch", "old watch", 50.00, Watch.Material.gold, "somebody", "unknown");
            InventoryItem car = new Vehicle("car", "some car", 12000.00, "bmw", 1985, "jfa", Vehicle.Condition.bad);

            ps.Inventory.Add(book);
            ps.Inventory.Add(watch);
            ps.Inventory.Add(car);

            //PrintInventory(ps);

            //PrintSearchResults(ps, "c");

            //SortByName(ps);
            SortByPrice(ps);
        }
Esempio n. 17
0
 public ClientInfoForm(Client client, PawnShop shop, bool isClient = false)
 {
     InitializeComponent();
     Client   = client;
     Shop     = shop;
     IsClient = isClient;
     productBindingSource1.DataSource = Products;
     if (IsClient == false)
     {
         Text                 = "Информация о клиенте";
         InfoNameBox.Text     = Client.Name;
         InfoAgeBox.Text      = Convert.ToString(Client.Age);
         InfoEmailBox.Text    = Client.Email;
         InfoPasswordBox.Text = Client.Password;
         InfoRankBox.Text     = Convert.ToString(Client.Rank);
         BuyOutButton.Hide();
         LoanBox.Hide();
         menuStrip.Hide();
     }
     else
     {
         Text = "Основное";
         MainInfoBox.Hide();
         CurrentDeposit.Show();
     }
     Deposits = Shop.FindDepositsByClient(Client);
     if (Deposits.Count != 0)
     {
         depositBindingSource.DataSource = Deposits;
         productBindingSource.DataSource = Deposits[0].Products;
         DateTimeBox.Text       = Deposits[0].DateTime.ToString();
         DateTimeBuyOutBox.Text = Deposits[0].DateTimeBuyOut.ToString();
         PriceBox.Text          = Deposits[0].Price.ToString();
     }
     else
     {
         BuyOutButton.Enabled = false;
     }
 }
 public Dao(PawnShop shop)
 {
     Shop = shop;
 }
Esempio n. 19
0
 public Dao(PawnShop shop)
 {
     this.shop = shop;
 }