Ejemplo n.º 1
0
 public SubCalendarEvent(string MySubEventID, DateTime EventStart, DateTime EventDeadline, BusyTimeLine SubEventBusy, bool Rigid, bool Enabled, EventDisplay UiParam, MiscData Notes, bool completeFlag, Location EventLocation = null, TimeLine RangeOfSubCalEvent = null)
 {
     CalendarEventRange = RangeOfSubCalEvent;
     SubEventID = new EventID(MySubEventID.Split('_'));
     StartDateTime = EventStart;
     EndDateTime = EventDeadline;
     EventDuration = SubEventBusy.TimelineSpan;
     BusyFrame = SubEventBusy;
     RigidSchedule = Rigid;
     this.Enabled = Enabled;
     this.EventLocation = EventLocation;
     UiParams = UiParam;
     DataBlob = Notes;
     Complete = completeFlag;
 }
Ejemplo n.º 2
0
        public SubCalendarEvent(string MySubEventID, BusyTimeLine MyBusylot, DateTime EventStart, DateTime EventDeadline, TimeSpan EventPrepTime, string myParentID, bool Rigid,bool Enabled, EventDisplay UiParam, MiscData Notes, bool completeFlag, Location EventLocation = null, TimeLine RangeOfSubCalEvent = null)
        {
            CalendarEventRange = RangeOfSubCalEvent;
            //string eventName, TimeSpan EventDuration, DateTime EventStart, DateTime EventDeadline, TimeSpan EventPrepTime, TimeSpan PreDeadline, bool EventRigidFlag, bool EventRepetition, int EventSplit
            StartDateTime = EventStart;
            EndDateTime = EventDeadline;
            EventDuration = MyBusylot.End - MyBusylot.Start;
            BusyFrame = MyBusylot;
            PrepTime = EventPrepTime;
            SubEventID = new EventID(MySubEventID.Split('_'));
            this.EventLocation = EventLocation;

            UiParams=UiParam;
            DataBlob= Notes;
            Complete = completeFlag;

            this.Enabled = Enabled;
            EventSequence = new EventTimeLine(SubEventID.ToString(), StartDateTime, EndDateTime);
            RigidSchedule = Rigid;
        }
Ejemplo n.º 3
0
 public CalendarEvent(CustomErrors Error)
 {
     EventDuration = new TimeSpan();
     CalendarEventName = "";
     StartDateTime = new DateTime();
     EndDateTime = new DateTime();
     EventPreDeadline = new TimeSpan();
     PrepTime = new TimeSpan();
     Priority = 0;
     RepetitionFlag = false;
     EventRepetition = new Repetition();
     RigidSchedule = false;
     Splits = 1;
     LocationData = new Location();
     CalendarEventID = new EventID("");
     SubEvents = new Dictionary<EventID, SubCalendarEvent>();
     SchedulStatus = false;
     otherPartyID = "";
     CalendarError = Error;
     EventSequence = new TimeLine();
 }
Ejemplo n.º 4
0
 public SubCalendarEvent(TimeSpan Event_Duration, DateTime EventStart, DateTime EventDeadline, TimeSpan EventPrepTime, string myParentID, bool Rigid, bool Enabled, EventDisplay UiParam,MiscData Notes,bool completeFlag, Location EventLocation =null, TimeLine RangeOfSubCalEvent = null)
 {
     CalendarEventRange = RangeOfSubCalEvent;
     StartDateTime = EventStart;
     EndDateTime = EventDeadline;
     EventDuration = Event_Duration;
     PrepTime = EventPrepTime;
     if (myParentID == "16")
     {
         ;
     }
     UiParams=UiParam;
     DataBlob = Notes;
     Complete=completeFlag;
     SubEventID = new EventID(myParentID + "_" + EventIDGenerator.generate().ToString());
     BusyFrame = new BusyTimeLine(this.ID, StartDateTime, EndDateTime);//this is because in current implementation busy frame is the same as CalEvent frame
     this.EventLocation = EventLocation;
     EventSequence = new EventTimeLine(SubEventID.ToString(), StartDateTime, EndDateTime);
     RigidSchedule = Rigid;
     this.Enabled = Enabled;
 }
Ejemplo n.º 5
0
 public CalendarEvent()
 {
     EventDuration = new TimeSpan();
     CalendarEventName = "";
     StartDateTime = new DateTime();
     EndDateTime = new DateTime();
     EventPreDeadline = new TimeSpan();
     PrepTime = new TimeSpan();
     Priority = 0;
     RepetitionFlag = false;
     EventRepetition = new Repetition();
     RigidSchedule = false;
     Splits = 1;
     LocationData = new Location();
     CalendarEventID = new EventID("");
     ArrayOfSubEvents = new SubCalendarEvent[0];
     SchedulStatus = false;
     otherPartyID = "";
     CalendarError = new CustomErrors(false, string.Empty);
     EventSequence = new TimeLine();
 }
Ejemplo n.º 6
0
 public XmlElement CreateLocationNode(Location Arg1, string ElementIdentifier)
 {
     XmlDocument xmldoc = new XmlDocument();
     XmlElement var1 = xmldoc.CreateElement(ElementIdentifier);
     string XCoordinate = "";
     string YCoordinate = "";
     string Descripion = "";
     string MappedAddress = "";
     if (Arg1 != null)
     {
         XCoordinate = Arg1.XCoordinate.ToString();
         YCoordinate = Arg1.YCoordinate.ToString();
         Descripion = Arg1.Description;
         MappedAddress = Arg1.Address;
     }
     var1.PrependChild(xmldoc.CreateElement("XCoordinate"));
     var1.ChildNodes[0].InnerText = XCoordinate;
     var1.PrependChild(xmldoc.CreateElement("YCoordinate"));
     var1.ChildNodes[0].InnerText = YCoordinate;
     var1.PrependChild(xmldoc.CreateElement("Address"));
     var1.ChildNodes[0].InnerText = MappedAddress;
     var1.PrependChild(xmldoc.CreateElement("Description"));
     var1.ChildNodes[0].InnerText = Descripion;
     return var1;
 }
Ejemplo n.º 7
0
 public Location CreateCopy()
 {
     Location this_cpy = new Location();
     this_cpy._token = this._token;
     this_cpy.TaggedAddress = this.TaggedAddress;
     this_cpy.TaggedDescription = this.TaggedDescription;
     this_cpy.xValue = this.xValue;
     this_cpy.yValue = this.yValue;
     return this_cpy;
 }
Ejemplo n.º 8
0
 private CalendarEvent(ConstructorModified UpdatedConstructor, EventID MyEventID, Location EventLocation=null)
     : this(MyEventID, UpdatedConstructor.Name, UpdatedConstructor.Duration, UpdatedConstructor.StartDate, UpdatedConstructor.EndDate, UpdatedConstructor.PrepTime, UpdatedConstructor.PreDeadline, UpdatedConstructor.Rigid, UpdatedConstructor.Repeat, UpdatedConstructor.Split, EventLocation, UpdatedConstructor.Enabled, UpdatedConstructor.ui, UpdatedConstructor.noteData, UpdatedConstructor.complete)
 {
 }
