Example #1
0
        public watchListForm(BusinessTier.User usr, BusinessTier.BusinessLogic b)
        {
            InitializeComponent();
           
            this.loggedUser = usr;
            this.bLogic = b;
            searchAutocomplete();

            if (bLogic.isWatchlistEmpty(loggedUser.id))
            {
                watchlistDataGridView.Rows.Clear();
                
                removeFromWatchlist.Enabled = false;
            }
            else
            {
                populateWatchListTable();
                removeFromWatchlist.Enabled = true;
                //populateGraph();
            }
            industriesComboBox.ValueMember = "Industry";
            industriesComboBox.DisplayMember = "Industry";
            industriesComboBox.DataSource = bLogic.populateIndustryDropDown();


        }
Example #2
0
 public HistoryStatementForm(BusinessTier.User usr, BusinessTier.BusinessLogic b)
 {
     InitializeComponent();
     this.loggedUser = usr;
     this.bLogic = b;
     displayHistoryStatementGrid();
 }
    /// <summary>
    /// This method verifies the user input by calling verifyGolfRegistration() (Business tier handles verification).
    /// Upon success, it adds two session variables and redirects to checkout.aspx   
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// 11/18/12 Michael Larsen
    /// Tested by Michael Larsen 11/27/12
    protected void btnCheckout_Click(object sender, EventArgs e)
    {
        try
        {
            BusinessTier bt = new BusinessTier();
            int numInParty;
            Int32.TryParse(txtNumInParty.Text, out numInParty);
            if (numInParty <= 0)
            {
                lblError.Text = "Please enter a valid number for 'Number in Party'";
                PresentationHelpers.FocusControlOnPageLoad(lblError.ClientID, this.Page);
            }
            else
            {
                Dictionary<String, String> golfRegInfo = grabGolfRegInfo();
                DataSet ds = bt.validateGolfReg(golfRegInfo);

                if (ds.Tables[0].Rows.Count > 0)
                    displayUserInputErrors(ds);
                else
                {
                    double cost = Convert.ToDouble(Session["admissionPrice"]) * Convert.ToDouble(txtNumInParty.Text);
                    golfRegInfo["cost"] = cost.ToString();
                    Session["regInfo"] = golfRegInfo;
                    Session["eventID"] = Request["eventID"].ToString();
                    Response.Redirect("Checkout.aspx", false);
                }
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx",false);
        }
    }
    /// <summary>
    /// This method executes on load and populates the Golf Details (using helper methods) and checks for errors
    /// 11/18/12 Michael Larsen
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>  
    /// Michael Larsen - 11/18/12
    /// Tested by Michael Larsen 11/27/12
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Request["eventID"] == null)
            {
                Response.Redirect("Events.aspx",false);
            }
            else
            {
                String eventID = Request["eventID"].ToString();
                BusinessTier bt = new BusinessTier();
                DataSet ds = bt.getGolfDetails(eventID);
                DataSet ds2 = bt.getMaxGolfParticipants(eventID);
                DataSet ds3 = bt.getGolfParticipants(eventID);

                int numErrors = ds.Tables[0].Rows.Count + ds2.Tables[0].Rows.Count + ds3.Tables[0].Rows.Count;

                if (numErrors > 0)
                {
                    Response.Redirect("Oops.aspx",false);
                }
                else
                {
                    populateGolfDetails(ds);
                    populateParticipantInfo(ds2, ds3);
                }
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx",false);
        }
    }
Example #5
0
        /// <summary>
        /// Sets the change tracking <c>State</c>
        /// of an <c>BusinessTier</c> to <c>EntityState.Modified</c>.
        /// This allows changes that have been made to the tracked <c>BusinessTier</c> to be
        /// committed when changes are saved to the database context.
        /// </summary>
        /// <param name="businessTier"></param>
        public async Task <BusinessTier> UpdateBusinessTier(BusinessTier businessTier)
        {
            var res = _context.BusinessTiers.Update(businessTier).Entity;
            await _context.SaveChangesAsync();

            return(res);
        }
Example #6
0
 public RecoverForm(String question, String usr, BusinessTier.BusinessLogic b)
 {
     InitializeComponent();
     this.question = question;
     this.userName = usr;
     this.bLogic = b;
     this.questionLabel.Text += " " + question.ToString();
 }
Example #7
0
        public async Task <BusinessTierDTO> Handle(CreateBusinessTierCommand message, CancellationToken cancellationToken)
        {
            var businessTier = new BusinessTier(message.Name, message.Description, message.Price);

            _repository.Add(businessTier);

            await _repository.UnitOfWork.SaveChangesAsync();

            var businessTierDTO  = _mapper.Map <BusinessTierDTO>(businessTier);
            var integrationEvent = new BusinessTierCreatedEvent(businessTierDTO);
            await _integrationEventService.AddAndSaveEventAsync(integrationEvent);

            return(businessTierDTO);
        }
