Exemplo n.º 1
0
 public int Insert(BillingAddress billingAddress)
 {
     try
     {
         string query = "insert into BillingAddress(Phone,DistrictID,DistrictName," +
                        " ProvinceID,ProvinceName, CountryID, CountryName,CustomerName,HomeAddress) " +
                        " values (@Phone,@DistrictID,@DistrictName," +
                        " @ProvinceID,@ProvinceName,@CountryID,@CountryName,@CustomerName,@HomeAddress)" +
                        " SELECT @@IDENTITY";
         int billingAddressID = connect.Query <int>(query, new
         {
             billingAddress.Phone,
             billingAddress.DistrictID,
             billingAddress.DistrictName,
             billingAddress.ProvinceID,
             billingAddress.ProvinceName,
             billingAddress.CountryID,
             billingAddress.CountryName,
             billingAddress.CustomerName,
             billingAddress.HomeAddress
         }).Single();
         return(billingAddressID);
     }
     catch (Exception ex)
     {
         LogService.WriteException(ex);
         return(0);
     }
 }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            int hashCode =
                IdVer.GetHashCode() +
                IdSubVer.GetHashCode() +
                Timestamp.GetHashCode() +
                (IdCustomer == null ? 0 : IdCustomer.GetHashCode()) +
                (CustomerName == null ? 0 : CustomerName.GetHashCode()) +
                Active.GetHashCode() +
                (VATNum == null ? 0 : VATNum.GetHashCode()) +
                (ShippingAddress == null ? 0 : ShippingAddress.GetHashCode()) +
                (ShippingAddressZh == null ? 0 : ShippingAddressZh.GetHashCode()) +
                (BillingAddress == null ? 0 : BillingAddress.GetHashCode()) +
                (BillingAddressZh == null ? 0 : BillingAddressZh.GetHashCode()) +
                (ContactName == null ? 0 : ContactName.GetHashCode()) +
                (ContactNameZh == null ? 0 : ContactNameZh.GetHashCode()) +
                (ContactPhone == null ? 0 : ContactPhone.GetHashCode()) +
                (Comments == null ? 0 : Comments.GetHashCode()) +
                (IdIncoterm == null ? 0 : IdIncoterm.GetHashCode()) +
                (IdPaymentTerms == null ? 0 : IdPaymentTerms.GetHashCode()) +
                (IdDefaultCurrency == null ? 0 : IdDefaultCurrency.GetHashCode()) +
                (User == null ? 0 : User.GetHashCode());

            return(hashCode);
        }
 public async Task <List <BillingAddress> > SaveBillingAddress(BillingAddress obj)
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@BillingAddressId", obj.BillingAddressId);
         parameters.Add("@UserID", obj.UserID);
         parameters.Add("@FName", obj.FName);
         parameters.Add("@LName", obj.LName);
         parameters.Add("@CompanyName", obj.CompanyName);
         parameters.Add("@Address", obj.Address);
         parameters.Add("@City", obj.City);
         parameters.Add("@State", obj.State);
         parameters.Add("@ZipCode", obj.ZipCode);
         parameters.Add("@EmailId", obj.EmailId);
         parameters.Add("@Phone", obj.Phone);
         parameters.Add("@Country", obj.Country);
         parameters.Add("@CreatedDate", obj.CreatedDate);
         List <BillingAddress> lst = (await SqlMapper.QueryAsync <BillingAddress>(con, "p_BillingAddress_Save", param: parameters, commandType: StoredProcedure)).ToList();
         return(lst);
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Exemplo n.º 4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is ChargeRequest other &&
                   ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((CardNonce == null && other.CardNonce == null) || (CardNonce?.Equals(other.CardNonce) == true)) &&
                   ((CustomerCardId == null && other.CustomerCardId == null) || (CustomerCardId?.Equals(other.CustomerCardId) == true)) &&
                   ((DelayCapture == null && other.DelayCapture == null) || (DelayCapture?.Equals(other.DelayCapture) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((BillingAddress == null && other.BillingAddress == null) || (BillingAddress?.Equals(other.BillingAddress) == true)) &&
                   ((ShippingAddress == null && other.ShippingAddress == null) || (ShippingAddress?.Equals(other.ShippingAddress) == true)) &&
                   ((BuyerEmailAddress == null && other.BuyerEmailAddress == null) || (BuyerEmailAddress?.Equals(other.BuyerEmailAddress) == true)) &&
                   ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) &&
                   ((AdditionalRecipients == null && other.AdditionalRecipients == null) || (AdditionalRecipients?.Equals(other.AdditionalRecipients) == true)) &&
                   ((VerificationToken == null && other.VerificationToken == null) || (VerificationToken?.Equals(other.VerificationToken) == true)));
        }
