Example #1
0
        public static ScheduleObject ScheduleRowToObject(DataRow schedule)
        {
            ScheduleObject obj = new ScheduleObject();

            try
            {
                if (schedule != null)
                {
                    obj.SchedID   = RowFunctions.GetValueFromRowToGuid(schedule, ScheduleObject.SCHED_ID, true, DataRowVersion.Current);
                    obj.Frequency = (Enumeration.Frequency.TimeFrequency)RowFunctions.GetValueFromRowToInteger(schedule, ScheduleObject.FREQUENCY, true, DataRowVersion.Current);
                    obj.Monday    = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.MONDAY, true, DataRowVersion.Current);
                    obj.Tuesday   = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.TUESDAY, true, DataRowVersion.Current);
                    obj.Wednesday = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.WEDNESDAY, true, DataRowVersion.Current);
                    obj.Thursday  = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.THURSDAY, true, DataRowVersion.Current);
                    obj.Friday    = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.FRIDAY, true, DataRowVersion.Current);
                    obj.Saterday  = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.SATERDAY, true, DataRowVersion.Current);
                    obj.Sunday    = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.SUNDAY, true, DataRowVersion.Current);
                    obj.StartDate = RowFunctions.GetValueFromRowToString(schedule, ScheduleObject.STARTDATE, true, DataRowVersion.Current);
                    obj.Time      = RowFunctions.GetValueFromRowToString(schedule, ScheduleObject.TIME, true, DataRowVersion.Current);
                    obj.LastSend  = RowFunctions.GetValueFromRowToString(schedule, ScheduleObject.LAST_SEND, true, DataRowVersion.Current);
                    return(obj);
                }
                obj = null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(obj);
        }
Example #2
0
 public static ScheduleObject ScheduleRowToObject(DataRow schedule)
 {
     ScheduleObject obj = new ScheduleObject();
     try
     {
         if (schedule != null)
         {
             obj.SchedID = RowFunctions.GetValueFromRowToGuid(schedule, ScheduleObject.SCHED_ID, true, DataRowVersion.Current);
             obj.Frequency = (Enumeration.Frequency.TimeFrequency)RowFunctions.GetValueFromRowToInteger(schedule, ScheduleObject.FREQUENCY, true, DataRowVersion.Current);
             obj.Monday = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.MONDAY, true, DataRowVersion.Current);
             obj.Tuesday = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.TUESDAY, true, DataRowVersion.Current);
             obj.Wednesday = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.WEDNESDAY, true, DataRowVersion.Current);
             obj.Thursday = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.THURSDAY, true, DataRowVersion.Current);
             obj.Friday = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.FRIDAY, true, DataRowVersion.Current);
             obj.Saterday = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.SATERDAY, true, DataRowVersion.Current);
             obj.Sunday = RowFunctions.GetValueFromRowToBoolean(schedule, ScheduleObject.SUNDAY, true, DataRowVersion.Current);
             obj.StartDate = RowFunctions.GetValueFromRowToString(schedule, ScheduleObject.STARTDATE, true, DataRowVersion.Current);
             obj.Time = RowFunctions.GetValueFromRowToString(schedule, ScheduleObject.TIME, true, DataRowVersion.Current);
             obj.LastSend = RowFunctions.GetValueFromRowToString(schedule, ScheduleObject.LAST_SEND, true, DataRowVersion.Current);
             return obj;
         }
         obj = null;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return obj;
 }
