예제 #1
0
        /// <summary>
        /// Saves data to the 'Event' Table
        /// </summary>
        private void SaveData()
        {
            bool boolSuccess;
            objEvent=null;

            /*
            if(File.Exists(strAppPath))
            {
                StreamReader re = File.OpenText(strAppPath);
                XMLData = re.ReadToEnd();
                re.Close();
                re=null;
            }
            else
            {
                XMLData="";
                IsRecurrenceFlag=0;
            }*/

            objEvent=new Scheduler.BusinessLayer.Events();
            objEvent.EventID=0;
            //objEvent.RepeatRule = XMLData;
            objEvent.RepeatRule = "";
            objEvent.NegativeException = "";
            objEvent.RecurrenceText = "";
            objEvent.Description = txtDescription.Text;
            objEvent.EventStatus = cmbEventStatus.SelectedIndex;

            /*
            if(IsRecurrenceFlag>0)
                objEvent.RecurrenceText = lblRecurrenceText.Text;
            else
                objEvent.RecurrenceText = "";
            */

            if(objEvent.Exists())
            {
                Scheduler.BusinessLayer.Message.MsgInformation("Duplicate Name not allowed");
                txtName.Focus();
                return;
            }

            boolSuccess = objEvent.InsertData();
            _eventid = objEvent.EventID;

            if(!boolSuccess)
            {
                Scheduler.BusinessLayer.Message.ShowException("Inserting Event record.", objEvent.Message);
                return;
            }

            //this.DialogResult = DialogResult.OK;
            //Close();
        }
예제 #2
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;
            }
        }