/// <summary>
        /// This method is called and executed when the page is loaded.
        /// The Page_Load handle the retrieval of the verification status of the organisation and displays it
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] > 0 && (int)HttpContext.Current.Session["User_lvl"] < 5)
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();

                ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

                bool verified = serv.getVerificationStatus(serv.getNPOWithManager(user.userValue.UserID));

                lblReason.Visible = false;

                if (verified)
                {
                    lblVerified.ForeColor = System.Drawing.Color.Green;
                    lblVerified.Text      = "Verified";
                }
                else
                {
                    lblVerified.ForeColor = System.Drawing.Color.Red;
                    lblVerified.Text      = "Not Verified";
                    lblReason.Visible     = true;
                    lblReason.ForeColor   = System.Drawing.Color.Red;
                    lblReason.Text        = "Please make sure you have the correct file attached as proof of your organisation!";
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] > 0 || (int)HttpContext.Current.Session["User_lvl"] < 8)
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail     u    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

                double value = 0;

                if (Request.QueryString["orgId"] != null)
                {
                    value = serv.getAverageRating(int.Parse(Request.QueryString["orgId"].ToString()));
                }
                else
                {
                    value = serv.getAverageRating(serv.getNPOWithManager(u.userValue.UserID));
                }

                lblRR.Text = "" + value + "/10";
            }
            else
            {
                lblRR.Text = "Rating</br></br>not</br></br>available";
            }
        }
        /// <summary>
        /// Displays the list of rsvp done by the user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 1)
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                ServiceReference1.RSVPEvent[]    Events;


                ServiceReference1.UserDetail u = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

                Events = serv.getEventUser(u.userValue.UserID);

                HeaderDiv.InnerHtml = "<h2>" + u.userValue.FirstName + "'s RSVP list:</h2>";

                TableList.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr><td>Organisation: </td><td>Event: </td><td>Date: </td><td>Status: </td></tr>";
                int orgID;
                foreach (ServiceReference1.RSVPEvent eve in Events)
                {
                    var ev = serv.getEvent(eve.EventID);
                    orgID = ev.EventValue.OrganisationID;
                    TableList.InnerHtml += "<tr><td>" + serv.getOrg(orgID).OrganisationName + "</td><td>" + ev.EventValue.Name + "</td><td>" + Convert.ToDateTime(ev.EventValue.DateOfEvent).ToShortDateString() + "</td><td>" + eve.Attendance + "</td></tr>";
                }
                TableList.InnerHtml += "</table>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ddlUpdateChart.Items.Add("Group by month");
                ddlUpdateChart.Items.Add("Group by year");
            }

            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 1)
            {
                ServiceReference1.reportDonation[] repDons = null;

                if (ddlUpdateChart.SelectedValue.Equals("Group by month"))
                {
                    repDons = service.getDonationsForComparison(31, "M");
                }
                else if (ddlUpdateChart.SelectedValue.Equals("Group by year"))
                {
                    repDons = service.getDonationsForComparison(31, "Y");
                }

                dates  = new string[repDons.Count()];
                amount = new double[repDons.Count()];

                for (int a = 0; a < repDons.Count(); a++)
                {
                    dates[a]  = repDons[a].Date;
                    amount[a] = repDons[a].Amount;
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Appropriate methods are called from the server to do the donation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 3 || (int)HttpContext.Current.Session["User_lvl"] == 5)
            {
                ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                donation.Donate = null;
                bool success;
                if (HttpContext.Current.Session["fundID"] == null)
                {
                    donation.Donate = null;
                    success         = service.addDonation(user.userValue.UserID, donation);
                }
                else
                {
                    success = service.DonateFC(Convert.ToInt32(HttpContext.Current.Session["fundID"]), user.userValue.UserID, Convert.ToDouble(HttpContext.Current.Session["Amount"]));
                }

                if (success)
                {
                    lblError.ForeColor = System.Drawing.Color.Black;
                    lblError.Text      = "Donation successful";
                    lblError.Visible   = true;
                    btnConfirm.Visible = false;
                }
                else
                {
                    lblError.Text    = "Donation failed";
                    lblError.Visible = true;
                }
            }
        }
        /// <summary>
        /// This method sends the email to the donors
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSendEmail_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 1)
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail     user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                int OrgNumber = 1;
                ServiceReference1.Organisation org = serv.getOrg(OrgNumber);
                String[] donorEmails = serv.getDonorEmails(OrgNumber);


                foreach (String email in donorEmails)
                {
                    EmailSender passEmail = new EmailSender();

                    passEmail.setReceiverEmail(email);
                    passEmail.setSubject("Progress Report");
                    passEmail.setDetails(org.OrganisationName + "\r\n" + txtTitle.Text + "\r\n" + txtBody.Text);

                    if (passEmail.sendEmail())
                    {
                        lblReply.Text = "Emails have successfully been sent to all donors.";
                    }
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
     if (user.AccessLvl > 1)
     {
         Response.Redirect("DashboardPage.aspx");
     }
 }
