コード例 #1
0
ファイル: Program.cs プロジェクト: l33Hart/projectPortfolio
        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
ファイル: CoolCal.cs プロジェクト: l33Hart/projectPortfolio
        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
ファイル: CoolCal.cs プロジェクト: l33Hart/projectPortfolio
        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;
 }