Exemple #1
0
        //methods
        public async void CreateEvent()
        {
            try
            {
                if (Evm.NewItem.Name == null || Evm.NewItem.Type == null || Evm.NewItem.Description == null || Evm.NewItem.Location == null || Evm.Date1 <= DateTime.Now)
                {
                    MessageDialog msg = new MessageDialog("In order to create event, you have to fill all the information. Otherwise make sure that the date is picked.", "Creating failed");
                    msg.ShowAsync();
                }
                else
                {
                    DateTime date = DataTimeConvertor.DateTimeOffsetAndTimeSetToDateTime(Evm.Date1, Evm.Time1);

                    _catalog.Events.Add(new Event(Evm.NewItem.Name, Evm.NewItem.Type, Evm.NewItem.Description, date,
                                                  Evm.NewItem.Location));
                    await _getEvents.SavetoJson(_catalog.Events);

                    _frameNAvigation.ActivateFrameNavigation(typeof(EventPage));
                }
            }
            catch (Exception e)
            {
                string        ex  = e.ToString();
                MessageDialog msg = new MessageDialog(ex, "Error");
                msg.ShowAsync();
            }
        }
Exemple #2
0
        public void DateTimeConverterTest()
        {
            //Act
            DateTime _expectedDate = new DateTime(2017, 12, 12, 6, 7, 0);
            DateTime _actualDate   = DataTimeConvertor.DateTimeOffsetAndTimeSetToDateTime(new DateTimeOffset(2017, 12, 12, 0, 0, 0, 0, new TimeSpan()),
                                                                                          new TimeSpan(6, 7, 0));

            //Assert
            Assert.AreEqual(_expectedDate, _actualDate);
        }
Exemple #3
0
 public void BeforeTest()
 {
     //Arrange
     evm     = new EventViewModel();
     ehc     = new EventHandlerClass(evm);
     eventt  = new Event("Name", "Type", "Description", DateTime.Parse("2018.02.08 12:00"), "Location");
     ecs     = new EventCatalogSingleton();
     getItem = new PersistancyService();
     getItem.EventsCatalog = new ObservableCollection <Event>();
     dateTimeCon           = new DataTimeConvertor();
 }