public static void Write_Admin_Log(FoxTickerEntities db, App_Label app_label, Type model, Action_Flag action_flag, string object_id, string object_repr, string change_message, bool save = false) { //db.Mapping.GetTables(); auth_admin_log dal = new auth_admin_log(); dal.action_flag = (short)action_flag; dal.action_time = DateTime.Now; dal.user_id = int.Parse(HttpContext.Current.Session["UserID"].ToString()); dal.change_message = change_message; string label = app_label.ToString(); dal.auth_content_type = db.auth_content_type.Where(dct => dct.app_label == label && dct.model == model.Name.ToLower() + "s").FirstOrDefault(); dal.object_id = object_id; if (object_repr.Length > 200) { object_repr = object_repr.Substring(0, 199); } dal.object_repr = object_repr; db.auth_admin_log.AddObject(dal); if (save) { } //db.SaveChanges(); }
// // GET: /Groups/ //List<SelectListItem> teams; public ActionResult Index() { //var groups = new FoxTickerEntities().Groups.Where(gw => gw.ClientID ==1); //ViewData["Groups"] = groups; ViewData["Groups"] = new FoxTickerEntities().Groups.Where(gw => gw.ClientID == 1); //null team Team newTeam = new Team(); newTeam.ID = -1; newTeam.NickName = "BLANK"; ////List<SelectListItem> // teams = new SelectList(ViewBag.Accounts as IEnumerable<Team>, "ID", "NickName").ToList(); //teams.Insert(0, new SelectListItem { Text = "", Value = "" }); //new FoxTickerEntities().Teams.Where(tw => tw.SportID == 1).ToList().ForEach(t => teams.Add(new SelectListItem { Text = t.NickName, Value = t.ID.ToString() })); //var teams = new FoxTickerEntities().Teams.Where(tw => tw.SportID == 1).Select(ts => new ViewDataTable { ID = ts.ID, Name = ts.NickName }).ToList(); //teams.Add(new ViewDataTable { Name = string.Empty }); ////teams.Add(newTeam); //ViewData["Teams"] = teams; List <Team> teams = new List <Team>(); teams.Add(newTeam); teams.AddRange(new FoxTickerEntities().Teams.Where(tw => tw.SportID == 1).ToList()); ViewData["Teams"] = teams; return(View()); //return View(groups.ToList()); }
// GET: api/Default/5 public IHttpActionResult Get(int id) { FoxTickerEntities db = new FoxTickerEntities(); var i = db.PlaylistDetails.Where(a => a.ID == id).ToList(); return(Json(i)); }
//public DataSourceResult Get(string id, [ModelBinder(typeof(Ticker.ModelBinders.DataSourceRequestModelBinder))] DataSourceRequest request) //{ // var suppress = db.suppressgames.Where(gw => gw.CorrelationID == id); // if (suppress == null) // { // throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); // } // return suppress.AsEnumerable().ToDataSourceResult(request, g => new // { // g.id, // g.LeagueCode, // g.ClientID, // g.CorrelationID // }); ; //} // GET: api/Suppress/5 //public IHttpActionResult Get(string correlationid) //{ // FoxTickerEntities db = new FoxTickerEntities(); // bool status = false; // if(db.suppressgames.Where(a=>a.CorrelationID== correlationid).Any()) // { // status = true; // } // return Json(status); //} // POST: api/Suppress public HttpResponseMessage Post(string id, string league, int client) { FoxTickerEntities db = new FoxTickerEntities(); // suppressgame Suppress = db.suppressgames.Where(a => a.CorrelationID == id && a.ClientID == client && a.LeagueCode == league).FirstOrDefault(); suppressgame suppress = new suppressgame(); suppress.ClientID = client; suppress.CorrelationID = id; suppress.LeagueCode = league; db.suppressgames.AddObject(suppress); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, suppress)); }
// // GET: /Groups/ //List<SelectListItem> teams; //public ActionResult Index() //public ActionResult Index(int clientID, int playlistID) public ActionResult Index(int playlistID) { FoxTickerEntities db = new FoxTickerEntities(); //ViewData["Playlists"] = new FoxTickerEntities().Playlists.Where(gw => gw.ClientID == 1); //ViewData["PlaylistDetails"] = new FoxTickerEntities().PlaylistDetails; ViewData["Groups"] = new FoxTickerEntities().Groups.Where(gw => gw.ClientID == 1); //Session["ClientID"] = clientID; ViewData["PlaylistID"] = playlistID; Playlist pld = db.Playlists.Where(gw => gw.ID == playlistID).Single(); ViewData["PlaylistName"] = pld.Name; // ViewData["AuxHiveID"] = pld.AuxHiveID; int clientID = db.Playlists.Where(plw => plw.ID == playlistID).Single().ClientID; Client client = db.Clients.Single(c => c.ID == clientID); Session["ClientID"] = clientID; ViewData["ClientID"] = clientID; ViewData["DataHiveEnabled"] = client.DataHiveEnabled; ViewData["ClientName"] = client.Abbreviation;// db.Clients.Where(plw => plw.ID == clientID).Single().Abbreviation; //null team Team newTeam = new Team(); //newTeam.ID = -1; newTeam.NickName = "BLANK"; ////List<SelectListItem> // teams = new SelectList(ViewBag.Accounts as IEnumerable<Team>, "ID", "NickName").ToList(); //teams.Insert(0, new SelectListItem { Text = "", Value = "" }); //new FoxTickerEntities().Teams.Where(tw => tw.SportID == 1).ToList().ForEach(t => teams.Add(new SelectListItem { Text = t.NickName, Value = t.ID.ToString() })); //var teams = new FoxTickerEntities().Teams.Where(tw => tw.SportID == 1).Select(ts => new ViewDataTable { ID = ts.ID, Name = ts.NickName }).ToList(); //teams.Add(new ViewDataTable { Name = string.Empty }); ////teams.Add(newTeam); //ViewData["Teams"] = teams; List <Team> teams = new List <Team>(); teams.Add(newTeam); teams.AddRange(new FoxTickerEntities().Teams.Where(tw => tw.SportID == 1).ToList()); ViewData["Teams"] = teams; if (!User.Identity.IsAuthenticated) { return(Redirect("~/User/Login?ReturnUrl=" + Request.Url.PathAndQuery)); } else if (Session.Count <= 1)// == 0 && Session.IsNewSession)//else if (Session.Count == 0 && Session.IsNewSession) { System.Web.Security.FormsAuthentication.SignOut(); return(Redirect("~/User/Login?ReturnUrl=" + Request.Url.PathAndQuery)); } return(View()); }
// GET: api/Suppress public IHttpActionResult Get(string corid, string leaguecode, int clietid) { FoxTickerEntities db = new FoxTickerEntities(); bool status = false; if (db.suppressgames.Where(a => a.CorrelationID == corid && a.ClientID == clietid && a.LeagueCode == leaguecode).Any()) { status = true; } return(Json(status)); }
// // GET: /EditUser/ public ActionResult Index(int UserID) { FoxTickerEntities db = new FoxTickerEntities(); ViewData["Username"] = db.Users.Where(gw => gw.UserID == UserID).Single().Username; ViewData["FirstName"] = db.Users.Where(gw => gw.UserID == UserID).Single().FirstName; ViewData["LastName"] = db.Users.Where(gw => gw.UserID == UserID).Single().LastName; if (!User.Identity.IsAuthenticated) { Response.Redirect("~/User/Login?ReturnUrl=" + Request.Url.PathAndQuery); } return(View("Index")); }
// // GET: /Game/Edit/5 public ActionResult Edit(int id = 0) { FoxTickerEntities db = new FoxTickerEntities(); spTICK_Games_GetByEntryID_Result Game; //if (id != 0) //{ if (id == 0) { return(View(new Game())); } Game = db.spTICK_Games_GetByEntryID(0, id, 2, false, false).First();; if (Game == null) { return(HttpNotFound()); } ViewData["Games"] = db.spTICK_Games_GetByEntryID(0, id, 2, false, false).First(); //ViewData["Users"] = db.Users.Distinct().Select(a => new { ID = a.UserID, Name = a.FirstName + " " + a.LastName }); //} //else // Game = new Game(); //null team Team newTeam = new Team(); newTeam.ID = -1; newTeam.NickName = "NONE"; List <Team> teams = new List <Team>(); teams.Add(newTeam); //foreach (Note n in db.Notes.Where(n => n.GameID == id)) //{ // int iSport = db.Teams.Where(t => t.ID == n.TeamID).FirstOrDefault().SportID; // if (teams.Where(t => t.SportID == iSport).Count() == 0) // teams.AddRange(db.Teams.Where(tw => tw.SportID == iSport).ToList()); //} teams.AddRange(db.Teams.ToList()); ViewData["Teams"] = teams; //if (Game.TeamID != null) // if (Game.TeamID != -1 && Game.TeamID != 0) // ViewData["SportID"] = db.Teams.Single(s => s.ID == Game.TeamID).SportID; return(View(Game)); }
// // GET: /Group/Edit/5 public ActionResult Edit(int id = 0) { FoxTickerEntities db = new FoxTickerEntities(); Group group; //if (id != 0) //{ group = db.Groups.Single(g => g.ID == id); if (group == null) { return(HttpNotFound()); } ViewData["Groups"] = db.Groups.Where(gw => gw.ClientID == 1); // ViewData["Users"] = db.Users.Distinct().Select(a => new {ID = a.UserID, Name = a.FirstName + " " + a.LastName}); //} //else // group = new Group(); //null team Team newTeam = new Team(); newTeam.ID = -1; newTeam.NickName = "NONE"; List <Team> teams = new List <Team>(); teams.Add(newTeam); //foreach (Note n in db.Notes.Where(n => n.GroupID == id)) //{ // int iSport = db.Teams.Where(t => t.ID == n.TeamID).FirstOrDefault().SportID; // if (teams.Where(t => t.SportID == iSport).Count() == 0) // teams.AddRange(db.Teams.Where(tw => tw.SportID == iSport).ToList()); //} teams.AddRange(db.Teams.ToList()); ViewData["Teams"] = teams; if (group.TeamID != null) { if (group.TeamID != -1 && group.TeamID != 0) { ViewData["SportID"] = db.Teams.Single(s => s.ID == group.TeamID).SportID; } } return(View(group)); }
// POST: api/Task public HttpResponseMessage Post(string name, string password) { FoxTickerEntities db = new FoxTickerEntities(); Mytask task = new Mytask(); task.Name = name; task.Password = password; db.Mytasks.AddObject(task); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, task)); }
// // GET: /Groups/ public ActionResult Index() { ViewData["Groups"] = new FoxTickerEntities().Groups; return(View()); }
// // GET: /Groups/ //public JsonResult GetClients(string text) //{ // FoxTickerEntities db = new FoxTickerEntities(); // var userClients = db.spTICK_Users_Get(Session["username"].ToString()).Select(c => c.ClientID).ToArray(); // var clients = db.Clients.Where(p => userClients.Contains(p.ID)); // if (!string.IsNullOrEmpty(text)) // { // clients = clients.Where(p => p.Description.Contains(text)); // } // return Json(clients.OrderBy(d => d.Description), JsonRequestBehavior.AllowGet); //} //List<SelectListItem> teams; //public ActionResult Index() //public ActionResult Index(int clientID, int playlistID) public ActionResult Index()//int? clientID) { int ClientID; List <Playlist> boards = new List <Playlist>(); Playlist newBoard = new Playlist(); newBoard.Name = "BLANK"; newBoard.ClientID = 0; boards.Add(newBoard); //if (Request.QueryString["ClientID"] != null) //{ // ClientID = int.Parse(Request.QueryString["ClientID"]); //boards.AddRange( new FoxTickerEntities().Playlists.Where(gw => gw.ClientID == ClientID && gw.PlaylistTypeID == 2)); boards.AddRange(new FoxTickerEntities().Playlists.Where(gw => gw.PlaylistTypeID == 2)); //} ViewData["Scoreboards"] = boards.Select(b => new { b.ClientID, b.ID, b.Name }); ViewData["PlaylistTypes"] = new FoxTickerEntities().PlaylistTypes; //ViewData["Playlists"] = new FoxTickerEntities().Playlists.Where(gw => gw.ClientID == 1); //ViewData["PlaylistDetails"] = new FoxTickerEntities().PlaylistDetails; //ViewData["Groups"] = new FoxTickerEntities().Groups.Where(gw => gw.ClientID == 1); //ViewData["ClientID"] = clientID; //ViewData["ClientID"] = clientID; //ViewData["ClientID"] = new FoxTickerEntities().Playlists.Where(plw => plw.ID == playlistID).Single().ClientID; //null team //Team newTeam = new Team(); ////newTeam.ID = -1; //newTeam.NickName="BLANK"; //////List<SelectListItem> //// teams = new SelectList(ViewBag.Accounts as IEnumerable<Team>, "ID", "NickName").ToList(); ////teams.Insert(0, new SelectListItem { Text = "", Value = "" }); ////new FoxTickerEntities().Teams.Where(tw => tw.SportID == 1).ToList().ForEach(t => teams.Add(new SelectListItem { Text = t.NickName, Value = t.ID.ToString() })); ////var teams = new FoxTickerEntities().Teams.Where(tw => tw.SportID == 1).Select(ts => new ViewDataTable { ID = ts.ID, Name = ts.NickName }).ToList(); ////teams.Add(new ViewDataTable { Name = string.Empty }); //////teams.Add(newTeam); ////ViewData["Teams"] = teams; //List<Team> teams = new List<Team>(); //teams.Add(newTeam); //teams.AddRange(new FoxTickerEntities().Teams.Where(tw => tw.SportID == 1).ToList()); //ViewData["Teams"] = teams; if (!User.Identity.IsAuthenticated) { return(Redirect("~/User/Login?ReturnUrl=" + Request.Url.PathAndQuery)); } else if (Session.Count <= 1)// == 0 && Session.IsNewSession) { System.Web.Security.FormsAuthentication.SignOut(); return(Redirect("~/User/Login?ReturnUrl=" + Request.Url.PathAndQuery)); } return(View()); }
public static void LoadClientShares(FoxTickerEntities db, int cid) { db.Clients.Single(s => s.ID == cid).Clients.Load(); }
// GET: /Game/Edit/5 public ActionResult Edit(string id, string hiveprefix, int clientID) { FoxTickerEntities db = new FoxTickerEntities(); spTICK_Games_GetByEntryID_Result Game; //if (id != 0) //{ if (id == null) { return(View(new Game())); } ViewData["HiveID"] = id; ViewData["HivePrefix"] = hiveprefix; ViewData["ClientID"] = clientID; //null team Team newTeam = new Team(); newTeam.ID = -1; newTeam.NickName = "NONE"; //Task<List<TeamObject>> t = Topic(); //List<TeamObject> lt = t.Result; // List<Team> teams = new List<Team>(); //List<TeamObject> to=new List<TeamObject>(); //to.AddTopic(hiveprefix)); //foreach (Note n in db.Notes.Where(n => n.GameID == id)) //{ // int iSport = db.Teams.Where(t => t.ID == n.TeamID).FirstOrDefault().SportID; // if (teams.Where(t => t.SportID == iSport).Count() == 0) // teams.AddRange(db.Teams.Where(tw => tw.SportID == iSport).ToList()); //} // teams.AddRange(db.Teams.ToList()); // teams.AddRange(Topic(hiveprefix)); TeamObject Team = new TeamObject(); //using (var client = new HttpClient()) //{ // client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["SDMUrl"]); // client.DefaultRequestHeaders.Accept.Clear(); // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // //HttpResponseMessage response = await client.GetAsync("api/TeamsAPI/SelectTeams?Abbr=" + Abbr + "&Code="+Code); // HttpResponseMessage response = client.GetAsync("/api/team").Result; // if (response.IsSuccessStatusCode) // { // List<TeamObject> listTeams = response.Content.ReadAsAsync<List<TeamObject>>().Result; // TeamObject newTobj = new TeamObject(); // newTobj.ID = -1; // newTobj.DisplayName = "NONE"; // listTeams.Add(newTobj); // ViewData["Teams"] = listTeams; // } //} // ViewData["Teams"] = Team; //if (Game.TeamID != null) // if (Game.TeamID != -1 && Game.TeamID != 0) // ViewData["SportID"] = db.Teams.Single(s => s.ID == Game.TeamID).SportID; List <TeamObject> listTeams = new List <TeamObject>(); TeamObject newTobj = new TeamObject(); newTobj.ID = -1; newTobj.DisplayName = "NONE"; listTeams.Add(newTobj); ViewData["Teams"] = listTeams; return(View()); }