protected void leaveGroupBtn_Click(object sender, EventArgs e) { string userName = Cookies.ReadCookie(this.Request, this.Response); Database.FirebaseUsers.RemoveGroupFromUser(userName); Response.Redirect("JoinGroup.aspx"); }
protected void createNewGroupBtn_Click(object sender, EventArgs e) { string userName = Cookies.ReadCookie(this.Request, this.Response); Database.FirebaseUsers.AddBrandNewGroupToUser(userName); Response.Redirect("Leaderboard.aspx"); }
protected void Page_Load(object sender, EventArgs e) { string userName = Cookies.ReadCookie(this.Request, this.Response); if (String.IsNullOrWhiteSpace(userName)) { Response.Redirect("LoginPage.aspx"); } var user = Database.FirebaseUsers.GetUser(userName); if (String.IsNullOrEmpty(user.GroupID)) { primaryJumbotron.Visible = false; secondaryJumbotron.Visible = true; //Response.Redirect("JoinGroup.aspx"); } else { primaryJumbotron.Visible = true; secondaryJumbotron.Visible = false; groupCodeLbl.Text = user.GroupID; var usersInGroup = Database.FirebaseUsers.GetUsersInGroup(user.GroupID); var sortedList = usersInGroup.OrderBy(si => si.Points).Reverse().ToArray(); for (int x = 0; x < sortedList.Length; x++) { string cardColor = "primary"; if (sortedList[x].Name == user.Name) { cardColor = "success"; } StringBuilder text = new StringBuilder(); text.Append("<div class=\"card\">"); text.Append("<div class=\"card bg-" + cardColor + " text-white\">"); text.Append("<b>" + sortedList[x].Name + "</b>"); text.Append("</div>"); text.Append("<div class=\"card-body\">"); text.Append("<a>Points: " + sortedList[x].Points + "</a>"); text.Append("</div>"); text.AppendLine("</div>"); text.AppendLine("<br />"); leaderboardList.Text += text.ToString(); } } }
protected void SubmitChanges_ServerClick(object sender, EventArgs e) { String imageUrl = Request.QueryString["image"]; string token = Request.QueryString["token"]; string url = imageUrl + "&token=" + token; url = url.Replace("Pictures/", "Pictures%2F"); var thingFromDb = Database.FirebaseDatabase.GetNameFromUrl(url); Database.FirebaseDatabase.DeletePicture(thingFromDb.ID); Database.FirebaseCloudStorage.DeletePhotoFromStorage(thingFromDb.name + ".jpg"); String inpName = Cookies.ReadCookie(this.Request, this.Response); Database.FirebaseUsers.AddPoints(inpName, 10); Success.Visible = true; SubmitChanges.Visible = false; Redirect.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { dangerAlert.Visible = false; successAlert.Visible = false; string userName = Cookies.ReadCookie(this.Request, this.Response); var user = Database.FirebaseUsers.GetUser(userName); if (String.IsNullOrWhiteSpace(user.GroupID)) { mainJumbotron.Visible = true; secondaryJumbotron.Visible = false; } else { mainJumbotron.Visible = false; secondaryJumbotron.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { string userName = Cookies.ReadCookie(this.Request, this.Response); if (String.IsNullOrWhiteSpace(userName)) { Response.Redirect("LoginPage.aspx"); } //Database.FirebaseDatabase.AddPicture("First Test"); //var allNames = Database.FirebaseDatabase.GetAllPictureNames(); //Database.FirebaseDatabase.DeletePicture("First Test"); //string url = Database.FirebaseCloudStorage.AddPhotoToStorage(MapPath(@"~\milky-way.jpg")); //bool succeeded = Database.FirebaseCloudStorage.DeletePhotoFromStorage("milky-way.jpg"); //ThreadStart ts = new ThreadStart(SendThingToTransfer); //Thread t = new Thread(ts); //t.Start(); //Database.FirebaseDatabase.AddUrlsToPicturesWithoutUrls(); //Database.FirebaseDatabase.TransferNameToGarbageFoundCategory("milky-way"); //Database.FirebaseUsers.CreateUser("Kade0", "abc"); //Database.FirebaseUsers.AddBrandNewGroupToUser("Kade0"); //Database.FirebaseUsers.AddGroupToUser("Kade1", "h2e51mc5"); //Database.FirebaseCloudStorage.AddPhotoToStorage(MapPath("ImageNames.txt")); //bool isGarbage = GetGarbage.CheckGarbage("https://firebasestorage.googleapis.com/v0/b/ecomake-de93b.appspot.com/o/Pictures%2Fmilky-way.jpg?alt=media&token=9fa46c36-1364-4b9d-bd7c-d3734b275525"); //var allPicturesWithGarbage = Database.FirebaseDatabase.GetAllPictureWithGarbageNames(); //DisplayPics(allPicturesWithGarbage); //Database.FirebaseCloudStorage.ClearImageNameFile(MapPath("ImageNames.txt")); //string url = "https://firebasestorage.googleapis.com/v0/b/ecomake-de93b.appspot.com/o/Pictures%2FImageNames.txt?alt=media&token=15e491e9-5014-462d-ae48-a504f62e4edb"; //string result = Database.FirebaseCloudStorage.GetImageNames(url); pathFile = MapPath("ImageNames.txt"); ThreadStart ts = new ThreadStart(CheckingClock); Thread t = new Thread(ts); t.Start(); DisplayPics(Database.FirebaseDatabase.GetAllPictureNames()); }
protected void joinGroupBtn_Click(object sender, EventArgs e) { dangerAlert.Visible = false; successAlert.Visible = false; string userName = Cookies.ReadCookie(this.Request, this.Response); string groupID = groupTextBox.Text; bool doesExist = Database.FirebaseUsers.DoesGroupIdExist(groupID); if (doesExist) { Database.FirebaseUsers.AddGroupToUser(userName, groupID); groupTextBox.Text = String.Empty; dangerAlert.Visible = false; successAlert.Visible = true; } else { dangerAlert.Visible = true; successAlert.Visible = false; } }