Exemplo n.º 5
0
        public ActionResult ConfirmOrder(BillingAddress objBillingAddress)
        {
            objBillingAddressBO.InsertBillingAddress(objBillingAddress);
            int        addressId  = objBillingAddress.PKAddressId;
            HttpCookie CartCookie = Request.Cookies[Helper.UserName];

            foreach (var items in CartCookie.Values)
            {
                string cookieValue = CartCookie[items.ToString()].ToString();
                var    product     = objProductBO.GetProduct(Convert.ToInt32(items));
                objOrder.FKProductId        = product.PKProductId;
                objOrder.FKBillingAddressId = addressId;
                objOrder.Status             = "Processing";
                objOrder.CustomerComment    = cookieValue.Split('^')[2];
                objOrderBO.InsertOrder(objOrder);
                objOrderDetail.FKProductId = product.PKProductId;
                objOrderDetail.FKOrderId   = objOrder.PKOrderId;
                objOrderDetail.Cost        = Convert.ToDecimal(cookieValue.Split('^')[1]);
                objOrderDetail.Quantity    = Convert.ToInt32(cookieValue.Split('^')[0]);
                objOrderDetailBO.InsertOrderDetail(objOrderDetail);
                objOrderHistory.FKOrderId = objOrder.PKOrderId;
                objOrderHistory.Status    = objOrder.Status;
                objOrderHistoryBO.InsertOrderHistory(objOrderHistory);
            }
            CartCookie.Expires = DateTime.Now.AddDays(-1);
            Response.Cookies.Add(CartCookie);
            return(RedirectToAction("GetOrderDetails", "MyOrder"));
        }
Exemplo n.º 6
0
        public void AddBillingAddressesTestMethod()
        {
            controller = new BillingAddressesController(context);
            BillingAddress billingAddress = new BillingAddress()
            {
                address     = "via pioppi",
                city        = "battipaglia",
                first_name  = "Gerardo",
                last_name   = "Longo",
                country     = "Italy",
                company     = "",
                postal_code = "84091",
                phone       = "33365987",
                province    = "SA",
                email       = "*****@*****.**",
                fiscal_code = "LNGGRD89A17A717B",
                vat_code    = "LNGGRD89A17A717B",
            };

            IActionResult  actionResult = controller.BillingAddresses(billingAddress);
            OkObjectResult result       = actionResult as OkObjectResult;

            Assert.IsNotNull(result);
            Assert.AreEqual(result.StatusCode, 200);

            string         name = "Gerardo";
            BillingAddress billingAddressAdded = result.Value as BillingAddress;

            Assert.AreEqual(billingAddressAdded.first_name, name);
            controller.Dispose();
        }
