Пример #1
0
        static void Main(string[] args)
        {
            UserName = Validations.Words("Please Enter User Name  :  ", 1, 1, false);
            CoolCalUser currentUser = new CoolCalUser(UserName);

            Event _events = new Event(currentUser);

            DataTable[] data    = _events.EventFinder();
            Event[]     events  = currentUser.CalEvents(data, currentUser);
            bool        running = true;

            while (running)
            {
                currentUser.View(events);
                Utility.Pause();
                bool run = Validations.GetBool("Do you want to add an event?");
                if (run)
                {
                    currentUser.EventCreator(currentUser);
                }
                else
                {
                    running = false;
                }
            }
        }
Пример #2
0
        public static Event CreateEvent(string value, CoolCalUser user)

        {
            Event  Created = null;
            string query   = $@"Insert Into Events ( CalendarID , Description , Color , EventDateTime , Location , AdditionalInfo, NotificationID , Notes , EventTypeID ) value {value};";

            DatabaseConnection.queryDataInsert(query);
            query = $@"Select EventID from Events where ( CalendarID , Description , Color , EventDateTime , Location , AdditionalInfo, NotificationID , Notes , EventTypeID ) =  {value}  ; ";
            DataTable tables = DatabaseConnection.queryDatabase(query);

            foreach (DataRow table in tables.Rows)
            {
                Created = new Event(user, table["EventID"].ToString());
            }

            return(Created);
        }
Пример #3
0
        public Event EventCreator(CoolCalUser users)
        {
            int       i           = 0;
            string    description = Validations.Words("Please Enter the Description ");
            DataTable data        = DatabaseConnection.queryDatabase(@"Select Distinct Color from Events ;");
            Dictionary <int, string> SelectColor = new Dictionary <int, string>();

            foreach (DataRow row in data.Rows)
            {
                Console.WriteLine($"{i + 1} + {row["Color"].ToString()}"); SelectColor.Add(i, row["Color"].ToString()); i++;
            }
            int      select   = Validations.GetInt(1, i + 1, "Select Your Colors Number : ");
            string   color    = SelectColor[select - 1];
            string   dateTime = Validations.Words("Please enter the Date & Time", 10, 0, false);
            DateTime eventDateTime;

            while (!(DateTime.TryParse(dateTime, out eventDateTime)))
            {
                dateTime = Validations.Words("Please enter the Date & Time", 10, 0, false);
            }
            ;
            string location       = Validations.Words("Please Enter the Location  : ", 100, 0, false);
            string additionalInfo = Validations.Words("Please enter additional info : ", 100, 0, false);
            int    noticication   = Validations.GetInt("Enter the notification priority 1 to 4 , 4 is the highest ");
            string notes          = Validations.Words("Please Enter Notes ", 100, 0, false);
            int    eventType      = 4;

            i = 1;
            foreach (int y in _calendarID)
            {
                Console.WriteLine($"Calendaer {i}"); i++;
            }
            int calID = Validations.GetInt(1, i, "Enter the Calendar you want to add to  :  ") - 1;

            calID = _calendarID[calID];

            string addEvent = $@"({calID}, '{description}', '{color}' , '{eventDateTime.ToString("yyyy-MM-dd HH:mm:ss")}' , '{location}', '{additionalInfo}', {noticication}, '{notes}' , {eventType} )";

            Console.WriteLine(addEvent);
            Utility.Pause();
            Event Create = Event.CreateEvent(addEvent, users);

            return(Create);
        }
Пример #4
0
        public Event[] CalEvents(DataTable[] tables, CoolCalUser user)
        {
            List <Event> CoolCalEvents = new List <Event>();

            for (int i = 0; i < tables.Count(); i++)
            {
                foreach (DataRow row in tables[i].Rows)


                {
                    string x = row["EventID"].ToString();


                    Event add = new Event(user, x);
                    CoolCalEvents.Add(add);
                }
            }
            return(CoolCalEvents.ToArray());
        }
Пример #5
0
 public Event(CoolCalUser user, string eventID)
 {
     int.TryParse(eventID, out _eventID);
     _user = user;
 }
Пример #6
0
 public Event(CoolCalUser user)
 {
     _user = user;
 }