Exemple #8
0
        /// <summary>
        /// This method is called and executed when the page is loaded.
        /// It retrieves and displays all donations that are made.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 3 || (int)HttpContext.Current.Session["User_lvl"] == 4 || (int)HttpContext.Current.Session["User_lvl"] == 5)
            {
                ServiceReference1.Service1Client service   = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail     user      = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                ServiceReference1.DonationUser[] donations = service.getDonationUser(user.userValue.UserID);

                DonationsTable.InnerHtml  = "";
                DonationsTable.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr style='border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left;'>Date</th><th style='text-align: left;'>NPO</th><th style='text-align: left;'>Amount</th></tr>";

                if (numOfDons < donations.Count())
                {
                    numOfDons = donations.Count();
                }

                for (int a = 0; a < donations.Count(); a++)
                {
                    donationCSV += donations[a].Date.ToShortDateString() + "," + donations[a].NpoName + "," + donations[a].Amount + "\n";
                }

                for (int a = (pageCount - 1) * 8; a < pageCount * 8; a++)
                {
                    if (a >= numOfDons)
                    {
                        break;
                    }

                    if (searchStr.Equals(""))
                    {
                        DonationsTable.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + donations[a].Date.ToShortDateString() + "</th><th style='text-align: left; margin-right: 10px;'>" + donations[a].NpoName + "</th><th style='text-align: right; padding-right: 10px;'>R " + donations[a].Amount + "</th></tr>";
                    }
                    else
                    {
                        int numOfDonsAdded = 0;
                        for (int b = 0; b < numOfDons; b++)
                        {
                            if (numOfDonsAdded > 7)
                            {
                                break;
                            }
                            if (donations[b].NpoName.Contains(searchStr))
                            {
                                DonationsTable.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + donations[b].Date.ToShortDateString() + "</th><th style='text-align: left; margin-right: 10px;'>" + donations[b].NpoName + "</th><th style='text-align: right; padding-right: 10px;'>R " + donations[b].Amount + "</th></tr>";
                                numOfDonsAdded++;
                            }
                        }

                        searchStr      = "";
                        txtSearch.Text = "";
                        break;
                    }
                }


                DonationsTable.InnerHtml += "</table>";
            }
        }
        /// <summary>
        /// reading EventId from the URL paramter and displays the details of that Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 1 || (int)HttpContext.Current.Session["User_lvl"] == 3)
            {
                tblRSVP.Visible = false;
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                ServiceReference1.RSVPEvent      rsvp = new ServiceReference1.RSVPEvent();
                ServiceReference1.UserDetail     user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                int EventID = int.Parse(Request.QueryString["id"].ToString());
                rsvp.EventID = EventID;
                rsvp.User    = user.userValue.UserID;

                ServiceReference1.Eve Event = serv.getEvent(EventID);

                string NPOman = "";

                if (user.AccessLvl == 1)
                {
                    divEventsDetailsTable.InnerHtml = "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr><td><h1>Name :</h1></td><td>" + Event.EventValue.Name + "</td></tr><tr><td><h2>Organisation :</h2></td><td>" + serv.getOrg(Event.EventValue.OrganisationID).OrganisationName +
                                                      "</td></tr><tr><td><h2>Location :</h2></td><td>" + Event.EventValue.Location + "</td></tr><tr><td><h2>Date :</h2></td><td>" + Event.EventValue.DateOfEvent + "</td></tr><tr><td><h2>Host :</h2></td><td>" + Event.EventValue.Host + "</td></tr><tr><td><h2>Description :</h2></td><td>" + Event.EventValue.Description + "</td></tr><tr><td><a href='npoRSVPlist.aspx?OrgID=" + serv.getNPOWithManager(rsvp.User) + "&EventID=" + EventID + "'>View All RSVP</a></td></tr></table>";
                }
                else
                {
                    divEventsDetailsTable.InnerHtml = "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr><td><h1>Name :</h1></td><td>" + Event.EventValue.Name + "</td></tr><tr><td><h2>Organisation :</h2></td><td>" + serv.getOrg(Event.EventValue.OrganisationID).OrganisationName +
                                                      "</td></tr><tr><td><h2>Location :</h2></td><td>" + Event.EventValue.Location + "</td></tr><tr><td><h2>Date :</h2></td><td>" + Event.EventValue.DateOfEvent + "</td></tr><tr><td><h2>Host :</h2></td><td>" + Event.EventValue.Host + "</td></tr><tr><td><h2>Description :</h2></td><td>" + Event.EventValue.Description + "</td></tr></table>";
                }

                if (user.AccessLvl == 3)
                {
                    tblRSVP.Visible = true;
                }

                //Upon selecting an radio button
                if (RBLrsvp.SelectedValue.Equals("1"))
                {
                    rsvp.Attendance = "Yes";
                    serv.setRSVP(rsvp);
                    lblRSVP.Text    = "Thank you.";
                    RBLrsvp.Visible = false;
                }
                else if (RBLrsvp.SelectedValue.Equals("2"))
                {
                    rsvp.Attendance = "Maybe";
                    serv.setRSVP(rsvp);
                    lblRSVP.Text    = "Thank you.";
                    RBLrsvp.Visible = false;
                }
                else if (RBLrsvp.SelectedValue.Equals("0"))
                {
                    rsvp.Attendance = "No";
                    serv.setRSVP(rsvp);
                    lblRSVP.Text    = "Next time..";
                    RBLrsvp.Visible = false;
                }
            }
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     u    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
            int userID = u.userValue.UserID;

            if (serv.checkBadge(userID, 1) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Bronze Donor Badge</h1><img style='width:50px;height:50px' src='/images/Badges/don_bronze.png'/></div>";
            }
            if (serv.checkBadge(userID, 2) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Silver Donor Badge</h1><img style='width:50px;height:50px' src='/images/Badges/don_silver.png'/></div>";
            }
            if (serv.checkBadge(userID, 3) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Gold Donor Badge</h1><img style='width:50px;height:50px' src='/images/Badges/don_gold.png'/></div>";
            }
            if (serv.checkBadge(userID, 4) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Bronze Volunteer</h1><img style='width:50px;height:50px' src='/images/Badges/vol_bronze.png'/></div>";
            }
            if (serv.checkBadge(userID, 5) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Silver Volunteer</h1><img style='width:50px;height:50px' src='/images/Badges/vol_silver.png'/></div>";
            }
            if (serv.checkBadge(userID, 6) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Gold Volunteer</h1><img style='width:50px;height:50px' src='/images/Badges/vol_gold.png'/></div>";
            }
            if (serv.checkBadge(userID, 7) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Bronze Points</h1><img style='width:50px;height:50px' src='/images/Badges/points_bronze.png'/></div>";
            }
            if (serv.checkBadge(userID, 8) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Silver Points</h1><img style='width:50px;height:50px' src='/images/Badges/points_silver.png'/></div>";
            }
            if (serv.checkBadge(userID, 9) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Gold Points</h1><img style='width:50px;height:50px' src='/images/Badges/points_gold.png'/></div>";
            }
            if (serv.checkBadge(userID, 10) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Bronze Rater</h1><img style='width:50px;height:50px' src='/images/Badges/rate_bronze.png'/></div>";
            }
            if (serv.checkBadge(userID, 11) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Silver Rater</h1><img style='width:50px;height:50px' src='/images/Badges/rate_silver.png'/></div>";
            }
            if (serv.checkBadge(userID, 12) == true)
            {
                badgesContainer.InnerHtml += "<div><h1>Gold Rater</h1><img style='width:50px;height:50px' src='/images/Badges/rate_gold.png'/></div>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 1)
            {
                showUp    = service.getVolsShowingUp(service.getNPOWithManager(user.userValue.UserID));
                notShowUp = 100 - showUp;
            }
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 1)
            {
                successful    = service.getFCSuccessRate(service.getNPOWithManager(user.userValue.UserID));
                notSuccessful = 100 - successful;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnBook_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 1)
            {
                lblIsValid.Text = "";

                ServiceReference1.Service1Client ser = new ServiceReference1.Service1Client();

                ServiceReference1.Eve eve = new ServiceReference1.Eve();
                string[] s;
                DateTime DateOfBook;
                try
                {
                    s          = lblEventDate.Text.Split('-');
                    DateOfBook = new DateTime(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]), Convert.ToInt32(s[2]), Convert.ToInt32(ddlSTHr.SelectedItem.Text), Convert.ToInt32(ddlSTMin.SelectedItem.Text), 0);
                }
                catch (Exception ex)
                {
                    s          = lblEventDate.Text.Split('/');
                    DateOfBook = new DateTime(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]), Convert.ToInt32(s[2]), Convert.ToInt32(ddlSTHr.SelectedItem.Text), Convert.ToInt32(ddlSTMin.SelectedItem.Text), 0);
                }

                eve.DateValue   = DateOfBook;
                eve.Host        = txtHost.Text;
                eve.Name        = txtEName.Text;
                eve.Location    = txtVenue.Text;
                eve.Description = txtDescription.Text;
                eve.Time        = ddlSTHr.SelectedValue + ":" + ddlSTMin.SelectedValue + " " + ddlSTAP.SelectedValue;
                ServiceReference1.UserDetail u = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                int id = ser.getNPOWithManager(u.userValue.UserID);
                eve.OrgID = id;
                bool added = ser.addEvent(eve, id);
                if (ddlEventType.SelectedItem.Text != "Other")
                {
                    eve.Description = ddlEventType.SelectedItem.Text;
                }
                else
                {
                    eve.Description = txtOther.Text;
                }

                if (added)
                {
                    lblIsValid.ForeColor = System.Drawing.Color.Black;
                    lblIsValid.Text      = "Event added successfully!";
                }
                else
                {
                    lblIsValid.ForeColor = System.Drawing.Color.Red;
                    lblIsValid.Text      = "An error occured. Please try again later!";
                }
            }
        }
        /// <summary>
        /// This method is called and executed when the page is loaded.
        /// The Page_Load handle the retrieval of the individuals points
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 5)
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();

                ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

                int points = serv.getPointsInd(user.userValue.UserID);

                lblPoints.Text = "" + points;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if ((int)HttpContext.Current.Session["User_lvl"] > 0 && (int)HttpContext.Current.Session["User_lvl"] < 8)
     {
         try
         {
             ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
             ServiceReference1.UserDetail     user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
             ServiceReference1.FileClass      file = serv.getUserImage(user.userValue.UserID);
             MemoryStream ms = new MemoryStream(file.FileBytes, 0, file.FileBytes.Length);
             imgUserPic.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(file.FileBytes);
         }
         catch (Exception ex)
         {
             imgUserPic.ImageUrl = "~/images/ina.jpg";
         }
     }
 }
