Пример #1
0
 public Form2(ICollection<UserEventInfo> deltakere, EventResultHandler handler)
 {
     _eventResultHandler = handler;
     
     InitializeComponent();
     this._deltakere = deltakere;
     var bindingList = new BindingList<UserEventInfo>(deltakere.ToList());
     var source = new BindingSource(bindingList,null);
     dataGridView1.DataSource = source;
     dataGridView1.ReadOnly = false;
     if (deltakere.First() != null)
     {
         //var x = new MockedEventService();
         //textBox1.Text = x.GetEvents("adsf", 2016).ToList().FirstOrDefault().Id1.ToString();
         //List<Event> eventer = eventService.GetEvents("adsf", DateTime.Now.Year).ToList();
         var eventer = _eventResultHandler.GetEvents(new DateTime(2015, 5, 10), new DateTime(2015, 10, 31)); //DateTime.Now
         if (eventer.Count >  0)
         {
             label2.Text = $"ID={eventer.First().Id}";
             listBox1.Items.Clear();
             listBox1.DataSource = eventer;
             listBox1.DisplayMember = "DisplayName";
             listBox1.ValueMember = "Id";
         }
         else
         {
             label2.Text = "Velg event...";
             listBox1.Items.Clear();
             listBox1.DataSource = eventer;
             listBox1.DisplayMember = "DisplayName";
             listBox1.ValueMember = "Id";
         }
     }
 }
Пример #2
0
 public Form1()
 {
     Thread.CurrentThread.CurrentCulture = new CultureInfo("nn-NO");
     var sqlDirectService = new SqlDirectService(ConfigurationManager.ConnectionStrings["db"].ConnectionString);
     var datalayerService = new DatalayerService(sqlDirectService);
     var eventService = new EventService(datalayerService);
     _handler = new EventResultHandler(new UserService(datalayerService),
             eventService, new FilterService(datalayerService));
     InitializeComponent();
 }
Пример #3
0
        public void Setup()
        {
            _eventService = new EventService(new DatalayerService(new SqlDirectService(ConfigurationManager.ConnectionStrings["db"].ConnectionString)));
            _assembly = Assembly.GetExecutingAssembly();
            _userService =
                new UserService(
                    new DatalayerService(
                        new SqlDirectService(ConfigurationManager.ConnectionStrings["db"].ConnectionString)));
            _filterService = new FilterService(new DatalayerService(
                        new SqlDirectService(ConfigurationManager.ConnectionStrings["db"].ConnectionString)));
            _handler = new EventResultHandler(_userService, _eventService, _filterService);

        }
Пример #4
0
        //private Assembly _assembly;

        public Form3(EventResultHandler handler)
        {
            _handler = handler;
            InitializeComponent();
            
            
            var filters = _handler.GetFilters();
            var filterList = filters.ToList();
            for (var i = 0; i < filters.Count; i++)
            {
                var j = i + 1;
                Controls["label" + j].Text = filterList[i].Type.ToString();
                Controls["textBox" + j].Text = filterList[i].Value;
            }
        }