Exemple #1
0
 protected override void OnEventResize(EventResizeArgs e)
 {
     var id = Convert.ToInt32(e.Id);
     var toBeResized = (from ev in db.events where ev.id == id select ev).First();
     toBeResized.eventStart = e.NewStart;
     toBeResized.eventEnd = e.NewEnd;
     db.SaveChanges();
     Update();
 }
 protected override void OnEventResize(EventResizeArgs e)
 {
     int idAux = Convert.ToInt32(e.Id);
     var toBeResized = (from ev in db.Event where ev.id == idAux select ev).FirstOrDefault();
     toBeResized.eventstart = e.NewStart;
     toBeResized.eventend = e.NewEnd;
     db.SaveChanges();
     Update();
 }
            protected override void OnEventResize(EventResizeArgs e)
            {
                var toBeResized = (from ev in db.Events where ev.id == Convert.ToInt32(e.Id) select ev).First();

                toBeResized.eventstart = e.NewStart;
                toBeResized.eventend   = e.NewEnd;
                db.SubmitChanges();
                Update();
            }
Exemple #4
0
            protected override void OnEventResize(EventResizeArgs e)
            {
                var item = (from ev in dc.Events where ev.Id == Convert.ToInt32(e.Id) select ev).First();

                if (item != null)
                {
                    item.Start = e.NewStart;
                    item.End   = e.NewEnd;
                    dc.SubmitChanges();
                }
            }
Exemple #5
0
            protected override void OnEventResize(EventResizeArgs e)
            {
                var toBeResized = new BusinessLogic.CalendarEntity().GetCalendar(Convert.ToInt32(e.Id));

                toBeResized.EventStart = e.NewStart;
                toBeResized.EventEnd   = e.NewEnd;

                new BusinessLogic.CalendarEntity().ManageCalendar(toBeResized);

                Update();
            }
Exemple #6
0
            protected override void OnEventResize(EventResizeArgs e)
            {
                var userID      = this.Controller.User.Identity.Name;
                int id          = int.Parse(e.Id);
                var toBeResized = (from ev in db.Events where ev.id == id && ev.userID == userID select ev).First();

                toBeResized.eventstart = e.NewStart;
                toBeResized.eventend   = e.NewEnd;
                db.SaveChanges();
                Update();
            }
Exemple #7
0
 protected override void OnEventResize(EventResizeArgs e)
 {
     if (e.Recurrent && !e.RecurrentException)
     {
         new EventManager().EventCreateException(e.NewStart, e.NewEnd, e.Text, e.Resource, RecurrenceRule.EncodeExceptionModified(e.RecurrentMasterId, e.OldStart));
         UpdateWithMessage("Wyjątek od powtarzalnego wydarzenia został utworzony.");
     }
     else
     {
         new EventManager().EventMove(e.Id, e.NewStart, e.NewEnd, e.Resource);
         UpdateWithMessage("Czas trwania wydarzenia został zmieniony.");
     }
 }
Exemple #8
0
        protected override void OnEventResize(EventResizeArgs e)
        {
            var reservationId = int.Parse(e.Id);

            var toBeResized = database
                              .Reservations
                              .Where(r => r.Id == reservationId)
                              .First();

            if (toBeResized.IsAuthor(HttpContext.Current.User.Identity.Name))
            {
                var oldStart = toBeResized.StartDate;
                var oldEnd   = toBeResized.EndDate;

                toBeResized.StartDate = e.NewStart;
                toBeResized.EndDate   = e.NewEnd;

                var reservations = database
                                   .Reservations
                                   .Where(r => r.MeetingRoomId == meetingRoomId)
                                   .Where(r => r.StartDate < toBeResized.EndDate && toBeResized.StartDate < r.EndDate)
                                   .ToList();

                if (reservations.Any())
                {
                    if ((reservations.Count == 1 && reservations.First().Id != toBeResized.Id) || reservations.Count > 1)
                    {
                        toBeResized.StartDate = oldStart;
                        toBeResized.EndDate   = oldEnd;
                    }
                }
                else
                {
                    database.Entry(toBeResized).State = EntityState.Modified;
                    database.SaveChanges();
                }
            }
            Update();
        }