Example #8
0
        // popup constructor for showing user ratings in another listbox
        // after a user double-clicks a user in the output listbox
        public Form2(Pushpin pin, BusinessTier.Business bt)
        {
            InitializeComponent();

              Location loc = pin.Location;

              double latitude = loc.Latitude;
              double longitude = loc.Longitude;

              // now get the stops at this location
              IReadOnlyList<BusinessTier.Stops> lines = bt.getAllStopsbyLocation(latitude, longitude);
              IEnumerator<BusinessTier.Stops> lineEn = lines.GetEnumerator();

              BusinessTier.Stops curLine;

              // format the content
              while (lineEn.MoveNext())
              {
            string stopMsg;
            string coordinates;
            string handicap;

            curLine = lineEn.Current;
            stopMsg = string.Format(" {0}: {1}", curLine.StopID, curLine.Name);

            // get stop info
            BusinessTier.Stops stopInfo = bt.getStopInfo(Convert.ToInt32(curLine.StopID));

            // display coordinates of stop
            coordinates = string.Format("({1},{0})", stopInfo.Longitude, stopInfo.Latitude);

            // handicap accessible ?
            if (stopInfo.ADA == 0)
            {
              handicap = "No";
            }
            else
            {
              handicap = "Yes";
            }

            this.pushPin_listBox.Items.Add(stopMsg);
            this.pushPin_listBox.Items.Add("Location: " + coordinates);
            this.pushPin_listBox.Items.Add("Handicap Accessible: " + handicap);
            this.pushPin_listBox.Items.Add("Direction: " + stopInfo.Direction);
            this.pushPin_listBox.Items.Add("Stop Detail: " + bt.getDetail(stopInfo.StopID));
            this.pushPin_listBox.Items.Add("");
              }
        }
    /// <summary>
    /// Gets the info for a particular branch
    /// AC 10/15/2012
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnBranchLookup_Click(object sender, EventArgs e)
    {
        try
        {
            BusinessTier branchBT = new BusinessTier();
            Dictionary<String, String> branchInfo = new Dictionary<string, string>();
            branchInfo.Add("branchID", txtBranchID.Text);

            // expects a dataset with two tables: error table and a results table
            DataSet branchDS = branchBT.getBranch(branchInfo);

            pnlBranch.Visible = false;
            pnlStaff.Visible = false;

            // first table in the dataset is the error table
            // the second table is the results table
            // accesses the results if the error table is empty
            if (branchDS.Tables[0].Rows.Count == 0 && branchDS.Tables[1].Rows.Count > 0)
            {
                lblBranchError.Text = "";
                lblBranchID.Text = branchDS.Tables[1].Rows[0][0].ToString();
                lblBranchStreet.Text = branchDS.Tables[1].Rows[0][1].ToString();
                lblBranchCity.Text = branchDS.Tables[1].Rows[0][2].ToString();
                lblBranchPostalCode.Text = branchDS.Tables[1].Rows[0][3].ToString();
                pnlBranch.Visible = true;
            }
            else if (branchDS.Tables[0].Rows.Count > 0)
            {
                lblBranchID.Text = "";
                lblBranchStreet.Text = "";
                lblBranchCity.Text = "";
                lblBranchPostalCode.Text = "";
                lblBranchError.Text = branchDS.Tables[0].Rows[0][0].ToString();
            }
            else
            {
                lblBranchID.Text = "";
                lblBranchStreet.Text = "";
                lblBranchCity.Text = "";
                lblBranchPostalCode.Text = "";
                lblBranchError.Text = "*Branch not found!";
            }
        }
        catch (Exception ex)
        {
            lblBranchError.Text = "A minor error occured. Please contact an Administrator.";
            BusinessTier.logError(ex, ex.Source.ToString(), ex.TargetSite.ToString());
        }
    }
Example #10
0
        public PurchaseForm(BusinessTier.User usr, BusinessTier.BusinessLogic b)
        {
            InitializeComponent();
            this.loggedUser = usr;
            this.bLogic = b;
            this.nameLabel.Text += " " + loggedUser.firstName.ToString() +" "+ loggedUser.lastName.ToString();
            this.cashTextBox.Text = loggedUser.balance.ToString();
            this.Size = new Size(851, 620);

            searchAutocomplete();
            industriesComboBox.ValueMember = "Industry";
            industriesComboBox.DisplayMember = "Industry";
            industriesComboBox.DataSource = bLogic.populateIndustryDropDown();

        }
    /// <summary>
    /// When the page loads, the transaction date and information are displayed.
    /// </summary>
    /// Creator: Olivia Johnson 11-28-12
    protected void Page_Load(object sender, EventArgs e)
    {
        //read in txn token from querystring
        String txToken = Request.QueryString.Get("tx");
        String IPNResponce = getIPN(txToken);

        //Create dictonary with Paypal info
        Dictionary<String, String> payPalInfo = getPayPalStuff(IPNResponce);

        // Parse the eventID and transactionID from the 'option' field
        // Example: eventID_transactionID (112314_31231231231)
        String customField = payPalInfo["custom"].ToString();
        eventID = customField.Substring(0, customField.LastIndexOf("_"));
        transactionID = customField.Substring(customField.IndexOf("_") + 1, customField.Length - customField.LastIndexOf("_") - 1);
        customerInfo = new Dictionary<string, string>();
        customerInfo["transactionID"] = transactionID;
        customerInfo["eventID"] = eventID;
        customerInfo["firstName"] = payPalInfo["first_name"];
        customerInfo["lastName"] = payPalInfo["last_name"];
        customerInfo["suffix"] = "";
        customerInfo["phone"] = "";
        if(Session["email"] == null)
            customerInfo["email"] = payPalInfo["payer_email"].Replace("%40", "@");
        else
            customerInfo["email"] = Session["email"].ToString();
        customerInfo["address"] = payPalInfo["address_street"];
        customerInfo["city"] = payPalInfo["address_city"];
        customerInfo["state"] = payPalInfo["address_state"];
        customerInfo["zip"] = payPalInfo["address_zip"];

        lblOrderDate.Text = DateTime.Now.ToString("MM/dd/yyyy");    //Display Date
        lblTransaction.Text = transactionID;

        BusinessTier bt = new BusinessTier();
        eventType = bt.getEventType(eventID).Tables[1].Rows[0][0].ToString();

        switch (eventType)
        {
            case "Golf": golfConfirmation();
                break;
            case "Dinner": dinnerConfirmation();
                break;
            case "Run": runConfirmation();
                break;
            case "Donation": donateConfirmation();
                break;
        }
    }