Example #3
0
 public int Add(ScheduleObject value)
 {
     try
     {
         return(List.Add(value));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #4
0
 public void Remove(ScheduleObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #5
0
 // Called by ScheduleObject when it changes
 internal void ScheduleObjectChanged(ScheduleObject schedule)
 {
     try
     {
         int index = List.IndexOf(schedule);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #6
0
 protected override void OnRemoveComplete(int index, object value)
 {
     try
     {
         ScheduleObject schedule = (ScheduleObject)value;
         schedule.Parent = this;
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #7
0
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         ScheduleObject schedule = new ScheduleObject();
         List.Add(schedule);
         return(schedule);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #8
0
 private void Initialize()
 {
     try
     {
         _schedule             = new ScheduleObject();
         datStartdate.DateTime = System.DateTime.Now;
         cmbFrequency.Properties.Items.AddRange(Enum.GetValues(typeof(Enumeration.Frequency.TimeFrequency)));
         Random random = new Random();
         txtTimeOfDay.Text = random.Next(0, 23).ToString() + ":" + FormatTimeFrame(random.Next(0, 59).ToString()) + ":" + FormatTimeFrame(random.Next(0, 59).ToString());
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #9
0
 public void Save(ScheduleObject schedule)
 {
     try
     {
         CheckTransaction();
         new ScheduleDataService(Transaction).Save(schedule);
         if (IsOwner) Transaction.Commit();
     }
     catch (Exception exception1)
     {
         if (IsOwner) Transaction.Rollback();
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (IsOwner) Connection.Close();
     }
 }
Example #10
0
        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            try
            {
                if (oldValue != newValue)
                {
                    ScheduleObject oldSchedule = (ScheduleObject)oldValue;
                    ScheduleObject newSchedule = (ScheduleObject)newValue;
                    oldSchedule.Parent = null;
                    newSchedule.Parent = this;

                    OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
                }
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
Example #11
0
 public Schedule(PROF_IT.Common.Enumerations.TypeForm typeForm, TaskScheduleObject taskSchedule)
 {
     try
     {
         InitializeComponent();
         _scheduleOriginal = taskSchedule.Schedule.Clone();
         _schedule = taskSchedule.Schedule;
         _typeForm = typeForm;
         if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm)
         {
             throw new NotImplementedException();
         }
         else
         {
             InitializePropertyForm();
         }
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #12
0
 public Schedule(PROF_IT.Common.Enumerations.TypeForm typeForm, TaskScheduleObject taskSchedule)
 {
     try
     {
         InitializeComponent();
         _scheduleOriginal = taskSchedule.Schedule.Clone();
         _schedule         = taskSchedule.Schedule;
         _typeForm         = typeForm;
         if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm)
         {
             throw new NotImplementedException();
         }
         else
         {
             InitializePropertyForm();
         }
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #13
0
 public bool Remove(ScheduleObject schedule)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "Schedule_DELETE",
             CreateParameter("@schedID", SqlDbType.UniqueIdentifier, schedule.SchedID, ParameterDirection.Input)
             );
         return true;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
Example #14
0
 void IEditableObject.EndEdit()
 {
     try
     {
         if (inTxn)
         {
             _loadedTask = this.Task;
             _loadedSchedule = this.Schedule;
             inTxn = false;
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #15
0
 private void Initialize()
 {
     try
     {
         _schedule = new ScheduleObject();
         datStartdate.DateTime = System.DateTime.Now;
         cmbFrequency.Properties.Items.AddRange(Enum.GetValues(typeof(Enumeration.Frequency.TimeFrequency)));
         Random random = new Random();
         txtTimeOfDay.Text = random.Next(0, 23).ToString() + ":" + FormatTimeFrame(random.Next(0, 59).ToString()) + ":" + FormatTimeFrame(random.Next(0, 59).ToString());
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #16
0
 public void Save(ScheduleObject schedule)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "Schedule_SAVE",
             CreateParameter("@schedID", SqlDbType.UniqueIdentifier, schedule.SchedID, ParameterDirection.InputOutput),
             CreateParameter("@Frequency", SqlDbType.Int, (int)schedule.Frequency),
             CreateParameter("@Monday", SqlDbType.Bit, schedule.Monday),
             CreateParameter("@Tuesday", SqlDbType.Bit, schedule.Tuesday),
             CreateParameter("@Wednesday", SqlDbType.Bit, schedule.Wednesday),
             CreateParameter("@Thursday", SqlDbType.Bit, schedule.Thursday),
             CreateParameter("@Friday", SqlDbType.Bit, schedule.Friday),
             CreateParameter("@Saterday", SqlDbType.Bit, schedule.Saterday),
             CreateParameter("@Sunday", SqlDbType.Bit, schedule.Sunday),
             CreateParameter("@Startdate", SqlDbType.VarChar, schedule.StartDate),
             CreateParameter("@Time", SqlDbType.VarChar, schedule.Time),
             CreateParameter("@LastSend", SqlDbType.VarChar, schedule.LastSend)
             );
         schedule.SchedID = (Guid)cmd.Parameters["@schedID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
 public int Add(ScheduleObject value)
 {
     try
     {
         return List.Add(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         ScheduleObject schedule = new ScheduleObject();
         List.Add(schedule);
         return schedule;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Remove(ScheduleObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Called by ScheduleObject when it changes
 internal void ScheduleObjectChanged(ScheduleObject schedule)
 {
     try
     {
         int index = List.IndexOf(schedule);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #21
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     try
     {
         ScheduleMember = _scheduleOriginal;
         this.Close();
     }
     catch (System.Exception exception1)
     {
         System.Exception thisException = exception1;
         Management.ShowException(thisException);
     }
 }