Exemple #9
0
        protected override void OnEventResize(EventResizeArgs e)
        {
            int idElement = Convert.ToInt32(e.Id);

            if (0 == idElement) // Si il s'agit bien de mon élément, qui n'est pas en base, donc id = 0
            {
                //var toBeResized = (from ev in db.CreneauxHoraires where ev.Id == idElement select ev).First();

                var toBeResized = (CreneauHoraire)HttpContext.Current.Session["MonCreneau"];

                if (e.NewEnd != e.OldEnd)
                {
                    // On a tiré par le bas :
                    toBeResized.DateFin   = e.NewEnd;
                    toBeResized.DateDebut = e.NewEnd.AddMinutes(-TempsSoinChoisis);
                }
                else
                {
                    // On a tiré par le haut :
                    toBeResized.DateDebut = e.NewStart;
                    toBeResized.DateFin   = e.NewStart.AddMinutes(TempsSoinChoisis);
                }

                var masseusesDispo = RendezVousServiceProxy.Instance().ObtenirMasseusesDisponibles(toBeResized);
                // Si il y a bien une masseuse dispo :
                if (masseusesDispo == null || masseusesDispo.Count == 0)
                {
                    //Rollback :
                    toBeResized.DateDebut = e.OldStart;
                    toBeResized.DateFin   = e.OldEnd;
                }

                // Ligne inutile : ref = même ref.
                HttpContext.Current.Session["MonCreneau"] = toBeResized;

                //db.SaveChanges();
            }
            Update();
        }
 /// <summary>
 /// Called when user resizes a calendar event
 /// </summary>
 /// <param name="e"></param>
 protected override void OnEventResize(EventResizeArgs e)
 {
     int id = int.Parse(e.Id);
     var toBeResized = db.Events.Where(o => o.Id == id).First();
     toBeResized.EventStart = e.NewStart;
     toBeResized.EventEnd = e.NewEnd;
     db.SaveChanges();
     Update();
 }
Exemple #11
0
        public ActionResult CallBack(Controller c)
        {
            Controller = c;

            // init
            UpdateType = CallBackUpdateType.None;

            // read request
            JsonData input      = SimpleJsonDeserializer.Deserialize(c.Request.InputStream);
            String   action     = (string)input["action"];
            JsonData parameters = input["parameters"];
            JsonData header     = input["header"];
            JsonData data       = input["data"]; // custom data

            Version.Check((string)header["v"]);

            StartDate            = (DateTime)header["startDate"];
            WeekStarts           = WeekStartsParser.FromIntJavaScript((int)header["weekStarts"]);
            HeaderBackColor      = (string)header["headerBackColor"];
            BackColor            = (string)header["backColor"];
            NonBusinessBackColor = (string)header["nonBusinessBackColor"];
            Id = (string)header["id"];

            OnPrepare();

            switch (action)
            {
            case "EventMove":
                OnEventMove(EventMoveArgs.FromJson(parameters, new string[] {}, data));
                break;

            case "EventResize":
                OnEventResize(EventResizeArgs.FromJson(parameters, new string[] {}, data));
                break;

            case "EventClick":
                OnEventClick(EventClickArgs.FromJson(parameters, new string[] {}, data));
                break;

            case "TimeRangeSelected":
                OnTimeRangeSelected(TimeRangeSelectedArgs.FromJson(parameters, data));
                break;

            case "Command":
                OnCommand(CommandArgs.FromJson(parameters, data));
                break;

            case "Init":
                OnInit(new InitArgs());
                break;
            }

            OnFinish();
            LoadEvents();


            Hashtable result = new Hashtable();

            result["UpdateType"] = UpdateType.ToString();

            if (_callbackRedirect != null)
            {
                result["CallBackRedirect"] = _callbackRedirect;
                return(new JsonResult {
                    Data = result
                });
            }

            if (UpdateType == CallBackUpdateType.None)
            {
                return(new JsonResult {
                    Data = result
                });
            }

            result["Events"]       = GetEvents();
            result["CallBackData"] = _callbackData;

            if (UpdateType == CallBackUpdateType.Full)
            {
                result["StartDate"]            = StartDate.ToString("s");
                result["WeekStarts"]           = Week.ResolveAsInt(WeekStarts);
                result["HeaderBackColor"]      = HeaderBackColor;
                result["BackColor"]            = BackColor;
                result["NonBusinessBackColor"] = NonBusinessBackColor;
            }

            JsonResult json = new JsonResult();

            json.Data = result;

            return(json);
        }
