Example #1
0
        private void SaveEventData(ref int _eventid)
        {
            bool boolSuccess;
            objEvent = null;

            if (File.Exists(strAppPath))
            {
                StreamReader re = File.OpenText(strAppPath);
                XMLData_Initial = re.ReadToEnd();
                re.Close();
                re = null;
            }
            else
            {
                XMLData_Initial = "";
                IsRecurrenceFlag_Initial = 0;
            }

            objEvent = new Scheduler.BusinessLayer.Events();
            objEvent.EventID = 0;
            objEvent.RepeatRule = XMLData_Initial;
            objEvent.NegativeException = "";
            objEvent.Description = txtDescription_I.Text;

            //if (cmbEventStatus_I.SelectedIndex == -1)
            //    cmbEventStatus_I.SelectedIndex = 0;
            if (chkEventStatus_I.Checked)
                objEvent.EventStatus = 1;
            else
                objEvent.EventStatus = 0;
            //objEvent.EventStatus = cmbEventStatus_I.SelectedIndex;

            if (IsRecurrenceFlag_Initial > 0)
                objEvent.RecurrenceText = lblRecurrenceText_I.Text;
            else
                objEvent.RecurrenceText = "";

            if (_eventid <= 0)
            {
                if (objEvent.Exists())
                {
                    Scheduler.BusinessLayer.Message.MsgInformation("Duplicate Course Name not allowed");
                    txtName_I.Focus();
                    return;
                }
                boolSuccess = objEvent.InsertData();
                _eventid_Initial = objEvent.EventID;
                _eventid = objEvent.EventID;
                setEventID(objEvent.EventID);
            }
            else
            {
                objEvent.EventID = _eventid;
                boolSuccess = objEvent.UpdateData();
            }
            if (!boolSuccess)
            {
                if (_eventid == 0)
                    Scheduler.BusinessLayer.Message.ShowException("Inserting Event record.", objEvent.Message);
                else
                    Scheduler.BusinessLayer.Message.ShowException("Updating Event record.", objEvent.Message);
                return;
            }
        }