protected void lbtnContact1_Click(object sender, EventArgs e) { Establishment currentEstab = (Establishment)Session["establishment"]; LinkButton lbtn = (LinkButton)sender; GridViewRow gvr = (GridViewRow)lbtn.NamingContainer; int i = Convert.ToInt32(gvr.RowIndex); List <BPMatchUserToEstab> allUserRequests = BPMatchUserToEstabDB.getAllbpMatchUserToEsta(); List <BPMatchUserToEstab> userRequests = new List <BPMatchUserToEstab>(); foreach (BPMatchUserToEstab m in allUserRequests) { if (m.matchID.ID == currentEstab.ID && m.status == "pending" && m.bpRequestID.unitMatched < m.bpRequestID.Units) { userRequests.Add(m); } } BPMatchUserToEstab currentMatch = userRequests[i]; Users contactUser = currentMatch.bpRequestID.requestorID; Session["ldID"] = contactUser.UserId; Session["rwEst"] = null; Session["echat"] = null; Server.Transfer("IndividualChatE.aspx"); //store session for individual chat in next page }
protected void Page_Load(object sender, EventArgs e) { if (Session["establishment"] == null) { Server.Transfer("Login.aspx"); } else { Establishment currentEstab = (Establishment)Session["establishment"]; List <EstabEstabMatch> allEstabRequests = EstabEstabMatchDB.getAllMatches(); List <EstabEstabMatch> estabRequests = new List <EstabEstabMatch>(); foreach (EstabEstabMatch m in allEstabRequests) { if (m.Match.ID == currentEstab.ID && m.Status == "pending" && m.Request.MatchedUnits < m.Request.Units) { estabRequests.Add(m); } } if (estabRequests.Count == 0) { lblOutput.Text = "There are currently no requests from establishments"; pnlEstabRequests.Visible = false; } else { gvEstabRequests.DataSource = estabRequests; gvEstabRequests.DataBind(); } List <BPMatchUserToEstab> allUserRequests = BPMatchUserToEstabDB.getAllbpMatchUserToEsta(); List <BPMatchUserToEstab> userRequests = new List <BPMatchUserToEstab>(); foreach (BPMatchUserToEstab m in allUserRequests) { if (m.matchID.ID == currentEstab.ID && m.status == "pending" && m.bpRequestID.unitMatched < m.bpRequestID.Units) { userRequests.Add(m); } } if (userRequests.Count == 0) { lblOutput.Text = "There are currently no requests from users"; pnlUserRequests.Visible = false; } else { gvUserRequests.DataSource = userRequests; gvUserRequests.DataBind(); } } }
protected void gvUserRequests_PageIndexChanging(object sender, GridViewPageEventArgs e) { Establishment currentEstab = (Establishment)Session["establishment"]; List <BPMatchUserToEstab> allUserRequests = BPMatchUserToEstabDB.getAllbpMatchUserToEsta(); List <BPMatchUserToEstab> userRequests = new List <BPMatchUserToEstab>(); foreach (BPMatchUserToEstab m in allUserRequests) { if (m.matchID.ID == currentEstab.ID && m.status == "pending" && m.bpRequestID.unitMatched < m.bpRequestID.Units) { userRequests.Add(m); } } gvUserRequests.PageIndex = e.NewPageIndex; gvUserRequests.DataSource = userRequests; gvUserRequests.DataBind(); }
protected void gvUserRequests_RowDeleting(object sender, GridViewDeleteEventArgs e) { Establishment currentEstab = (Establishment)Session["establishment"]; List <BPMatchUserToEstab> allUserRequests = BPMatchUserToEstabDB.getAllbpMatchUserToEsta(); List <BPMatchUserToEstab> userRequests = new List <BPMatchUserToEstab>(); foreach (BPMatchUserToEstab m in allUserRequests) { if (m.matchID.ID == currentEstab.ID && m.status == "pending" && m.bpRequestID.unitMatched < m.bpRequestID.Units) { userRequests.Add(m); } } BPMatchUserToEstab currentMatch = userRequests[gvUserRequests.PageSize * gvUserRequests.PageIndex + e.RowIndex]; currentMatch.status = "declined"; BPMatchUserToEstabDB.updateBPMatchUserToEstab(currentMatch); Server.Transfer("IncomingRequests.aspx"); }
protected void btnUserSubmit_Click(object sender, EventArgs e) { Establishment currentEstab = (Establishment)Session["establishment"]; List <BPMatchUserToEstab> allUserRequests = BPMatchUserToEstabDB.getAllbpMatchUserToEsta(); List <BPMatchUserToEstab> userRequests = new List <BPMatchUserToEstab>(); foreach (BPMatchUserToEstab m in allUserRequests) { if (m.matchID.ID == currentEstab.ID && m.status == "pending" && m.bpRequestID.unitMatched < m.bpRequestID.Units) { userRequests.Add(m); } } BPMatchUserToEstab currentMatch = userRequests[gvUserRequests.PageSize * gvUserRequests.PageIndex + gvUserRequests.SelectedIndex]; BloodPlateletRequestUser r = currentMatch.bpRequestID; BplTransactionUserToEstab newTransaction = new BplTransactionUserToEstab(); int donateUnits = Convert.ToInt32(tbxUserUnits.Text); if (donateUnits > (currentMatch.bpRequestID.Units - currentMatch.bpRequestID.unitMatched)) { lblUserOutput.Text = "Please enter a valid amount"; } else { currentMatch.status = "accepted"; BPMatchUserToEstabDB.updateBPMatchUserToEstab(currentMatch); newTransaction.bpMatchUsrEstID = currentMatch; newTransaction.unit = donateUnits; newTransaction.status = "accepted"; BplTransactionUserToEstabDB.insertbptrans(newTransaction); r.unitMatched = r.unitMatched + donateUnits; BloodPlateletRequestUserDB.updateBloodPlateles(r); lblOutput.Text = "Donation successfully accepted!"; pnlAcceptUser.Visible = false; tbxUserUnits.Text = ""; Server.Transfer("IncomingRequests.aspx"); } }