Пример #1
0
    protected void gvEstabMatches_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        EstablishmentBPRequest       selectedRequest      = pendingRequests[gvRequests.PageSize * gvRequests.PageIndex + gvRequests.SelectedIndex];
        List <EstabEstabTransaction> allEstabTransactions = EstabEstabTransactionDB.getAllTransactions();

        foreach (EstabEstabTransaction m in allEstabTransactions)
        {
            if (m.Match.Request.ID == selectedRequest.ID && m.Status == "accepted")
            {
                estabTransactions.Add(m);
            }
        }

        EstabEstabTransaction selectedTransaction = estabTransactions[e.RowIndex];

        selectedTransaction.Status = "cancelled";
        EstabEstabTransactionDB.updateTransaction(selectedTransaction);


        selectedTransaction.Match.Status = "declined";
        EstabEstabMatchDB.updateMatch(selectedTransaction.Match);

        selectedRequest.MatchedUnits = selectedRequest.MatchedUnits - selectedTransaction.Units;
        EstablishmentBPRequestDB.updateEstablishmentRequest(selectedRequest);
        Server.Transfer("PendingRequests.aspx");
    }
Пример #2
0
    protected void gvRequests_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        EstablishmentBPRequest selectedRequest = pendingRequests[gvRequests.PageSize * gvRequests.PageIndex + e.RowIndex];
        int noTransactions = 0;
        List <EstabEstabTransaction> allEstabTransactions = EstabEstabTransactionDB.getAllTransactions();
        List <EstabUserTransaction>  allUserTransactions  = EstabUserTransactionDB.getAllTransactions();

        foreach (EstabEstabTransaction m in allEstabTransactions)
        {
            if (m.Match.Request.ID == selectedRequest.ID && m.Status == "complete")
            {
                noTransactions = 1;
            }
        }
        foreach (EstabUserTransaction m in allUserTransactions)
        {
            if (m.Match.Request.ID == selectedRequest.ID && m.Status == "complete")
            {
                noTransactions = 2;
            }
        }
        if (noTransactions == 1 || noTransactions == 2)
        {
            lblOutput.Text = "Sorry this request cannot be cancelled!";
        }
        else
        {
            foreach (EstabEstabTransaction m in allEstabTransactions)
            {
                if (m.Match.Request.ID == selectedRequest.ID)
                {
                    m.Status = "cancelled";
                    EstabEstabTransactionDB.updateTransaction(m);
                    m.Match.Status = "declined";
                    EstabEstabMatchDB.updateMatch(m.Match);
                }
            }
            foreach (EstabUserTransaction m in allUserTransactions)
            {
                if (m.Match.Request.ID == selectedRequest.ID)
                {
                    m.Status = "cancelled";
                    EstabUserTransactionDB.updateTransaction(m);
                    m.Match.Status = "declined";
                    EstabUserMatchDB.updateMatch(m.Match);
                }
            }

            selectedRequest.Status = "cancelled";
            EstablishmentBPRequestDB.updateEstablishmentRequest(selectedRequest);
            Server.Transfer("PendingRequests.aspx");
        }
    }
Пример #3
0
    protected void gvEstabMatches_SelectedIndexChanged(object sender, EventArgs e)
    {
        EstablishmentBPRequest selectedRequest = pendingRequests[gvRequests.PageSize * gvRequests.PageIndex + gvRequests.SelectedIndex];

        List <EstabEstabTransaction> allEstabTransactions = EstabEstabTransactionDB.getAllTransactions();

        foreach (EstabEstabTransaction m in allEstabTransactions)
        {
            if (m.Match.Request.ID == selectedRequest.ID && m.Status == "accepted")
            {
                estabTransactions.Add(m);
            }
        }
        EstabEstabTransaction selectedTransaction = estabTransactions[gvEstabMatches.SelectedIndex];

        selectedTransaction.Status = "complete";
        EstabEstabTransactionDB.updateTransaction(selectedTransaction);

        EstabEstabMatch currentMatch = selectedTransaction.Match;

        currentMatch.Status = "complete";
        EstabEstabMatchDB.updateMatch(currentMatch);



        if (selectedRequest.MatchedUnits == selectedRequest.Units)
        {
            selectedRequest.Status = "complete";
            EstablishmentBPRequestDB.updateEstablishmentRequest(selectedRequest);
            foreach (EstabEstabTransaction et in allEstabTransactions)
            {
                if (et.Match.Request.ID == selectedRequest.ID)
                {
                    et.Status = "complete";
                    EstabEstabTransactionDB.updateTransaction(et);
                    et.Match.Status = "complete";
                    EstabEstabMatchDB.updateMatch(et.Match);
                }
            }
        }
        Server.Transfer("PendingRequests.aspx");
    }
Пример #4
0
    protected void lbtnContact_Click1(object sender, EventArgs e)
    {
        LinkButton                   lbtn                 = (LinkButton)sender;
        GridViewRow                  gvr                  = (GridViewRow)lbtn.NamingContainer;
        int                          i                    = Convert.ToInt32(gvr.RowIndex);
        EstablishmentBPRequest       selectedRequest      = pendingRequests[gvRequests.PageSize * gvRequests.PageIndex + gvRequests.SelectedIndex];
        List <EstabEstabTransaction> allEstabTransactions = EstabEstabTransactionDB.getAllTransactions();

        foreach (EstabEstabTransaction m in allEstabTransactions)
        {
            if (m.Match.Request.ID == selectedRequest.ID && m.Status == "accepted")
            {
                estabTransactions.Add(m);
            }
        }
        EstabEstabTransaction selectedTransaction = estabTransactions[i];
        Establishment         contactEstab        = selectedTransaction.Match.Match;

        Session["ldID"]  = null;
        Session["rwEst"] = null;
        Session["echat"] = contactEstab.ID;
        Server.Transfer("IndividualChatE.aspx");
    }
Пример #5
0
    protected void gvRequests_SelectedIndexChanged(object sender, EventArgs e)
    {
        EstablishmentBPRequest       selectedRequest      = pendingRequests[gvRequests.PageSize * gvRequests.PageIndex + gvRequests.SelectedIndex];
        List <EstabEstabTransaction> allEstabTransactions = EstabEstabTransactionDB.getAllTransactions();
        List <EstabUserTransaction>  allUserTransactions  = EstabUserTransactionDB.getAllTransactions();
        int flag = 0;

        foreach (EstabEstabTransaction m in allEstabTransactions)
        {
            if (m.Match.Request.ID == selectedRequest.ID && m.Status == "accepted")
            {
                estabTransactions.Add(m);
                flag = 1;
            }
        }
        foreach (EstabUserTransaction m in allUserTransactions)
        {
            if (m.Match.Request.ID == selectedRequest.ID && m.Status == "accepted")
            {
                userTransactions.Add(m);
                flag = 2;
            }
        }
        if (flag == 0)
        {
            lblOutput.Text       = "Sorry no matches found yet!";
            panelMatches.Visible = false;
        }
        else
        {
            panelMatches.Visible      = true;
            gvEstabMatches.DataSource = estabTransactions;
            gvEstabMatches.DataBind();
            gvUserMatches.DataSource = userTransactions;
            gvUserMatches.DataBind();
        }
    }