Beispiel #1
0
        /*  ----- Public Methods ----- */
        public IOperationResult Create(Event ev)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Insert("Event", "EventID", ev);
                _IOperationResult.RecordID = ev.EventID;
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(Result);
        }
Beispiel #2
0
        public IOperationResult Update(EventType eventType)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Update("EventType", "TypeID", eventType);
                _IOperationResult.RecordID = eventType.TypeID;
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(Result);
        }
Beispiel #3
0
        public IOperationResult Delete(Event ev)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Delete(ev);
                //_UnitOfWork.db.Execute("DELETE FROM [dbo].[Event] WHERE EventID = @0", eventID)
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(Result);
        }
        /*  ----- Public Methods ----- */
        public IOperationResult Create(RepeatType repeatType)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Insert("RepeatType", "TypeID", repeatType);
                _IOperationResult.RecordID = repeatType.TypeID;
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(Result);
        }
        public IOperationResult Delete(RepeatType repeatType)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Delete(repeatType);
                //_UnitOfWork.db.Execute("DELETE FROM [dbo].[RepeatType] WHERE TypeID = @0", repeatTypeID);
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(Result);
        }
        public IEnumerable <DateTime> GetAllEventDatesFromMonth(int year, int month)
        {
            ResetError();

            List <DateTime> eventDates = null;

            try
            {
                eventDates = _UnitOfWork.db.Query <DateTime>("SELECT DISTINCT(CONVERT(VARCHAR, CONVERT(DATETIME,[EventStart]),23)) AS StartDate FROM [dbo].[Event] WHERE Month([EventStart]) = @0 AND Year([EventStart]) = @1 ORDER BY StartDate ASC", month, year).ToList <DateTime>();
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(eventDates);
        }
        public IEnumerable <Event> GetAllEventsFromMonth(int year, int month)
        {
            ResetError();

            List <Event> events = null;

            try
            {
                events = _UnitOfWork.db.Query <Event>("SELECT * FROM [dbo].[Event] WHERE Month([EventStart]) = @0 AND Year([EventStart]) = @1 ORDER BY StartDate ASC", month, year).ToList <Event>();
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(events);
        }
        public IEnumerable<Event> GetAllEventsFromMonth(int year, int month)
        {
            ResetError();

            List<Event> events = null;

            try
            {
                events = _UnitOfWork.db.Query<Event>("SELECT * FROM [dbo].[Event] WHERE Month([EventStart]) = @0 AND Year([EventStart]) = @1 ORDER BY StartDate ASC", month, year).ToList<Event>();
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return events;
        }
Beispiel #9
0
        public IEnumerable <Event> GetAll()
        {
            ResetError();

            List <Event> events = null;

            try
            {
                events = _UnitOfWork.db.Query <Event>("SELECT * FROM [dbo].[Event]").ToList <Event>();
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(events);
        }
Beispiel #10
0
        public Event Read(long eventID)
        {
            ResetError();

            Event ev = null;

            try
            {
                ev = _UnitOfWork.db.SingleOrDefault <Event>("SELECT * FROM [dbo].[Event] WHERE EventID = @0", eventID);
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(ev);
        }
        public RepeatType Read(long typeID)
        {
            ResetError();

            RepeatType repeatType = null;

            try
            {
                repeatType = _UnitOfWork.db.SingleOrDefault <RepeatType>("SELECT * FROM [dbo].[RepeatType] WHERE TypeID = @0", typeID);
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(repeatType);
        }
        public IEnumerable<DateTime> GetAllEventDatesFromMonth(int year, int month)
        {
            ResetError();

            List<DateTime> eventDates = null;

            try
            {
                eventDates = _UnitOfWork.db.Query<DateTime>("SELECT DISTINCT(CONVERT(VARCHAR, CONVERT(DATETIME,[EventStart]),23)) AS StartDate FROM [dbo].[Event] WHERE Month([EventStart]) = @0 AND Year([EventStart]) = @1 ORDER BY StartDate ASC", month, year).ToList<DateTime>();
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return eventDates;
        }
        public IEnumerable <RepeatType> GetAll()
        {
            ResetError();

            List <RepeatType> repeatTypes = null;

            try
            {
                repeatTypes = _UnitOfWork.db.Query <RepeatType>("SELECT * FROM [dbo].[RepeatType]").ToList <RepeatType>();
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return(repeatTypes);
        }
        public IEnumerable<RepeatType> GetAll()
        {
            ResetError();

            List<RepeatType> repeatTypes = null;

            try
            {
                repeatTypes = _UnitOfWork.db.Query<RepeatType>("SELECT * FROM [dbo].[RepeatType]").ToList<RepeatType>();
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return repeatTypes;
        }
Beispiel #15
0
        public ActionResult CreateReservation(ReservationMD Data)
        {
            DBOperationResult result = RepositoryOrder.Insert(Data);

            return(Json(result));
        }
 private void ResetError()
 {
     Result = new DBOperationResult();
 }
        public IOperationResult Update(EventType eventType)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Update("EventType", "TypeID", eventType);
                _IOperationResult.RecordID = eventType.TypeID;
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return Result;
        }
        public IOperationResult Delete(Event ev)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Delete(ev);
                //_UnitOfWork.db.Execute("DELETE FROM [dbo].[Event] WHERE EventID = @0", eventID)
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return Result;
        }
        /*  ----- Public Methods ----- */
        public IOperationResult Create(Event ev)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Insert("Event", "EventID", ev);
                _IOperationResult.RecordID = ev.EventID;
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return Result;
        }
        /*  ----- Public Methods ----- */
        public IOperationResult Create(RepeatType repeatType)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Insert("RepeatType", "TypeID", repeatType);
                _IOperationResult.RecordID = repeatType.TypeID;
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return Result;
        }
        public RepeatType Read(long typeID)
        {
            ResetError();

            RepeatType repeatType = null;

            try
            {
                repeatType = _UnitOfWork.db.SingleOrDefault<RepeatType>("SELECT * FROM [dbo].[RepeatType] WHERE TypeID = @0", typeID);
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return repeatType;
        }
 private void ResetError()
 {
     Result = new DBOperationResult();
 }
        public IEnumerable<Event> GetAll()
        {
            ResetError();

            List<Event> events = null;

            try
            {
                events = _UnitOfWork.db.Query<Event>("SELECT * FROM [dbo].[Event]").ToList<Event>();
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return events;
        }
        public IOperationResult Delete(RepeatType repeatType)
        {
            ResetError();

            try
            {
                _UnitOfWork.db.Delete(repeatType);
                //_UnitOfWork.db.Execute("DELETE FROM [dbo].[RepeatType] WHERE TypeID = @0", repeatTypeID);
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return Result;
        }
        public Event Read(long eventID)
        {
            ResetError();

            Event ev = null;

            try
            {
                ev = _UnitOfWork.db.SingleOrDefault<Event>("SELECT * FROM [dbo].[Event] WHERE EventID = @0", eventID);
            }
            catch (Exception ex)
            {
                Result = new DBOperationResult(ex);
            }

            return ev;
        }