protected void gv_screeningsID_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("DeleteScreening")) { HttpCookie cookie = Request.Cookies["Details"]; if (cookie == null) { Response.Redirect("Login.aspx"); } else { DataSet ds = (DataSet)Session["dsScreenings"]; DataTable dt = ds.Tables[0]; int i = int.Parse(e.CommandArgument.ToString()); int screening = int.Parse(dt.Rows[i]["ScreeningID"].ToString()); AdminActions aa = new AdminActions(); int msg = aa.DeleteScreeningID(screening); if (msg == 1) { dt.Rows.RemoveAt(i); Response.Write("Screening Deleted"); gv_screeningsID.DataSource = dt; gv_screeningsID.DataBind(); Session["dsScreenings"] = dt; } else { Response.Write("Screening Was not Deleted"); } } } }
protected void btn_addnewscreening_Click(object sender, EventArgs e) { string date = txt_datenewscreening.Text; int price = int.Parse(txt_pricenewscreening.Text); string movie = ddl_movienewscreening.SelectedValue; string scinema = ddl_cinemanewscreening.SelectedValue; int cinema = int.Parse(scinema); AdminActions ac = new AdminActions(); Service s = new Service(); DateTime start = DateTime.Parse(s.MovieDateStart(movie)); DateTime end = DateTime.Parse(s.MovieDateEnd(movie)); DateTime d = DateTime.Parse(date); DateTime today = DateTime.Now; if (d > end) { Response.Write("Date Can't Be After Date End"); } else if (d < today) { Response.Write("Date Can't Be In The Past"); } else { ac.InsertNewScreening(date, cinema, price, movie); Response.Write("New Screening Added"); } }
public async Task CreateAdminAction(AdminActionDto adminActionDto) { if (adminActionDto == null) { throw new ArgumentNullException(nameof(adminActionDto)); } var player = await _legacyContext.Player2.SingleOrDefaultAsync(p => p.PlayerId == adminActionDto.PlayerId); if (player == null) { throw new NullReferenceException(nameof(player)); } AspNetUsers admin = null; if (!string.IsNullOrWhiteSpace(adminActionDto.AdminId)) { admin = await _legacyContext.AspNetUsers.SingleOrDefaultAsync(u => u.XtremeIdiotsId == adminActionDto.AdminId); } var adminAction = new AdminActions { PlayerPlayer = player, Admin = admin, Type = adminActionDto.Type, Text = adminActionDto.Text, Created = adminActionDto.Created, Expires = adminActionDto.Expires, ForumTopicId = adminActionDto.ForumTopicId }; _legacyContext.AdminActions.Add(adminAction); await _legacyContext.SaveChangesAsync(); }
public void ReindexFullTextNodesAndChildren([FromUri] int[] nodes) { if (nodes != null && nodes.Length > 0) { AdminActions.ReindexFullTextNodesAndChildren(nodes); } }
public void ReindexFullTextNodes([FromUri] int[] nodes) { if (nodes != null && nodes.Length > 0) { AdminActions.ReindexFullTextNodes(nodes.ToList()); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie cookie = Request.Cookies["Details"]; if (cookie == null) { Response.Redirect("Login.aspx"); } string movie = Request.QueryString["movieid"]; lb_movie.Text = movie; lb_movie.PostBackUrl = "MovieDetails.aspx?movie=" + movie; Service s = new Service(); AdminActions aa = new AdminActions(); DataSet ds = s.SearchMovieByMoviesName(movie); DataTable dt = ds.Tables[0]; dt.Columns.Add("InvitationsNum"); for (int i = 0; i < dt.Rows.Count; i++) { int screening = int.Parse(dt.Rows[i]["ScreeningID"].ToString()); int num = aa.NumOfInvitationsForScreeningID(screening); dt.Rows[i]["invitationsNum"] = num; } Session.Add("dsScreenings", ds); gv_screeningsID.DataSource = dt; gv_screeningsID.DataBind(); } }
// if (msg2 == 1) // Response.Redirect("AdminDefault.aspx?msg="+msg1); // else // Response.Write("Update Failed"); //} protected void btn_deletemovies_Click(object sender, EventArgs e) { AdminActions act = new AdminActions(); int msg = act.DeleteOldMovies(); string msg2 = msg.ToString(); Response.Write(msg + "Movies Deleted"); }
//protected void ddl_moviestoupdate_SelectedIndexChanged(object sender, EventArgs e) //{ // string movie = ddl_moviestoupdate.SelectedValue; // Response.Redirect("AdminDeleteMovies.aspx?movieID="+movie); //} protected void btn_updatedateend_Click(object sender, EventArgs e) { string movie = ddl_moviestoupdate.SelectedValue; AdminActions aa = new AdminActions(); string msg = aa.UpdateDateEndOfMovieAndDeleteEmptyScreenings(movie, txt_newdateend.Text); Response.Write(msg); }
public AdminVM() { RoomList = roomBLL.RoomList; Image = DataManager.Instance.DefaultIcon; DescriptionText = ""; PriceText = ""; adminActions = new AdminActions(this, roomBLL, featureBLL, extraServicesBLL, discountBLL); }
/// <summary> /// Commit an admin action asynchronously /// </summary> /// <param name="action"></param> /// <param name="user"></param> /// <param name="group"></param> /// <returns></returns> public async Task <Response> AdminAction(AdminActions action, UserId user, GroupId group) { var tcs = new TaskCompletionSource <Response>(); AdminAction(action, user, group, (re) => { tcs.TrySetResult(re); }); return(await tcs.Task); }
/// <summary> /// /// </summary> /// <param name="Action"></param> /// <param name="RoomID"></param> /// <param name="targetID"></param> /// <returns></returns> public static Packet AdminAction(AdminActions Action, int RoomID, int targetID) { Packet p = new Packet(); p.Command = "GROUP ADMIN"; p.Headers.Add("group-id", RoomID.ToString()); p.Headers.Add("target-id", targetID.ToString()); p.Headers.Add("last", "1"); p.Headers.Add("action", ((int)Action).ToString()); return(p); }
public IPacket AdminAction(AdminActions action, string user, string group) { return(new Packet { Command = "GROUP ADMIN", Headers = new Dictionary <string, string> { ["GROUP-ID"] = group.ToString(), ["TARGET-ID"] = user.ToString(), ["ACTION"] = ((int)action).ToString() } }); }
/// <summary> /// Commit an admin action /// </summary> /// <param name="action"></param> /// <param name="user"></param> /// <param name="group"></param> /// <param name="onResponse"></param> public void AdminAction(AdminActions action, UserId user, GroupId group, rs onResponse = null) { if (AuthorizationEngine.AuthorizedUsers.Contains(user) && (action == AdminActions.Ban || action == AdminActions.Kick || action == AdminActions.Silence)) { return; } var p = PacketTemplates.AdminAction(action, group, user).Watch(this, onResponse); _client.WritePacket(p); }
protected void btn_addnewmovie_Click(object sender, EventArgs e) { string movieid = txt_mnameadmin.Text; string director = txt_dnameadmin.Text; string mainactor = txt_mainactioradmin.Text; int yearfilmed = int.Parse(txt_yearfilmedadmin.Text); int length = int.Parse(txt_lengthadmin.Text); string genre = ddl_genresadmin.SelectedValue; int rate = int.Parse(txt_rateadmin.Text); string datestart = txt_datestartadmin.Text; string dateend = txt_dateendadmin.Text; int agelimit = int.Parse(txt_agelimitadmin.Text); ValidationService vs = new ValidationService(); AdminActions aa = new AdminActions(); AdminActions aa2 = new AdminActions(); string msg = vs.CheckMoviesName(movieid); //string msg2 = aa.InsertNewMovieDateChecking(movieid); if (msg == "Movie's name is already in DataBase") { Response.Write(msg); } else { DateTime dstart = DateTime.Parse(datestart); DateTime dend = DateTime.Parse(dateend); if (dend < dstart) { Response.Write("Date End Can't Be Earlier Than Date Start"); } else { //if (msg2 != "ok") // Response.Write(msg2); //else int num = aa2.InsertNewMovie(movieid, director, mainactor, yearfilmed, length, genre, rate, datestart, dateend, agelimit); if (num == 1) { Response.Write("Movie added"); } else { Response.Write("Movie Was Not Added"); } } } }
protected void btn_setprices_Click(object sender, EventArgs e) { string stringsundaytothrusday = txt_stot.Text; int sundaytothursday = int.Parse(stringsundaytothrusday); string sweekend = txt_weekend.Text; int weekend = int.Parse(sweekend); string svip = txt_vip.Text; int vip = int.Parse(svip); AdminActions ac = new AdminActions(); ac.UpdateTicketPrice(sundaytothursday, weekend); ac.VipPrice(vip); Response.Write("Prices Changed"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie cookie = Request.Cookies["Details"]; if (cookie == null) { Response.Redirect("Login.aspx"); } AdminActions ac = new AdminActions(); DataSet ds = ac.Details(); Session.Add("dsMovieDetails", ds); gv_details.DataSource = ds; gv_details.DataBind(); } }
protected void btn_addnewcinema_Click(object sender, EventArgs e) { string genre = txt_genreaddnewcinema.Text; int seats = int.Parse(txt_seats_addnewcinema.Text); string kind = rbl_kind_addnewcinema.Text; AdminActions ac = new AdminActions(); int msg = ac.InsertNewCinema(genre, seats, kind); if (msg == 1) { Response.Redirect("AdminDefault.aspx"); } else { Response.Write("Error"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //HttpCookie cookie = Request.Cookies["Details"]; //if (cookie == null) // Response.Redirect("Login.aspx"); AdminActions ac = new AdminActions(); DataTable dt = ac.AllUsersDetails(); DataSet ds = new DataSet(); ds.Tables.Add(dt); Session.Add("usersTable", ds); gv_deleteusers.DataSource = ds; gv_deleteusers.DataBind(); } }
public WebAPI(IRequestSender requestSender) { requestSender_ = requestSender; admin_ = new AdminActions (requestSender); appstore_ = new AppstoreActions (requestSender); chrome_web_store_ = new ChromeWebStoreActions (requestSender); facebook_ = new FacebookActions (requestSender); friends_ = new FriendsActions (requestSender); google_ = new GoogleActions (requestSender); info_ = new InfoActions (requestSender); items_ = new ItemsActions (requestSender); leaderboards_ = new LeaderboardsActions (requestSender); mail_ = new MailActions (requestSender); shop_ = new ShopActions (requestSender); scripts_ = new ScriptsActions (requestSender); tasks_ = new TasksActions (requestSender); user_ = new UserActions (requestSender); urbanairship_ = new UrbanairshipActions (requestSender); }
public WebAPI(IRequestSender requestSender) { requestSender_ = requestSender; admin_ = new AdminActions(requestSender); appstore_ = new AppstoreActions(requestSender); chrome_web_store_ = new ChromeWebStoreActions(requestSender); facebook_ = new FacebookActions(requestSender); friends_ = new FriendsActions(requestSender); google_ = new GoogleActions(requestSender); info_ = new InfoActions(requestSender); items_ = new ItemsActions(requestSender); leaderboards_ = new LeaderboardsActions(requestSender); mail_ = new MailActions(requestSender); shop_ = new ShopActions(requestSender); scripts_ = new ScriptsActions(requestSender); tasks_ = new TasksActions(requestSender); user_ = new UserActions(requestSender); urbanairship_ = new UrbanairshipActions(requestSender); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Service s = new Service(); DataSet ds = s.AllMoviesTable(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { ListItem li = new ListItem(ds.Tables[0].Rows[i]["MovieID"].ToString()); ddl_movienewscreening.Items.Add(li); } AdminActions ac = new AdminActions(); DataTable dt = ac.Cinema(); for (int i = 0; i < dt.Rows.Count; i++) { ListItem li = new ListItem(dt.Rows[i]["CinemaID"].ToString()); ddl_cinemanewscreening.Items.Add(li); } } }
public static Role ToRole(this AdminActions action) { switch (action) { case AdminActions.Admin: return(Role.Admin); case AdminActions.Mod: return(Role.Mod); case AdminActions.Kick: return(Role.NotMember); case AdminActions.Ban: return(Role.Banned); case AdminActions.Silence: return(Role.Silenced); default: return(Role.User); } }
protected void gv_deleteusers_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("DeleteUser")) { HttpCookie cookie = Request.Cookies["Details"]; if (cookie == null) { Response.Redirect("Login.aspx"); } else { WS_UserProfile ws = new WS_UserProfile(); DataSet ds = (DataSet)Session["usersTable"]; DataTable dt = ds.Tables[0]; int i = int.Parse(e.CommandArgument.ToString()); int id = int.Parse(dt.Rows[i]["UserID"].ToString()); AdminActions ac = new AdminActions(); DataTable dt2 = ws.UserTicketView(id); for (int q = 0; q < dt2.Rows.Count; q++) { int invitation = int.Parse(dt2.Rows[q]["InvitationID"].ToString()); ws.CancelInvite(invitation); } int j = ac.DeleteUser(id); if (j == 1) { Response.Write("User Was Deleted"); } else { Response.Write("Delete Failed"); } Response.Redirect("AdminDeleteUsers.aspx"); } } }
private void Load() { ViewData["adminActionTree"] = AdminActions.GetAdminActionTree(); ViewData["referer"] = ShopUtils.GetAdminRefererCookie(); }
public async Task <Response> AdminAction(AdminActions action, int user, int group) { var packet = packetTemplates.AdminAction(action, user, group); return(await SendAwaitResponse(packet)); }
private object DoAdminActionOnUser( Func <Tuple <Client, User> > fetch, Func <HttpResponseMessage> onError, AdminActions adminAction, AdminActionParameters actionParameters ) { var(client, user) = fetch(); if (user == null) { return(onError()); } var player = client?.Entity; var targetIp = client?.GetIp() ?? ""; switch (adminAction) { case AdminActions.Ban: if (string.IsNullOrEmpty(Ban.CheckBan(user, ""))) { Ban.Add( user.Id, actionParameters.Duration, actionParameters.Reason ?? "", actionParameters.Moderator ?? @"api", actionParameters.Ip ? targetIp : "" ); client?.Disconnect(); PacketSender.SendGlobalMsg(Strings.Account.banned.ToString(user.Name)); return(Request.CreateMessageResponse( HttpStatusCode.OK, Strings.Account.banned.ToString(user.Name) )); } else { return(Request.CreateMessageResponse( HttpStatusCode.BadRequest, Strings.Account.alreadybanned.ToString(user.Name) )); } case AdminActions.UnBan: Ban.Remove(user.Id, false); PacketSender.SendGlobalMsg(Strings.Account.unbanned.ToString(user.Name)); return(Request.CreateMessageResponse( HttpStatusCode.OK, Strings.Account.unbanned.ToString(user.Name) )); case AdminActions.Mute: if (string.IsNullOrEmpty(Mute.FindMuteReason(user.Id, ""))) { Mute.Add( user, actionParameters.Duration, actionParameters.Reason ?? "", actionParameters.Moderator ?? @"api", actionParameters.Ip ? targetIp : "" ); PacketSender.SendGlobalMsg(Strings.Account.muted.ToString(user.Name)); return(Request.CreateMessageResponse( HttpStatusCode.OK, Strings.Account.muted.ToString(user.Name) )); } else { return(Request.CreateMessageResponse( HttpStatusCode.BadRequest, Strings.Account.alreadymuted.ToString(user.Name) )); } case AdminActions.UnMute: Mute.Remove(user); PacketSender.SendGlobalMsg(Strings.Account.unmuted.ToString(user.Name)); return(Request.CreateMessageResponse( HttpStatusCode.OK, Strings.Account.unmuted.ToString(user.Name) )); case AdminActions.WarpTo: if (player != null) { var mapId = actionParameters.MapId == Guid.Empty ? player.MapId : actionParameters.MapId; player.Warp(mapId, (byte)player.X, (byte)player.Y); return(Request.CreateMessageResponse( HttpStatusCode.OK, $@"Warped '{player.Name}' to {mapId} ({player.X}, {player.Y})." )); } break; case AdminActions.WarpToLoc: if (player != null) { var mapId = actionParameters.MapId == Guid.Empty ? player.MapId : actionParameters.MapId; player.Warp(mapId, actionParameters.X, actionParameters.Y, true); return(Request.CreateMessageResponse( HttpStatusCode.OK, $@"Warped '{player.Name}' to {mapId} ({actionParameters.X}, {actionParameters.Y})." )); } break; case AdminActions.Kick: if (client != null) { client.Disconnect(actionParameters.Reason); PacketSender.SendGlobalMsg(Strings.Player.serverkicked.ToString(player?.Name)); return(Request.CreateMessageResponse( HttpStatusCode.OK, Strings.Player.serverkicked.ToString(player?.Name) )); } break; case AdminActions.Kill: if (client != null && client.Entity != null) { lock (client.Entity.EntityLock) { client.Entity.Die(); } PacketSender.SendGlobalMsg(Strings.Player.serverkilled.ToString(player?.Name)); return(Request.CreateMessageResponse( HttpStatusCode.OK, Strings.Commandoutput.killsuccess.ToString(player?.Name) )); } break; case AdminActions.WarpMeTo: case AdminActions.WarpToMe: return(Request.CreateErrorResponse( HttpStatusCode.BadRequest, $@"'{adminAction.ToString()}' not supported by the API." )); case AdminActions.SetSprite: case AdminActions.SetFace: case AdminActions.SetAccess: default: return(Request.CreateErrorResponse(HttpStatusCode.NotImplemented, adminAction.ToString())); } return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Strings.Player.offline)); }
public void RebuildFullTextIndex() { AdminActions.RebuildFullTextIndex(); }
public void ReindexAllFullTextNodes() { AdminActions.ReindexAllFullTextNodes(); }
/// <summary> /// Commits an admin action /// </summary> /// <param name="action">The action to commit</param> /// <param name="user">The User to commit against</param> /// <param name="group">The Group to commit in</param> /// <returns>The response</returns> public Response AdminAction(AdminActions action, UserId user, GroupId group) { return(Bot.AdminAction(action, user, group).Result); }