Exemple #12
0
 protected virtual void OnEventResize(EventResizeArgs e)
 {
 }
 protected override void OnEventResize(EventResizeArgs e)
 {
     DbHelper.MoveReservation(Convert.ToInt32(e.Id), e.NewStart, e.NewEnd,Convert.ToInt32( e.Resource));
     LoadReservations();
     Update();
 }
 protected override void OnEventResize(EventResizeArgs e)
 {
     new CalendarEventManager().MoveCalendarEvent(e.Id, e.NewStart, e.NewEnd);
     Update();
 }
 protected override void OnEventResize(EventResizeArgs e)
 {
     Db.MoveReservation(e.Id, e.NewStart, e.NewEnd, e.Resource);
     LoadReservations();
     Update();
 }
Exemple #16
0
 protected override void OnEventResize(EventResizeArgs e)
 {
     new EventManager(Controller).EventMove(e.Id, e.NewStart, e.NewEnd);
     Update();
 }
 protected override void OnEventResize(EventResizeArgs e)
 {
     DbHelper.MoveReservation(Convert.ToInt32(e.Id), e.NewStart, e.NewEnd, Convert.ToInt32(e.Resource));
     LoadReservations();
     Update();
 }
 protected override void OnEventResize(EventResizeArgs e)
 {
 }
        public ActionResult CallBack(Stream stream)
        {
            // init
            UpdateType = CallBackUpdateType.None;

            // read request
            JsonData input      = SimpleJsonDeserializer.Deserialize(stream);
            var      action     = (string)input["action"];
            JsonData parameters = input["parameters"];
            JsonData header     = input["header"];
            JsonData data       = input["data"]; // custom data

            Version.Check((string)header["v"]);

            Id                 = (string)header["id"];
            StartDate          = (DateTime)header["startDate"];
            Days               = (int)header["days"];
            HeightSpec         = HeightSpecParser.Parse((string)header["heightSpec"]);
            BusinessBeginsHour = (int)header["businessBeginsHour"];
            BusinessEndsHour   = (int)header["businessEndsHour"];
            ViewType           = ViewTypeParser.Parse((string)header["viewType"]);
            CellBackColor      = (string)header["backColor"];
            EventHeaderVisible = header["eventHeaderVisible"] != null && (bool)header["eventHeaderVisible"];
            TimeFormat         = TimeFormatParser.Parse((string)header["timeFormat"]);

            // required for custom hour header rendering
            HourNameBackColor = (string)header["hourNameBackColor"];
            HourFontFamily    = (string)header["hourFontFamily"];
            HourFontSize      = (string)header["hourFontSize"];
            HourFontColor     = (string)header["hourFontColor"];

            OnPrepare();

            switch (action)
            {
            case "Command":
                OnCommand(CommandArgs.FromJson(parameters, data));
                break;

            case "EventClick":
                OnEventClick(EventClickArgs.FromJson(parameters, data));
                break;

            case "EventMove":
                OnEventMove(EventMoveArgs.FromJson(parameters, data));
                break;

            case "EventResize":
                OnEventResize(EventResizeArgs.FromJson(parameters, data));
                break;

            case "TimeRangeSelected":
                OnTimeRangeSelected(TimeRangeSelectedArgs.FromJson(parameters, data));
                break;

            case "Init":
                OnInit(new InitArgs());
                break;

            default:
                throw new Exception(String.Format("Unknown CallBack command '{0}'.", action));
            }

            OnFinish();
            LoadEvents();
            LoadColumns();

            var result = new Hashtable();

            result["UpdateType"] = UpdateType.ToString();

            if (_callbackRedirect != null)
            {
                result["CallBackRedirect"] = _callbackRedirect;
                return(new JsonResult {
                    Data = result
                });
            }

            if (UpdateType == CallBackUpdateType.None)
            {
                return(new JsonResult {
                    Data = result
                });
            }

            result["Events"] = GetEvents();

            if (UpdateType == CallBackUpdateType.Full)
            {
                result["Days"]      = Days;
                result["StartDate"] = StartDate.ToString("s");
                result["ViewType"]  = ViewType.ToString();
                result["Columns"]   = _columns;
            }

            return(new JsonResult {
                Data = result
            });
        }