public Form1()
        {
            InitializeComponent();

            countryDB               = new CountryDB();
            comboBox1.DataSource    = null;
            comboBox1.DataSource    = countryDB.GetListCombobox();
            comboBox1.DisplayMember = "NameCountry";

            categoryDB              = new CategoryDB();
            comboBox3.DataSource    = null;
            comboBox3.DataSource    = categoryDB.GetListCombobox();
            comboBox3.DisplayMember = "NameCategory";

            discoveredDB            = new DiscoveredDB();
            comboBox5.DataSource    = null;
            comboBox5.DataSource    = discoveredDB.GetDiscoveredBox();
            comboBox5.DisplayMember = "Status";

            dB = new AdvertisementDB();
            // создаем экземпл¤р пагинатора дл¤ отображени¤ 10 записей на странице. „исло 10 можно сделать переменной и вынести в настройки
            paginator = new Paginator <AdvertisementDB, Advertisement>(dB, 10);
            // дл¤ отображени¤ данных в листвью ¤ сделал отдельный класс
            // в нем кэшируютс¤ строки
            viewer = new ListViewViewer(listView1, 5, 10);


            // вызываем обновление всех данных и событий
            // за счет того, что данный метод вызываетс¤ ѕќ—Ћ≈ создани¤ пагинатора интерфейс успевает подписатьс¤ на событи¤ пагинатора и нормально отобразить все данные
            dB.Save();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var user = new UserApp();

            var advertisement = new AdvertisementDB();


            try
            {
                var i = user.Validaion("");
                //var add = user.Add(
                //new User
                //{
                //    email = "*****@*****.**",
                //    name = "mohannad",
                //    tokens = new List<Token>
                //    {
                //    new Token {
                //        expierdDate = DateTime.Now.ToUniversalTime(),
                //        token = "ASDFGHJKL"
                //    }
                //    }

                //  //});
                var r = Check(true);
                ////      r.Bind(Check(true));
                //      var re = r.Match(
                //        Left: l =>l.Map((a)=>"",""),
                //        Right: r => $"The result is: {r}");

                //Console.WriteLine(re);
                advertisement.Add(new Advertisement
                {
                    title  = "",
                    border = new List <Border> {
                        new Border {
                            IsStreet = false, direction = ""
                        }
                    }
                }
                                  );
                //var DeleteByID = user.DeleteByID("5ecc56c2609b036c58066ef1");
                //var addtoken = user.CreateToken(new Token {token = "jkfjkfjkfjkfj", expierdDate = DateTime.Now.ToUniversalTime() }, "5ecc57aca0c0e69ad86c4fec");
                //Console.WriteLine(DeleteByID);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #3
0
        public void setup()
        {
            bookingDB       = new BookingDB();
            advertisementDB = new AdvertisementDB();
            userDB          = new UserDB();
            bicycleDB       = new BicycleDB();
            crypto          = new CryptoModule();

            // Seed Brands
            b1 = new Brand {
                Name = "Croissant"
            };
            b2 = new Brand {
                Name = "Canondale"
            };
            b3 = new Brand {
                Name = "Trek"
            };

            // Seed Types
            bt1 = new BicycleType {
                TypeName = "Mountainbike"
            };
            bt2 = new BicycleType {
                TypeName = "Racer"
            };

            // Seed FrameSizes
            f1 = new Frame {
                Size = 30
            };
            f2 = new Frame {
                Size = 32
            };
            f3 = new Frame {
                Size = 34
            };
            f4 = new Frame {
                Size = 36
            };

            // Seed WheelSizes
            w1 = new Wheel {
                Size = 20
            };
            w2 = new Wheel {
                Size = 22
            };
            w3 = new Wheel {
                Size = 24
            };
            w4 = new Wheel {
                Size = 26
            };

            // Seed Users

            u1 = new User
            {
                Address = "test",
                Age     = "1",
                Salt    = crypto.GenerateSaltString(),
                Email   = "test",
                Name    = "test",
                PWord   = "1",
                Phone   = "1234",
                Zipcode = "9200"
            };

            u2 = new User
            {
                Address = "Hobrovej",
                Age     = "30",
                Salt    = crypto.GenerateSaltString(),
                Email   = "*****@*****.**",
                Name    = "John",
                PWord   = "123",
                Phone   = "87654321",
                Zipcode = "9000"
            };

            // Seed bicycles

            bike1 = new Bicycle
            {
                Brand     = b1,
                FrameSize = f1,
                Type      = bt1,
                User      = u1,
                WheelSize = w1,
                Year      = "2017"
            };

            bike2 = new Bicycle
            {
                Brand     = b2,
                FrameSize = f2,
                Type      = bt2,
                User      = u1,
                WheelSize = w2,
                Year      = "2016"
            };

            bike3 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f3,
                Type      = bt1,
                User      = u1,
                WheelSize = w3,
                Year      = "2015"
            };

            bike4 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f1,
                Type      = bt1,
                User      = u2,
                WheelSize = w1,
                Year      = "2012"
            };

            bike5 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f3,
                Type      = bt1,
                User      = u2,
                WheelSize = w3,
                Year      = "2011"
            };

            bike6 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f4,
                Type      = bt1,
                User      = u2,
                WheelSize = w4,
                Year      = "2010"
            };

            // Seed advertisements

            a1 = new Advertisement
            {
                Title       = "lorem 2",
                Description = "K0WJZFWWZW VLL4262TZI 81CS84SUUR OCWPGNS3X2 66WJ5APZLR BDCHCU3WEC",
                Price       = 18.90,
                StartDate   = DateTime.ParseExact("01/05/2017", "dd/MM/yyyy", null),
                EndDate     = DateTime.ParseExact("01/07/2017", "dd/MM/yyyy", null),
                User        = u2,
                Bike        = bike4
            };

            a2 = new Advertisement
            {
                Title       = "lorem 1",
                Description = "K0WJZFWWZW VLL4262TZI 81CS84SUUR OCWPGNS3X2 66WJ5APZLR BDCHCU3WEC",
                Price       = 18.90,
                StartDate   = DateTime.ParseExact("01/05/2017", "dd/MM/yyyy", null),
                EndDate     = DateTime.ParseExact("01/07/2017", "dd/MM/yyyy", null),
                User        = u1,
                Bike        = bike2
            };
        }