Ejemplo n.º 9
0
        public void ProcessRequest(HttpContext context)
        {
            //write your handler implementation here.

            context.Response.ContentType = "text/plain";

            string Command = context.Request["WagCommand"];
            string UserID = context.Request["UI"];
            string UserName = context.Request["UN"];

            string serverDirectoryOfCalLogs = System.Web.HttpContext.Current.Server.MapPath("..\\WagTapCalLogs\\");
            DateTime refNow = DateTime.UtcNow;
            TimeSpan TimeZoneSpan = new TimeSpan(0);
            string TimeZoneString = context.Request.Form["TimeZoneOffset"];
            if (!string.IsNullOrEmpty(TimeZoneString))
            {
                int TimeSpanint = Convert.ToInt32(TimeZoneString);
                TimeZoneSpan = TimeSpan.FromMinutes(TimeSpanint);
                refNow=refNow.Add(-TimeZoneSpan);
            }

            /*//forces copying of my log online
            string serverDirectoryOfFiles = System.Web.HttpContext.Current.Server.MapPath("..\\18.xml");
            {
                Directory.CreateDirectory(serverDirectoryOfCalLogs);
                File.Copy(serverDirectoryOfFiles, serverDirectoryOfCalLogs + "18.xml", true);
            }

            context.Response.Write("Name of Dir: " + UserAccount.WagTapLogLocation + "\nRest Of File:" + serverDirectoryOfCalLogs);
            //*/
            string User = context.Request.Form["UserName"];
            string Password = context.Request.Form["Password"];

            UserAccount myUser;
            if (string.IsNullOrEmpty(Password))
            {
                int UserIDEntry =0;
                try
                {
                    UserIDEntry = Convert.ToInt32(context.Request.Form["UserID"]);
                    myUser = new UserAccount(User, UserIDEntry, serverDirectoryOfCalLogs);
                }
                catch(Exception e)
                {
                    PostBackData invalid = new PostBackData("Incorrect Username or password", 1);
                    context.Response.Write(invalid.getPostBackData);
                    return;
                }

            }
            else
            {
                myUser = new UserAccount(User, Password, serverDirectoryOfCalLogs);
            }

            if (Command == "3")
            {
                string FirstName = context.Request.Form["FirstName"];
                string LastName = context.Request.Form["LastName"];
                string Email = context.Request.Form["Email"];
                string UserNameRegister = context.Request.Form["UserName"];
                string regPasswordPassword = context.Request.Form["Password"];
                UserAccount newUser = new UserAccount(serverDirectoryOfCalLogs);
                string retValue;
                CustomErrors registerStatus=newUser.Register(FirstName, LastName, Email, UserNameRegister, regPasswordPassword);
                PostBackData myPostBackData;
                if (!registerStatus.Status)
                {
                    newUser.Login();

                    retValue = "{\"ID\":\"" + newUser.UserID + "\",\"User\":\"" + newUser.UserName + "\"}";
                    myPostBackData = new PostBackData(retValue, registerStatus.Code);
                }
                else
                {
                    myPostBackData = new PostBackData(registerStatus.Message, registerStatus.Code);

                }

                context.Response.Write(myPostBackData.getPostBackData);
            }
            else
            {
                myUser.Login();
                if (!myUser.Status)
                {
                    PostBackData invalid = new PostBackData("\"\"", 1);
                    context.Response.Write(invalid.getPostBackData);
                    return;
                }

                //TimeSpan referenceShift=
                switch (Command)
                {
                    case "0"://get user schedule
                    {

                        string MiscCounter = context.Request.Form["Misc"];
                        string mydirectory = "";
                        string StartRange = context.Request.Form["StartRange"];
                        string EndRange = context.Request.Form["EndRange"];
                        Tuple<Dictionary<string, My24HourTimerWPF.CalendarEvent>, DateTime> ProfileData = myUser.getProfileInfo();

                        /*
                        if (!string.IsNullOrEmpty(MiscCounter))
                        {
                            int counter = Convert.ToInt32( MiscCounter);
                            if (counter == 0)
                            {
                                mydirectory = "WagTapCalLogs\\Older18.xml";
                            }
                            else
                            {
                                mydirectory = "WagTapCalLogs\\Newer18.xml";
                            }

                            mydirectory = System.Web.HttpContext.Current.Server.MapPath("..\\" + mydirectory);
                        }
                        */

                        Dictionary<string, My24HourTimerWPF.CalendarEvent> myDict = ProfileData.Item1;// getAllCalendarElements(mydirectory);
                        PostBackData myPostBackData;
                        if (myDict != null)
                        {
                            TimeLine ScheduleRange;
                            DateTime Now=DateTime.Now;
                            DateTime StartWeekDateInMS=DateTime.Parse(Now.Date.ToShortDateString());
                            int StartOfWeekDay =(int) StartWeekDateInMS.DayOfWeek;
                            StartOfWeekDay = 0 - StartOfWeekDay;

                            TimeSpan OneDayInMs= new TimeSpan(1,0,0,0);
                            TimeSpan OneWeekInMs= new TimeSpan(7,0,0,0);

                            DateTime StartOfRangeDate= StartWeekDateInMS.Add((TimeSpan.FromTicks((StartOfWeekDay *OneDayInMs.Ticks))));
                            StartOfRangeDate =StartOfRangeDate.AddDays(-7);
                            DateTime EndOfRangeDate=StartOfRangeDate.AddDays(21);

                            if (! (String.IsNullOrEmpty(StartRange) || String.IsNullOrEmpty(EndRange)))
                            {
                                long TotalTIcks = Convert.ToInt64(StartRange) ;
                                TotalTIcks  *= TimeSpan.TicksPerMillisecond;
                                StartOfRangeDate = new DateTime(TotalTIcks);
                                StartOfRangeDate=StartOfRangeDate.AddYears(1969);

                                TotalTIcks = Convert.ToInt64(EndRange);
                                TotalTIcks *=TimeSpan.TicksPerMillisecond;
                                EndOfRangeDate = new DateTime(TotalTIcks);
                                EndOfRangeDate = EndOfRangeDate.AddYears(1969);
                            }

                            ScheduleRange = new TimeLine(StartOfRangeDate, EndOfRangeDate);

                            string jsonText = getJSONData(myDict, ScheduleRange, myUser.Usersname, TimeZoneSpan);

                            myPostBackData = new PostBackData(jsonText, 0);
                            context.Response.Write(myPostBackData.getPostBackData);
                        }
                        else
                        {
                            string message = "invalid user";
                            myPostBackData = new PostBackData(message, 4);

                            context.Response.Write(myPostBackData.getPostBackData);
                        }
                    }
                    break;
                    case "1"://Add new event
                        {
                            string BColor = context.Request.Form["BColor"];
                            string RColor = context.Request.Form["RColor"];
                            string GColor = context.Request.Form["GColor"];
                            string Count = context.Request.Form["Count"];
                            string DurationDays = context.Request.Form["DurationDays"];
                            string DurationHours = context.Request.Form["DurationHours"];
                            string DurationMins = context.Request.Form["DurationMins"];
                            string EndDay = context.Request.Form["EndDay"];
                            string EndHour = context.Request.Form["EndHour"];
                            string EndMins = context.Request.Form["EndMins"];
                            string EndMonth = context.Request.Form["EndMonth"];
                            string EndYear = context.Request.Form["EndYear"];

                            string LocationAddress = context.Request.Form["LocationAddress"];
                            string LocationTag = context.Request.Form["LocationTag"];
                            string Name = context.Request.Form["Name"];

                            string RepeatData = context.Request.Form["RepeatData"];
                            string RepeatEndDay = context.Request.Form["RepeatEndDay"];
                            string RepeatEndMonth = context.Request.Form["RepeatEndMonth"];
                            string RepeatEndYear = context.Request.Form["RepeatEndYear"];
                            string RepeatStartDay = context.Request.Form["RepeatStartDay"];
                            string RepeatStartMonth = context.Request.Form["RepeatStartMonth"];
                            string RepeatStartYear = context.Request.Form["RepeatStartYear"];
                            string RepeatType = context.Request.Form["RepeatType"];
                            string RepeatWeeklyData = context.Request.Form["RepeatWeeklyData"];
                            string Rigid = context.Request.Form["Rigid"];
                            string StartDay = context.Request.Form["StartDay"];
                            string StartHour = context.Request.Form["StartHour"];
                            string StartMins = context.Request.Form["StartMins"];
                            string StartMonth = context.Request.Form["StartMonth"];
                            string StartYear = context.Request.Form["StartYear"];
                            string RepeatFrequency =  context.Request.Form["RepeatFrequency"];

                            string StartTime=StartHour+":"+StartMins;
                            string EndTime=EndHour+":"+EndMins;
                            DateTime StartDateEntry = new DateTime(Convert.ToInt32(StartYear),Convert.ToInt32(StartMonth),Convert.ToInt32( StartDay));
                            DateTime EndDateEntry = new DateTime(Convert.ToInt32(EndYear),Convert.ToInt32(EndMonth),Convert.ToInt32( EndDay));

                            TimeSpan fullTimeSpan = new TimeSpan(Convert.ToInt32(DurationDays),Convert.ToInt32(DurationHours),Convert.ToInt32(DurationMins),0);
                            string EventDuration = TimeSpan.FromSeconds(fullTimeSpan.TotalSeconds*Convert.ToInt32(Count)).ToString();

                            bool RigidScheduleFlag = Convert.ToBoolean(Rigid);
                            Location EventLocation = new Location(LocationAddress);

                            Repetition MyRepetition=new Repetition();
                            DateTime RepeatStart = new DateTime();
                            DateTime RepeatEnd= new DateTime();
                            bool RepetitionFlag = false;
                            Color userColor= new Color();

                            if (RigidScheduleFlag)
                            {
                                DateTime FullStartTime = DateTime.Parse(StartDateEntry.ToShortDateString() + " " + StartTime);
                                DateTime FullEndTime = DateTime.Parse(EndDateEntry.ToShortDateString() + " " + EndTime);

                                EventDuration = (FullEndTime - FullStartTime).ToString();
                            }

                             if (!string.IsNullOrEmpty(RepeatType))
                            {

                                DateTime FullStartTime = DateTime.Parse(StartDateEntry.ToShortDateString() + " " + StartTime);
                                DateTime FullEndTime = DateTime.Parse(EndDateEntry.ToShortDateString() + " " + EndTime);

                                RepeatStart = StartDateEntry;

                                RepeatEnd = new DateTime(Convert.ToInt32(RepeatEndYear),Convert.ToInt32(RepeatEndMonth),Convert.ToInt32(RepeatEndDay));
                                //RepeatEnd = (DateTime.Now).AddDays(7);
                                RepetitionFlag = true;
                                MyRepetition = new Repetition(RepetitionFlag, new TimeLine(RepeatStart, RepeatEnd), RepeatFrequency, new TimeLine(FullStartTime,FullEndTime));
                                EndDateEntry = RepeatEnd;
                            }

                            Schedule MySchedule = new Schedule(myUser,refNow);
                            CalendarEvent newCalendarEvent = new CalendarEvent(Name, StartTime, StartDateEntry, EndTime, EndDateEntry, Count, "", EventDuration, MyRepetition, true, RigidScheduleFlag, "", true, EventLocation, true, new EventDisplay(true,userColor),new MiscData(),false);

                            newCalendarEvent.Repeat.PopulateRepetitionParameters(newCalendarEvent);

                            string BeforemyName = newCalendarEvent.ToString(); //BColor + " -- " + Count + " -- " + DurationDays + " -- " + DurationHours + " -- " + DurationMins + " -- " + EndDay + " -- " + EndHour + " -- " + EndMins + " -- " + EndMonth + " -- " + EndYear + " -- " + GColor + " -- " + LocationAddress + " -- " + LocationTag + " -- " + Name + " -- " + RColor + " -- " + RepeatData + " -- " + RepeatEndDay + " -- " + RepeatEndMonth + " -- " + RepeatEndYear + " -- " + RepeatStartDay + " -- " + RepeatStartMonth + " -- " + RepeatStartYear + " -- " + RepeatType + " -- " + RepeatWeeklyData + " -- " + Rigid + " -- " + StartDay + " -- " + StartHour + " -- " + StartMins + " -- " + StartMonth + " -- " + StartYear;

                            string AftermyName = newCalendarEvent.ToString();
                            MySchedule.AddToSchedule(newCalendarEvent);
                            PostBackData myPostData = new PostBackData("\"Success\"", 0);
                            context.Response.Write(myPostData.getPostBackData);
                        }
                        break;
                    case "2"://procrastinate
                        {
                            string EventID = context.Request.Form["EventID"];
                            string DurationDays = context.Request.Form["DurationDays"];
                            string DurationHours = context.Request.Form["DurationHours"];
                            string DurationMins = context.Request.Form["DurationMins"];

                            Schedule MySchedule = new Schedule(myUser, refNow);
                            TimeSpan fullTimeSpan = new TimeSpan(Convert.ToInt32(DurationDays), Convert.ToInt32(DurationHours), Convert.ToInt32(DurationMins), 0);
                            Tuple<CustomErrors, Dictionary<string, CalendarEvent>> ScheduleUpdateMessage = MySchedule.ProcrastinateJustAnEvent(EventID, fullTimeSpan);
                            MySchedule.UpdateWithProcrastinateSchedule(ScheduleUpdateMessage.Item2);

                            PostBackData myPostData = new PostBackData("\"Success\"", 0);
                            context.Response.Write(myPostData.getPostBackData);
                        }
                        break;
                    case "4"://SignInToUerAccount
                        {

                            string retValue;
                            retValue = "{\"ID\":\"" + myUser.UserID + "\",\"User\":\"" + myUser.UserName + "\",\"Name\":\"" + myUser.Usersname + "\"}";
                            PostBackData myPostData = new PostBackData(retValue, 0);
                            context.Response.Write(myPostData.getPostBackData);
                        }
                        break;
                    case "5"://CreateLogFolder
                        {
                            string serverDirectoryOfFile = System.Web.HttpContext.Current.Server.MapPath("..\\18.xml");
                            {
                                Directory.CreateDirectory(serverDirectoryOfCalLogs);
                                File.Copy(serverDirectoryOfFile, serverDirectoryOfCalLogs + "18.xml",true);
                            }

                            context.Response.Write("Name of Dir: " + UserAccount.WagTapLogLocation + "\nRest Of File:" + serverDirectoryOfCalLogs);
                        }
                        break;
                    case "6"://Delete an event and readjust
                        {
                            string EventID = context.Request.Form["EventID"];
                            Schedule MySchedule = new Schedule(myUser, refNow);
                            MySchedule.deleteSubCalendarEvent(EventID);
                            PostBackData myPostData = new PostBackData("\"Success\"", 0);
                            context.Response.Write(myPostData.getPostBackData);
                        }
                        break;
                    case "7"://Mark as Complete and readjust
                        {
                            string EventID = context.Request.Form["EventID"];
                            Schedule MySchedule = new Schedule(myUser, refNow);
                            MySchedule.markSubEventAsCompleteCalendarEventAndReadjust(EventID);
                            PostBackData myPostData = new PostBackData("\"Success\"", 0);
                            context.Response.Write(myPostData.getPostBackData);
                        }
                        break;
                    case "8"://Set as now
                        {
                            string EventID = context.Request.Form["EventID"];
                            Schedule MySchedule = new Schedule(myUser, refNow);
                            Tuple<CustomErrors, Dictionary<string, CalendarEvent>> retValue = MySchedule.SetEventAsNow(EventID);
                            MySchedule.UpdateWithProcrastinateSchedule(retValue.Item2);
                            PostBackData myPostData = new PostBackData("\"Success\"", 0);
                            context.Response.Write(myPostData.getPostBackData);
                        }
                        break;
                    case "9"://Download Log
                        {
                            string serverDirectoryOfFile = System.Web.HttpContext.Current.Server.MapPath("..\\"+myUser.UserID+".xml");

                            byte[] FileData = File.ReadAllBytes(myUser.getFullLogDir);
                            string SaveAsName = myUser.UserName + "Log.xml";
                            string SomeXLog= myUser.getFullLogDir;

                            ResponseOpenFileBytes(FileData, null, SaveAsName, context.Response);
                            context.Response.Write("sent: " + SaveAsName + "\nSomeXLog is:" + SomeXLog + "\nRest Of File:" + serverDirectoryOfCalLogs + "Current Time is: " + DateTime.Now.ToString());
                            context.Response.End();
                        }
                        break;

                    default:
                        break;
                }

            }

            DateTime dt;
        }
