Esempio n. 1
0
    public void UpdateProfile()
    {
        ProfileCommon profile =
            HttpContext.Current.Profile as ProfileCommon;

        profile.Address1       = address1;
        profile.Address2       = address2;
        profile.City           = city;
        profile.Region         = region;
        profile.PostalCode     = postalCode;
        profile.Country        = country;
        profile.ShippingRegion = shippingRegion;
        profile.DayPhone       = dayPhone;
        profile.EvePhone       = evePhone;
        profile.MobPhone       = mobPhone;
        profile.CreditCard     = creditCard;
        MembershipUser user = Membership.GetUser(profile.UserName);

        user.Email = email;
        Membership.UpdateUser(user); try
        {
            SecureCard secureCard = new SecureCard(
                creditCardHolder, creditCardNumber,
                creditCardIssueDate, creditCardExpiryDate,
                creditCardIssueNumber, creditCardType);
            profile.CreditCard = secureCard.EncryptedData;
        }
        catch
        {
            creditCard = "";
        }
    }
Esempio n. 2
0
    public ProfileWrapper()
    {
        ProfileCommon profile =
            HttpContext.Current.Profile as ProfileCommon;

        Address1       = profile.Address1;
        Address2       = profile.Address2;
        City           = profile.City;
        Region         = profile.Region;
        PostalCode     = profile.PostalCode;
        Country        = profile.Country;
        ShippingRegion = (profile.ShippingRegion == null || profile.ShippingRegion == "" ? "1" : profile.ShippingRegion);
        DayPhone       = profile.DayPhone;
        EvePhone       = profile.EvePhone;
        MobPhone       = profile.MobPhone;
        Email          = Membership.GetUser(profile.UserName).Email;
        try
        {
            SecureCard secureCard = new SecureCard(profile.CreditCard);
            CreditCard            = secureCard.CardNumberX;
            CreditCardHolder      = secureCard.CardHolder;
            CreditCardNumber      = secureCard.CardNumber;
            CreditCardIssueDate   = secureCard.IssueDate;
            CreditCardIssueNumber = secureCard.IssueNumber;
            CreditCardExpiryDate  = secureCard.ExpiryDate;
            CreditCardType        = secureCard.CardType;
        }
        catch
        {
            CreditCard = "Not entered.";
        }
    }
    public CommerceLibOrderInfo(DataRow orderRow)
    {
        Shipping = new ShippingInfo();
        Tax      = new TaxInfo();

        OrderID     = Int32.Parse(orderRow["OrderID"].ToString());
        DateCreated = orderRow["DateCreated"].ToString();
        DateShipped = orderRow["DateShipped"].ToString();
        Comments    = orderRow["Comments"].ToString();
        Status      = Int32.Parse(orderRow["Status"].ToString());
        AuthCode    = orderRow["AuthCode"].ToString();
        Reference   = orderRow["Reference"].ToString();
        Customer    = Membership.GetUser(
            new Guid(orderRow["CustomerID"].ToString()));
        CustomerProfile =
            (HttpContext.Current.Profile as ProfileCommon)
            .GetProfile(Customer.UserName);
        CreditCard   = new SecureCard(CustomerProfile.CreditCard);
        OrderDetails =
            CommerceLibAccess.GetOrderDetails(
                orderRow["OrderID"].ToString());
        // Get Shipping Data
        if (orderRow["ShippingID"] != DBNull.Value &&
            orderRow["ShippingType"] != DBNull.Value &&
            orderRow["ShippingCost"] != DBNull.Value)
        {
            Shipping.ShippingID =
                Int32.Parse(orderRow["ShippingID"].ToString());
            Shipping.ShippingType = orderRow["ShippingType"].ToString();
            Shipping.ShippingCost =
                double.Parse(orderRow["ShippingCost"].ToString());
        }
        else
        {
            Shipping.ShippingID = -1;
        }
        // Get Tax Data
        if (orderRow["TaxID"] != DBNull.Value &&
            orderRow["TaxType"] != DBNull.Value &&
            orderRow["TaxPercentage"] != DBNull.Value)
        {
            Tax.TaxID         = Int32.Parse(orderRow["TaxID"].ToString());
            Tax.TaxType       = orderRow["TaxType"].ToString();
            Tax.TaxPercentage =
                double.Parse(orderRow["TaxPercentage"].ToString());
        }
        else
        {
            Tax.TaxID = -1;
        }
        // set info properties
        Refresh();
    }
    protected void processButton_Click(object sender, EventArgs e)
    {
        SecureCard encryptedCard =
            new SecureCard(cardHolderBox.Text, cardNumberBox.Text,
                           issueDateBox.Text, expiryDateBox.Text, issueNumberBox.Text,
                           cardTypeBox.Text);
        string     encryptedData = encryptedCard.EncryptedData;
        SecureCard decryptedCard = new SecureCard(encryptedData);
        string     decryptedData = string.Format(
            "{0}, {1}, {2}, {3}, {4}, {5}",
            decryptedCard.CardHolder, decryptedCard.CardNumber,
            decryptedCard.IssueDate, decryptedCard.ExpiryDate,
            decryptedCard.IssueNumber, decryptedCard.CardType);
        StringBuilder sb = new StringBuilder();

        sb.Append("Encrypted data:<br />");
        sb.Append("<textarea style=\"width:400px;height:150px;\">");
        sb.Append(encryptedData);
        sb.Append("</textarea><br />Decrypted data:");
        sb.Append(decryptedData);
        result.Text = sb.ToString();
    }