/// <summary> /// Add /// </summary> /// <param name="name"></param> /// <param name="address"></param> /// <returns></returns> public bool UpdateDetails(DateTime start, DateTime end, DayOfWeek?weekday, ShiftExceptionType type) { lock (BusinessEntity.m_sDS) { bool success = false; if (type != null) { m_dataRow.StartTime = start; m_dataRow.EndTime = end; m_dataRow.SetWeekDayNull(); if (weekday.HasValue) { m_dataRow.WeekDay = weekday.Value.ToString(); } m_dataRow.ShiftExceptionTypeID = type.ID; try { success = 1 == ShiftException.m_sTA.Update(m_dataRow); } catch { } if (!success) { m_dataRow.RejectChanges(); } } return(success); } }
/// <summary> /// Add /// </summary> /// <param name="name"></param> /// <param name="address"></param> /// <returns></returns> public bool AddException(DateTime start, DateTime end, DayOfWeek?weekday, ShiftExceptionType type) { lock (BusinessEntity.m_sDS) { bool success = false; if (type != null) { var dataRow = BusinessEntity.m_sDS.ShiftExceptions.AddShiftExceptionsRow(start, end, null, m_dataRow, type.m_dataRow); dataRow.SetWeekDayNull(); if (weekday.HasValue) { dataRow.WeekDay = weekday.ToString(); } try { success = 1 == ShiftException.m_sTA.Update(dataRow); } catch { } if (success) { m_exceptions.Add(new ShiftException(this, dataRow)); } else { BusinessEntity.m_sDS.ShiftExceptions.RemoveShiftExceptionsRow(dataRow); } } return(success); } }
/// <summary> /// Remove /// </summary> /// <param name="id"></param> /// <returns></returns> public static bool Remove(ShiftExceptionType shiftExceptionType) { lock (BusinessEntity.m_sDS) { bool success = false; if (shiftExceptionType != null) { try { success = (m_sTA.DeleteByID(shiftExceptionType.ID) == 1); } catch { } if (success) { m_sShiftExceptionTypes.Remove(shiftExceptionType); BusinessEntity.m_sDS.ShiftExceptionTypes.RemoveShiftExceptionTypesRow(shiftExceptionType.m_dataRow); } } return(success); } }