Ejemplo n.º 10
0
        void UpdateLocationMatrix(Location newLocation)
        { 
            
            int i = 0;
            int j = 0;
            if (DistanceMatrix == null)
            {
                DistanceMatrix = new Dictionary<string, List<double>>();
            }
            if(Horizontal==null)
            {
                Horizontal= new List<Location>();
            }

            if(!DistanceMatrix.ContainsKey(this.CalendarEventID.getLevelID(0)))
            {
                string myCalString = this.CalendarEventID.getLevelID(0);
                DistanceMatrix.Add(myCalString, new List<double>());
                Horizontal.Add(newLocation);
                DistanceMatixKeys= DistanceMatrix.Keys.ToList();
                foreach (string eachString in DistanceMatixKeys)
                {
                        
                        Location eachStringLocation=Horizontal[DistanceMatixKeys.IndexOf(eachString)];
                        double MyDistance = Location.calculateDistance(eachStringLocation, newLocation);

                        if (double.IsPositiveInfinity(MyDistance))
                        {
                            ;
                        }

                        if (eachString == this.CalendarEventID.getLevelID(0))
                        {
                            MyDistance = double.MaxValue / DistanceMatixKeys.Count;

                            

                            DistanceMatrix[myCalString].Add(MyDistance);
                        }
                        else
                        {

                            DistanceMatrix[eachString].Add(MyDistance);
                            DistanceMatrix[myCalString].Add(MyDistance);
                        }

                        
                        DistanceMatrix[eachString][DistanceMatixKeys.IndexOf(eachString)] = double.MaxValue / DistanceMatixKeys.Count; 
                        
                }
                
                
            }
        }