Exemplo n.º 7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (TransactionId != null ? TransactionId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ChargeStatus != null ? ChargeStatus.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PaymentProcessor != null ? PaymentProcessor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ AddressIsActive.GetHashCode();
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ChargeId.GetHashCode();
         hashCode = (hashCode * 397) ^ AddressId.GetHashCode();
         hashCode = (hashCode * 397) ^ (ShopifyId != null ? ShopifyId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShopifyOrderId != null ? ShopifyOrderId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShopifyOrderNumber.GetHashCode();
         hashCode = (hashCode * 397) ^ (ShopifyCartToken != null ? ShopifyCartToken.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShippingDate.GetHashCode();
         hashCode = (hashCode * 397) ^ ScheduledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ ShippedDate.GetHashCode();
         hashCode = (hashCode * 397) ^ ProcessedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ CustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Hash != null ? Hash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsPrepaid.GetHashCode();
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalPrice != null ? TotalPrice.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShippingAddress != null ? ShippingAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingAddress != null ? BillingAddress.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 8
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Card other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((CardBrand == null && other.CardBrand == null) || (CardBrand?.Equals(other.CardBrand) == true)) &&
                   ((Last4 == null && other.Last4 == null) || (Last4?.Equals(other.Last4) == true)) &&
                   ((ExpMonth == null && other.ExpMonth == null) || (ExpMonth?.Equals(other.ExpMonth) == true)) &&
                   ((ExpYear == null && other.ExpYear == null) || (ExpYear?.Equals(other.ExpYear) == true)) &&
                   ((CardholderName == null && other.CardholderName == null) || (CardholderName?.Equals(other.CardholderName) == true)) &&
                   ((BillingAddress == null && other.BillingAddress == null) || (BillingAddress?.Equals(other.BillingAddress) == true)) &&
                   ((Fingerprint == null && other.Fingerprint == null) || (Fingerprint?.Equals(other.Fingerprint) == true)) &&
                   ((CardType == null && other.CardType == null) || (CardType?.Equals(other.CardType) == true)) &&
                   ((PrepaidType == null && other.PrepaidType == null) || (PrepaidType?.Equals(other.PrepaidType) == true)) &&
                   ((Bin == null && other.Bin == null) || (Bin?.Equals(other.Bin) == true)));
        }
Exemplo n.º 9
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendLine($"Order: {Number}");
            if (SpecialOrder)
            {
                sb.AppendLine("This order is special");
            }
            sb.AppendLine("Customer:");
            sb.AppendLine(Client?.ToString());
            sb.AppendLine("Shipping:");
            sb.Append(ShippingAddress?.ToString());
            sb.AppendLine("Billing address:");
            if (ShippingAddress == BillingAddress)
            {
                sb.AppendLine("The same as shipping address");
            }
            else
            {
                sb.Append(BillingAddress?.ToString());
            }

            sb.AppendLine("Products:");
            Products.ForEach(p => sb.AppendLine(p.ToString()));

            sb.AppendLine($"Total: {Total.ToString("$ 0.00")}");

            return(sb.ToString());
        }
        public async Task <IActionResult> Create([Bind("BillingAddressID,Street,Unit,City,State,ZipCode,IsDefault")] BillingAddress billingAddress)
        {
            ModelState.Remove("User");
            ApplicationUser user = await _userManager.GetUserAsync(User);

            if (ModelState.IsValid)
            {
                // Check DB for default BillingAddress and set to false if one exists
                BillingAddress formerDefaultBillingAddress = await _context.BillingAddress.SingleOrDefaultAsync(ba => ba.IsDefault == true);

                if (billingAddress.IsDefault == true && formerDefaultBillingAddress != null)
                {
                    formerDefaultBillingAddress.IsDefault = false;
                    _context.Update(formerDefaultBillingAddress);

                    billingAddress.User = user;
                    _context.Add(billingAddress);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("GetAddresses", "Manage"));
                }
                else
                {
                    billingAddress.User = user;
                    _context.Add(billingAddress);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("GetAddresses", "Manage"));
                }
            }
            return(View(billingAddress));
        }
        public FormData GetFormData(int id)
        {
            FormData formData = null;

            try
            {
                string          query           = $"SELECT * FROM ShippingAddress WHERE FormId=@id";
                ShippingAddress shippingAddress = _dbFactory.GetData <ShippingAddress>(_connection, new CommandDefinition(query, new { id = id })).FirstOrDefault();

                query = $"SELECT * FROM BillingAddress WHERE FormId=@id";
                BillingAddress billingAddress = _dbFactory.GetData <BillingAddress>(_connection, new CommandDefinition(query, new { id = id })).FirstOrDefault();

                query = $"SELECT * FROM OrderDetails WHERE FormId=@id";
                OrderDetails orderDetails = _dbFactory.GetData <OrderDetails>(_connection, new CommandDefinition(query, new { id = id })).FirstOrDefault();

                query = $"SELECT * FROM Specifications WHERE FormId=@id";
                Specifications specifications = _dbFactory.GetData <Specifications>(_connection, new CommandDefinition(query, new { id = id })).FirstOrDefault();

                formData = new FormData();

                formData.Specifications  = specifications;
                formData.ShippingAddress = shippingAddress;
                formData.BillingAddress  = billingAddress;
                formData.OrderDetails    = orderDetails;
                formData.Id = id;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }

            return(formData);
        }
