private void addItemToList(int contactId, List <CartItem> itmArr, int catId, int cost)
    {
        EventSignUp sup = new EventSignUp();

        sup.EventCategoryTypeID = catId;
        sup.ContactID           = contactId;
        sup.EventID             = eventID;
        int rez = sup.addEventSignUp();

        CartItem itm = new CartItem();

        itm.itemCost      = cost;
        itm.EventSignUpID = rez;
        itm.StrSessionID  = Session.SessionID;
        itmArr.Add(itm);
    }
    private void addLine(int contactId, List <CartItem> items, int itemCount, int eventCategoryId)
    {
        int cost = getCost(itemCount);

        EventSignUp sup = new EventSignUp();

        sup.EventCategoryTypeID = eventCategoryId;
        sup.ContactID           = contactId;
        sup.EventID             = eventID;

        int rez = sup.addEventSignUp();

        CartItem itm = new CartItem();

        itm.itemCost      = cost;
        itm.EventSignUpID = rez;
        itm.StrSessionID  = Session.SessionID;
        items.Add(itm);
    }
    private void processButton()
    {
        setGlobals();
        bool redirectError = false;

        try
        {
            String xcxcx = Session.SessionID;

            int contactID = addContact();
            int coachID   = addCoach(contactID);

            List <CartItem> itmArr = new List <CartItem>();

            CartItem    itm;
            EventSignUp sup;

            try
            {
                sup                     = new EventSignUp();
                sup.ContactID           = contactID;
                sup.EventID             = eventID;
                sup.EventCategoryTypeID = 26;

                int rez = sup.addEventSignUp();

                itm               = new CartItem();
                itm.itemCost      = (dtToday > dtApril4) ? 25 : 20;
                itm.EventSignUpID = rez;
                itm.StrSessionID  = Session.SessionID;
                itmArr.Add(itm);

                addShirt(contactID, itmArr);
                addTickets(contactID, itmArr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sup = null;
                itm = null;
            }

            try
            {
                // instructor
                Session.Add("schoolName", txtSchool.Value);
                Session.Add("instructorName", txtInstrName.Value);
                Session.Add("instructorEmail", txtInstrEmail.Value);
                Session.Add("instructorPhone", txtInstrWebsite.Value);

                //contact
                Session.Add("address", txtAddress.Value);
                Session.Add("city", txtCity.Value);
                Session.Add("state", ddlStates.Value);
                Session.Add("postal", postal.Value);
                Session.Add("email", txtEmail.Value);
                Session.Add("phone", txtPhone.Value);
            }
            catch
            {
                // swallow these because we don't care if they fail
            }

            // Add items to shopping cart
            int rezCart = 0;
            foreach (CartItem i in itmArr)
            {
                rezCart = i.addCartItem();
            }

            try
            {
                Response.Redirect(@"~/Cart2.aspx?s=" + Session.SessionID, false);
            }
            catch (ThreadAbortException taex)
            {
                // don't worry about it
                redirectError = true;
            }
        }
        catch (Exception ex)
        {
            if (redirectError != true) //don't ignore this error
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Cookie[MySessionID].Value: " + Request.Cookies["MySessionID"].Value);
                sb.AppendLine("Session Values");
                for (int i = 0; i < Session.Contents.Count; i++)
                {
                    var key   = Session.Keys[i];
                    var value = Session[i];
                    sb.AppendLine("Key: " + key + "  -  Value: " + value);
                }
                sb.AppendLine("Stack Trace: " + ex.StackTrace);
                ErrorLogger.LogError(ex.Message, sb.ToString(), "Coach.processButton");
                throw ex;
            }
        }
    }
Beispiel #4
0
    private void processButton()
    {
        bool redirectError = false;

        try
        {
            int eventID = int.Parse(System.Configuration.ConfigurationManager.AppSettings["eventDatabaseID"]);


            eventID = 12; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!##################################  Warning, do not use this after 205  ################################!!!!!!!!!!!!!!!!!!!!!!!!


            String xcxcx = Session.SessionID;


            CartItem    itm;
            EventSignUp sup;

            try
            {
                sup                     = new EventSignUp();
                sup.ContactID           = 444;
                sup.EventID             = eventID;
                sup.EventCategoryTypeID = 36;

                int rez = sup.addEventSignUp();

                itm               = new CartItem();
                itm.itemCost      = int.Parse(Session["price"].ToString());
                itm.EventSignUpID = rez;
                itm.StrSessionID  = Session.SessionID;
                itm.addCartItem();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                //clean up
                sup = null;
                itm = null;
            }

            try
            {
                Session.Add("MySessionID", Session.SessionID);
                Response.Cookies["MySessionID"].Value   = Session.SessionID;
                Response.Cookies["MySessionID"].Expires = DateTime.Now.AddDays(1);
                Response.Redirect(@"~/Cart2.aspx?s=" + Session.SessionID, false);
            }
            catch (Exception ex)
            {
                // don't worry about it
                redirectError = true;
                String ewerwer = ex.Message;
            }
        }
        catch (Exception ex)
        {
            if (redirectError != true) //ignore this error
            {
                throw ex;
            }
        }
    }