Ejemplo n.º 11
0
 public CalendarEvent(string NameEntry, string StartTime, DateTime StartDateEntry, string EndTime, DateTime EventEndDateEntry, string eventSplit, string PreDeadlineTime, string EventDuration, Repetition EventRepetitionEntry, bool DefaultPrepTimeflag, bool RigidScheduleFlag, string eventPrepTime, bool PreDeadlineFlag,Location EventLocation)
     : this(new ConstructorModified(NameEntry, StartTime, StartDateEntry, EndTime, EventEndDateEntry, eventSplit, PreDeadlineTime, EventDuration, EventRepetitionEntry, DefaultPrepTimeflag, RigidScheduleFlag, eventPrepTime, PreDeadlineFlag), EventLocation)
 {
 }
Ejemplo n.º 12
0
        public CalendarEvent(EventID EventIDEntry, string EventName, TimeSpan Event_Duration, DateTime EventStart, DateTime EventDeadline, TimeSpan EventPrepTime, TimeSpan Event_PreDeadline, bool EventRigidFlag, Repetition EventRepetitionEntry, int EventSplit, Location EventLocation, bool enabledFlag, EventDisplay UiData, MiscData NoteData, bool CompletionFlag)
        {
            CalendarEventName = EventName;
            StartDateTime = EventStart;
            EndDateTime = EventDeadline;
            EventDuration = Event_Duration;
            Enabled = enabledFlag;
            EventRepetition = EventRepetitionEntry;
            PrepTime = EventPrepTime;
            EventPreDeadline = Event_PreDeadline;
            RigidSchedule = EventRigidFlag;
            LocationData = EventLocation;
            CalendarEventID = EventIDEntry;
            UiParams = UiData;
            DataBlob = NoteData;
            Complete = CompletionFlag;

            if (EventRepetition.Enable)
            {
                Splits = EventSplit;
                TimePerSplit = new TimeSpan();
            }
            else
            {
                Splits = EventSplit;
                TimePerSplit = TimeSpan.FromTicks(((EventDuration.Ticks / Splits)));
            }
            SubEvents = new Dictionary<EventID, SubCalendarEvent>();
            for (int i = 0; i < Splits; i++)
            {
                //(TimeSpan Event_Duration, DateTime EventStart, DateTime EventDeadline, TimeSpan EventPrepTime, string myParentID, bool Rigid, Location EventLocation =null, TimeLine RangeOfSubCalEvent = null)
                SubCalendarEvent newSubCalEvent = new SubCalendarEvent(TimePerSplit, (EndDateTime - TimePerSplit), this.End, new TimeSpan(), CalendarEventID.ToString(), RigidSchedule,this.isEnabled, this.UiParams,this.Notes,this.Complete, EventLocation, this.RangeTimeLine);
                SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
            }

            EventSequence = new TimeLine(StartDateTime, EndDateTime);
            UpdateLocationMatrix(EventLocation);
        }
