Exemplo n.º 1
0
        public JsonResult SaveUrlaub(Events e)
        {
            var status = false;

            using (EventsEntities dc = new EventsEntities())
            {
                if (e.EventID > 0)
                {
                    ///Update the event
                    var v = dc.Events.Where(a => a.EventID == e.EventID).FirstOrDefault();
                    if (v != null)
                    {
                        v.Subject     = e.Subject;
                        v.Start       = e.Start;
                        v.End         = e.End;
                        v.Description = e.Description;

                        v.ThemeColor = e.ThemeColor;
                    }
                }
                else
                {
                    dc.Events.Add(e);
                }

                dc.SaveChanges();
                SendVerificationLinkEmail();

                status = true;
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
Exemplo n.º 2
0
        public JsonResult SaveEvent(Events a)
        {
            var status = false;

            using (EventsEntities db = new EventsEntities())
            {
                if (a.EventId > 0)
                {
                    var evnt = db.Events.Where(b => b.EventId == a.EventId).FirstOrDefault();
                    if (evnt != null)
                    {
                        evnt.EventName = a.EventName;
                        evnt.StartTime = a.StartTime;
                        evnt.EndTime   = a.EndTime;
                    }
                }
                else
                {
                    db.Events.Add(a);
                }
                db.SaveChanges();

                status = true;
            }
            return(new JsonResult {
                Data = new { status }
            });
        }
Exemplo n.º 3
0
 public JsonResult GetUrlaubs()
 {
     using (EventsEntities dc = new EventsEntities())
     {
         var urlaubs = dc.Events.ToList();
         return(new JsonResult {
             Data = urlaubs, JsonRequestBehavior = JsonRequestBehavior.AllowGet
         });
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Load Events
        /// </summary>
        /// <returns></returns>
        public JsonResult GetEvents()
        {
            using (EventsEntities db = new EventsEntities())
            {
                var data = db.Events.ToList();

                return(new JsonResult {
                    Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }
Exemplo n.º 5
0
 public frmNewEdit(EventsTable obj)
 {
     InitializeComponent();
     db = new EventsEntities();
     if (obj == null)
     {
         eventsTableBindingSource.DataSource = new EventsTable();
         db.EventsTable.Add(eventsTableBindingSource.Current as EventsTable);
     }
     else
     {
         eventsTableBindingSource.DataSource = obj;
         db.EventsTable.Attach(eventsTableBindingSource.Current as EventsTable);
     }
 }
Exemplo n.º 6
0
        public JsonResult DeleteEvent(int eventId)
        {
            var status = false;

            using (EventsEntities db = new EventsEntities())
            {
                var ev = db.Events.Where(a => a.EventId == eventId).FirstOrDefault();
                if (ev != null)
                {
                    db.Events.Remove(ev);
                    db.SaveChanges();
                    status = true;
                }
            }
            return(new JsonResult {
                Data = new { status }
            });
        }
Exemplo n.º 7
0
        public JsonResult DeleteUrlaub(int EventID)
        {
            /// <summary>
            /// Implements the DeleteEvent method.
            /// </summary>
            /// <returns>Memeful Comments</returns>
            /// <image url="https://media.giphy.com/media/Ca7gy6EZqdH32/giphy.gif" scale="0.3" />

            var status = false;

            using (EventsEntities dc = new EventsEntities())
            {
                var v = dc.Events.Where(a => a.EventID == EventID).FirstOrDefault();
                if (v != null)
                {
                    dc.Events.Remove(v);
                    dc.SaveChanges();
                    status = true;
                }
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
Exemplo n.º 8
0
 // set all records in the table( closest date first and so on)
 // used when opening the app
 // also used for date filtering in filter buttons region
 private void RefreshEvents()
 {
     db = new EventsEntities();
     eventsTableBindingSource.DataSource = db.EventsTable.OrderBy(d => d.Date).ToList();
 }
Exemplo n.º 9
0
 public StatusController()
 {
     _db = new EventsEntities();
 }
 public FirstPageController()
 {
     _db = new EventsEntities();
 }