public ActionResult CalendarNewEventType(string type, string calId) { CalendarEventTypeModel eventType = new CalendarEventTypeModel(); try { eventType.CalendarId = new Guid(calId); eventType.OwnerEntity = type; eventType.PointsForPresent = 5; eventType.PointsForPartial = 4; eventType.PointsForNotPresent = 0; eventType.PointsForExcused = 3; eventType.PointsForTardy = -1; eventType.LeagueId = MemberCache.GetLeagueIdOfMember(RDN.Library.Classes.Account.User.GetMemberId()); var colors = ColorDisplayFactory.GetLeagueColors(eventType.LeagueId); eventType.ColorList = new SelectList(colors, "HexColor", "NameOfColor"); ViewBag.IsSuccessful = false; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return View(eventType); }
public ActionResult CalendarNewEventType(CalendarEventTypeModel eventType) { try { long eventTypeid = CalendarFactory.AddCalendarEventType(eventType); string returnUrl = string.Empty; if (Request.UrlReferrer != null) { NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(Request.UrlReferrer.Query); returnUrl = nameValueCollection["returnUrl"]; } // if a create another was clicked instead of just submitting the event. if (Request.Form["addAnother"] != null) { ViewBag.IsSuccessful = true; eventType.EventTypeName = ""; return View(eventType); } if (String.IsNullOrEmpty(returnUrl)) return Redirect(Url.Content("~/calendar/settings/" + eventType.OwnerEntity.ToString() + "/" + eventType.CalendarId.ToString().Replace("-", ""))); else return Redirect(returnUrl); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return Redirect(Url.Content("~/calendar/settings/" + eventType.OwnerEntity.ToString() + "/" + eventType.CalendarId.ToString().Replace("-", ""))); }
public ActionResult CalendarEditEventType(string type, string calId, string eventTypeId) { CalendarEventTypeModel eventType = null; try { eventType = new CalendarEventTypeModel(CalendarFactory.GetEventType(Convert.ToInt64(eventTypeId))); eventType.LeagueId = MemberCache.GetLeagueIdOfMember(RDN.Library.Classes.Account.User.GetMemberId()); var colors = ColorDisplayFactory.GetLeagueColors(eventType.LeagueId); eventType.ColorList = new SelectList(colors, "HexColor", "NameOfColor"); eventType.CalendarId = new Guid(calId); eventType.OwnerEntity = type; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return View(eventType); }