Exemple #16
0
        /// <summary>
        /// data for Financial manager is stored and sent to the database.
        /// A Link is then emailed to the finanicial maager which will lead the
        /// financial manager to set his/her password.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSendFMR_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 1 || (int)HttpContext.Current.Session["User_lvl"] == 3)
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                bool IsRegister = false;
                try
                {
                    int    AccLvl = Convert.ToInt32(HttpContext.Current.Session["User_lvl"].ToString());
                    string email  = txtEmailAddress.Text;
                    ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                    int OrgNumber = serv.getNPOWithManager(user.userValue.UserID);
                    ServiceReference1.Organisation o = serv.getOrg(OrgNumber);

                    if (txtEmailAddress.Text != null && txtEmailAddress.Text != "")
                    {
                        IsRegister = serv.registerIndividual(email, null, AccLvl++, OrgNumber);
                    }
                    int userID = serv.getUserID(email);
                    if (IsRegister == true)
                    {
                        EmailSender passEmal = new EmailSender();
                        passEmal.setReceiverEmail(txtEmailAddress.Text);
                        if (passEmal.verfiyEmail())
                        {
                            passEmal.setSubject("Set Password");
                            passEmal.setDetails("Set Password to the following link: " + "http://localhost:29451/frames/FinManDetails.aspx?User_ID=" + userID.ToString() + ". You were added as a finantion manager for " + o.OrganisationName + ".");
                            if (passEmal.sendEmail())
                            {
                                lblRegFinMan.Text = "Financial Manager Added. Further Instructions forwarded to Financial Manager.";
                            }
                        }
                    }
                    else
                    {
                        lblRegFinMan.Text = "User Already Exists.";
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Exemple #17
0
        /// <summary>
        /// when page  is loaded: the labels and textboxs are set approtpriatly
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 3 || (int)HttpContext.Current.Session["User_lvl"] == 5)
            {
                lblError.Visible = false;

                try
                {
                    donation = new ServiceReference1.DonationRequester();
                    service  = new ServiceReference1.Service1Client();
                    user     = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                    if (HttpContext.Current.Session["fundID"] == null)
                    {
                        donation = service.getDonation(int.Parse(Request.QueryString["donationID"].ToString()));

                        lblAmount.Text = "R " + donation.Donate.Amount;
                        lblNPO.Text    = donation.NpoName;
                    }
                    else
                    {
                        lblNPO.Text    = HttpContext.Current.Session["NPOName"].ToString();
                        lblAmount.Text = "R " + HttpContext.Current.Session["Amount"];
                    }
                    lblCardHolder.Text = user.FirstNameValue;
                    lblEmail.Text      = user.EmailValue;

                    if (Request.QueryString["paypal"].ToString().Equals("Yes"))
                    {
                        cardNumber.Visible = false;
                        cardHolder.Visible = false;
                    }
                    else
                    {
                        cardNumber.Visible = true;
                        cardHolder.Visible = true;
                        lblCardNum.Text    = "**** **** **** " + Request.QueryString["cnum"];
                    }
                }
                catch (Exception ex)
                {
                    lblError.Visible = true;
                }
            }
        }
