Exemplo n.º 1
0
        public Frm_RecordEventSessionSelection(Object oCollection, Form Caller, RecordObjectSelectionMode eMode)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            FrmCaller      = Caller;
            eSelectionMode = eMode;

            switch (eSelectionMode)
            {
            case RecordObjectSelectionMode.Event:

                oEventCollection = (CS_RecordEventsCollection)oCollection;
                oEvent           = null;

                Show_Events();

                break;

            case RecordObjectSelectionMode.Session:

                oEventCollection = null;
                oEvent           = (CS_RecordEvent)oCollection;

                Show_Sessions();

                break;
            }
        }
Exemplo n.º 2
0
        private bool Set_EventProperties()
        {
            if (!(Txt_EventName.Text.Equals("")))
            {
                oRecordEvent.Name = Txt_EventName.Text;
            }
            else
            {
                MessageBox.Show("Name of the record event cannot be empty !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            oRecordEvent.StartingDate = DP_EventDate.Value;
            oRecordEvent.Comment      = rTxt_EventComment.Text;

            //User infos
            oRecordEvent.UserInfos = Ctrl_UserInfo.Get_UserInformations();

            //Record session created in the event on the fly

            //Update application event list if new event
            string AppEventsFile = CANStreamTools.CsDataPath + "\\RecordEvents.xml";
            CS_RecordEventsCollection oAppEvents = new CS_RecordEventsCollection();

            if (File.Exists(AppEventsFile))
            {
                oAppEvents.Read_EventsCollectionFile(AppEventsFile);
            }

            if (bNewEvent)
            {
                oAppEvents.Events.Insert(0, oRecordEvent);
            }
            else
            {
                int EventId = oAppEvents.Get_RecordEventIndex(OriginalEventName, OriginalEventDate);

                if (EventId != -1)
                {
                    oAppEvents.Events[EventId] = oRecordEvent;
                }
                else
                {
                    oAppEvents.Events.Insert(0, oRecordEvent);
                }
            }

            oAppEvents.Write_EventsCollectionFile(AppEventsFile);

            return(true);
        }
Exemplo n.º 3
0
        private void Update_RecordEventsFile()
        {
            CS_RecordEventsCollection oAppEvents = new CS_RecordEventsCollection();
            string AppEventsFile = CANStreamTools.CsDataPath + "\\RecordEvents.xml";

            if (File.Exists(AppEventsFile))
            {
                if (oAppEvents.Read_EventsCollectionFile(AppEventsFile))
                {
                    int CurrentEventIndex = oAppEvents.Get_RecordEventIndex(oEventParent.Name, oEventParent.StartingDate);

                    if (!(CurrentEventIndex == -1))
                    {
                        oAppEvents.Events[CurrentEventIndex] = oEventParent;
                        oAppEvents.Write_EventsCollectionFile(AppEventsFile);
                    }
                }
            }
        }