Ejemplo n.º 13
0
 private CalendarEvent(ConstructorModified UpdatedConstructor, Location EventLocation)
     : this(UpdatedConstructor.Name, UpdatedConstructor.Duration, UpdatedConstructor.StartDate, UpdatedConstructor.EndDate, UpdatedConstructor.PrepTime, UpdatedConstructor.PreDeadline, UpdatedConstructor.Rigid, UpdatedConstructor.Repeat, UpdatedConstructor.Split, EventLocation)
 {
 }
Ejemplo n.º 14
0
        public CalendarEvent(string EventName, TimeSpan Event_Duration, DateTime EventStart, DateTime EventDeadline, TimeSpan EventPrepTime, TimeSpan Event_PreDeadline, bool EventRigidFlag, Repetition EventRepetitionEntry, int EventSplit, Location EventLocation, bool EnableFlag, EventDisplay UiData, MiscData NoteData, bool CompletionFlag)
        {
            CalendarEventName = EventName;
            /*CalendarEventName = EventName.Split(',')[0];
            LocationString = "";
            if (EventName.Split(',').Length > 1)
            {
                LocationString = EventName.Split(',')[1];
            }
            CalendarEventLocation = null;
            CalendarEventLocation = new Location();
            if (LocationString != "")
            {
                CalendarEventLocation = new Location(LocationString);
            }
            */
            StartDateTime = EventStart;
            EndDateTime = EventDeadline;
            EventDuration = Event_Duration;
            PrepTime = EventPrepTime;
            EventPreDeadline = Event_PreDeadline;
            RigidSchedule = EventRigidFlag;
            LocationData = EventLocation;
            CalendarEventID = new EventID(new string[] { EventIDGenerator.generate().ToString() });
            EventRepetition = EventRepetitionEntry;

            UiParams = UiData;
            DataBlob = NoteData;
            Complete = CompletionFlag;


            if (EventRepetition.Enable)
            {
                Splits = EventSplit;
                TimePerSplit = new TimeSpan();
            }
            else
            {
                Splits = EventSplit;
                TimePerSplit = TimeSpan.FromTicks(((EventDuration.Ticks / Splits)));
            }

            SubEvents = new Dictionary<EventID, SubCalendarEvent>();
            for (int i = 0; i < Splits; i++)
            {
                SubCalendarEvent newSubCalEvent = new SubCalendarEvent(TimePerSplit, (EndDateTime - TimePerSplit), this.End, new TimeSpan(), CalendarEventID.ToString(), RigidSchedule, this.Enabled, this.UiParams, this.Notes, this.Complete, EventLocation, this.RangeTimeLine); //new SubCalendarEvent(CalendarEventID);
                SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
            }

            
            
            EventSequence = new TimeLine(StartDateTime, EndDateTime);
            UpdateLocationMatrix(LocationData);
        }
Ejemplo n.º 15
0
        public static double calculateDistance(Location Location24A, Location Location24B)
        {
            //note .... this function does not take into consideration the calendar event. So if there are two locations of the same calendarevent they will get scheduled right next to each other
            double R = 3958.7558657440545; // Radius of earth in Miles
            double dLat = toRad(Location24A.xValue - Location24B.xValue);
            double dLon = toRad(Location24A.yValue - Location24B.yValue);
            double a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) +
                    Math.Cos(toRad(Location24A.xValue)) * Math.Cos(toRad(Location24A.xValue)) *
                    Math.Sin(dLon / 2) * Math.Sin(dLon / 2);
            double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
            double d = R * c;
            return d;

            /*double deltaX=Location24A.xValue-Location24B.xValue;
            double deltaY = Location24A.yValue - Location24B.yValue;
            double sqrValue = (Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2));
            double retValue=Math.Sqrt(sqrValue);
            if (double.IsPositiveInfinity(retValue))
                        {
                            ;
                        }
            return retValue;*/
        }
Ejemplo n.º 16
0
        public static Location AverageGPSLocation(IEnumerable<Location> Locations)
        {
            double xCoord=Locations.Average(obj=>obj.xValue);
            double yCoord=Locations.Average(obj=>obj.yValue);
            Location retValue= new Location(xCoord,yCoord);

            return retValue;
        }
Ejemplo n.º 17
0
        public CalendarEvent(CalendarEvent MyUpdated, SubCalendarEvent[] MySubEvents)
        {
            CalendarEventName = MyUpdated.Name;
            
            StartDateTime = MyUpdated.StartDateTime;
            EndDateTime = MyUpdated.End;
            EventSequence = new TimeLine(StartDateTime, EndDateTime);
            EventDuration = MyUpdated.ActiveDuration;
            Splits = MyUpdated.Splits;
            PrepTime = MyUpdated.PrepTime;
            EventPreDeadline = MyUpdated.PreDeadline;
            RigidSchedule = MyUpdated.Rigid;
            TimePerSplit = MyUpdated.TimePerSplit;
            if (MyUpdated.ID != null)
            {
                CalendarEventID = new EventID(MyUpdated.ID.Split('_'));
            }
            Enabled = MyUpdated.isEnabled;

            SubEvents = new Dictionary<EventID, SubCalendarEvent>();
            for (int i = 0; i < MySubEvents.Length; i++)//using MySubEvents.length for the scenario of the call for repeat event. Remember the parent event does not generate subevents
            {
                SubCalendarEvent newSubCalEvent = MySubEvents[i];
                if (SubEvents.ContainsKey(newSubCalEvent.SubEvent_ID))
                { 
                    SubEvents[newSubCalEvent.SubEvent_ID]=newSubCalEvent;
                }
                else
                {
                    SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                }   
            }

            SchedulStatus = false;
            EventRepetition = MyUpdated.Repeat;
            LocationData = MyUpdated.LocationData;
            UpdateLocationMatrix(LocationData);
            EventSequence = new TimeLine(StartDateTime, EndDateTime);
        }
Ejemplo n.º 18
0
 public CalendarEvent(string NameEntry, string StartTime, DateTime StartDateEntry, string EndTime, DateTime EventEndDateEntry, string eventSplit, string PreDeadlineTime, string EventDuration, Repetition EventRepetitionEntry, bool DefaultPrepTimeflag, bool RigidScheduleFlag, string eventPrepTime, bool PreDeadlineFlag,Location EventLocation,bool EnabledEventFlag, EventDisplay UiData,MiscData NoteData,bool CompletionFlag)
     : this(new ConstructorModified(NameEntry, StartTime, StartDateEntry, EndTime, EventEndDateEntry, eventSplit, PreDeadlineTime, EventDuration, EventRepetitionEntry, DefaultPrepTimeflag, RigidScheduleFlag, eventPrepTime, PreDeadlineFlag, EnabledEventFlag,  UiData, NoteData, CompletionFlag), EventLocation)
 {
 }