Exemple #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 3 || user.AccessLvl == 5)
            {
                ServiceReference1.reportDonation[] donations = service.getAllDailyDonationsUser(user.userValue.UserID);

                dates   = new string[donations.Count()];
                amounts = new double[donations.Count()];

                for (int a = 0; a < dates.Count(); a++)
                {
                    dates[a]   = donations[a].Date;
                    amounts[a] = donations[a].Amount;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 1)
            {
                ServiceReference1.reportDonation[] donations = service.getAllDailyDonations(service.getNPOWithManager(user.userValue.UserID));

                ServiceReference1.reportDonation[] don = Predict.prodictValue(donations, 6);
                dates   = new string[don.Count()];
                amounts = new double[don.Count()];
                for (int i = 0; i < don.Count(); i++)
                {
                    dates[i]   = don[i].Date;
                    amounts[i] = don[i].Amount;
                }
            }
        }
Exemple #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 3)
            {
                totalDons.InnerText = "R " + service.TotalDonated(user.userValue.UserID);
                ServiceReference1.mobileEve eve = service.getNextNPOEvent(user.userValue.UserID);
                if (eve == null)
                {
                    nextEvent.InnerText = "No upcoming events which you are attending";
                }
                else
                {
                    nextEvent.InnerText = eve.Name + " on the " + eve.Date + " at " + eve.Location;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 1)
            {
                ServiceReference1.reportFC[] fcs = service.getFCReports(service.getNPOWithManager(user.userValue.UserID));

                title      = new string[fcs.Count()];
                percentage = new double[fcs.Count()];

                for (int a = 0; a < fcs.Count(); a++)
                {
                    title[a]      = fcs[a].Title;
                    percentage[a] = fcs[a].Precentage;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];


            if (user.AccessLvl == 6)
            {
                ServiceReference1.reportDonation[] OrgRegistration = service.getDailyOrganisationRegistration();
                int size = OrgRegistration.Count();
                dates   = new string[size];
                amounts = new double[size];

                for (int a = 0; a < dates.Count(); a++)
                {
                    dates[a]   = OrgRegistration[a].Date;
                    amounts[a] = OrgRegistration[a].Amount;
                }
            }
        }
Exemple #23
0
        /// <summary>
        /// This method is called and executed when the btnPostNewsFeed button is clicked.
        /// The new news feed that is entered is stored and posted on the system.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnPostNewsFeed_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 1)
            {
                ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
                NPOManager npoManager = new NPOManager(user.userValue.UserID, user.userValue.FirstName, user.userValue.Email);
                NewsFeed   feed       = new NewsFeed();
                feed.Title1 = txtTitle.Text;
                feed.Body1  = txtBody.Text;

                NPO npo = new NPO();
                npo.ID1 = service.getNPOWithManager(npoManager.ID1);

                npoManager.Npo = npo;

                npoManager.PostNewsFeed(feed);

                lblReply.Text = npoManager.Npo.FeedAdded;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 5)
            {
                totalDons.InnerText = "R " + service.TotalDonated(user.userValue.UserID);
                ServiceReference1.EventVolunteer vol = service.getNextVolunteer(user.userValue.UserID);
                if (vol == null)
                {
                    nextEvent.InnerText = "No upcoming volunteering";
                }
                else
                {
                    nextEvent.InnerText = vol.OrnName + " on the " + vol.ShortDate;
                }

                numOfBadges.InnerText = "" + service.getNumOfBadgesEarned(user.userValue.UserID);
            }
        }
