Ejemplo n.º 1
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.";
        }
    }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 public CommerceLibOrderInfo(DataRow orderRow)
 {
     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();
 }
Ejemplo n.º 4
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 = "";
     }
 }