Exemplo n.º 12
0
        public ActionResult MakePayment()
        {
            var models = Session["SelectedB2BBaskets"] as IEnumerable <B2BCheckoutViewModel>;

            if (models == null || models.Count() == 0)
            {
                return(RedirectToAction("BasketSummary", "Webtex"));
            }

            if (Request.Form["paymentType"] == "account")
            {
                if (_b2bCheckoutService.IsB2BUserLoggedIn(Session))
                {
                    var results = _b2bCheckoutService.ProcessMertexOrders(models, Request.Form["savedAddresses"], false, Session);
                    return(View("CheckoutResult", results));
                }
                return(View());
            }
            else if (Request.Form["paymentType"] == "card")
            {
                AddressViewModel address = this.BindModel <AddressViewModel>();
                BillingAddress   b       = _b2bCheckoutService.BillingAddressFromAddress(address);
                Session["BillingAddress"] = b;
                decimal basketTotal = models.Sum(v => v.Basket.BasketItems.Sum(t => decimal.Parse(t.Unit_Price) * decimal.Parse(t.Quantity_Ordered)));

                Transaction transaction = _b2bCheckoutService.GetTransaction(basketTotal, 0);
                return(RedirectToAction("B2BCardPayment", new { transactionId = transaction.Id }));
            }
            return(View());
        }
Exemplo n.º 13
0
        protected void SaveBillingAddress()
        {
            //Save the level B Address information from the form (level A is predetermined)
            if (!this.UserIsLevelA)
            {
                //BillingAddress.City = tbShippingCity.Text;
                //Replaced wrong City mapping above with correct mapping below (Heath Gardner 06/25/13)
                // Issue ID 1075 - "ECF - Standard User’s Bill-To City is overwritten with their Ship-To City"
                BillingAddress.City               = tbBillingCity.Text;
                BillingAddress.State              = ssBillingState.SelectedState;
                BillingAddress.Line1              = tbBillingAddress.Text;
                BillingAddress.PostalCode         = tbBillingZip.Text;
                BillingAddress.DaytimePhoneNumber = pnBillingDayPhone.Text;
                //BillingAddress.EveningPhoneNumber = pnBillingEveningPhone.Text;
                BillingAddress.FaxNumber = pnBillingFax.Text;
                BillingAddress.AcceptChanges();
            }
            //set the cart billing address
            this.CheckoutCartHelper.GetOrderForm(this.CheckoutCart.Name).BillingAddressId = BillingAddress.Name;

            //save the billing meta data
            this.CheckoutCart["OrderContactName"]    = this.tbBillingContactName.Text;
            this.CheckoutCart["OrderContactPhone"]   = this.pnBillingContact.Text;
            this.CheckoutCart["PurchaseOrder"]       = this.tbBillingPurchaseOrder.Text;
            this.CheckoutCart["SpecialInstructions"] = this.tbBillingSpecialInstructions.Text;
            this.CheckoutCart.AcceptChanges();
        }