Exemple #25
0
        protected void btnVolunteer_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 5)
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();

                ServiceReference1.EventVolunteer vol = new ServiceReference1.EventVolunteer();
                string[] s;
                DateTime DateOfVolEvent;
                try
                {
                    s = lblVolDate.Text.Split('-');
                    DateOfVolEvent = new DateTime(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]), Convert.ToInt32(s[2]), 0, 0, 0);
                }
                catch (Exception ex)
                {
                    s = lblVolDate.Text.Split('/');
                    DateOfVolEvent = new DateTime(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]), Convert.ToInt32(s[2]), 0, 0, 0);
                }

                vol.VolDate = DateOfVolEvent;

                ServiceReference1.UserDetail u = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                int id = Convert.ToInt32(Request.QueryString["Org_ID"].ToString());
                vol.OrgID  = id;
                vol.UserID = u.userValue.UserID;

                bool success = serv.setVolunteer(vol);

                if (success == true)
                {
                    lblSuccessful.Text = "Congratulations! You have successfully volunteered at the NPO";
                }
                else
                {
                    lblSuccessful.ForeColor = System.Drawing.Color.Red;
                    lblSuccessful.Text      = "Sorry! You have not been able to register successfully!";
                }
            }
        }
        /// <summary>
        /// This method is called and executed when btnAddDonation is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddDonation_Click(object sender, EventArgs e)
        {
            try
            {
                if ((int)HttpContext.Current.Session["User_lvl"] == 1)
                {
                    ServiceReference1.Service1Client    service     = new ServiceReference1.Service1Client();
                    ServiceReference1.DonationRequester newDonation = new ServiceReference1.DonationRequester();
                    ServiceReference1.UserDetail        user        = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

                    newDonation.OrgID       = service.getNPOWithManager(user.userValue.UserID);
                    newDonation.Discription = txtDescription.Text;
                    double amount = double.Parse(txtAmount.Text);
                    newDonation.Amount = amount;
                    int typeInt = ddlType.SelectedIndex + 1;
                    newDonation.Type = typeInt;
                    newDonation.Date = Convert.ToDateTime(DateTime.Today);

                    bool added = service.addDonationRequest(newDonation);

                    if (added)
                    {
                        lblError.Text = "Donation request added successfully!";
                    }
                    else
                    {
                        lblError.Text = "An error occured please try again!";
                    }
                }
                else
                {
                    lblError.Text = "You have insufficient permission to do this!";
                }
            }
            catch (Exception ex)
            {
                lblError.Text = "An error occured when adding the donation. Please check the amount textbox and try again. Use a ',' for decimals!";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 1)
            {
                totalDons.InnerText = "R " + service.TotalRecievedFromDonations(service.getNPOWithManager(user.userValue.UserID));
                ServiceReference1.mobileEve eve = service.GetNextEvent((service.getNPOWithManager(user.userValue.UserID)));
                if (eve == null)
                {
                    nextEvent.InnerText = "No upcoming events";
                }
                else
                {
                    nextEvent.InnerText = eve.Name + " on the " + eve.Date;
                }

                ServiceReference1.mobileFC fc = service.GetTotalFCProgress(((service.getNPOWithManager(user.userValue.UserID))));
                FCProgress.InnerText = "R " + fc.Current + " / R" + fc.Target;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();

            ServiceReference1.Support[] Sup = null;

            ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
            string Type     = service.targetedDonations(user.userValue.UserID);
            int    numOfOrg = service.NumOfOrgByIndustry(Type);


            Sup = service.MostSupportInType(Type);

            name   = new string[numOfOrg];
            amount = new double[numOfOrg];


            for (int i = 0; i < numOfOrg; i++)
            {
                name[i]   = Sup[i].type;
                amount[i] = Sup[i].supportValue;
            }
        }
Exemple #29
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 3 || (int)HttpContext.Current.Session["User_lvl"] == 5)
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail     user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                int    userId   = user.userValue.UserID;
                int    orgID    = Convert.ToInt32(Request.QueryString["orgId"]);
                int    rate     = Convert.ToInt32(ddlRating.SelectedItem.ToString());
                String review   = txtReview.Text.ToString();
                bool   feedback = serv.SetFeedback(rate, review, userId, orgID);

                if (feedback == true)
                {
                    lblSuccess.Text = "Congratulations! You have successfully rated and reviewed the NPO!";
                }
                else
                {
                    lblSuccess.ForeColor = System.Drawing.Color.Red;
                    lblSuccess.Text      = "Sorry! You were not able to rate and review the NPO!";
                }
            }
        }
        /// <summary>
        /// This method is called and executed when the page is loaded.
        /// All donations are retrieved and displayed on the page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            NewDons.Visible = false;
            if ((int)HttpContext.Current.Session["User_lvl"] == 3 || (int)HttpContext.Current.Session["User_lvl"] == 5)
            {
                ServiceReference1.Service1Client      service   = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail          user      = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                ServiceReference1.DonationRequester[] donations = service.getAllDonationRequest(user.userValue.UserID);

                DonationsTable.InnerHtml  = "";
                DonationsTable.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr style='border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left; margin-right: 10px;'>NPO</th><th style='text-align: left; margin-right: 10px;'>Amount</th><th style='text-align: left; margin-right: 10px;'>Description</th><th style='text-align: left; margin-right: 10px;'>Donate</th></tr>";

                DonationsTableNew.InnerHtml  = "";
                DonationsTableNew.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr style='border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left; margin-right: 10px;'>NPO</th><th style='text-align: left; margin-right: 10px;'>Amount</th><th style='text-align: left; margin-right: 10px;'>Description</th><th style='text-align: left; margin-right: 10px;'>Donate</th></tr>";


                int countDons = 0;

                ArrayList availableDons = new ArrayList();

                for (int a = 0; a < donations.Count(); a++)
                {
                    ServiceReference1.Organisation org = service.getOrg(donations[a].OrgID);

                    if ((bool)org.Verified)
                    {
                        if (!donations[a].Inprogress)
                        {
                            availableDons.Add(donations[a]);
                        }
                    }
                }

                ServiceReference1.DonationRequester[] avDons = (ServiceReference1.DonationRequester[])availableDons.ToArray(typeof(ServiceReference1.DonationRequester));
                numOfDonsNew = 0;
                numOfDons    = 0;

                foreach (ServiceReference1.DonationRequester d in avDons)
                {
                    if (DashboardPage.lastOnline <= d.Donate.DonationDate)
                    {
                        numOfDonsNew++;
                    }
                    else
                    {
                        numOfDons++;
                    }
                }

                ServiceReference1.DonationRequester[] avDonsNew = new ServiceReference1.DonationRequester[numOfDonsNew];
                ServiceReference1.DonationRequester[] avDonsOld = new ServiceReference1.DonationRequester[numOfDons];

                int oldCount = 0;
                int newCount = 0;

                foreach (ServiceReference1.DonationRequester d in avDons)
                {
                    if (DashboardPage.lastOnline <= d.Donate.DonationDate)
                    {
                        avDonsNew[newCount] = d;
                        newCount++;
                    }
                    else
                    {
                        avDonsOld[oldCount] = d;
                        oldCount++;
                    }
                }

                if (numOfDonsNew > 0)
                {
                    NewDons.Visible = true;

                    for (int a = (pageCountNew - 1) * 4; a < pageCountNew * 4; a++)
                    {
                        if (a >= numOfDonsNew)
                        {
                            break;
                        }

                        if (searchStrNew.Equals(""))
                        {
                            DonationsTableNew.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + avDonsNew[a].NpoName + "</th><th style='text-align: right; padding-right: 10px;'>R " + avDonsNew[a].Donate.Amount + "</th><th style='text-align: left; margin-right: 10px;'>" + avDonsNew[a].Donate.Description + "</th><th style='text-align: left;'><a href='PaymentForm.aspx?donationID=" + avDonsOld[a].Donate.RequestIDNumber + "' class='button'>Donate now</a></th></tr>";

                            countDons++;
                        }
                        else
                        {
                            int numOfDonsAdded = 0;
                            for (int b = 0; b < numOfDons; b++)
                            {
                                if (numOfDonsAdded > 3)
                                {
                                    break;
                                }
                                if (avDons[b].Discription.Contains(searchStr))
                                {
                                    DonationsTableNew.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + avDonsNew[b].NpoName + "</th><th style='text-align: right; padding-right: 10px;'>R " + avDonsNew[b].Donate.Amount + "</th><th style='text-align: left; margin-right: 10px;'>" + avDonsNew[b].Donate.Description + "</th><th style='text-align: left;'><a href='PaymentForm.aspx?donationID=" + avDonsOld[b].Donate.RequestIDNumber + "' class='button'>Donate now</a></th></tr>";

                                    numOfDonsAdded++;
                                }
                            }

                            searchStrNew      = "";
                            txtSearchNew.Text = "";
                            break;
                        }
                    }

                    DonationsTableNew.InnerHtml += "</table>";
                }

                countDons = 0;

                for (int a = (pageCount - 1) * 4; a < pageCount * 4; a++)
                {
                    if (a >= numOfDons)
                    {
                        break;
                    }

                    if (searchStr.Equals(""))
                    {
                        DonationsTable.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + avDonsOld[a].NpoName + "</th><th style='text-align: right; padding-right: 10px;'>R " + avDonsOld[a].Donate.Amount + "</th><th style='text-align: left; margin-right: 10px;'>" + avDonsOld[a].Donate.Description + "</th><th style='text-align: left;'><a href='PaymentForm.aspx?donationID=" + avDonsOld[a].Donate.RequestIDNumber + "' class='button'>Donate now</a></th></tr>";

                        countDons++;
                    }
                    else
                    {
                        int numOfDonsAdded = 0;
                        for (int b = 0; b < numOfDons; b++)
                        {
                            if (numOfDonsAdded > 3)
                            {
                                break;
                            }
                            if (avDons[b].Discription.Contains(searchStr))
                            {
                                DonationsTable.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + avDonsOld[b].NpoName + "</th><th style='text-align: right; padding-right: 10px;'>R " + avDonsOld[b].Donate.Amount + "</th><th style='text-align: left; margin-right: 10px;'>" + avDonsOld[b].Donate.Description + "</th><th style='text-align: left;'><a href='PaymentForm.aspx?donationID=" + avDonsOld[b].Donate.RequestIDNumber + "' class='button'>Donate now</a></th></tr>";

                                numOfDonsAdded++;
                            }
                        }

                        searchStr      = "";
                        txtSearch.Text = "";
                        break;
                    }
                }

                DonationsTable.InnerHtml += "</table>";
            }
        }