Ejemplo n.º 19
0
        public bool UpdateThis(SubCalendarEvent SubEventEntry)
        {
            if ((this.ID == SubEventEntry.ID)&&canExistWithinTimeLine(SubEventEntry.getCalendarEventRange))
            {
                StartDateTime= SubEventEntry.Start;
                EndDateTime= SubEventEntry.End;
                BusyFrame.updateBusyTimeLine(SubEventEntry.BusyFrame);
                AvailablePreceedingFreeSpace = SubEventEntry.AvailablePreceedingFreeSpace;
                RigidSchedule = SubEventEntry.Rigid;
                CalendarEventRange = SubEventEntry.CalendarEventRange;
                EventLocation = SubEventEntry.LocationData;
                Enabled = SubEventEntry.Enabled;
                ThirdPartyID = SubEventEntry.ThirdPartyID;
                return true;
            }

            throw new Exception("Error Detected: Trying to update SubCalendar Event with non matching ID");
        }
Ejemplo n.º 20
0
        private void RunEvaluation(object sender, RoutedEventArgs e)
        {
            int NumberOfRetries = Convert.ToInt32(textBox10.Text);
            long[] AllData = new long[NumberOfRetries];

            while(--NumberOfRetries>=0)
            {
                UserAccount currentUser = new UserAccount(UserNameTextBox.Text, PasswordTextBox.Text);
                MySchedule = new Schedule(currentUser,DateTime.Now);

                string eventName = textBox1.Text;
                string LocationString = textBox8.Text.Trim();
                /*if (LocationString != "")
                {
                    eventName += "," + LocationString;
                }*/

                DateTime CurrentTimeOfExecution = DateTime.Now;
                string eventStartTime = textBox5.Text;
                string locationInformation = textBox8.Text;
                DateTime eventStartDate = (DateTime)datePicker1.SelectedDate.Value;
                string eventEndTime = textBox7.Text;
                DateTime eventEndDate = (DateTime)datePicker2.SelectedDate.Value;
                bool EventRepetitionflag = checkBox2.IsChecked.Value;
                bool DefaultPrepTimeflag = checkBox3.IsChecked.Value;
                string eventPrepTime = textBox3.Text;
                bool RigidScheduleFlag = checkBox5.IsChecked.Value;
                string RepeatFrequency = comboBox2.Text;
                string EventDuration = textBox4.Text;
                string eventSplit = textBox2.Text;
                bool DefaultPreDeadlineFlag = checkBox4.IsChecked.Value;
                string PreDeadlineTime = textBox6.Text;
                eventStartTime = eventStartTime.Trim();
                eventStartTime = eventStartTime.Replace(" ", string.Empty);
                if (eventStartTime == "")
                {
                    eventStartTime = CurrentTimeOfExecution.ToString();
                    string[] TempString = eventStartTime.Split(' ');
                    eventStartTime = TempString[1] + TempString[2];
                }
                //This attempts to detect invalid inputs for start time values
                string[] TimeElements = CalendarEvent.convertTimeToMilitary(eventStartTime).Split(':');
                DateTime EnteredDateTime = new DateTime(eventStartDate.Year, eventStartDate.Month, eventStartDate.Day, Convert.ToInt32(TimeElements[0]), Convert.ToInt32(TimeElements[1]), 0);
                //if checks for StartDateTime
                if (EnteredDateTime < DateTime.Now)
                {
                    //DateTime Now=DateTime.Now;
                    //MessageBox.Show("Please Adjust Your Start Date, Its less than the current time:");
                    //return;
                }

                if (eventEndTime == "")
                {
                    DateTime EventEndDateTime = new DateTime(eventEndDate.Year, eventEndDate.Month, eventEndDate.Day, EnteredDateTime.Hour, EnteredDateTime.Minute, EnteredDateTime.Second);

                    eventEndTime = EventEndDateTime.ToString();
                    //eventEndDate
                    //MessageBox.Show("Please Type EndTime in The Format: HH:MM A/PM");
                    //return;
                }
                TimeSpan TestTimeSpan = new TimeSpan();
                bool RigidFlag = false;
                bool RepetitionFlag = false;
                Repetition MyRepetition = new Repetition();
                if (checkBox5.IsChecked.Value)
                {
                    RigidFlag = true;
                }
                DateTime CurrentNow = DateTime.Now;
                DateTime RepeatStart = CurrentNow;
                DateTime RepeatEnd = RepeatStart;

                if (checkBox2.IsChecked.Value)
                {

                    DateTime FullStartTime = DateTime.Parse(eventStartDate.ToShortDateString() + " " + eventStartTime);
                    DateTime FullEndTime = DateTime.Parse(eventEndDate.ToShortDateString() + " " + eventEndTime);

                    //RepeatStart = (DateTime)calendar3.SelectedDate.Value;
                    RepeatStart = DateTime.Parse(eventStartTime);
                    RepeatEnd = (DateTime)calendar4.SelectedDate.Value;
                    //RepeatEnd = (DateTime.Now).AddDays(7);
                    RepetitionFlag = true;
                    MyRepetition = new Repetition(RepetitionFlag, new TimeLine(RepeatStart, RepeatEnd), RepeatFrequency, new TimeLine((FullStartTime),(FullEndTime)));

                    //eventStartDate = RepeatStart;
                    eventEndDate = RepeatStart;
                }

                CustomErrors ErrorCheck = ValidateInputValues(EventDuration, eventStartTime, eventStartDate.ToString(), eventEndTime, eventEndDate.ToString(), RepeatStart.ToString(), RepeatEnd.ToString(), PreDeadlineTime, eventSplit, eventPrepTime, CurrentNow);

                if (!ErrorCheck.Status)
                {
                    //MessageBox.Show(ErrorCheck.Message);
                    return;
                    //
                }
                //C6RXEZ
                Location var0 = new Location(textBox8.Text);

                EventDisplay UiData = new EventDisplay();
                MiscData NoteData = new MiscData();
                bool CompletedFlag = false;

                //CalendarEvent ScheduleUpdated = CreateSchedule(eventName, eventStartTime, eventStartDate, eventEndTime, eventEndDate, eventSplit, PreDeadlineTime, EventDuration, EventRepetitionflag, DefaultPreDeadlineFlag, RigidScheduleFlag, eventPrepTime, DefaultPreDeadlineFlag);
                CalendarEvent ScheduleUpdated = new CalendarEvent(eventName, eventStartTime, eventStartDate, eventEndTime, eventEndDate, eventSplit, PreDeadlineTime, EventDuration, MyRepetition, DefaultPreDeadlineFlag, RigidFlag, eventPrepTime, DefaultPreDeadlineFlag, var0, true, UiData, NoteData,CompletedFlag);
                ScheduleUpdated.Repeat.PopulateRepetitionParameters(ScheduleUpdated);

                Stopwatch snugarrayTester = new Stopwatch();
                snugarrayTester.Start();
                CustomErrors ScheduleUpdateMessage = MySchedule.AddToSchedule(ScheduleUpdated);
                snugarrayTester.Stop();
                AllData[NumberOfRetries] = snugarrayTester.ElapsedMilliseconds;

            }

            int q= 0;
            double totalTIme = 0;
            for(q=0;q<AllData.Length;q++)
            {
                textBlock9.Text += AllData[q] + ",";
                totalTIme += AllData[q];
            }
            totalTIme /= q;

            textBlock9.Text += "Average is " + totalTIme;
        }