Example #12
0
 public MainForm(BusinessTier.User usr, BusinessTier.BusinessLogic b)
 {
     InitializeComponent();
     this.loggedUser = usr;
     this.bLogic = b;
     this.mainFormLoadingCircle.Visible = false;
     this.mainFormLoadingCircle.Active = true;
     this.mainFormLoadingCircle.OuterCircleRadius = 42;
     this.mainFormLoadingCircle.InnerCircleRadius = 14;
     this.mainFormLoadingCircle.SpokeThickness = 4;
     this.mainFormLoadingCircle.NumberSpoke = 14;
     // this enforces the user to see the hotkeys
     mainFormMenuStrip.Renderer = new CustomMenuStripRenderer();
     this.KeyPreview = true;
     this.KeyDown += new KeyEventHandler(Form_KeyDown);
     this.Size = new Size(1002, 783);
     populateControls(this.zedPieControl);
     this.nameLabel.Text += " " + loggedUser.firstName.ToString() + " " + loggedUser.lastName.ToString();
     this.cashTextBox.Text = loggedUser.balance.ToString(String.Format("c"));
 }
    /// <summary>
    /// Grabs all the events from the database and loads them onto the page.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// Andrew Heim - 11/26/2012
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            BusinessTier bt = new BusinessTier();
            DataSet data = bt.getAllEvents();

            foreach (DataRow row in data.Tables[1].Rows)
            {
                if (row[11].ToString() == "1")
                {
                    Controls_EventHolder eventHolder = (Controls_EventHolder)Page.LoadControl("~/Controls/EventHolder.ascx"); ;
                    eventHolder.LoadEvent(row);
                    events.Controls.Add(eventHolder);
                }
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
Example #14
0
 /// <summary>
 /// Adds a <c>BusinessTier</c> to the <c>BusinessManagementContext</c> in-memory
 /// </summary>
 /// <param name="businessTier"></param>
 /// <returns>The added <c>BusinessTier</c> entity</returns>
 public BusinessTier Add(BusinessTier businessTier)
 {
     return(_context.BusinessTiers.Add(businessTier).Entity);
 }
    /// <summary>
    /// Button event for "Save and add another runner" button
    /// Adds a Dictionary of runner info to the List<Dictionary> of runners
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// Jason Vance - 11/23/2012
    protected void btnAddAnotherRunner_Click(object sender, EventArgs e)
    {
        Dictionary<String, String> runnerInfo;
        List<Dictionary<String, String>> runners;
        BusinessTier bt = new BusinessTier();

        try
        {
            // Get the runners on the session
            runners = (List<Dictionary<String, String>>)Session["runners"];
            // If there were no runners on the session, assign a new List to the variable
            if (runners == null)
            {
                runners = new List<Dictionary<String, String>>();
            }

            // Get the runner off the form
            runnerInfo = extractRunnerInfo();

            // Validate the entered information
            DataSet ds = bt.validateRunReg(runnerInfo);
            // If there were problems let the user know
            if (ds.Tables[0].Rows.Count > 0)
            {
                showErrorMessages(ds);
                return; // Get out so the user can fix what's wrong
            }
            else { lblError.Text = ""; }

            // If we're editing an existing runner
            if (hdnEditingRunner.Value == "yes")
            {
                if (!runnerIsDuplicate(runnerInfo))
                {
                    // Replace the old runner with the new runner
                    int index = Convert.ToInt32(hdnNameId.Value);
                    runners[index] = runnerInfo;

                    // reset the hidden fields
                    hdnNameId.Value = "-1";
                    hdnEditingRunner.Value = "no";

                    // Tell the user that editing worked
                    lblFormSuccess.Text = txtFirstName.Text + " was edited";
                }
                else
                {
                    lblError.Text = "This runner is already registered";
                    return;
                }
            }
            else
            {
                if (!runnerIsDuplicate(runnerInfo))
                {
                    // Add the runner to the list of runners
                    runners.Add(runnerInfo);
                    // Tell the user that adding worked
                    lblFormSuccess.Text = txtFirstName.Text + " was added";
                }
                else
                {
                    lblError.Text = "This runner is already registered";
                    return;
                }
            }

            // Put the list of runners back on the session
            Session.Add("runners", runners);

            // Populate our on-going list of runners
            populateRunnersSoFar();

            // empty out appropriate fields for a new runner
            txtFirstName.Text = "";
            txtLastName.Text = "";
            txtNameSuffix.Text = "";
            txtPhoneAreaCode.Text = "";
            txtPhonePrefix.Text = "";
            txtPhoneSuffix.Text = "";
            txtEmail.Text = "";
            txtConfirmEmail.Text = "";
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// Retrieves the ticket price for each ticket type from the database based on the eventID
    /// </summary>
    /// <param name="type">String storing the type of ticket - adult or child</param>
    /// <returns>String storing the price for either an adult ticket or child ticket</returns>
    /// Created by: Olivia Johnson 11-18-12
    private String getTicketPrice(String type)
    {
        BusinessTier bt = new BusinessTier();

        if (eventType == "Dinner")
        {
            if (type == "child")
                return bt.getDinnerDetails(Session["eventID"].ToString()).Tables[1].Rows[0][12].ToString();
            else
                return bt.getDinnerDetails(Session["eventID"].ToString()).Tables[1].Rows[0][13].ToString();
        }
        else
        {
            if (type == "child")
                return bt.getRunDetails(Session["eventID"].ToString()).Tables[1].Rows[0][12].ToString();
            else
                return bt.getRunDetails(Session["eventID"].ToString()).Tables[1].Rows[0][13].ToString();
        }
    }
    /// <summary>
    /// gets the infor for a particular staff member
    /// AC 10/15/2012
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnStaffLookup_Click(object sender, EventArgs e)
    {
        try
        {
            BusinessTier staffBT = new BusinessTier();
            Dictionary<String, String> staffInfo = new Dictionary<string, string>();
            staffInfo.Add("staffID", txtStaffID.Text);

            // expects a dataset with two tables: error table and a results table
            DataSet staffDS = staffBT.getStaff(staffInfo);

            pnlBranch.Visible = false;
            pnlStaff.Visible = false;

            // first table in the dataset is the error table
            // the second table is the results table
            // accesses the results if the error table is empty
            if (staffDS.Tables[0].Rows.Count == 0 && staffDS.Tables[1].Rows.Count > 0)
            {
                lblStaffError.Text = "";
                lblStaffID.Text = staffDS.Tables[1].Rows[0][0].ToString();
                lblStaffFirst.Text = staffDS.Tables[1].Rows[0][1].ToString();
                lblStaffLast.Text = staffDS.Tables[1].Rows[0][2].ToString();
                lblStaffPosition.Text = staffDS.Tables[1].Rows[0][3].ToString();
                lblStaffGender.Text = staffDS.Tables[1].Rows[0][4].ToString();
                lblStaffDOB.Text = staffDS.Tables[1].Rows[0][5].ToString();
                lblStaffSalary.Text = staffDS.Tables[1].Rows[0][6].ToString();
                lblStaffBranchID.Text = staffDS.Tables[1].Rows[0][7].ToString();
                pnlStaff.Visible = true;
            }
            else if (staffDS.Tables[0].Rows.Count > 0)
            {
                lblStaffID.Text = "";
                lblStaffFirst.Text = "";
                lblStaffLast.Text = "";
                lblStaffPosition.Text = "";
                lblStaffGender.Text = "";
                lblStaffDOB.Text = "";
                lblStaffSalary.Text = "";
                lblStaffBranchID.Text = "";
                lblStaffError.Text = staffDS.Tables[0].Rows[0][0].ToString();
            }
            else
            {
                lblStaffID.Text = "";
                lblStaffFirst.Text = "";
                lblStaffLast.Text = "";
                lblStaffPosition.Text = "";
                lblStaffGender.Text = "";
                lblStaffDOB.Text = "";
                lblStaffSalary.Text = "";
                lblStaffBranchID.Text = "";
                lblStaffError.Text = "*Staff member not found!";
            }
        }
        catch (Exception ex)
        {
            lblStaffError.Text = "A minor error occured. Please contact an Administrator.";
            BusinessTier.logError(ex, ex.Source.ToString(), ex.TargetSite.ToString());
        }
    }
    /// <summary>
    /// This method validates the dinner registration information entered by the user.
    /// If problems exist the user is prompted to fix them.
    /// If the information does not produce an error the information is saved as a session variable
    /// and user is directed to the checkout page.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// Aaron Copeland - 11/19/2012
    /// Tested by Aaron Copeland - 11/28/2012
    protected void btnCheckout_Click(object sender, EventArgs e)
    {
        // verifyDinnerRegistration
        BusinessTier bt = new BusinessTier();
        Dictionary<String, String> dinnerRegInfo = new Dictionary<string, string>();

        try
        {
            // variables for the party size calculation
            int numAdults;
            int numChildren;
            int numParty;

            // attempt to parse the number of adults and number of children
            Int32.TryParse(txtNumAdults.Text, out numAdults);
            Int32.TryParse(txtNumChildren.Text, out numChildren);

            // party size was properly calculated above
            numParty = numAdults + numChildren;

            // checks if the party size is zero or if the number of adults or children is a negative number
            if (numAdults <= 0 || numAdults < 0 || numChildren < 0)
            {
                lblError.Text = "Please enter a valid number for adults and children";
                PresentationHelpers.FocusControlOnPageLoad(lblError.ClientID, this.Page);
            }
            else
            {
                // creates a dictionary with the registrants information as specified by the contract 11/28/2012 10:30am --AC
                dinnerRegInfo.Add("firstName", txtFirstName.Text);
                dinnerRegInfo.Add("lastName", txtLastName.Text);
                dinnerRegInfo.Add("suffix", txtSuffix.Text);
                dinnerRegInfo.Add("email", txtEmail.Text);
                dinnerRegInfo.Add("emailConfirm", txtConfirmEmail.Text);
                dinnerRegInfo.Add("phone", txtAreaCode.Text + txtPrefix.Text + txtLineNumber.Text);
                dinnerRegInfo.Add("numInParty", numParty.ToString());
                dinnerRegInfo.Add("numChildren", numChildren.ToString());
                dinnerRegInfo.Add("numAdults", numAdults.ToString());
                dinnerRegInfo.Add("transactionID", Guid.NewGuid().ToString());
                dinnerRegInfo.Add("cost", ((numChildren * Convert.ToDouble(lblChildPrice.Text))
                    + (numAdults * Convert.ToDouble(lblAdultPrice.Text))).ToString());
                Session["email"] = txtEmail.Text;
                // sends the dictionary to the business tier to check the fields
                DataSet ds = bt.validateDinnerReg(dinnerRegInfo);

                // gets any errors returned
                if (ds.Tables[0].Rows.Count > 0)
                {
                    String errorString = "Please fix the following items:</br>";

                    //  Iterate through errors
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        errorString += ds.Tables[0].Rows[i][1] + "<br/>";

                    lblError.Text = errorString;
                    PresentationHelpers.FocusControlOnPageLoad(lblError.ClientID, this.Page);

                }
                else
                {
                    // no errors were returned
                    Session["regInfo"] = dinnerRegInfo;     // dictionary used as a session variable
                    Session["eventID"] = Request["eventID"].ToString();
                    Response.Redirect("Checkout.aspx", false);
                }
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// Confirms the transaction in the database and displays the transaction info
    /// </summary>
    /// Creator: Olivia Johnson 11-28-12
    private void runConfirmation()
    {
        BusinessTier bt = new BusinessTier();
        DataSet ds = new DataSet();
        Decimal totalCost = 0;
        int numOfRunners = 0;
        Decimal childCost = 0;
        Decimal adultCost = 0;
        int numOfAdults = 0;
        int numOfChildren = 0;
        string childPrice = bt.getRunDetails(Session["eventID"].ToString()).Tables[1].Rows[0][12].ToString();

        try
        {
            ds = bt.confirmRunPayment(customerInfo);

            foreach (DataRow dr in ds.Tables[1].Rows)
            {
                totalCost += Convert.ToDecimal(dr[12].ToString());
                numOfRunners++;
                if (dr["cost"] == childPrice)  //if participant is older than 12, count them as an adult.
                    numOfChildren++;
                else
                    numOfAdults++;    //If participant is younger than 12, count them as a child

                if (dr[7].ToString() != "") //if there is a confirm email
                    sendConfirmationEmail("5k Run Event", dr[1].ToString(), dr[7].ToString());
            }

            lblticketType1.Text = "5k Child Ticket x" + numOfChildren;
            lblprice1.Text = (childCost * numOfChildren).ToString("C");
            lblticketType2.Text = "5k Adult Ticket x" + numOfAdults;
            lblprice2.Text = (adultCost * numOfAdults).ToString("C");
            lbltotalCost.Text = totalCost.ToString("C");

            foreach (DataRow dr in ds.Tables[1].Rows)
            {
                if (dr[7].ToString() != "") //if there is a confirm email
                    sendConfirmationEmail("5k Run Event", dr[1].ToString(), dr[7].ToString());
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// On page load, two functions are called - getEventType and Display???ReistrantDetails
    ///The Display function fills in the checkout table to display the total cost.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// Created by: OJ 11-18-12
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //Used to bring the user back to the previous screen with the info filled out -Andrew Heim 11/30/12
            if (!IsPostBack)
            {
                PostBackCount = 1;
                Session["PostBackCount"] = PostBackCount;
            }
            else
            {
                PostBackCount = ((int)Session["PostBackCount"]);
                Session["PostBackCount"] = ++PostBackCount;
            }

            BusinessTier bt = new BusinessTier();

            String eventID = Session["eventID"].ToString();

            DataSet ds = bt.getEventType(eventID);

            eventType = ds.Tables[1].Rows[0][0].ToString();

            btnPayPal.Enabled = chkLiabilityStatus();   //enables or disables the continue to paypal button based on the liabilty checkbox

            if (eventType != "Run")
                regInfo = (Dictionary<String, String>)Session["regInfo"];       //if not a 5k, session variable is a dictionary object
            else
                runnerList = (List<Dictionary<String, string>>)Session["regInfo"];  //if a 5k, session variable is a list of dictionary objects

            lblEventType.Text = eventType + " Event";

            switch (eventType)
            {
                case "Golf": displayGolfRegistrantDetails();
                    break;
                case "Dinner": displayDinnerRegistrantDetails();
                    break;
                case "Run": displayRunRegistrantDetails();
                    break;
                case "Donation": displayDonationDetails();
                    break;
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// Confirms the transaction in the database and displays the transaction info
    /// </summary>
    /// Creator: Olivia Johnson 11-28-12
    private void donateConfirmation()
    {
        BusinessTier bt = new BusinessTier();
        DataSet ds = new DataSet();
        Decimal donationAmount = 0;

        try
        {
            ds = bt.confirmDonation(customerInfo);
            donationAmount = decimal.Parse(ds.Tables[1].Rows[0][10].ToString());
            lblticketType1.Text = " Donation";
            lblprice1.Text = donationAmount.ToString("C");
            lbltotalCost.Text = donationAmount.ToString("C");

            donationAmount = Convert.ToDecimal(ds.Tables[1].Rows[0][9].ToString());

            sendConfirmationEmail("Donation", ds.Tables[1].Rows[0][0].ToString(), ds.Tables[1].Rows[0][5].ToString());
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// Confirms the transaction in the database and displays the transaction info
    /// </summary>
    /// Creator: Olivia Johnson 11-28-12
    private void dinnerConfirmation()
    {
        BusinessTier bt = new BusinessTier();
        DataSet ds = new DataSet();
        Decimal childCost = 0;
        Decimal adultCost = 0;
        int numOfAdults = 0;
        int numOfChildren = 0;

        try
        {
            ds = bt.confirmDinnerPayment(customerInfo);

            numOfChildren = Convert.ToInt16(ds.Tables[1].Rows[0][5].ToString());
            numOfAdults = Convert.ToInt16(ds.Tables[1].Rows[0][6].ToString());
            childCost = Convert.ToDecimal(bt.getDinnerDetails(eventID).Tables[1].Rows[0][12].ToString());
            adultCost = Convert.ToDecimal(bt.getDinnerDetails(eventID).Tables[1].Rows[0][13].ToString());

            lblticketType1.Text = "Child Dinner Ticket x" + numOfChildren;
            lblprice1.Text = (numOfChildren * childCost).ToString("C");
            lblticketType2.Text = "Adult Dinner Ticket x" + numOfAdults;
            lblprice2.Text = (numOfAdults * adultCost).ToString("C");
            lbltotalCost.Text = ((numOfAdults * adultCost) + (numOfChildren * childCost)).ToString("C");

            sendConfirmationEmail("Dinner Event", ds.Tables[1].Rows[0][0].ToString(), ds.Tables[1].Rows[0][3].ToString());
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
 private string getEventType(string eventID)
 {
     try
     {
         BusinessTier bt = new BusinessTier();
         DataSet ds = bt.getEventType(eventID);
         string eventType = ds.Tables[1].Rows[0][0].ToString();
         return eventType;
      }
     catch (Exception ex)
     {
         ErrorLog.logError(ex);
         Response.Redirect("Oops.aspx");
         return "";
     }
 }
 /// <summary>
 /// Inserts the Run details and stores transaction id and cost into the session for paypal to use.
 /// </summary>
 /// Created by: Andrew Heim 11-29-12
 private void insertRunRegistrantDetails()
 {
     BusinessTier bt = new BusinessTier();
     List<Dictionary<string,string>> runRegInfo = (List<Dictionary<string, string>>)Session["regInfo"];
     DataSet ds = bt.registerRunGroup(runRegInfo);
     Session["transactionID"] = ds.Tables[1].Rows[0][0];
     double cost = 0;
     foreach(Dictionary<string,string> row in runRegInfo)
     {
         cost += double.Parse(row["cost"]);
     }
     Session["cost"] = cost;
 }
 /// <summary>
 /// Inserts the Golf details and stores transaction id and cost into the session for paypal to use.
 /// </summary>
 /// Created by: Andrew Heim 11-29-12
 private void insertGolfRegistrantDetails()
 {
     BusinessTier bt = new BusinessTier();
     DataSet ds = bt.insertGolfRegistration((Dictionary<string, string>)Session["regInfo"]);
     Session["transactionID"] = ds.Tables[1].Rows[0][0];
     Session["cost"] = ((Dictionary<string, string>)Session["regInfo"])["cost"];
     Session["eventType"] = "Golf";
 }
Example #26
0
 /// <summary>
 /// Sets the change tracking <c>State</c>
 /// of a <c>BusinessTier</c> to <c>EntityState.Modified</c>.
 /// This allows changes that have been made to the tracked <c>BusinessTier</c> to be
 /// committed when changes are saved to the database context.
 /// </summary>
 /// <param name="businessTier"></param>
 public void Update(BusinessTier businessTier)
 {
     _context.Entry(businessTier).State = EntityState.Modified;
 }
    /// <summary>
    /// Button event for "Proceed to checkout" button
    /// Adds the current runner to the list of runners in the session, then registers them
    /// If all goes well, redirects to checkout. Otherwise, informs the user
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// Jason Vance - 11/23/2012
    protected void btnProceedToCheckout_Click(object sender, EventArgs e)
    {
        Dictionary<String, String> runnerInfo;
        List<Dictionary<String, String>> runners;
        BusinessTier bt = new BusinessTier();
        DataSet result;

        try
        {
            // Get the runners on the session
            runners = (List<Dictionary<String, String>>)Session["runners"];
            // If there were no runners on the session, assign a new List to the variable
            if (runners == null)
            {
                runners = new List<Dictionary<String, String>>();
            }

            // Get the runner info from the form
            runnerInfo = extractRunnerInfo();

            Session["eventID"] = hdnEventId.Value;

            // Validate the entered information
            DataSet ds = bt.validateRunReg(runnerInfo);
            // If there were problems let the user know
            if (ds.Tables[0].Rows.Count > 0)
            {
                showErrorMessages(ds);
                PresentationHelpers.FocusControlOnPageLoad(lblError.ClientID, this.Page);
                return; // Get out so the user can fix what's wrong
            }
            else { lblError.Text = ""; }

            // If we're editing an existing runner
            if (hdnEditingRunner.Value == "yes")
            {
                if (!runnerIsDuplicate(runnerInfo))
                {
                    // Replace the old runner with the new runner
                    int index = Convert.ToInt32(hdnNameId.Value);
                    runners[index] = runnerInfo;

                    // reset the hidden fields
                    hdnNameId.Value = "-1";
                    hdnEditingRunner.Value = "no";

                    // Tell the user that editing worked
                    lblFormSuccess.Text = txtFirstName.Text + " was edited";
                }
                else
                {
                    lblError.Text = "This runner is already registered";
                    PresentationHelpers.FocusControlOnPageLoad(lblError.ClientID, this.Page);
                    return;
                }
            }
            else
            {
                if (!runnerIsDuplicate(runnerInfo))
                {
                    // Add the runner to the list of runners
                    runners.Add(runnerInfo);
                    // Tell the user that adding worked
                    lblFormSuccess.Text = txtFirstName.Text + " was added";
                }
                else
                {
                    lblError.Text = "This runner is already registered";
                    PresentationHelpers.FocusControlOnPageLoad(lblError.ClientID, this.Page);
                    return;
                }
            }

            // Register the runners
            result = bt.registerRunGroup(runners);

            // If there were problems let the user know
            if (result.Tables[0].Rows.Count > 0)
            {
                showErrorMessages(result);

                // Empty out all fields to avoid registering a runner twice
                emptyFormFields();
                // Let the user know that the runner was added to the list
                populateRunnersSoFar();
            }
            else
            {
                lblError.Text = "";
                // There weren't any problems registering, so send the user to checkout
                Session.Add("regInfo", runners);
                Response.Redirect("Checkout.aspx",false);
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// Populates the run page details if a valid eventID is part of the query string
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// Jason Vance - 11/19/2012
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            // Clear out the result labels if they need to be
            lblError.Text = "";
            lblFormSuccess.Text = "";

            // Get the event id
            String eventId = Request.QueryString["eventID"];
            BusinessTier bt = new BusinessTier();
            DataSet ds = null;

            // If the event id is good, then fill in the page information
            if (eventId != null)
            {
                ds = bt.getRunDetails(eventId);
                populateRunDetails(ds);

                ds = bt.getRunParticipants(eventId);
                populatePartcipantsBox(ds);

                // Populate our on-going list of runners
                populateRunnersSoFar();
            }
            else
            {
                Response.Redirect("Oops.aspx");
            }

            // Keep the postbask url of the add runner button consistent, needed because buttons to edit runners change the url
            btnAddAnotherRunner.PostBackUrl = "RunRegistration.aspx?eventID=" + Request.QueryString["eventID"];
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// This method runs as the page is loaded. The event information that is displayed is based on the 
    /// query string "eventID".
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// Aaron Copeland - 11/19/2012
    /// Tested by Aaron Copeland - 11/28/2012
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Request["eventID"] == null)  // Go to events main page
            {
                Response.Redirect("Events.aspx", false);
            }
            else
            {

                String eventID = Request.QueryString["eventID"];
                BusinessTier bt = new BusinessTier();

                // get the details for the Dinner Event
                DataSet ds = bt.getDinnerDetails(eventID);

                // Calculates The Participants
                DataSet ds2 = bt.getMaxDinnerParticipants(eventID);
                DataSet ds3 = bt.getDinnerParticipants(eventID);

                // Prints out any errors
                String errorString = "";

                checkDSErrorTable(ds, errorString);
                checkDSErrorTable(ds2, errorString);
                checkDSErrorTable(ds3, errorString);

                lblError.Text = errorString;

                // populate the information on the page
                populateDinnerDetails(ds);

                // calculates the number of participants
                calculateParticipants(ds2, ds3);

                GoogleMap.LoadAddress(ds.Tables[1].Rows[0][15].ToString() + " " + ds.Tables[1].Rows[0][16].ToString() + " " + ds.Tables[1].Rows[0][17].ToString() + " " + ds.Tables[1].Rows[0][18].ToString());
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// This method validates the donation information entered by the user.
    /// If problems exist the user is prompted to fix them.
    /// If the information does not produce an error the information is saved as a session variable
    /// and user is directed to the checkout page.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// Aaron Copeland - 11/27/2012
    /// Tested by Aaron Copeland - 11/28/2012
    protected void btnCheckout_Click(object sender, EventArgs e)
    {
        BusinessTier bt = new BusinessTier();
        Dictionary<String, String> donationInfo = new Dictionary<string, string>();

        try
        {
            // check if they are anonymous
            string isAnonymousPerson = "no";
            if(chkAnonymous.Checked)
                isAnonymousPerson = "yes";

            // try to parse the dontaion amount
            double cashValue = 0;
            Double.TryParse(txtCashValue.Text, out cashValue);

            if (cashValue <= 0)
                lblError.Text = "Please enter a valid donation amount.";
            else
            {
                donationInfo.Add("anonymousPerson", isAnonymousPerson);
                donationInfo.Add("firstName", txtFirstName.Text);
                donationInfo.Add("lastName", txtLastName.Text);
                donationInfo.Add("suffix", txtSuffix.Text);
                donationInfo.Add("phone", txtAreaCode.Text + txtPrefix.Text + txtLineNumber.Text);
                donationInfo.Add("email", txtEmail.Text);
                donationInfo.Add("emailConfirm", txtConfirmEmail.Text);
                donationInfo.Add("cashValue", cashValue.ToString());
                donationInfo.Add("address", "123 Temp");
                donationInfo.Add("city", "Ogden");
                donationInfo.Add("state", "UT");
                donationInfo.Add("zip", "84414");
                donationInfo.Add("recipientID", hdnReciepantsID.Value.ToString());
                // sends the dictionary to the business tier to check the fields
                DataSet ds = bt.validateDonationInfo(donationInfo);
                Session["email"] = txtEmail.Text;
                // gets any errors returned
                if (ds.Tables[0].Rows.Count > 0)
                {
                    String errorString = "Please fix the following items:</br>";

                    //  Iterate through errors
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        errorString += ds.Tables[0].Rows[i][1] + "<br/>";

                    lblError.Text = errorString;
                    PresentationHelpers.FocusControlOnPageLoad(lblError.ClientID, this.Page);
                }
                else
                {
                    // no errors were returned
                    Session["regInfo"] = donationInfo;     // dictionary used as a session variable
                    Session["eventID"] = Request["eventID"].ToString();
                    Response.Redirect("Checkout.aspx", false);
                }
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
Example #31
0
 public ChangePassword(string usr, BusinessTier.BusinessLogic b)
 {
     InitializeComponent();
     this.userName = usr;
     this.bLogic = b;
 }
    /// <summary>
    /// This method runs as the page is loaded. The donation information that is displayed is based on the 
    /// query string "eventID".
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// Aaron Copeland - 11/27/2012
    /// Tested by Aaron Copeland - 11/28/2012
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Request["eventID"] == null)  // Go to events main page
            {
                Response.Redirect("Events.aspx", false);
            }
            else
            {
                String eventID = Request.QueryString["eventID"];
                BusinessTier bt = new BusinessTier();

                // get the details for the Donation Event
                DataSet ds = bt.getDonationDetails(eventID);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    String errorString = "Please fix the following items:</br>";

                    //  Iterate through errors
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        errorString += ds.Tables[0].Rows[i][1] + "<br/>";

                    lblError.Text = errorString;
                    PresentationHelpers.FocusControlOnPageLoad(lblError.ClientID, this.Page);
                }

                // populate the page with the recipients info
                recipientImage.Attributes.Add("src", ds.Tables[1].Rows[0][6].ToString());
                lblEventTitle.Text = ds.Tables[1].Rows[0][2].ToString();
                lblEventDescription.Text = ds.Tables[1].Rows[0][3].ToString();
                lblEventDetails.Text = ds.Tables[1].Rows[0][4].ToString();
                hdnReciepantsID.Value = ds.Tables[1].Rows[0][1].ToString();
            }
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// Confirms the transaction in the database and displays the transaction info
    /// </summary>
    /// Creator: Olivia Johnson 11-28-12
    private void golfConfirmation()
    {
        BusinessTier bt = new BusinessTier();
        DataSet ds = new DataSet();
        Decimal cost = 0;
        Decimal numOfGolfers = 0;

        try
        {
            ds = bt.confirmGolfPayment(customerInfo);

            lblticketType1.Text = "Golf Event Ticket x" + ds.Tables[1].Rows[0][5].ToString();
            lblprice1.Text = cost.ToString("C");
            lbltotalCost.Text = (cost * numOfGolfers).ToString("C");

            cost = Convert.ToDecimal(ds.Tables[1].Rows[0][7].ToString());
            numOfGolfers = Convert.ToDecimal(ds.Tables[1].Rows[0][5].ToString());

            sendConfirmationEmail("Golf Event", ds.Tables[1].Rows[0][0].ToString(), ds.Tables[1].Rows[0][3].ToString());

        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }
    /// <summary>
    /// Traverses the List of regInfo Dictionary objects and counts the number of adults and children. Then DisplayRunOrDinner is called to 
    /// fill in the dinner checkout table
    /// </summary>
    /// Created by: Olivia Johnson 11-18-12
    private void displayRunRegistrantDetails()
    {
        try
        {
            BusinessTier bt = new BusinessTier();
            List<Dictionary<String, String>> regInfoList = (List<Dictionary<String, String>>)Session["regInfo"];

            int numOfChildren = 0, numOfAdults = 0;
            string childPrice = bt.getRunDetails(Session["eventID"].ToString()).Tables[1].Rows[0][12].ToString();
            foreach (Dictionary<String, String> registeredRunner in regInfoList)
            {
                if (registeredRunner["cost"] == childPrice)  //if participant is older than 12, count them as an adult.
                    numOfChildren++;
                else
                    numOfAdults++;    //If participant is younger than 12, count them as a child
            }

            displayRunOrDinner(numOfChildren, numOfAdults);
        }
        catch (Exception ex)
        {
            ErrorLog.logError(ex);
            Response.Redirect("Oops.aspx");
        }
    }