Exemplo n.º 14
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (BillingAddress != null)
         {
             hashCode = hashCode * 59 + BillingAddress.GetHashCode();
         }
         if (ContactDetails != null)
         {
             hashCode = hashCode * 59 + ContactDetails.GetHashCode();
         }
         if (FiscalNumber != null)
         {
             hashCode = hashCode * 59 + FiscalNumber.GetHashCode();
         }
         if (Locale != null)
         {
             hashCode = hashCode * 59 + Locale.GetHashCode();
         }
         if (PersonalInformation != null)
         {
             hashCode = hashCode * 59 + PersonalInformation.GetHashCode();
         }
         if (ShippingAddress != null)
         {
             hashCode = hashCode * 59 + ShippingAddress.GetHashCode();
         }
         return(hashCode);
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (BillingAddress != null)
         {
             hashCode = hashCode * 59 + BillingAddress.GetHashCode();
         }
         if (PersonalInformation != null)
         {
             hashCode = hashCode * 59 + PersonalInformation.GetHashCode();
         }
         if (CompanyInformation != null)
         {
             hashCode = hashCode * 59 + CompanyInformation.GetHashCode();
         }
         if (MerchantCustomerId != null)
         {
             hashCode = hashCode * 59 + MerchantCustomerId.GetHashCode();
         }
         if (VatNumber != null)
         {
             hashCode = hashCode * 59 + VatNumber.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 16
0
        public async Task <ActionResult> BillingAddress(BillingAddress model)
        {
            if (ModelState.IsValid)
            {
                var userId = User.Identity.GetUserId();

                // Call your service to save the billing address
                var user = await UserManager.FindByIdAsync(userId);

                user.BillingAddress = model;
                await UserManager.UpdateAsync(user);

                // Model Country has to be 2 letter ISO Code
                if (!string.IsNullOrEmpty(model.Vat) && !string.IsNullOrEmpty(model.Country) &&
                    EuropeanVat.Countries.ContainsKey(model.Country))
                {
                    await UpdateSubscriptionTax(userId, 0);
                }
                else if (!string.IsNullOrEmpty(model.Country) && EuropeanVat.Countries.ContainsKey(model.Country))
                {
                    await UpdateSubscriptionTax(userId, EuropeanVat.Countries[model.Country]);
                }

                TempData.Add("flash", new FlashSuccessViewModel("Your billing address has been saved."));

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
        public async Task <IActionResult> Edit(int id, [Bind("id,firstName,lastName,UserName,Email,Address,Country,Zip")] BillingAddress billingAddress)
        {
            if (id != billingAddress.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(billingAddress);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BillingAddressExists(billingAddress.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(billingAddress));
        }
        public void SetBillingValues()
        {
            var fullPath = Path.GetFullPath(@"..\..\..\");
            var path     = Path.Combine(fullPath, "BillingAddressDetails.xlsx");

            string[,] billingAddressDetails = ReadTestDataFromExcel(path);
            var billingDetails = new BillingAddress();

            for (var row = 1; row < 2; row++)
            {   //// login details data object
                billingDetails.billAddress   = billingAddressDetails[row, 0];
                billingDetails.firstName     = billingAddressDetails[row, 1];
                billingDetails.lastName      = billingAddressDetails[row, 2];
                billingDetails.Email         = billingAddressDetails[row, 3];
                billingDetails.country       = billingAddressDetails[row, 4];
                billingDetails.city          = billingAddressDetails[row, 5];
                billingDetails.zipPostalCode = billingAddressDetails[row, 6];
                billingDetails.address       = billingAddressDetails[row, 7];
                billingDetails.phoneNumber   = billingAddressDetails[row, 8];
            }
            selectAddressDropdown(TestConstants.BillingAddress, billingDetails.billAddress);
            EnterValuesInTextbox(TestConstants.FirstName, billingDetails.firstName);
            EnterValuesInTextbox(TestConstants.LastName, billingDetails.lastName);
            EnterValuesInTextbox(TestConstants.Email, billingDetails.Email);
            selectCountryDropdown(TestConstants.Country, billingDetails.country, 0);
            EnterValuesInTextbox(TestConstants.City, billingDetails.city);
            EnterValuesInTextbox(TestConstants.Address, billingDetails.address);
            EnterValuesInTextbox(TestConstants.ZipPostalCode, billingDetails.zipPostalCode);
            EnterValuesInTextbox(TestConstants.PhoneNumber, billingDetails.phoneNumber);
        }
Exemplo n.º 19
0
 public IActionResult AddBillAddress(ShippingBillAddressModel model)
 {
     try
     {
         BillingAddress shipData = new BillingAddress();
         shipData.Name           = model.Name;
         shipData.UserId         = model.UserId;
         shipData.IpAddress      = model.IpAddress;
         shipData.Street         = model.Street;
         shipData.Street1        = model.Street1;
         shipData.Street2        = model.Street2;
         shipData.OutsideNumber  = model.OutsideNumber;
         shipData.InteriorNumber = model.InteriorNumber;
         shipData.City           = model.City;
         shipData.PhoneNo        = model.PhoneNo;
         shipData.LandMark       = model.LandMark;
         shipData.Pincode        = model.Pincode;
         shipData.State          = model.State;
         shipData.Colony         = model.Colony;
         shipData.IsDefault      = false;
         shipData.IsActive       = true;
         db.BillingAddress.Add(shipData);
         db.SaveChanges();
         return(Ok(shipData));
     }
     catch (Exception ex)
     {
         return(Ok(ex));
     }
 }
Exemplo n.º 20
0
        public ActionResult CreateBilling(
            [Bind(Include = "BillingAddressId,BillingAddress")] Customer customer)
        {
            // define the address and payment models
            BillingAddress     billing  = customer.BillingAddress;
            ShippingAddress    shipping = (ShippingAddress)TempData["shipping"];
            PaymentInformation payment  = (PaymentInformation)TempData["payment"];

            // define the customer model
            customer.FirstName    = TempData["first"].ToString();
            customer.LastName     = TempData["last"].ToString();
            customer.PhoneNumber  = TempData["phone"].ToString();
            customer.EmailAddress = TempData["email"].ToString();

            customer.ShippingAddress    = shipping;
            customer.PaymentInformation = payment;

            // add the customer data to the database
            db.BillingAddresses.Add(billing);
            db.ShippingAddresses.Add(shipping);
            db.PaymentInformation.Add(payment);
            db.Customers.Add(customer);

            // save the changes and redirect to the index
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 21
0
 public ActionResult UpdateAddress(BillingAddress address)
 {
     using (var context = new OnlineStoreContext())
     {
         return(RedirectToAction("Index"));
     }
 }
Exemplo n.º 22
0
        //DTO
        /// <summary>
        ///     Allows you to convert the current customer account object to the DTO equivalent for use with the REST API
        /// </summary>
        /// <returns>A new instance of CustomerAccountDTO</returns>
        public CustomerAccountDTO ToDto()
        {
            var dto = new CustomerAccountDTO();

            dto.Bvin      = Bvin;
            dto.Email     = Email;
            dto.FirstName = FirstName;
            dto.LastName  = LastName;
            dto.Password  = Password;

            dto.TaxExempt      = TaxExempt;
            dto.Notes          = Notes;
            dto.PricingGroupId = PricingGroupId;

            dto.FailedLoginCount = FailedLoginCount;

            dto.LastUpdatedUtc   = LastUpdatedUtc;
            dto.CreationDateUtc  = CreationDateUtc;
            dto.LastLoginDateUtc = LastLoginDateUtc;

            foreach (var a in Addresses)
            {
                dto.Addresses.Add(a.ToDto());
            }

            dto.ShippingAddress = ShippingAddress.ToDto();
            dto.BillingAddress  = BillingAddress.ToDto();
            return(dto);
        }
Exemplo n.º 23
0
        public override int GetHashCode()
        {
            int hashCode = 1509386817;

            if (CardNonce != null)
            {
                hashCode += CardNonce.GetHashCode();
            }

            if (BillingAddress != null)
            {
                hashCode += BillingAddress.GetHashCode();
            }

            if (CardholderName != null)
            {
                hashCode += CardholderName.GetHashCode();
            }

            if (VerificationToken != null)
            {
                hashCode += VerificationToken.GetHashCode();
            }

            return(hashCode);
        }
Exemplo n.º 24
0
        /// <summary>
        ///     Allows you to populate the current customer account object using a CustomerAccount instance
        /// </summary>
        /// <param name="dto">An instance of the customer account from the REST API</param>
        public void FromDto(CustomerAccountDTO dto)
        {
            Bvin      = dto.Bvin;
            Email     = dto.Email;
            FirstName = dto.FirstName;
            LastName  = dto.LastName;
            Password  = dto.Password;

            TaxExempt      = dto.TaxExempt;
            Notes          = dto.Notes;
            PricingGroupId = dto.PricingGroupId;

            FailedLoginCount = dto.FailedLoginCount;

            LastUpdatedUtc   = dto.LastUpdatedUtc;
            CreationDateUtc  = dto.CreationDateUtc;
            LastLoginDateUtc = dto.LastLoginDateUtc;

            foreach (var a in dto.Addresses)
            {
                var addr = new Address();
                addr.FromDto(a);
                Addresses.Add(addr);
            }

            ShippingAddress.FromDto(dto.ShippingAddress);
            BillingAddress.FromDto(dto.BillingAddress);
        }
Exemplo n.º 25
0
 public ConfirmResponse(string orderId, string snippet, BillingAddress billingAddress, ShippingAddress shippingAddress, string status, string reservationNumber, int totalCost)
 {
     if (orderId == null)
     {
         throw new ArgumentNullException("orderId");
     }
     if (snippet == null)
     {
         throw new ArgumentNullException("snippet");
     }
     if (billingAddress == null)
     {
         throw new ArgumentNullException("billingAddress");
     }
     if (shippingAddress == null)
     {
         throw new ArgumentNullException("shippingAddress");
     }
     if (totalCost == null)
     {
         throw new ArgumentNullException("totalCost");
     }
     Snippet           = snippet;
     BillingAddress    = billingAddress;
     ShippingAddress   = shippingAddress;
     Status            = status;
     ReservationNumber = reservationNumber;
     TotalCost         = totalCost;
     OrderId           = orderId;
 }
Exemplo n.º 26
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CreatePaymentRequest other &&
                   ((SourceId == null && other.SourceId == null) || (SourceId?.Equals(other.SourceId) == true)) &&
                   ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((TipMoney == null && other.TipMoney == null) || (TipMoney?.Equals(other.TipMoney) == true)) &&
                   ((AppFeeMoney == null && other.AppFeeMoney == null) || (AppFeeMoney?.Equals(other.AppFeeMoney) == true)) &&
                   ((DelayDuration == null && other.DelayDuration == null) || (DelayDuration?.Equals(other.DelayDuration) == true)) &&
                   ((Autocomplete == null && other.Autocomplete == null) || (Autocomplete?.Equals(other.Autocomplete) == true)) &&
                   ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((VerificationToken == null && other.VerificationToken == null) || (VerificationToken?.Equals(other.VerificationToken) == true)) &&
                   ((AcceptPartialAuthorization == null && other.AcceptPartialAuthorization == null) || (AcceptPartialAuthorization?.Equals(other.AcceptPartialAuthorization) == true)) &&
                   ((BuyerEmailAddress == null && other.BuyerEmailAddress == null) || (BuyerEmailAddress?.Equals(other.BuyerEmailAddress) == true)) &&
                   ((BillingAddress == null && other.BillingAddress == null) || (BillingAddress?.Equals(other.BillingAddress) == true)) &&
                   ((ShippingAddress == null && other.ShippingAddress == null) || (ShippingAddress?.Equals(other.ShippingAddress) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((StatementDescriptionIdentifier == null && other.StatementDescriptionIdentifier == null) || (StatementDescriptionIdentifier?.Equals(other.StatementDescriptionIdentifier) == true)));
        }
Exemplo n.º 27
0
 /// <summary>
 /// Constructor to builds the object
 /// </summary>
 /// <param name="token"></param>
 /// <param name="useHomeAddress"></param>
 /// <param name="address"></param>
 /// <param name="creditCard"></param>
 public BillingInfo(string token, bool useHomeAddress, BillingAddress address, CreditCard creditCard)
 {
     this.token          = token;
     this.useHomeAddress = false;
     this.address        = address;
     this.creditCard     = creditCard;
 }
Exemplo n.º 28
0
        public BillingAddress GetBilling()
        {
            try
            {
                Dictionary <string, object> listKV = new Dictionary <string, object>();
                listKV.Add("@order_id", this.orderForAccess.OrderId.ToString());

                BillingAddress billingTmp = null;

                SqlDataReader reader = DatabaseFactory.DataReader(System.Data.CommandType.StoredProcedure, "GetBilling", listKV, this.connectionForAccess);
                if (reader.Read())
                {
                    billingTmp             = new BillingAddress();
                    billingTmp.AddressId   = reader.GetInt32(0);
                    billingTmp.FullAddress = reader.GetString(1);
                    billingTmp.FirstName   = reader.GetString(4);
                    billingTmp.LastName    = reader.GetString(5);
                    billingTmp.State       = reader.GetString(6);
                    billingTmp.ZipCode     = reader.GetString(7);
                    billingTmp.City        = reader.GetString(2);
                    billingTmp.Country     = new Country(reader.GetString(3));
                    billingTmp.OrderId     = this.orderForAccess.OrderId;
                }
                reader.Close();
                if (billingTmp == null)
                {
                    throw new Exception("Fail to get billing");
                }
                return(billingTmp);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 29
0
        public ViewResult BillingAddress()
        {
            // TODO: Get Billing address from your model
            var model = new BillingAddress();

            return(View(model));
        }
        public void BillingAddressService_Test_UpdateBillingAddress()
        {
            // arrange
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "BillingAddressService_Test_UpdateBillingAddress")
                          .Options;

            var billingAddressEntity = new BillingAddress()
            {
                Id = Guid.NewGuid(), Address = "local", Telephone = "0123456789"
            };

            using (var context = new ApplicationDbContext(options))
            {
                context.BillingAddresses.Add(billingAddressEntity);
                context.SaveChanges();
            }

            using (var context = new ApplicationDbContext(options))
            {
                var service = new Service(context);

                // act
                billingAddressEntity.Address = "local updated";
                service.BillingAddressService.UpdateBillingAddress(billingAddressEntity);

                // assert
                Assert.Equal("local updated", service.BillingAddressService.GetBillingAddressById(billingAddressEntity.Id).Address);
            }
        }