Ejemplo n.º 21
0
        // class CitiesData

        static public double AverageToAllNodes(Location MyLocation, List<Location> otherLocations)
        {
            double retValue = 0;
            foreach (Location eachLocation in otherLocations)
            {
                retValue += Location.calculateDistance(MyLocation, eachLocation);
            }
            retValue = retValue/(double)otherLocations.Count;
            return retValue;
        }
Ejemplo n.º 22
0
 public Repetition()
 {
     RepetitionFrequency = "";
     RepetitionRange = new TimeLine();
     EnableRepeat = false;
     RepeatingEvents = new CalendarEvent[0];
     RepeatLocation = new Location();
     initializingRange = new TimeLine();
     DictionaryOfIDAndCalendarEvents = new System.Collections.Generic.Dictionary<string, CalendarEvent>();
 }
Ejemplo n.º 23
0
 public CalendarEvent(string EventName, TimeSpan Event_Duration, DateTime EventStart, DateTime EventDeadline, TimeSpan EventPrepTime, TimeSpan Event_PreDeadline, bool EventRigidFlag, Repetition EventRepetitionEntry, int EventSplit, Location EventLocation)
 {
     CalendarEventName = EventName;
     /*CalendarEventName = EventName.Split(',')[0];
     LocationString = "";
     if (EventName.Split(',').Length > 1)
     {
         LocationString = EventName.Split(',')[1];
     }
     CalendarEventLocation = null;
     CalendarEventLocation = new Location();
     if (LocationString != "")
     {
         CalendarEventLocation = new Location(LocationString);
     }
     */
     StartDateTime = EventStart;
     EndDateTime = EventDeadline;
     EventDuration = Event_Duration;
     Splits = EventSplit;
     PrepTime = EventPrepTime;
     EventPreDeadline = Event_PreDeadline;
     RigidSchedule = EventRigidFlag;
     TimePerSplit = TimeSpan.FromTicks(((EventDuration.Ticks / Splits)));
     ArrayOfSubEvents = new SubCalendarEvent[Splits];
     CalendarEventID = new EventID(new string[] { EventIDGenerator.generate().ToString() });
     EventRepetition = EventRepetitionEntry;
     LocationData = EventLocation;
     EventSequence = new TimeLine(StartDateTime, EndDateTime);
     UpdateLocationMatrix(LocationData);
 }
Ejemplo n.º 24
0
 public Repetition(bool EnableFlag ,TimeLine RepetitionRange_Entry, string Frequency,TimeLine EventActualRange)
 {
     RepetitionRange = RepetitionRange_Entry;
     RepetitionFrequency = Frequency.ToUpper();
     EnableRepeat = EnableFlag;
     RepeatLocation = new Location();
     DictionaryOfIDAndCalendarEvents = new System.Collections.Generic.Dictionary<string, CalendarEvent>();
     initializingRange = EventActualRange;
 }
Ejemplo n.º 25
0
        //public Repetition(bool EnableFlag,CalendarEvent BaseCalendarEvent,  TimeLine RepetitionRange_Entry, string Frequency)
        public Repetition(bool ReadFromFileEnableFlag, TimeLine ReadFromFileRepetitionRange_Entry, string ReadFromFileFrequency, CalendarEvent[] ReadFromFileRecurringListOfCalendarEvents)
        {
            EnableRepeat = ReadFromFileEnableFlag;
            DictionaryOfIDAndCalendarEvents = new System.Collections.Generic.Dictionary<string, CalendarEvent>();

            foreach (CalendarEvent MyRepeatCalendarEvent in ReadFromFileRecurringListOfCalendarEvents)
            {
                DictionaryOfIDAndCalendarEvents.Add(MyRepeatCalendarEvent.ID, MyRepeatCalendarEvent);
            }

            RepeatingEvents = DictionaryOfIDAndCalendarEvents.Values.ToArray();
            RepetitionFrequency = ReadFromFileFrequency;
            RepetitionRange = ReadFromFileRepetitionRange_Entry;
            if (ReadFromFileRecurringListOfCalendarEvents.Length > 0)
            {
                RepeatLocation=ReadFromFileRecurringListOfCalendarEvents[0].myLocation;
            }
        }
