public void AddEvent(string EventNam)
 {
     DataBaseECont.EventBase.Add(new EventBase {
         EventName = EventNam
     });
     DataBaseECont.SaveChanges();
 }
 public bool AddEventsFromEventCreator(List <EventDataCreator> Inlist)
 {
     try
     {
         DataBaseECont.Database.Connection.Open();
         DataBaseECont.EventBase.Add(new EventBase {
             EventName = Inlist.First().EventName, EventTimeTable = CollectionFromEventDateCreator(Inlist)
         });                                                                                                                                           //ВЫбрать между этим или Foreach ниже
         foreach (EventDataCreator DT in Inlist)
         {
             DataBaseECont.EventTimeTable.Add(new EventTimeTable
             {
                 EventDateTime   = DT.EventDate,
                 EventID         = DataBaseECont.EventBase.Local.Last().EventID,
                 UserID          = (short)DataBaseECont.GetNowUserID(),
                 EverywhatRemind = DT.RemindEvery
             });
         }
         DataBaseECont.SaveChanges();
         DataBaseECont.Database.Connection.Close();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public string[] GetEventNamesArray()
        {
            int temp = DataBaseECont.GetNowUserID();

            return(DataBaseECont.EventTimeTable.Where(W => (W.UserID == 0 || W.UserID == temp))
                   .Select(P => P.EventBase.EventName)
                   .Distinct()
                   .ToArray());
        }
        public object GetBaseView()
        {
            var t = DataBaseECont.GetViewForNowUser().ToList();
            List <MainViewShowClass> ReturnList = new List <MainViewShowClass>();

            foreach (var el in t)
            {
                ReturnList.Add(new MainViewShowClass(el));
            }
            return(ReturnList);
        }
        private ICollection <EventTimeTable> CollectionFromEventDateCreator(List <EventDataCreator> InList)
        {
            List <EventTimeTable> Result = new List <EventTimeTable>();

            foreach (EventDataCreator DT in InList)
            {
                Result.Add(new EventTimeTable {
                    EventDateTime   = DT.EventDate,
                    UserID          = (short)DataBaseECont.GetNowUserID(),
                    EverywhatRemind = DT.RemindEvery
                });
            }
            return(Result);
        }
 public bool AddRemindsFromRemindCreator(List <RemindDataCreator> InList, int InID)
 {
     try
     {
         DataBaseECont.Database.Connection.Open();
         foreach (RemindDataCreator DT in InList)
         {
             DataBaseECont.EventRemindTable.Add(new EventRemindTable
             {
                 EventID         = InID,
                 DateUntilRemind = DT.RemindUntil,
                 UserID          = (short)DataBaseECont.GetNowUserID(),
                 TypeOfRemind    = DT.HowToRemind,
                 //TODO
             });
         }
         DataBaseECont.SaveChanges();
         DataBaseECont.Database.Connection.Close();
         return(true);
     }
     catch { return(false); }
 }