Ejemplo n.º 26
0
        private void button5_Click_2(object sender, RoutedEventArgs e)
        {
            string eventName = textBox1.Text;
            string LocationString  = textBox8.Text.Trim();
            /*if (LocationString != "")
            {
                eventName += "," + LocationString;
            }*/

            DateTime CurrentTimeOfExecution =DateTime.Now;
            string eventStartTime = textBox5.Text;
            string locationInformation = textBox8.Text;
            DateTime eventStartDate = (DateTime)datePicker1.SelectedDate.Value;
            string eventEndTime = textBox7.Text;
            DateTime eventEndDate = (DateTime)datePicker2.SelectedDate.Value;
            bool EventRepetitionflag = checkBox2.IsChecked.Value;
            bool DefaultPrepTimeflag = checkBox3.IsChecked.Value;
            string eventPrepTime = textBox3.Text;
            bool RigidScheduleFlag = checkBox5.IsChecked.Value;
            string RepeatFrequency = comboBox2.Text;
            string EventDuration = textBox4.Text;
            string eventSplit = textBox2.Text;
            bool DefaultPreDeadlineFlag = checkBox4.IsChecked.Value;
            string PreDeadlineTime = textBox6.Text;
            eventStartTime=eventStartTime.Trim();
            eventStartTime=eventStartTime.Replace(" ", string.Empty);
            if (eventStartTime == "")
            {
                eventStartTime = CurrentTimeOfExecution.ToString();
                string[] TempString = eventStartTime.Split(' ');
                eventStartTime =TempString[1]+TempString[2];
            }
            //This attempts to detect invalid inputs for start time values
            string[] TimeElements = CalendarEvent.convertTimeToMilitary(eventStartTime).Split(':');
            DateTime EnteredDateTime = new DateTime(eventStartDate.Year, eventStartDate.Month, eventStartDate.Day, Convert.ToInt32(TimeElements[0]), Convert.ToInt32(TimeElements[1]), 0);
            //if checks for StartDateTime
            if (EnteredDateTime < DateTime.Now)
            {
                //DateTime Now=DateTime.Now;
                //MessageBox.Show("Please Adjust Your Start Date, Its less than the current time:");
                //return;
            }

            if (eventEndTime == "")
            {
                DateTime EventEndDateTime = new DateTime(eventEndDate.Year, eventEndDate.Month, eventEndDate.Day, EnteredDateTime.Hour, EnteredDateTime.Minute, EnteredDateTime.Second);

                eventEndTime = EventEndDateTime.ToString();
                //eventEndDate
                //MessageBox.Show("Please Type EndTime in The Format: HH:MM A/PM");
                //return;
            }
            TimeSpan TestTimeSpan = new TimeSpan();
            bool RigidFlag = false;
            bool RepetitionFlag = false;
            Repetition MyRepetition=new Repetition();
            if (checkBox5.IsChecked.Value)
            {
                RigidFlag = true;
            }
            DateTime CurrentNow = DateTime.Now;
            DateTime RepeatStart = CurrentNow;
            DateTime RepeatEnd=RepeatStart;

            if (checkBox2.IsChecked.Value)
            {
                //RepeatStart = (DateTime)calendar3.SelectedDate.Value;
                DateTime FullStartTime = DateTime.Parse(eventStartDate.ToShortDateString() + " " + eventStartTime);
                DateTime FullEndTime = DateTime.Parse(eventEndDate.ToShortDateString() + " " + eventEndTime);

                RepeatStart = DateTime.Parse(eventStartTime);
                RepeatEnd = (DateTime)calendar4.SelectedDate.Value;
                RepetitionFlag = true;
                MyRepetition = new Repetition(RepetitionFlag, new TimeLine(RepeatStart, RepeatEnd), RepeatFrequency, new TimeLine((FullStartTime),(FullEndTime)));
                //eventStartDate = RepeatStart;
                eventEndDate = RepeatEnd;
            }

            CustomErrors ErrorCheck = ValidateInputValues(EventDuration, eventStartTime, eventStartDate.ToString(), eventEndTime, eventEndDate.ToString(), RepeatStart.ToString(), RepeatEnd.ToString(), PreDeadlineTime, eventSplit, eventPrepTime, CurrentNow);

            if (!ErrorCheck.Status)
            {
                MessageBox.Show(ErrorCheck.Message);
                return;
                //
            }
            //C6RXEZ
            Location var0 = new Location(textBox8.Text);

            EventDisplay UiData = new EventDisplay();
            MiscData NoteData = new MiscData();
            bool CompletedFlag = false;

            //CalendarEvent ScheduleUpdated = CreateSchedule(eventName, eventStartTime, eventStartDate, eventEndTime, eventEndDate, eventSplit, PreDeadlineTime, EventDuration, EventRepetitionflag, DefaultPreDeadlineFlag, RigidScheduleFlag, eventPrepTime, DefaultPreDeadlineFlag);
            CalendarEvent ScheduleUpdated = new CalendarEvent(eventName, eventStartTime, eventStartDate, eventEndTime, eventEndDate, eventSplit, PreDeadlineTime, EventDuration, MyRepetition, DefaultPreDeadlineFlag, RigidFlag, eventPrepTime, DefaultPreDeadlineFlag, var0,true,UiData,NoteData,CompletedFlag);
            ScheduleUpdated.Repeat.PopulateRepetitionParameters(ScheduleUpdated);
            textBlock9.Text = "...Loading";
            Stopwatch snugarrayTester = new Stopwatch();
            snugarrayTester.Start();
            CustomErrors ScheduleUpdateMessage = MySchedule.AddToSchedule(ScheduleUpdated);
            snugarrayTester.Stop();
            //MessageBox.Show("It took " + snugarrayTester.ElapsedMilliseconds.ToString() + "ms max thread count is ");

            if (!ScheduleUpdateMessage.Status)
            {
                textBlock9.Text = "Schedule Updated with " + ScheduleUpdated.Name;
                if (ScheduleUpdateMessage.Status)
                {
                    textBlock9.Text = ScheduleUpdateMessage.Message;
                }
            }

            else
            {
                textBlock9.Text = "Failed to update Schedule" + ScheduleUpdated.Name;
                //MessageBox.Show(ScheduleUpdateMessage.Message);
            }
        }
Ejemplo n.º 27
0
 public CalendarEvent(CalendarEvent MyUpdated, SubCalendarEvent[] MySubEvents)
 {
     CalendarEventName = MyUpdated.Name;
     
     StartDateTime = MyUpdated.StartDateTime;
     EndDateTime = MyUpdated.End;
     EventSequence = new TimeLine(StartDateTime, EndDateTime);
     EventDuration = MyUpdated.ActiveDuration;
     Splits = MyUpdated.Splits;
     PrepTime = MyUpdated.PrepTime;
     EventPreDeadline = MyUpdated.PreDeadline;
     RigidSchedule = MyUpdated.Rigid;
     TimePerSplit = MyUpdated.TimePerSplit;
     ArrayOfSubEvents = new SubCalendarEvent[Splits];
     if (MyUpdated.ID != null)
     {
         CalendarEventID = new EventID(MyUpdated.ID.Split('_'));
     }
     //CalendarEventID = new EventID(new string[] { EventIDGenerator.generate().ToString() });
     //ArrayOfSubEvents = generateSubEvent(ArrayOfSubEvents, 4, EventDuration, CalendarEventID.ToString());
     ArrayOfSubEvents = MySubEvents;
     SchedulStatus = false;
     EventRepetition = MyUpdated.Repeat;
     LocationData = MyUpdated.LocationData;
     UpdateLocationMatrix(LocationData);
     EventSequence = new TimeLine(StartDateTime, EndDateTime);
     //EventRepetition = new Repetition(EventRepetition.Enable, this, EventRepetition.Range, EventRepetition.Frequency);
 }
Ejemplo n.º 28
0
 public virtual void UpdateThis(CalendarEvent CalendarEventEntry)
 {
     if ((this.ID == CalendarEventEntry.ID))
     {
         EventDuration=CalendarEventEntry.ActiveDuration;
         CalendarEventName=CalendarEventEntry.Name;
         StartDateTime=CalendarEventEntry.StartDateTime;
         EndDateTime=CalendarEventEntry.EndDateTime;
         EventPreDeadline=CalendarEventEntry.PreDeadline;
         PrepTime=CalendarEventEntry.PrepTime;
         Priority=CalendarEventEntry.Priority;
         RepetitionFlag=CalendarEventEntry.RepetitionFlag;
         EventRepetition=CalendarEventEntry.EventRepetition;
         Complete = CalendarEventEntry.Complete;
         RigidSchedule = CalendarEventEntry.RigidSchedule;
         Splits=CalendarEventEntry.Splits;
         TimePerSplit=CalendarEventEntry.TimePerSplit;
         CalendarEventID=CalendarEventEntry.CalendarEventID;
         EventSequence=CalendarEventEntry.EventSequence;;
         SubEvents=CalendarEventEntry.SubEvents;
         SchedulStatus=CalendarEventEntry.SchedulStatus;
         CalendarError = CalendarEventEntry.CalendarError;
         Enabled=CalendarEventEntry.Enabled;
         UiParams=CalendarEventEntry.UiParams;
         DataBlob=CalendarEventEntry.DataBlob;
         LocationData =CalendarEventEntry.LocationData;
         otherPartyID = CalendarEventEntry.otherPartyID;
         return;
     }
 
     throw new Exception("Invalid Calendar ID used in Update Calendar Event");    
 }